public static TListInt16 Parse(SqlString AString) { if (AString.IsNull) return null; TListInt16 LResult = new TListInt16(); LResult.FromString(AString.Value); return LResult; }
public static IEnumerable Enum(TListInt16 AList) { if(AList == null) yield break; Int32 LIndex = 0; foreach(Int16 LKey in AList.FList) { yield return new KeyValuePair<Int16,Int32>(LKey, ++LIndex); } }
/// <summary> /// Возвращает значение параметра типа TListInt16 /// </summary> protected TListInt16 AsTListInt16(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 TListInt16) return (TListInt16)LValue; else { TListInt16 LResult = new TListInt16(); 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}' в тип TListInt16", Sql.ValueToString(LValue, Sql.ValueDbStyle.Text), AName)); } }
public void AddTListInt16(String AName, TListInt16 AValue) { base.AddParam(AName, new SqlUdt(AValue)); }
public Boolean ContainsAll(TListInt16 AValue) { if(AValue == null || AValue.FList.Count == 0) return true; for(int i = AValue.FList.Count - 1; i >= 0; i--) if(!FList.Contains(AValue.FList[i])) return false; return true; }
public void Read(System.IO.BinaryReader r) { //if (r == null) throw new ArgumentNullException("r"); if(OResult == null) OResult = new TListInt16(); OResult.Read(r); }
public void Init() { OResult = new TListInt16(); }
public bool Equals(TListInt16 AList) { if(AList == null || FList.Count != AList.FList.Count) return false; for(int i = FList.Count - 1; i >= 0; i--) if(FList[i] != AList.FList[i]) return false; return true; }