Exemplo n.º 1
0
 private void EditCompanyMobileButton_Click(object sender, EventArgs e)
 {
     HPS.BLL.BLLCompanyMobile_TKeys CompanyMobileKey = new HPS.BLL.BLLCompanyMobile_TKeys();
     CompanyMobileKey.CompanyMobileID_int = (Int32)this.CompanyMobileGridView.CurrentRow.Cells["colCompanyMobileID_int"].Value;
     HPS.Present.CompanyMobileEntityForm CompanyMobile = new HPS.Present.CompanyMobileEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.CompanyMobileGridView.DataSource, CompanyMobileKey);
     CompanyMobile.ShowDialog();
 }
Exemplo n.º 2
0
        private void DeleteCompanyMobileButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BLLCompanyMobile_TFactory CompanyMobileFactory = new HPS.BLL.BLLCompanyMobile_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.BLLCompanyMobile_TFactory CompanyMobile_TFactory = new HPS.BLL.BLLCompanyMobile_TFactory();
                HPS.BLL.BLLCompanyMobile_TKeys    CompanyMobileKey       = new HPS.BLL.BLLCompanyMobile_TKeys();

                CompanyMobileKey.CompanyMobileID_int = (Int32)CompanyMobileGridView.CurrentRow.Cells["colCompanyMobileID_int"].Value;
                CompanyMobileFactory.Delete(CompanyMobileKey);

                DataRow[] dr = ((DataTable)this.CompanyMobileGridView.DataSource).Select(HPS.BLL.BLLCompanyMobile_T.CompanyMobile_TField.CompanyMobileID_int.ToString() + "='" + CompanyMobileKey.CompanyMobileID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.CompanyMobileGridView.DataSource).AcceptChanges();
            }

            catch (System.Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemplo n.º 3
0
        public HPS.BLL.BLLCompanyMobile_T SelectByPrimaryKey(HPS.BLL.BLLCompanyMobile_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.BLLCompanyMobile_T businessObject = new HPS.BLL.BLLCompanyMobile_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;
            }
        }
Exemplo n.º 4
0
 public void GetBy(HPS.BLL.BLLCompanyMobile_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);
     }
 }
Exemplo n.º 5
0
 public HPS.BLL.BLLCompanyMobile_T GetBy(HPS.BLL.BLLCompanyMobile_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemplo n.º 6
0
 public void Delete(HPS.BLL.BLLCompanyMobile_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemplo n.º 7
0
        public void SelectByPrimaryKey(HPS.BLL.BLLCompanyMobile_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_CompanyMobile_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemplo n.º 8
0
        public void Update(HPS.BLL.BLLCompanyMobile_T businessObject, HPS.BLL.BLLCompanyMobile_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.CompanyMobileID_int == businessObjectKey.CompanyMobileID_int)
                {
                    ExceptList.Add("UniqueCompanyMobileID_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);
            }
        }
Exemplo n.º 9
0
 public CompanyMobileEntityForm(enmState State, DataTable DataTable, HPS.BLL.BLLCompanyMobile_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
Exemplo n.º 10
0
        public void Update(HPS.BLL.BLLCompanyMobile_T businessObject, HPS.BLL.BLLCompanyMobile_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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

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

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

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



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

                this.Command.ExecuteNonQuery();

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