Esempio n. 1
0
 public CCommand(CConnection ConnObj)
 {
     Comm = null;
     if (ConnObj == null)
     {
     }
     else if (ConnObj.IsOpen())
     {
         try {
             Comm = ConnObj.CreateCommand();
         } catch (System.Exception Excpt) {
             Err.Add(Excpt);
             Comm = null;
         }
     }
 }
Esempio n. 2
0
 CXml(string Value)
 {
     if (Value == null)
     {
         return;
     }
     if (Value.Trim().Length == 0)
     {
         return;
     }
     try {
         base.LoadXml(Value);
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
     }
 }
Esempio n. 3
0
        void System.Collections.ICollection.CopyTo(System.Array AnyArray, int Index)
        {
            Validate();
            int J = Index;
            int I = 0;

            try {
                for (I = 0; I <= Length(); I++)
                {
                    AnyArray.SetValue(Buffer[I], J);
                    J = J + 1;
                }
            } catch (System.Exception Excpt) {
                Err.Add(Excpt);
            }
        }
Esempio n. 4
0
 public bool LoadFromString(object Value)
 {
     Buffer = null;
     if (Value == null)
     {
         return(false);
     }
     try {
         Buffer = new System.Text.StringBuilder(Value.ToString());
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         Validate();
         return(false);
     }
     Validate();
     return(true);
 }
Esempio n. 5
0
 void System.Collections.IList.Insert(int Index, object Value)
 {
     Validate();
     if (Index < 0)
     {
         return;
     }
     if (Value == null)
     {
         return;
     }
     try {
         Buffer.Insert(Index, Value.ToString());
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
     }
 }
Esempio n. 6
0
 public string this[int Index] {
     get {
         if (DataReader.IsDBNull(Index))
         {
             return(CAbc.EMPTY);
         }
         else
         {
             try {
                 return(DataReader[Index].ToString());
             } catch (System.Exception Excpt) {
                 Err.Add(Excpt);
                 return(CAbc.EMPTY);
             }
         }
     }
 }
