private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory ChargePriceFactory = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory ChargePrice_TFactory = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory(); HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys ChargePriceKey = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys(); ChargePriceKey.ChargePriceID_int = (Int32?)ChargePriceGridView.CurrentRow.Cells["colChargePriceID_int"].Value; ChargePriceFactory.Delete(ChargePriceKey); DataRow[] dr = ((DataTable)this.ChargePriceGridView.DataSource).Select(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.ChargePriceID_int.ToString() + "='" + ChargePriceKey.ChargePriceID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.ChargePriceGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public void Update(HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject, HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys businessObjectKey) { try { if (businessObject.ChargePriceID_int == businessObjectKey.ChargePriceID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueChargePriceID_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); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys ChargePriceKey = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys(); ChargePriceKey.ChargePriceID_int = (Int32?)this.ChargePriceGridView.CurrentRow.Cells["colChargePriceID_int"].Value; ChargePriceEntityForm ChargePrice = new ChargePriceEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.ChargePriceGridView.DataSource, ChargePriceKey); ChargePrice.ShowDialog(); }
public void GetBy(HPS.BLL.ChargePriceBLL.BLLChargePrice_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); } }
public HPS.BLL.ChargePriceBLL.BLLChargePrice_T GetBy(HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys keys) { try{ return(_dataObject.SelectByPrimaryKey(keys)); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys keys) { try{ _dataObject.Delete(keys); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public HPS.BLL.ChargePriceBLL.BLLChargePrice_T SelectByPrimaryKey(HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_ChargePrice_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter ChargePriceID_int = new SqlParameter(); ChargePriceID_int.ParameterName = "@ChargePriceID_int"; ChargePriceID_int.SqlDbType = SqlDbType.Int; ChargePriceID_int.Direction = ParameterDirection.Input; ChargePriceID_int.IsNullable = false; ChargePriceID_int.Value = businessObjectKey.ChargePriceID_int; this.Command.Parameters.Add(ChargePriceID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject = new HPS.BLL.ChargePriceBLL.BLLChargePrice_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; } }
public void SelectByPrimaryKey(HPS.BLL.ChargePriceBLL.BLLChargePrice_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_ChargePrice_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter ChargePriceID_int = new SqlParameter(); ChargePriceID_int.ParameterName = "@ChargePriceID_int"; ChargePriceID_int.SqlDbType = SqlDbType.Int; ChargePriceID_int.Direction = ParameterDirection.Input; ChargePriceID_int.IsNullable = false; ChargePriceID_int.Value = businessObjectKey.ChargePriceID_int; this.Command.Parameters.Add(ChargePriceID_int); if (ControlConnection) { this.BeginTransaction(); } sqlDataAdapter.Fill(dataTable); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public ChargePriceEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }
public void Update(HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject, HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_ChargePrice_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter DriverID_bint = new SqlParameter(); DriverID_bint.ParameterName = "@DriverID_bint"; DriverID_bint.SqlDbType = SqlDbType.BigInt; DriverID_bint.Direction = ParameterDirection.Input; DriverID_bint.IsNullable = false; DriverID_bint.Value = businessObject.DriverID_bint; this.Command.Parameters.Add(DriverID_bint); SqlParameter DriverName_nvc = new SqlParameter(); DriverName_nvc.ParameterName = "@DriverName_nvc"; DriverName_nvc.SqlDbType = SqlDbType.NVarChar; DriverName_nvc.Direction = ParameterDirection.Input; DriverName_nvc.IsNullable = false; DriverName_nvc.Value = businessObject.DriverName_nvc; this.Command.Parameters.Add(DriverName_nvc); SqlParameter DriverCardNumber_nvc = new SqlParameter(); DriverCardNumber_nvc.ParameterName = "@DriverCardNumber_nvc"; DriverCardNumber_nvc.SqlDbType = SqlDbType.NVarChar; DriverCardNumber_nvc.Direction = ParameterDirection.Input; DriverCardNumber_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.DriverCardNumber_nvc)) { DriverCardNumber_nvc.Value = DBNull.Value; } else { DriverCardNumber_nvc.Value = businessObject.DriverCardNumber_nvc; } this.Command.Parameters.Add(DriverCardNumber_nvc); SqlParameter Price_dec = new SqlParameter(); Price_dec.ParameterName = "@Price_dec"; Price_dec.SqlDbType = SqlDbType.Decimal; Price_dec.Direction = ParameterDirection.Input; Price_dec.IsNullable = true; Price_dec.Value = businessObject.Price_dec; this.Command.Parameters.Add(Price_dec); SqlParameter Date_nvc = new SqlParameter(); Date_nvc.ParameterName = "@Date_nvc"; Date_nvc.SqlDbType = SqlDbType.NVarChar; Date_nvc.Direction = ParameterDirection.Input; Date_nvc.IsNullable = false; Date_nvc.Value = businessObject.Date_nvc; this.Command.Parameters.Add(Date_nvc); SqlParameter Time_nvc = new SqlParameter(); Time_nvc.ParameterName = "@Time_nvc"; Time_nvc.SqlDbType = SqlDbType.NVarChar; Time_nvc.Direction = ParameterDirection.Input; Time_nvc.IsNullable = false; Time_nvc.Value = businessObject.Time_nvc; this.Command.Parameters.Add(Time_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 Description_nvc = new SqlParameter(); Description_nvc.ParameterName = "@Description_nvc"; Description_nvc.SqlDbType = SqlDbType.NVarChar; Description_nvc.Direction = ParameterDirection.Input; Description_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.Description_nvc)) { Description_nvc.Value = DBNull.Value; } else { Description_nvc.Value = businessObject.Description_nvc; } this.Command.Parameters.Add(Description_nvc); SqlParameter pk_ChargePriceID_int = new SqlParameter(); pk_ChargePriceID_int.ParameterName = "@pk_ChargePriceID_int"; pk_ChargePriceID_int.SqlDbType = SqlDbType.Int; pk_ChargePriceID_int.Direction = ParameterDirection.Input; pk_ChargePriceID_int.IsNullable = false; pk_ChargePriceID_int.Value = businessObjectKey.ChargePriceID_int; this.Command.Parameters.Add(pk_ChargePriceID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }