Ejemplo n.º 1
0
        public void Update(HPS.BLL.BillMessageBLL.BLLBillMessage_T businessObject, HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.BillMessageID_int == businessObjectKey.BillMessageID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueBillMessageID_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);
            }
        }
Ejemplo n.º 2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillMessageFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();

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


                HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillMessage_TFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
                HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys    BillMessageKey       = new HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys();

                BillMessageKey.BillMessageID_int = (Int32?)BillMessageGridView.CurrentRow.Cells["colBillMessageID_int"].Value;
                BillMessageFactory.Delete(BillMessageKey);

                DataRow[] dr = ((DataTable)this.BillMessageGridView.DataSource).Select(HPS.BLL.BillMessageBLL.BLLBillMessage_T.BillMessage_TField.BillMessageID_int.ToString() + "='" + BillMessageKey.BillMessageID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.BillMessageGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys BillMessageKey = new HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys();
            BillMessageKey.BillMessageID_int = (Int32?)this.BillMessageGridView.CurrentRow.Cells["colBillMessageID_int"].Value;
            BillMessageEntityForm BillMessage = new BillMessageEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.BillMessageGridView.DataSource, BillMessageKey);

            BillMessage.ShowDialog();
        }
Ejemplo n.º 4
0
        public HPS.BLL.BillMessageBLL.BLLBillMessage_T SelectByPrimaryKey(HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

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

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Ejemplo n.º 9
0
 public BillMessageEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
Ejemplo n.º 10
0
        public void Update(HPS.BLL.BillMessageBLL.BLLBillMessage_T businessObject, HPS.BLL.BillMessageBLL.BLLBillMessage_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter BillID_int = new SqlParameter();
                BillID_int.ParameterName = "@BillID_int";
                BillID_int.SqlDbType     = SqlDbType.Int;
                BillID_int.Direction     = ParameterDirection.Input;
                BillID_int.IsNullable    = true;
                if (businessObject.BillID_int.HasValue)
                {
                    BillID_int.Value = businessObject.BillID_int;
                }
                else
                {
                    BillID_int.Value = DBNull.Value;
                }
                this.Command.Parameters.Add(BillID_int);
                SqlParameter Message_nvc = new SqlParameter();
                Message_nvc.ParameterName = "@Message_nvc";
                Message_nvc.SqlDbType     = SqlDbType.NVarChar;
                Message_nvc.Direction     = ParameterDirection.Input;
                Message_nvc.IsNullable    = false;
                Message_nvc.Value         = businessObject.Message_nvc;
                this.Command.Parameters.Add(Message_nvc);

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

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

                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 SaloonID_intParam = new SqlParameter();
                SaloonID_intParam.ParameterName = "@SaloonID_int";
                SaloonID_intParam.SqlDbType     = SqlDbType.Int;
                SaloonID_intParam.Direction     = ParameterDirection.Input;
                SaloonID_intParam.IsNullable    = true;
                if (businessObject.SaloonID_int.HasValue)
                {
                    SaloonID_intParam.Value = businessObject.SaloonID_int;
                }
                else
                {
                    SaloonID_intParam.Value = DBNull.Value;
                }

                this.Command.Parameters.Add(SaloonID_intParam);

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

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



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

                this.Command.ExecuteNonQuery();

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