public static TDictionaryStringInt32 Parse(SqlString AString) { if (AString.IsNull) return null; TDictionaryStringInt32 LResult = new TDictionaryStringInt32(); LResult.FromString(AString.Value); return LResult; }
public static IEnumerable Enum(TDictionaryStringInt32 ADictionary) { if(ADictionary == null) yield break; Int32 LIndex = 0; foreach(KeyValuePair<String,Int32> LKeyPair in ADictionary.FList) { yield return new KeyValueIndexPair<String,Int32,Int32>(LKeyPair.Key, LKeyPair.Value, ++LIndex); } }
/// <summary> /// Возвращает значение параметра типа TDictionaryStringInt32 /// </summary> protected TDictionaryStringInt32 AsTDictionaryStringInt32(String AName) { Object LValue; if (!FData.TryGetValue(AName, out LValue)) return null; try { if(LValue is SqlUdt) LValue = ((SqlUdt)LValue).CreateUdtObject(true); if (LValue is TDictionaryStringInt32) return (TDictionaryStringInt32)LValue; else { TDictionaryStringInt32 LResult = new TDictionaryStringInt32(); if (LValue is SqlString) LResult.FromString(((SqlString)LValue).Value); else if (LValue is SqlChars) LResult.FromString(((SqlChars)LValue).ToString()); //else if (LValue is Sql.SqlAnsiString) return new SqlBinary(((Sql.SqlAnsiString)LValue).Buffer); else { System.IO.BinaryReader r; if (LValue is SqlBytes) r = new System.IO.BinaryReader(((SqlBytes)LValue).Stream); else if (LValue is SqlBinary) r = new System.IO.BinaryReader(new System.IO.MemoryStream(((SqlBinary)LValue).Value)); else throw new Exception(); LResult.Read(r); } return LResult; } } catch { throw new Exception(String.Format("Не удалось сконвертировать значение '{0}' параметра '{1}' в тип TDictionaryStringInt32", Sql.ValueToString(LValue, Sql.ValueDbStyle.Text), AName)); } }
public void Read(System.IO.BinaryReader r) { //if (r == null) throw new ArgumentNullException("r"); if(OResult == null) OResult = new TDictionaryStringInt32(); OResult.Read(r); }
public void Init() { OResult = new TDictionaryStringInt32(); }
public bool Equals(TDictionaryStringInt32 AList) { if(AList == null || FList.Count != AList.FList.Count) return false; foreach(KeyValuePair<String,Int32> LKeyPair in AList.FList) { if(FList[LKeyPair.Key] != LKeyPair.Value) return false; } return true; }
public void AddTDictionaryStringInt32(String AName, TDictionaryStringInt32 AValue) { base.AddParam(AName, new SqlUdt(AValue)); }