Beispiel #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BoundryBLL.BLLBoundry_TFactory BoundryFactory = new HPS.BLL.BoundryBLL.BLLBoundry_TFactory();

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


                HPS.BLL.BoundryBLL.BLLBoundry_TFactory Boundry_TFactory = new HPS.BLL.BoundryBLL.BLLBoundry_TFactory();
                HPS.BLL.BoundryBLL.BLLBoundry_TKeys    BoundryKey       = new HPS.BLL.BoundryBLL.BLLBoundry_TKeys();

                BoundryKey.BoundryID_int = (Int32)BoundryGridView.CurrentRow.Cells["colBoundryID_int"].Value;
                BoundryFactory.Delete(BoundryKey);

                DataRow[] dr = ((DataTable)this.BoundryGridView.DataSource).Select(HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryID_int.ToString() + "='" + BoundryKey.BoundryID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.BoundryGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Beispiel #2
0
 public void GetBy(HPS.BLL.BoundryBLL.BLLBoundry_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);
     }
 }
Beispiel #3
0
 public HPS.BLL.BoundryBLL.BLLBoundry_T GetBy(HPS.BLL.BoundryBLL.BLLBoundry_TKeys keys)
 {
     try{
         return(_dataObject.SelectByPrimaryKey(keys));
     }catch (System.Exception ex) {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Beispiel #4
0
 public void Delete(HPS.BLL.BoundryBLL.BLLBoundry_TKeys keys)
 {
     try{
         _dataObject.Delete(keys);
     }catch (System.Exception ex) {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Beispiel #5
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BoundryBLL.BLLBoundry_TKeys BoundryKey = new HPS.BLL.BoundryBLL.BLLBoundry_TKeys();
            BoundryKey.BoundryID_int = (Int32)this.BoundryGridView.CurrentRow.Cells["colBoundryID_int"].Value;
            BoundryEntityForm Boundry = new BoundryEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.BoundryGridView.DataSource, BoundryKey);

            Boundry.ShowDialog();
        }
Beispiel #6
0
        public void Update(HPS.BLL.BoundryBLL.BLLBoundry_T businessObject, HPS.BLL.BoundryBLL.BLLBoundry_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #7
0
        public HPS.BLL.BoundryBLL.BLLBoundry_T SelectByPrimaryKey(HPS.BLL.BoundryBLL.BLLBoundry_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.BoundryBLL.BLLBoundry_T businessObject = new HPS.BLL.BoundryBLL.BLLBoundry_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;
            }
        }
Beispiel #8
0
        public void SelectByPrimaryKey(HPS.BLL.BoundryBLL.BLLBoundry_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_Boundry_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #9
0
        public void Update(HPS.BLL.BoundryBLL.BLLBoundry_T businessObject, HPS.BLL.BoundryBLL.BLLBoundry_TKeys businessObjectKey)
        {
            try{
                if (businessObject.BoundryID_int == businessObjectKey.BoundryID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueBoundryID_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);
            }
        }
Beispiel #10
0
 public BoundryEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.BoundryBLL.BLLBoundry_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }