Exemplo n.º 1
0
    public static TListInt16 Parse(SqlString AString)
    {
        if (AString.IsNull) return null;

        TListInt16 LResult = new TListInt16();
        LResult.FromString(AString.Value);

        return LResult;
    }
Exemplo n.º 2
0
    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);
        }
    }
Exemplo n.º 3
0
        /// <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));
              }
        }
Exemplo n.º 4
0
 public void AddTListInt16(String AName, TListInt16 AValue)
 {
     base.AddParam(AName, new SqlUdt(AValue));
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 public void Read(System.IO.BinaryReader r)
 {
     //if (r == null) throw new ArgumentNullException("r");
     if(OResult == null)
       OResult = new TListInt16();
     OResult.Read(r);
 }
Exemplo n.º 7
0
 public void Init()
 {
     OResult = new TListInt16();
 }
Exemplo n.º 8
0
    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;
    }