Example #1
0
        private void DeleteCompanyGroupButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory CompanyGroupFactory = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory();

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


                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory CompanyGroup_TFactory = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory();
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys    CompanyGroupKey       = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys();

                CompanyGroupKey.GroupID_int = (Int32)CompanyGroupGridView.CurrentRow.Cells["colGroupID_int"].Value;
                CompanyGroupFactory.Delete(CompanyGroupKey);

                DataRow[] dr = ((DataTable)this.CompanyGroupGridView.DataSource).Select(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupID_int.ToString() + "='" + CompanyGroupKey.GroupID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.CompanyGroupGridView.DataSource).AcceptChanges();
            }

            catch (System.Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Example #2
0
 private void EditCompanyGroupButton_Click(object sender, EventArgs e)
 {
     HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys CompanyGroupKey = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys();
     CompanyGroupKey.GroupID_int = (Int32)this.CompanyGroupGridView.CurrentRow.Cells["colGroupID_int"].Value;
     HPS.Present.CompanyGroup.CompanyGroupEntityForm CompanyGroup = new HPS.Present.CompanyGroup.CompanyGroupEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.CompanyGroupGridView.DataSource, CompanyGroupKey);
     CompanyGroup.ShowDialog();
 }
Example #3
0
        public HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T SelectByPrimaryKey(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_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;
            }
        }
Example #4
0
 public void Delete(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Example #5
0
 public void GetBy(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys keys, ref System.Data.DataSet dataSet, String srcTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataSet, srcTable);
         this._count = dataSet.Tables[srcTable].Rows.Count;
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Example #6
0
 public HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T GetBy(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys keys)
 {
     try
     {
         this._count = 1;
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Example #7
0
        public void Update(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

            try
            {
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys businessObjectKey = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys();
                businessObjectKey.GroupID_int = (Int32)businessObject.GroupID_int;
                this.Command.Parameters.Clear();
                SqlParameter GroupName_nvc = new SqlParameter();
                GroupName_nvc.ParameterName = "@GroupName_nvc";
                GroupName_nvc.SqlDbType     = SqlDbType.NVarChar;
                GroupName_nvc.Direction     = ParameterDirection.Input;
                GroupName_nvc.IsNullable    = false;
                GroupName_nvc.Value         = businessObject.GroupName_nvc;
                this.Command.Parameters.Add(GroupName_nvc);


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Example #8
0
        public void SelectByPrimaryKey(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_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_CompanyGroup_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Example #9
0
        public void Update(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject, HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.GroupID_int == businessObjectKey.GroupID_int)
                {
                    ExceptList.Add("UniqueGroupID_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);
            }
        }
Example #10
0
 public CompanyGroupEntityForm(enmState State, DataTable DataTable, HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }