クライアントパーツをWPF / Silverlight、WCFサービス、DBMS Oracle、Postrges、MsSQLで使用(および使用)しました。 コードはMVVMによって記述され、モジュール性とナビゲーションのためにPrismによって使用されます。 これらのどれが他のプラットフォームや言語に適しているかを確実に言うことはできません。
ある時点で、その時点で完全に普通のプログラマーだった私が、多数の条件、移行、作業段階を備えた大規模で複雑なデータアカウンティングシステムを設計する仕事をしたことがありました。 このシステムは、居住者に関するデータ、定期的な会議、パスおよび拒否の発行、パスの延長、活動の終了、罰金、およびその他多くの小さなことを入力するように設計されています。 現在、システムのコアはすでに大部分が書き直されており、govnokodは消滅し、新しい最新のテクノロジー、プラットフォームが使用されています。
行きましょう。
1.コードの繰り返しをなくしたい
2つの異なるアセンブリ(インターフェイスと言えば、異なる時点で呼び出される2つの異なるシステムモジュール)では、たとえば
GetComissions()
メソッドを使用して、データベースからエンティティの同様のリストを選択する必要がありました。 プログラマーのPetyaは、プログラマーのVasyaが既にサービスに既に記述されて
GetComissions()
メソッドを
GetComissions()
ました(そして、1つのエンドポイントを持つ1つのサービスがありました)。 数週間後には、顧客は統計、ステータス、決定などを手数料以外の場所で表示する必要があり、すべてがうまくいきました。 その結果、2番目のモジュールはすぐにエラーで落ち始めました。
悲しいかな、そのようなケースは明らかに複数あり、その後、サービスメソッドを異なるサービスエンドポイントに、または少なくとも個々の部分クラス(1つのサービスの場合)に分離するには多大な労力が必要でした。
結論:2つのプロジェクトがサービスで同じ機能を使用できるのは、これらのプロジェクトが常に同じ方法で機能することが事前にわかっている場合のみです。 この場合、メソッドは、各プロジェクトに接続されている一般クラスに配置する必要があります。
他のすべての場合、サーバーでコードを記述する原則は、 単一責任の原則 ( SOLIDの原則の1つ)に似たものに従う必要があります。
2.データコントラクトにロジックを記述しないようにします
私の経験では、すべてのデータコントラクト(RiaServicesの場合-エンティティクラス)が常に元のままで、データベーススキーマと1k1が一致する場合、ソリューションは絶対に簡単です。 すべては、従業員のフルネームを1つの変数に連結する無害なコードで始まり、いくつかのあいまいな係数(通常は1か所でのみ必要)の膨大な計算で終わります。 その結果、データコントラクトは80%のメソッド(はい、プロパティのゲッターにコードが記述されている場合、これもメソッドと見なします)、または誰かが一時的に必要とした他のテーブルのフィールドで構成され始めました。 サービスまたはクライアント(タスクに応じて)で相続人またはラッパーを作成する方が常に優れています。これらは、このモジュールの目的にのみ使用されます。 それらの問題について-次の段落で。
3.相続人、部分的?
残念ながら、私たちは完璧な解決策を見つけることができませんでした。 いくつかのケースを考慮してください:
a)モジュールは、サービスごとに1つのクライアント参照で動作します。 サーバー上のクラスは、1つのサービスからの部分クラスに分割されます。
短所:
- 1つのモジュール用に作成されたクライアントパーシャルはどこにでも表示されます。
- 1つのモジュール用に作成されたクライアント相続人はどこにでも表示されます(より簡単です-必要のない場所では使用できません)
- クライアントサービスを使用したプロジェクト参照の
copy local
パラメーターを設定したHe(MEFを使用し、サービスロケーターにあるクラスの1つのエンティティが必要な場合)。 - ネットワーク内のサービスが合併し、2人で同時に再生するHe。
長所:
- クライアントモジュール間でデータコントラクトオブジェクトを転送する機能。
b)各モジュールは、サービスのクライアント参照を個別に作成します。
短所:
- クライアントモジュール間でデータコントラクトを転送する可能性(この場合、クライアントデータコントラクトのプロジェクトが作成されます。図を参照)と、クライアントの相続人とパーシャルを作成する機能(図のバージョンでは、これは非常に不便です)
ほとんどの場合、オプションa)を選択します。 モジュール間でオブジェクトを渡すことは非常に便利です。 タイトルに戻りましょう。相続人とパーシャルの違いが非常に顕著になるのはオプションa)です。
データベースに
Person
と
Document
のプレートがあるとします。 規範によると、データコントラクトでは、
Person
クラスには
List, .. Document Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
-
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
.Person
Documents
, . ,Person
List.
, , (, , Person
Document
),PersonEx
DocumentEx
,PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). ,ParentDiapason
,ChildDiapason
- .
, .. 245 300 400. ,quantity
, ,quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .
List, .. Document
Person
. Person
Documents
, . , Person
List.
, , (, , Person
Document
), PersonEx
DocumentEx
, PersonEx
List! , – , . -, , - , .. .
4. , , -
, , . , , - , , – .
, – , - , , ( – ).
- , , .
Hint: date_insert
date_update
, - .
5. ,
, , -, - . , . , ..:
, - . - , , , , . , .. .
– « », - .
, «» () , - ( ) .
6.
.
, - ( - ). , ParentDiapason
, ChildDiapason
- .
, .. 245 300 400. , quantity
, , quantity
(startSeries, endSeries, startNumber, endNumber)
. , :
:
:
, – .
.
Hint: MsSQL Server 2012 - , -, .
7.
- , . , :
, ( – , – )
public class Users { public class Status : StatusBase<Status> { /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Active = 1; /// <summary> /// ( ) /// </summary> [StringStatus("")] public const int Inactive = 0; } }
StatusBase – , (-),
public class StatusBase<T> where T : class { private static Dictionary<int, string> statusesDictionary; public static string GetStringStatus(int key) { if (statusesDictionary == null) { CreateStatusDictionary(); } string result = statusesDictionary.ContainsKey(key) ? statusesDictionary[key] : " "; return result; } private static void CreateStatusDictionary() { statusesDictionary = new Dictionary<int, string>(); FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo field in fields) { string TextStatus = ((StringStatusAttribute)field.GetCustomAttributes(typeof(StringStatusAttribute), false)[0]). TextStatus; int statusKey = (int)field.GetValue(null); statusesDictionary.Add(statusKey, TextStatus); } } }
, , ,
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = Data.Statuses.Users.Status.GetStringStatus((int)value); return result; }
, , , .
. , - .