Esempio n. 7
0
 public bool Add(string Value)
 {
     if (Value == null)
     {
         return(false);
     }
     try {
         Value = Value.Trim().Replace("=", " ").Replace(CAbc.TAB, " ");
         if (Value.IndexOf(" ") > 0)
         {
             Add(Value.Substring(0, Value.IndexOf(" ")).Trim(), Value.Substring(Value.IndexOf(" ")).Trim());
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     return(true);
 }
Esempio n. 8
0
 bool System.Collections.IList.Contains(object Value)
 {
     Validate();
     try {
         if (ToString().IndexOf(System.Convert.ToChar(Value)) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     return(false);
 }
Esempio n. 9
0
 int System.Collections.IList.Add(object Value)
 {
     Validate();
     try {
         if (Value == null)
         {
             return(-1);
         }
         else
         {
             Buffer.Append(Value.ToString());
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(0);
     }
     return((Length()) - 1);
 }
Esempio n. 10
0
        void System.Collections.ICollection.CopyTo(System.Array AnyArray, int Index)
        {
            Validate();
            long J = (long)Index, I = 0, SavedPos;

            try {
                SavedPos = Buffer.Position;
                for (I = 0; I <= Buffer.Length; I++)
                {
                    Buffer.Position = J;
                    AnyArray.SetValue((byte)Buffer.ReadByte(), (int)J);
                    J = J + 1;
                }
                Buffer.Position = SavedPos;
            } catch (System.Exception Excpt) {
                Err.Add(Excpt);
            }
        }
Esempio n. 11
0
 int AddByte(byte Value)
 {
     Validate();
     try {
         if (Value == null)
         {
             return(-1);
         }
         else
         {
             Buffer.WriteByte((byte)Value);
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(0);
     }
     return((Length()) - 1);
 }
Esempio n. 12
0
 public void Add(System.Collections.IEnumerable ObjectList)
 {
     if (ObjectList == null)
     {
         return;
     }
     try {
         foreach (object Obj in ObjectList)
         {
             if (!(Obj == null))
             {
                 base.Enqueue(Obj.ToString());
             }
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
     }
 }
Esempio n. 13
0
 public System.Data.SqlClient.SqlDataReader GetDataReader(string CommandText)
 {
     if (CommandText == null)
     {
         return(null);
     }
     if (Comm == null)
     {
         return(null);
     }
     Comm.CommandText = CommandText;
     try {
         return(Comm.ExecuteReader());
     } catch (System.Exception Excpt) {
         Err.Add(Excpt, CAbc.CRLF + " >> " + CommandText);
         return(null);
     }
 }
Esempio n. 14
0
 public bool Read()
 {
     if (HFile == null)
     {
         return(false);
     }
     try {
         Current = HFile.ReadByte();
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     if (Current == (-1))
     {
         return(false);
     }
     return(true);
 }
Esempio n. 15
0
 public void Push(System.Collections.IEnumerable ObjectList)
 {
     if (ObjectList == null)
     {
         return;
     }
     try {
         foreach (object Obj in ObjectList)
         {
             if (!(Obj == null))
             {
                 base.Push(Obj);
             }
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
     }
 }
Esempio n. 16
0
 public System.Xml.XmlReader GetXml(string CommandText)
 {
     if (CommandText == null)
     {
         return(null);
     }
     if (Comm == null)
     {
         return(null);
     }
     Comm.CommandText = CommandText;
     try {
         return(Comm.ExecuteXmlReader());
     } catch (System.Exception Excpt) {
         Err.Add(Excpt, CAbc.CRLF + " >> " + CommandText);
         return(null);
     }
 }
Esempio n. 17
0
 public override bool Open(string FileName, int CharSet)
 {
     if (HeaderSize < 1)
     {
         HeaderSize = 0;
     }
     if (RecordSize < 1)
     {
         RecordSize = 1;
     }
     if (base.Open(FileName, CharSet))
     {
         try {
             if (HeaderSize > 0)
             {
                 Buffer = (char[])System.Array.CreateInstance(typeof(System.Char), HeaderSize);
                 System.Array.Clear(Buffer, 0, HeaderSize);
                 if (HFile.ReadBlock(Buffer, 0, HeaderSize) != HeaderSize)
                 {
                     return(false);
                 }
                 StrBuilder.Length = 0;
                 StrBuilder.Append(Buffer);
                 Header = StrBuilder.ToString();
                 if (Buffer.Length < RecordSize)
                 {
                     Buffer = (char[])System.Array.CreateInstance(typeof(System.Char), RecordSize);
                 }
             }
             else
             {
                 Buffer = (char[])System.Array.CreateInstance(typeof(System.Char), RecordSize);
             }
         } catch (System.Exception Excpt) {
             Err.Add(Excpt);
             return(false);
         }
     }
     else
     {
         return(false);
     }
     return(true);
 }
Esempio n. 18
0
 public object GetScalar(string CommandText)
 {
     if (CommandText == null)
     {
         return(null);
     }
     if (Comm == null)
     {
         return(null);
     }
     Comm.CommandText = CommandText;
     try {
         return(Comm.ExecuteScalar());
     } catch (System.Exception Excpt) {
         Err.Add(Excpt, CAbc.CRLF + " >> " + CommandText);
         return(null);
     }
     return(null);
 }
Esempio n. 19
0
 public bool Execute(string CommandText)
 {
     if (CommandText == null)
     {
         return(false);
     }
     if (Comm == null)
     {
         return(false);
     }
     Comm.CommandText = CommandText;
     try {
         Comm.ExecuteNonQuery();
     } catch (System.Exception Excpt) {
         Err.Add(Excpt, CAbc.CRLF + " >> " + CommandText);
         return(false);
     }
     return(true);
 }
Esempio n. 20
0
 public virtual bool Open(string FileName, int CharSet)
 {
     if ((FileName == null))
     {
         return(false);
     }
     if ((FileName.Trim() == ""))
     {
         return(false);
     }
     try {
         HFile = new System.IO.StreamReader(FileName, System.Text.Encoding.GetEncoding(CharSet));
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         HFile = null;
         return(false);
     }
     return(true);
 }
Esempio n. 21
0
        void System.Collections.IList.Remove(object Value)
        {
            if (Value == null)
            {
                return;
            }
            int Position;

            try {
                Position = ToString().IndexOf(System.Convert.ToChar(Value));
                while (Position >= 0)
                {
                    Delete(Position);
                    Position = ToString().IndexOf(System.Convert.ToChar(Value));
                }
            } catch (System.Exception Excpt) {
                Err.Add(Excpt);
            }
        }
Esempio n. 22
0
 public bool Open(string ServerName, string DatabaseName, string UserName, string Password)
 {
     if (IsOpen())
     {
         Close();
     }
     Conn = new System.Data.SqlClient.SqlConnection();
     if ((ServerName == null) || (ServerName.Trim() == ""))
     {
         Conn.ConnectionString = "SERVER=(local)";
     }
     else
     {
         Conn.ConnectionString = "SERVER=" + ServerName.Trim().ToUpper();
     }
     if ((DatabaseName == null) || (DatabaseName.Trim() == ""))
     {
     }
     else
     {
         Conn.ConnectionString = Conn.ConnectionString + ";DATABASE=" + DatabaseName.Trim().ToUpper();
     }
     if ((UserName == null) || (UserName.Trim() == ""))
     {
         Conn.ConnectionString = Conn.ConnectionString + ";Integrated Security=TRUE;";
     }
     else
     {
         Conn.ConnectionString = Conn.ConnectionString + ";UID=" + UserName.Trim();
         Conn.ConnectionString = Conn.ConnectionString + ";PWD=" + Password.Trim();
     }
     Conn.ConnectionString = Conn.ConnectionString + ";";
     try {
         Conn.Open();
     } catch (System.Exception Excpt)
     {
         Err.Add(Excpt);
         return(false);
     }
     return(IsOpen());
 }
Esempio n. 23
0
 public CConnection(string ConnectionString)
 {
     if (ConnectionString == null)
     {
         Conn = null;
         return;
     }
     Conn              = new System.Data.SqlClient.SqlConnection();
     Conn.InfoMessage += new System.Data.SqlClient.SqlInfoMessageEventHandler(Err.OnInfoMessage);
     if (Conn == null)
     {
         return;
     }
     Conn.ConnectionString = ConnectionString;
     try {
         Conn.Open();
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         Close();
     }
 }
Esempio n. 24
0
 public int Add(params object[] ObjectList)
 {
     Validate();
     if (ObjectList == null)
     {
         return(-1);
     }
     try {
         foreach (object Obj in ObjectList)
         {
             if (!(Obj == null))
             {
                 Buffer.Append(Obj.ToString());
             }
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(-1);
     }
     return((Length()) - 1);
 }
Esempio n. 25
0
 public bool AppendToFile(string FileName, int CharSet)
 {
     if (FileName == null)
     {
         return(false);
     }
     if (FileName.Length == 0)
     {
         return(false);
     }
     try {
         HFile = new System.IO.StreamWriter(FileName, true, System.Text.Encoding.GetEncoding(CharSet));
         ((System.IO.StreamWriter)HFile).Write(ToString());
         ((System.IO.StreamWriter)HFile).Close();
         HFile = null;
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     return(true);
 }
Esempio n. 26
0
 public virtual bool Read()
 {
     if (HFile == null)
     {
         return(false);
     }
     try {
         Record = HFile.ReadLine();
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     if (Record == null)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Esempio n. 27
0
 public virtual bool Add(string Value)
 {
     if (HFile == null)
     {
         return(false);
     }
     if (Value == null)
     {
         return(false);
     }
     try
     {
         HFile.Write(Value);
     }
     catch (System.Exception Excpt)
     {
         Err.Add(Excpt);
         return(false);
     }
     return(true);
 }
Esempio n. 28
0
 public void Add(params object[] ObjectList)
 {
     if (ObjectList == null)
     {
         return;
     }
     if (ObjectList.Length == 0)
     {
         return;
     }
     try {
         foreach (object Obj in ObjectList)
         {
             if (!(Obj == null))
             {
                 base.Add(Obj);
             }
         }
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
     }
 }
Esempio n. 29
0
 public bool AppendToFile(string FileName)
 {
     Validate();
     if (FileName == null)
     {
         return(false);
     }
     if (FileName.Length == 0)
     {
         return(false);
     }
     try {
         HFile = new System.IO.FileStream(FileName, System.IO.FileMode.Append, System.IO.FileAccess.Write);
         ((System.IO.FileStream)HFile).Write(Buffer.ToArray(), 0, Length());
         ((System.IO.FileStream)HFile).Close();
         HFile = null;
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     return(true);
 }
Esempio n. 30
0
 public bool Open(string FileName)
 {
     if (FileName == null)
     {
         return(false);
     }
     if (FileName.Trim() == "")
     {
         return(false);
     }
     if (!(HFile == null))
     {
         Close();
     }
     try {
         HFile = new System.IO.FileStream(FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
     } catch (System.Exception Excpt) {
         Err.Add(Excpt);
         return(false);
     }
     return(true);
 }