コード例 #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BillBLL.BLLBill_TFactory BillFactory = new HPS.BLL.BillBLL.BLLBill_TFactory();

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


                HPS.BLL.BillBLL.BLLBill_TFactory Bill_TFactory = new HPS.BLL.BillBLL.BLLBill_TFactory();
                HPS.BLL.BillBLL.BLLBill_TKeys    BillKey       = new HPS.BLL.BillBLL.BLLBill_TKeys();

                BillKey.BillID_int = (Int32)BillGridView.CurrentRow.Cells["colBillID_int"].Value;
                BillFactory.Delete(BillKey);

                DataRow[] dr = ((DataTable)this.BillGridView.DataSource).Select(HPS.BLL.BillBLL.BLLBill_T.Bill_TField.BillID_int.ToString() + "='" + BillKey.BillID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.BillGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #2
0
        public void Update(HPS.BLL.BillBLL.BLLBill_T businessObject, HPS.BLL.BillBLL.BLLBill_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.BillID_int == businessObjectKey.BillID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueBillID_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);
            }
        }
コード例 #3
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.BillBLL.BLLBill_TKeys BillKey = new HPS.BLL.BillBLL.BLLBill_TKeys();
            BillKey.BillID_int = (Int32)this.BillGridView.CurrentRow.Cells["colBillID_int"].Value;
            BillEntityForm Bill = new BillEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.BillGridView.DataSource, BillKey);

            Bill.ShowDialog();
        }
コード例 #4
0
        public HPS.BLL.BillBLL.BLLBill_T SelectByPrimaryKey(HPS.BLL.BillBLL.BLLBill_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_Bill_T_SelectByPrimaryKey]";
            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    = false;
                BillID_int.Value         = businessObjectKey.BillID_int;
                this.Command.Parameters.Add(BillID_int);



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.BillBLL.BLLBill_T businessObject = new HPS.BLL.BillBLL.BLLBill_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;
            }
        }
コード例 #5
0
 public void GetBy(HPS.BLL.BillBLL.BLLBill_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);
     }
 }
コード例 #6
0
 public HPS.BLL.BillBLL.BLLBill_T GetBy(HPS.BLL.BillBLL.BLLBill_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #7
0
 public void Delete(HPS.BLL.BillBLL.BLLBill_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #8
0
        public void SelectByPrimaryKey(HPS.BLL.BillBLL.BLLBill_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_Bill_T_SelectByPrimaryKey]";
            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    = false;
                BillID_int.Value         = businessObjectKey.BillID_int;
                this.Command.Parameters.Add(BillID_int);



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #9
0
        public void Update(HPS.BLL.BillBLL.BLLBill_T businessObject, HPS.BLL.BillBLL.BLLBill_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #10
0
 public BillEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.BillBLL.BLLBill_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }