Esempio n. 1
0
 public virtual int Update(int SGID, int SWID, double STopLine, double SbaseLine, double SQuantity, int Original_SGID, int Original_SWID, double Original_STopLine, double Original_SbaseLine, double Original_SQuantity)
 {
     this.Adapter.UpdateCommand.Parameters[0].Value = ((int)(SGID));
     this.Adapter.UpdateCommand.Parameters[1].Value = ((int)(SWID));
     this.Adapter.UpdateCommand.Parameters[2].Value = ((double)(STopLine));
     this.Adapter.UpdateCommand.Parameters[3].Value = ((double)(SbaseLine));
     this.Adapter.UpdateCommand.Parameters[4].Value = ((double)(SQuantity));
     this.Adapter.UpdateCommand.Parameters[5].Value = ((int)(Original_SGID));
     this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(Original_SWID));
     this.Adapter.UpdateCommand.Parameters[7].Value = ((double)(Original_STopLine));
     this.Adapter.UpdateCommand.Parameters[8].Value = ((double)(Original_SbaseLine));
     this.Adapter.UpdateCommand.Parameters[9].Value = ((double)(Original_SQuantity));
     System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
     if (((this.Adapter.UpdateCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.UpdateCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.UpdateCommand.Connection.Close();
         }
     }
 }
        public virtual int UpdateQuery(string explanation, long id)
        {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[3];
            if ((explanation == null))
            {
                command.Parameters[0].Value = System.DBNull.Value;
            }
            else
            {
                command.Parameters[0].Value = ((string)(explanation));
            }
            command.Parameters[1].Value = ((long)(id));
            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            if (((command.Connection.State & System.Data.ConnectionState.Open)
                 != System.Data.ConnectionState.Open))
            {
                command.Connection.Open();
            }
            int returnValue;

            try {
                returnValue = command.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }
            return(returnValue);
        }
Esempio n. 3
0
        public static SqlDataBaseOjectHandler GlobalPerformQuery(string query)
        {
            SqlDataBaseOjectHandler handler = new SqlDataBaseOjectHandler();

            try
            {
                SqlCommand command = new SqlCommand(query, SqlConnectionClass.getConn());
                SqlConnectionClass.getConn().Open();
                System.Data.ConnectionState state = SqlConnectionClass.getConn().State;
                if (!(state == System.Data.ConnectionState.Open))
                {
                    Helper_Classes_namespace.ErrorMessages.setErrorMessage(" Sorry no Db Connection !!!!!!! ", true);
                    handler.hasErrors = true;
                    return(handler);
                }

                command.ExecuteNonQuery();
                handler.reader = command.ExecuteReader();
            }
            catch (System.Exception em)
            {
                Helper_Classes_namespace.ErrorMessages.setErrorMessage(em.ToString(), true);
                handler.hasErrors = true;
            }
            return(handler);
        }
        public virtual int InsertQuery(int questionId, string explanation)
        {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
            command.Parameters[0].Value = ((int)(questionId));
            if ((explanation == null))
            {
                command.Parameters[1].Value = System.DBNull.Value;
            }
            else
            {
                command.Parameters[1].Value = ((string)(explanation));
            }
            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            if (((command.Connection.State & System.Data.ConnectionState.Open)
                 != System.Data.ConnectionState.Open))
            {
                command.Connection.Open();
            }
            int returnValue;

            try {
                returnValue = command.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }
            return(returnValue);
        }
 public virtual int Insert(string RoleDescription)
 {
     if ((RoleDescription == null))
     {
         throw new System.ArgumentNullException("RoleDescription");
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[0].Value = ((string)(RoleDescription));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
     if (((this.Adapter.InsertCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.InsertCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.InsertCommand.Connection.Close();
         }
     }
 }
 public virtual int Update(System.Guid p1, byte[] p2, System.DateTime p3, System.Guid p4)
 {
     this.Adapter.UpdateCommand.Parameters[0].Value = ((System.Guid)(p1));
     if ((p2 == null))
     {
         throw new System.ArgumentNullException("p2");
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[1].Value = ((byte[])(p2));
     }
     this.Adapter.UpdateCommand.Parameters[2].Value = ((System.DateTime)(p3));
     this.Adapter.UpdateCommand.Parameters[3].Value = ((System.Guid)(p4));
     System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
     if (((this.Adapter.UpdateCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.UpdateCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.UpdateCommand.Connection.Close();
         }
     }
 }
 public virtual int Insert(string MaNgayCong, System.Nullable <int> SoNgay)
 {
     if ((MaNgayCong == null))
     {
         throw new System.ArgumentNullException("MaNgayCong");
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[0].Value = ((string)(MaNgayCong));
     }
     if ((SoNgay.HasValue == true))
     {
         this.Adapter.InsertCommand.Parameters[1].Value = ((int)(SoNgay.Value));
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[1].Value = System.DBNull.Value;
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
     if (((this.Adapter.InsertCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.InsertCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.InsertCommand.Connection.Close();
         }
     }
 }
Esempio n. 8
0
 public virtual int Insert(int Number, System.Nullable <decimal> Balance, string Name)
 {
     this.Adapter.InsertCommand.Parameters[0].Value = ((int)(Number));
     if ((Balance.HasValue == true))
     {
         this.Adapter.InsertCommand.Parameters[1].Value = ((decimal)(Balance.Value));
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[1].Value = System.DBNull.Value;
     }
     if ((Name == null))
     {
         this.Adapter.InsertCommand.Parameters[2].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[2].Value = ((string)(Name));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
     this.Adapter.InsertCommand.Connection.Open();
     try {
         return(this.Adapter.InsertCommand.ExecuteNonQuery());
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.InsertCommand.Connection.Close();
         }
     }
 }
        public virtual int UpdateQuery(int value, int id)
        {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
            command.Parameters[0].Value = ((int)(value));
            command.Parameters[1].Value = ((int)(id));
            System.Data.ConnectionState previousConnectionState = command.Connection.State;

            Trace.WriteLine(string.Format("connection state: {0}", previousConnectionState));

            if (((command.Connection.State & System.Data.ConnectionState.Open)
                 != System.Data.ConnectionState.Open))
            {
                command.Connection.Open();
                Trace.WriteLine("Opening connection again");
            }
            int returnValue;

            try {
                returnValue = command.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }
            return(returnValue);
        }
Esempio n. 10
0
        public virtual object DeleteGroup(int Original_idx)
        {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[1];
            command.Parameters[0].Value = ((int)(Original_idx));
            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            if (((command.Connection.State & System.Data.ConnectionState.Open)
                 != System.Data.ConnectionState.Open))
            {
                command.Connection.Open();
            }
            object returnValue;

            try {
                returnValue = command.ExecuteScalar();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }
            if (((returnValue == null) ||
                 (returnValue.GetType() == typeof(System.DBNull))))
            {
                return(null);
            }
            else
            {
                return((object)(returnValue));
            }
        }
 public virtual int Update(int AnimalID, string AnimalName, int Original_AnimalID, string Original_AnimalName)
 {
     this.Adapter.UpdateCommand.Parameters[0].Value = ((int)(AnimalID));
     if ((AnimalName == null))
     {
         throw new System.ArgumentNullException("AnimalName");
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(AnimalName));
     }
     this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(Original_AnimalID));
     if ((Original_AnimalName == null))
     {
         throw new System.ArgumentNullException("Original_AnimalName");
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Original_AnimalName));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
     this.Adapter.UpdateCommand.Connection.Open();
     try {
         return(this.Adapter.UpdateCommand.ExecuteNonQuery());
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.UpdateCommand.Connection.Close();
         }
     }
 }
Esempio n. 12
0
        public List <int> GetIdList()
        {
            List <int> list = new List <int>();

            System.Data.SqlClient.SqlCommand command = this.CommandCollection(0);
            command.CommandTimeout = command.Connection.ConnectionTimeout;

            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            try {
                if (((command.Connection.State & System.Data.ConnectionState.Open) != System.Data.ConnectionState.Open))
                {
                    command.Connection.Open();
                }
                using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader()) {
                    while (reader.Read())
                    {
                        list.Add(reader.GetInt32(0));
                    }
                }
            } finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }

            return(list);
        }
Esempio n. 13
0
 public virtual int Update(string DemoValue, int Original_DemoID, string Original_DemoValue, int DemoID)
 {
     if ((DemoValue == null))
     {
         this.Adapter.UpdateCommand.Parameters[0].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(DemoValue));
     }
     this.Adapter.UpdateCommand.Parameters[1].Value = ((int)(Original_DemoID));
     if ((Original_DemoValue == null))
     {
         this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(1));
         this.Adapter.UpdateCommand.Parameters[3].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(0));
         this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Original_DemoValue));
     }
     this.Adapter.UpdateCommand.Parameters[4].Value = ((int)(DemoID));
     System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
     this.Adapter.UpdateCommand.Connection.Open();
     try {
         return(this.Adapter.UpdateCommand.ExecuteNonQuery());
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.UpdateCommand.Connection.Close();
         }
     }
 }
 public virtual int Insert(string name)
 {
     if ((name == null))
     {
         this.Adapter.InsertCommand.Parameters[0].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[0].Value = ((string)(name));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
     if (((this.Adapter.InsertCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.InsertCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.InsertCommand.Connection.Close();
         }
     }
 }
Esempio n. 15
0
         public List<int> GetIdList(int categoryID)
         {
             List<int> list = new List<int>();
             System.Data.SqlClient.SqlCommand command = this.CommandCollection[0];
             command.CommandTimeout = command.Connection.ConnectionTimeout;
 
             System.Data.ConnectionState previousConnectionState = command.Connection.State;
             try {
                 if (((command.Connection.State & System.Data.ConnectionState.Open) != System.Data.ConnectionState.Open)) {
                     command.Connection.Open();
                 }
                 command.Parameters[ "@id" ].Value = categoryID;
                 using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader()) {
                     while (reader.Read()) {
                         list.Add(reader.GetInt32(0));
                     }
                 }
             } finally {
                 if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
                     command.Connection.Close();
                 }
             }
 
             return list;
         }
        public virtual int UpdateGroup(string name, int Original_idx)
        {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
            if ((name == null))
            {
                command.Parameters[0].Value = System.DBNull.Value;
            }
            else
            {
                command.Parameters[0].Value = ((string)(name));
            }
            command.Parameters[1].Value = ((int)(Original_idx));
            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            if (((command.Connection.State & System.Data.ConnectionState.Open)
                 != System.Data.ConnectionState.Open))
            {
                command.Connection.Open();
            }
            int returnValue;

            try {
                returnValue = command.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }
            return(returnValue);
        }
 public virtual int Delete(int Original_Id, string Original_Name)
 {
     this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
     if ((Original_Name == null))
     {
         throw new System.ArgumentNullException("Original_Name");
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(Original_Name));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
     if (((this.Adapter.DeleteCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.DeleteCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.DeleteCommand.Connection.Close();
         }
     }
 }
 public virtual int Delete(int Original_id, string Original_nome)
 {
     this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_id));
     if ((Original_nome == null))
     {
         this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(1));
         this.Adapter.DeleteCommand.Parameters[2].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(0));
         this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_nome));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
     if (((this.Adapter.DeleteCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.DeleteCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.DeleteCommand.Connection.Close();
         }
     }
 }
Esempio n. 19
0
 public virtual int Insert(string FirstName, string LastName)
 {
     if ((FirstName == null))
     {
         throw new System.ArgumentNullException("FirstName");
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[0].Value = ((string)(FirstName));
     }
     if ((LastName == null))
     {
         this.Adapter.InsertCommand.Parameters[1].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.InsertCommand.Parameters[1].Value = ((string)(LastName));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
     this.Adapter.InsertCommand.Connection.Open();
     try {
         return(this.Adapter.InsertCommand.ExecuteNonQuery());
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.InsertCommand.Connection.Close();
         }
     }
 }
Esempio n. 20
0
 public virtual int Delete(int Original_UserID, string Original_FirstName, string Original_LastName)
 {
     this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_UserID));
     if ((Original_FirstName == null))
     {
         throw new System.ArgumentNullException("Original_FirstName");
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(Original_FirstName));
     }
     if ((Original_LastName == null))
     {
         this.Adapter.DeleteCommand.Parameters[2].Value = ((int)(1));
         this.Adapter.DeleteCommand.Parameters[3].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[2].Value = ((int)(0));
         this.Adapter.DeleteCommand.Parameters[3].Value = ((string)(Original_LastName));
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
     this.Adapter.DeleteCommand.Connection.Open();
     try {
         return(this.Adapter.DeleteCommand.ExecuteNonQuery());
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.DeleteCommand.Connection.Close();
         }
     }
 }
Esempio n. 21
0
        public virtual int DeleteGroupByName(string name)
        {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
            if ((name == null))
            {
                throw new System.ArgumentNullException("name");
            }
            else
            {
                command.Parameters[0].Value = ((string)(name));
            }
            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            if (((command.Connection.State & System.Data.ConnectionState.Open)
                 != System.Data.ConnectionState.Open))
            {
                command.Connection.Open();
            }
            int returnValue;

            try {
                returnValue = command.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }
            return(returnValue);
        }
Esempio n. 22
0
 public void TestDbAccess_Connection()        // Assertion is true if connection was opened
 {
     enetConnection.Open();
     System.Data.ConnectionState state = enetConnection.State;
     enetConnection.Close();
     CheckIfItsPopulated();
     Assert.IsTrue(state == System.Data.ConnectionState.Open);
 }
Esempio n. 23
0
 public void CloseConnection()
 {
     if (_OracleConnection.State != System.Data.ConnectionState.Closed)
     {
         System.Data.ConnectionState prevstate = _OracleConnection.State;
         _OracleConnection.Close();
         FireConnectionChangedEvent(prevstate, _OracleConnection.State);
     }
 }
Esempio n. 24
0
 public virtual int Update(string NameOfApplicant, string Village_CityName, decimal Original_AdjudicationId, string Original_NameOfApplicant, string Original_Village_CityName, decimal AdjudicationId)
 {
     if ((NameOfApplicant == null))
     {
         this.Adapter.UpdateCommand.Parameters[0].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(NameOfApplicant));
     }
     if ((Village_CityName == null))
     {
         this.Adapter.UpdateCommand.Parameters[1].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Village_CityName));
     }
     this.Adapter.UpdateCommand.Parameters[2].Value = ((decimal)(Original_AdjudicationId));
     if ((Original_NameOfApplicant == null))
     {
         this.Adapter.UpdateCommand.Parameters[3].Value = ((object)(1));
         this.Adapter.UpdateCommand.Parameters[4].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[3].Value = ((object)(0));
         this.Adapter.UpdateCommand.Parameters[4].Value = ((string)(Original_NameOfApplicant));
     }
     if ((Original_Village_CityName == null))
     {
         this.Adapter.UpdateCommand.Parameters[5].Value = ((object)(1));
         this.Adapter.UpdateCommand.Parameters[6].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.UpdateCommand.Parameters[5].Value = ((object)(0));
         this.Adapter.UpdateCommand.Parameters[6].Value = ((string)(Original_Village_CityName));
     }
     this.Adapter.UpdateCommand.Parameters[7].Value = ((decimal)(AdjudicationId));
     System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
     if (((this.Adapter.UpdateCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.UpdateCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.UpdateCommand.Connection.Close();
         }
     }
 }
Esempio n. 25
0
        public void CloseCurrentUIMF()
        {
            if (instance != null)
            {
                Reader.Dispose();

                ConnectionState = System.Data.ConnectionState.Closed;
            }
        }
 public override void Open()
 {
     if (state != System.Data.ConnectionState.Open)
     {
         this.query      = new LogQuery();
         this.connection = new IISLogInputFormat();
     }
     state = System.Data.ConnectionState.Open;
 }
Esempio n. 27
0
 public virtual int Delete(string Original_OznDrzave, string Original_NazDrzave, string Original_ISO3Drzave, System.Nullable <int> Original_SifDrzave)
 {
     if ((Original_OznDrzave == null))
     {
         throw new System.ArgumentNullException("Original_OznDrzave");
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[0].Value = ((string)(Original_OznDrzave));
     }
     if ((Original_NazDrzave == null))
     {
         throw new System.ArgumentNullException("Original_NazDrzave");
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(0));
         this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_NazDrzave));
     }
     if ((Original_ISO3Drzave == null))
     {
         this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(1));
         this.Adapter.DeleteCommand.Parameters[4].Value = System.DBNull.Value;
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(0));
         this.Adapter.DeleteCommand.Parameters[4].Value = ((string)(Original_ISO3Drzave));
     }
     if ((Original_SifDrzave.HasValue == true))
     {
         this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(0));
         this.Adapter.DeleteCommand.Parameters[6].Value = ((int)(Original_SifDrzave.Value));
     }
     else
     {
         this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(1));
         this.Adapter.DeleteCommand.Parameters[6].Value = System.DBNull.Value;
     }
     System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
     if (((this.Adapter.DeleteCommand.Connection.State & System.Data.ConnectionState.Open)
          != System.Data.ConnectionState.Open))
     {
         this.Adapter.DeleteCommand.Connection.Open();
     }
     try {
         int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
         return(returnValue);
     }
     finally {
         if ((previousConnectionState == System.Data.ConnectionState.Closed))
         {
             this.Adapter.DeleteCommand.Connection.Close();
         }
     }
 }
Esempio n. 28
0
        public override void Close()
        {
            _Connected = false;
            _State     = System.Data.ConnectionState.Closed;

            if (_TcpClient != null)
            {
                _TcpClient.Close();
            }
        }
Esempio n. 29
0
        private void FireConnectionChangedEvent(System.Data.ConnectionState prevState, System.Data.ConnectionState newState)
        {
            if (_eventMgr == null)
            {
                return;
            }
            DbConnectionChangedMessage message = new DbConnectionChangedMessage(prevState, newState);

            _eventMgr.GetEvent <DbConnectionChangedEvent>().Publish(message);
        }
Esempio n. 30
0
        protected void Open(TcpClient tcpClient)
        {
            int    elapseConnectTime = 1;
            Random rand = new Random();

            _ServerBusy = false;

            while (elapseConnectTime < this.ConnectionTimeout * 1000)
            {
                tcpClient.Connect(this.ConnectionTimeout * 1000);

                try
                {
                    tcpClient.SendSyncMessage((short)ConnectEvent.Connect, BuildConnectionMessage());
                    break;
                }
                catch (Exception e)
                {
                    if (e.Message.Trim() == "Too many connects on server")
                    {
                        tcpClient.Close();
                        _Connected       = false;
                        ConnectionString = ConnectionString;

                        if (!CommandReportNoCache && TryConnectTimeout > 0)
                        {
                            if (elapseConnectTime >= TryConnectTimeout)
                            {
                                _ServerBusy = true;
                                return;
                            }
                        }

                        int sleepMillisecond = rand.Next(200, 800);
                        elapseConnectTime += sleepMillisecond;
                        System.Threading.Thread.Sleep(sleepMillisecond);

                        continue;
                    }

                    tcpClient.Close();

                    throw e;
                }
            }

            if (elapseConnectTime > this.ConnectionTimeout * 1000)
            {
                throw new System.Data.DataException("Connect timeout.The hubbledotnet server is too busy right now.");
            }

            _Connected = true;
            _State     = System.Data.ConnectionState.Open;
            DataCacheMgr.OnConnect(this);
        }
 public override void Close()
 {
     state = System.Data.ConnectionState.Closed;
 }
Esempio n. 32
0
 public void Close()
 {
     this.state = System.Data.ConnectionState.Closed;
 }
Esempio n. 33
0
        public void Open()
        {
            System.Diagnostics.Trace.WriteLine("DataSetConnection Open");

            // nothing to open, just set the state
            this.state = System.Data.ConnectionState.Open;
        }
Esempio n. 34
0
		/// <summary>
		/// Opens the connection
		/// </summary>
		private void OpenConnection()
		{
			this.ConnectionState = Connection.State;
			this.Connection.Close();
			this.Connection.Open();
			schemaData = null;
		}
 public override void Open()
 {
     if (state != System.Data.ConnectionState.Open)
     {
         this.query = new LogQuery();
         this.connection = new IISLogInputFormat();
     }
     state = System.Data.ConnectionState.Open;
 }