Exemple #1
0
        public void Update(HPS.BLL.ProvinceBLL.BLLProvince_T businessObject, HPS.BLL.ProvinceBLL.BLLProvince_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.Province_int == businessObjectKey.Province_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueProvince_int") == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == 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);
            }
        }
Exemple #2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.ProvinceBLL.BLLProvince_TFactory ProvinceFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory();

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


                HPS.BLL.ProvinceBLL.BLLProvince_TFactory Province_TFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory();
                HPS.BLL.ProvinceBLL.BLLProvince_TKeys    ProvinceKey       = new HPS.BLL.ProvinceBLL.BLLProvince_TKeys();

                ProvinceKey.Province_int = (Int32?)ProvinceGridView.CurrentRow.Cells["colProvince_int"].Value;
                ProvinceFactory.Delete(ProvinceKey);

                DataRow[] dr = ((DataTable)this.ProvinceGridView.DataSource).Select(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_int.ToString() + "='" + ProvinceKey.Province_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.ProvinceGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #3
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.ProvinceBLL.BLLProvince_TKeys ProvinceKey = new HPS.BLL.ProvinceBLL.BLLProvince_TKeys();
            ProvinceKey.Province_int = (Int32?)this.ProvinceGridView.CurrentRow.Cells["colProvince_int"].Value;
            ProvinceEntityForm Province = new ProvinceEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.ProvinceGridView.DataSource, ProvinceKey);

            Province.ShowDialog();
        }
Exemple #4
0
        public HPS.BLL.ProvinceBLL.BLLProvince_T SelectByPrimaryKey(HPS.BLL.ProvinceBLL.BLLProvince_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.ProvinceBLL.BLLProvince_T businessObject = new HPS.BLL.ProvinceBLL.BLLProvince_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;
            }
        }
Exemple #5
0
 public void GetBy(HPS.BLL.ProvinceBLL.BLLProvince_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);
     }
 }
Exemple #6
0
 public HPS.BLL.ProvinceBLL.BLLProvince_T GetBy(HPS.BLL.ProvinceBLL.BLLProvince_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #7
0
 public void Delete(HPS.BLL.ProvinceBLL.BLLProvince_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #8
0
        public void SelectByPrimaryKey(HPS.BLL.ProvinceBLL.BLLProvince_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_Province_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemple #9
0
        public void Update(HPS.BLL.ProvinceBLL.BLLProvince_T businessObject, HPS.BLL.ProvinceBLL.BLLProvince_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemple #10
0
 public ProvinceEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.ProvinceBLL.BLLProvince_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }