private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionTypeFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionType_TFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory(); HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys InfractionTypeKey = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys(); InfractionTypeKey.InfractionTypeID_int = (Int32?)InfractionTypeGridView.CurrentRow.Cells["colInfractionTypeID_int"].Value; InfractionTypeFactory.Delete(InfractionTypeKey); DataRow[] dr = ((DataTable)this.InfractionTypeGridView.DataSource).Select(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionTypeID_int.ToString() + "='" + InfractionTypeKey.InfractionTypeID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.InfractionTypeGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys InfractionTypeKey = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys(); InfractionTypeKey.InfractionTypeID_int = (Int32?)this.InfractionTypeGridView.CurrentRow.Cells["colInfractionTypeID_int"].Value; InfractionTypeEntityForm InfractionType = new InfractionTypeEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.InfractionTypeGridView.DataSource, InfractionTypeKey); InfractionType.ShowDialog(); }
public HPS.BLL.InfractionTypeBLL.BLLInfractionType_T SelectByPrimaryKey(HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_InfractionType_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter InfractionTypeID_int = new SqlParameter(); InfractionTypeID_int.ParameterName = "@InfractionTypeID_int"; InfractionTypeID_int.SqlDbType = SqlDbType.Int; InfractionTypeID_int.Direction = ParameterDirection.Input; InfractionTypeID_int.IsNullable = false; InfractionTypeID_int.Value = businessObjectKey.InfractionTypeID_int; this.Command.Parameters.Add(InfractionTypeID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.InfractionTypeBLL.BLLInfractionType_T businessObject = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_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 GetBy(HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys keys, ref System.Data.DataSet dataSet) { try { _dataObject.SelectByPrimaryKey(keys, ref dataSet); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public HPS.BLL.InfractionTypeBLL.BLLInfractionType_T GetBy(HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.InfractionTypeBLL.BLLInfractionType_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_InfractionType_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter InfractionTypeID_int = new SqlParameter(); InfractionTypeID_int.ParameterName = "@InfractionTypeID_int"; InfractionTypeID_int.SqlDbType = SqlDbType.Int; InfractionTypeID_int.Direction = ParameterDirection.Input; InfractionTypeID_int.IsNullable = false; InfractionTypeID_int.Value = businessObjectKey.InfractionTypeID_int; this.Command.Parameters.Add(InfractionTypeID_int); if (ControlConnection) { this.BeginTransaction(); } sqlDataAdapter.Fill(dataTable); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public void Update(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T businessObject, HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_InfractionType_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter InfractionType_nvc = new SqlParameter(); InfractionType_nvc.ParameterName = "@InfractionType_nvc"; InfractionType_nvc.SqlDbType = SqlDbType.NVarChar; InfractionType_nvc.Direction = ParameterDirection.Input; InfractionType_nvc.IsNullable = false; InfractionType_nvc.Value = businessObject.InfractionType_nvc; this.Command.Parameters.Add(InfractionType_nvc); SqlParameter InfractionGroupID_int = new SqlParameter(); InfractionGroupID_int.ParameterName = "@InfractionGroupID_int"; InfractionGroupID_int.SqlDbType = SqlDbType.Int; InfractionGroupID_int.Direction = ParameterDirection.Input; InfractionGroupID_int.IsNullable = false; InfractionGroupID_int.Value = businessObject.InfractionGroupID_int; this.Command.Parameters.Add(InfractionGroupID_int); SqlParameter InfractionSurveyGroupID_int = new SqlParameter(); InfractionSurveyGroupID_int.ParameterName = "@InfractionSurveyGroupID_int"; InfractionSurveyGroupID_int.SqlDbType = SqlDbType.Int; InfractionSurveyGroupID_int.Direction = ParameterDirection.Input; InfractionSurveyGroupID_int.IsNullable = false; InfractionSurveyGroupID_int.Value = businessObject.InfractionSurveyGroupID_int; this.Command.Parameters.Add(InfractionSurveyGroupID_int); SqlParameter PenaltyFee_dec = new SqlParameter(); PenaltyFee_dec.ParameterName = "@PenaltyFee_dec"; PenaltyFee_dec.SqlDbType = SqlDbType.Decimal; PenaltyFee_dec.Direction = ParameterDirection.Input; PenaltyFee_dec.IsNullable = false; if (businessObject.PenaltyFee_dec.HasValue == false) { PenaltyFee_dec.Value = DBNull.Value; } else { PenaltyFee_dec.Value = businessObject.PenaltyFee_dec; } this.Command.Parameters.Add(PenaltyFee_dec); SqlParameter Date_nvc = new SqlParameter(); Date_nvc.ParameterName = "@Date_nvc"; Date_nvc.SqlDbType = SqlDbType.NVarChar; Date_nvc.Direction = ParameterDirection.Input; Date_nvc.IsNullable = true; 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 Active_bit = new SqlParameter(); Active_bit.ParameterName = "@Active_bit"; Active_bit.SqlDbType = SqlDbType.Bit; Active_bit.Direction = ParameterDirection.Input; Active_bit.IsNullable = false; Active_bit.Value = businessObject.Active_bit; this.Command.Parameters.Add(Active_bit); 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 pk_InfractionTypeID_int = new SqlParameter(); pk_InfractionTypeID_int.ParameterName = "@pk_InfractionTypeID_int"; pk_InfractionTypeID_int.SqlDbType = SqlDbType.Int; pk_InfractionTypeID_int.Direction = ParameterDirection.Input; pk_InfractionTypeID_int.IsNullable = false; pk_InfractionTypeID_int.Value = businessObjectKey.InfractionTypeID_int; this.Command.Parameters.Add(pk_InfractionTypeID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public InfractionTypeEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }
public void Update(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T businessObject, HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys businessObjectKey) { try { HPS.BLL.InfractionTypeBLL.BLLInfractionType_T tmpInfractionType = this.GetBy(businessObjectKey); List <string> Except = new List <string>(); if (businessObject.InfractionTypeID_int == businessObjectKey.InfractionTypeID_int) { Except.Add("UniqueInfractionTypeID_int"); } if (businessObject.InfractionGroupID_int == tmpInfractionType.InfractionGroupID_int) { Except.Add("UniqueInfractionGroupID_int"); } //if (businessObject.InfractionType_nvc == tmpInfractionType.InfractionType_nvc) // Except.Add("UniqueInfractionType_nvc"); if (Except.Count > 0) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, Except.ToArray()) == 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); } }