コード例 #1
0
        public HPS.BLL.OnlineUserBLL.BLLOnlineUser_T SelectByPrimaryKey(HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_OnlineUser_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter OnlineUserID_int = new SqlParameter();
                OnlineUserID_int.ParameterName = "@OnlineUserID_int";
                OnlineUserID_int.SqlDbType     = SqlDbType.Int;
                OnlineUserID_int.Direction     = ParameterDirection.Input;
                OnlineUserID_int.IsNullable    = false;
                OnlineUserID_int.Value         = businessObjectKey.OnlineUserID_int;
                this.Command.Parameters.Add(OnlineUserID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.OnlineUserBLL.BLLOnlineUser_T businessObject = new  HPS.BLL.OnlineUserBLL.BLLOnlineUser_T();
                if (dataReader.Read())
                {
                    PopulateBusinessObjectFromReader(businessObject, dataReader);
                }
                else
                {
                    businessObject = null;
                }

                if (dataReader.IsClosed == false)
                {
                    dataReader.Close();
                }


                if (ControlConnection)
                {
                    this.Commit();
                }
                return(businessObject);
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #2
0
 public void GetBy(HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys keys, ref System.Data.DataTable dataTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #3
0
 public HPS.BLL.OnlineUserBLL.BLLOnlineUser_T GetBy(HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #4
0
 public void Delete(HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #5
0
        public void SelectByPrimaryKey(HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys businessObjectKey, ref System.Data.DataTable dataTable)
        {
            bool           ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);
            SqlDataAdapter sqlDataAdapter    = new System.Data.SqlClient.SqlDataAdapter(this.Command);

            this.Command.CommandText = "[sp_OnlineUser_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter OnlineUserID_int = new SqlParameter();
                OnlineUserID_int.ParameterName = "@OnlineUserID_int";
                OnlineUserID_int.SqlDbType     = SqlDbType.Int;
                OnlineUserID_int.Direction     = ParameterDirection.Input;
                OnlineUserID_int.IsNullable    = false;
                OnlineUserID_int.Value         = businessObjectKey.OnlineUserID_int;
                this.Command.Parameters.Add(OnlineUserID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #6
0
        public void Update(HPS.BLL.OnlineUserBLL.BLLOnlineUser_T businessObject, HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.OnlineUserID_int == businessObjectKey.OnlineUserID_int)
                {
                    ExceptList.Add("UniqueOnlineUserID_int");
                }
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.ToArray()) == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Update(businessObject, businessObjectKey);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
コード例 #7
0
        public void Update(HPS.BLL.OnlineUserBLL.BLLOnlineUser_T businessObject, HPS.BLL.OnlineUserBLL.BLLOnlineUser_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_OnlineUser_T_Update]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter UserName_nvc = new SqlParameter();
                UserName_nvc.ParameterName = "@UserName_nvc";
                UserName_nvc.SqlDbType     = SqlDbType.NVarChar;
                UserName_nvc.Direction     = ParameterDirection.Input;
                UserName_nvc.IsNullable    = false;
                UserName_nvc.Value         = businessObject.UserName_nvc;
                this.Command.Parameters.Add(UserName_nvc);

                SqlParameter MacAddress_nvc = new SqlParameter();
                MacAddress_nvc.ParameterName = "@MacAddress_nvc";
                MacAddress_nvc.SqlDbType     = SqlDbType.NVarChar;
                MacAddress_nvc.Direction     = ParameterDirection.Input;
                MacAddress_nvc.IsNullable    = false;
                MacAddress_nvc.Value         = businessObject.MacAddress_nvc;
                this.Command.Parameters.Add(MacAddress_nvc);

                SqlParameter LoginDate_vc = new SqlParameter();
                LoginDate_vc.ParameterName = "@LoginDate_vc";
                LoginDate_vc.SqlDbType     = SqlDbType.VarChar;
                LoginDate_vc.Direction     = ParameterDirection.Input;
                LoginDate_vc.IsNullable    = false;
                LoginDate_vc.Value         = businessObject.LoginDate_vc;
                this.Command.Parameters.Add(LoginDate_vc);

                SqlParameter LoginTime_vc = new SqlParameter();
                LoginTime_vc.ParameterName = "@LoginTime_vc";
                LoginTime_vc.SqlDbType     = SqlDbType.VarChar;
                LoginTime_vc.Direction     = ParameterDirection.Input;
                LoginTime_vc.IsNullable    = false;
                LoginTime_vc.Value         = businessObject.LoginTime_vc;
                this.Command.Parameters.Add(LoginTime_vc);

                SqlParameter LogOutDate_vc = new SqlParameter();
                LogOutDate_vc.ParameterName = "@LogOutDate_vc";
                LogOutDate_vc.SqlDbType     = SqlDbType.VarChar;
                LogOutDate_vc.Direction     = ParameterDirection.Input;
                LogOutDate_vc.IsNullable    = false;
                if (String.IsNullOrEmpty(businessObject.LogOutDate_vc))
                {
                    LogOutDate_vc.Value = DBNull.Value;
                }
                else
                {
                    LogOutDate_vc.Value = businessObject.LogOutDate_vc;
                }
                this.Command.Parameters.Add(LogOutDate_vc);

                SqlParameter LogOutTime_vc = new SqlParameter();
                LogOutTime_vc.ParameterName = "@LogOutTime_vc";
                LogOutTime_vc.SqlDbType     = SqlDbType.VarChar;
                LogOutTime_vc.Direction     = ParameterDirection.Input;
                LogOutTime_vc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.LogOutTime_vc))
                {
                    LogOutTime_vc.Value = DBNull.Value;
                }
                else
                {
                    LogOutTime_vc.Value = businessObject.LogOutTime_vc;
                }
                this.Command.Parameters.Add(LogOutTime_vc);


                SqlParameter pk_OnlineUserID_int = new SqlParameter();
                pk_OnlineUserID_int.ParameterName = "@pk_OnlineUserID_int";
                pk_OnlineUserID_int.SqlDbType     = SqlDbType.Int;
                pk_OnlineUserID_int.Direction     = ParameterDirection.Input;
                pk_OnlineUserID_int.IsNullable    = false;
                pk_OnlineUserID_int.Value         = businessObjectKey.OnlineUserID_int;
                this.Command.Parameters.Add(pk_OnlineUserID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }