public void Update(HPS.BLL.BoxingBLL.BLLBoxing_T businessObject, HPS.BLL.BoxingBLL.BLLBoxing_TKeys businessObjectKey) { try { if (businessObject.BoxingID_int == businessObjectKey.BoxingID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueBoxingID_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 DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.BoxingBLL.BLLBoxing_TFactory Boxing_TFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory(); HPS.BLL.BoxingBLL.BLLBoxing_TKeys BoxingKey = new HPS.BLL.BoxingBLL.BLLBoxing_TKeys(); BoxingKey.BoxingID_int = (Int32?)BoxingGridView.CurrentRow.Cells["colBoxingID_int"].Value; BoxingFactory.Delete(BoxingKey); DataRow[] dr = ((DataTable)this.BoxingGridView.DataSource).Select(HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingID_int.ToString() + "='" + BoxingKey.BoxingID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.BoxingGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.BoxingBLL.BLLBoxing_TKeys BoxingKey = new HPS.BLL.BoxingBLL.BLLBoxing_TKeys(); BoxingKey.BoxingID_int = (Int32?)this.BoxingGridView.CurrentRow.Cells["colBoxingID_int"].Value; BoxingEntityForm Boxing = new BoxingEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.BoxingGridView.DataSource, BoxingKey); Boxing.ShowDialog(); }
public HPS.BLL.BoxingBLL.BLLBoxing_T SelectByPrimaryKey(HPS.BLL.BoxingBLL.BLLBoxing_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Boxing_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter BoxingID_int = new SqlParameter(); BoxingID_int.ParameterName = "@BoxingID_int"; BoxingID_int.SqlDbType = SqlDbType.Int; BoxingID_int.Direction = ParameterDirection.Input; BoxingID_int.IsNullable = false; BoxingID_int.Value = businessObjectKey.BoxingID_int; this.Command.Parameters.Add(BoxingID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.BoxingBLL.BLLBoxing_T businessObject = new HPS.BLL.BoxingBLL.BLLBoxing_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.BoxingBLL.BLLBoxing_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.BoxingBLL.BLLBoxing_T GetBy(HPS.BLL.BoxingBLL.BLLBoxing_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.BoxingBLL.BLLBoxing_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
private void SearchButton_Click(object sender, EventArgs e) { if (BoxingGridView.CurrentRow != null) { HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory(); HPS.BLL.BoxingBLL.BLLBoxing_TKeys BoxingKey = new HPS.BLL.BoxingBLL.BLLBoxing_TKeys(); BoxingKey.BoxingID_int = (Int32)BoxingGridView.CurrentRow.Cells[colBoxingID_int.Name].Value; BoxingEntity = BoxingFactory.GetBy(BoxingKey); if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingGridView.CurrentRow.Cells[colBoxingID_int.Name].Value, TypeCode.String).ToString()) == false) { BoxingEntity.BoxingType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingGridView.CurrentRow.Cells[colBoxingType_nvc.Name].Value, TypeCode.String).ToString(); } } this.Close(); }
public void SelectByPrimaryKey(HPS.BLL.BoxingBLL.BLLBoxing_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_Boxing_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter BoxingID_int = new SqlParameter(); BoxingID_int.ParameterName = "@BoxingID_int"; BoxingID_int.SqlDbType = SqlDbType.Int; BoxingID_int.Direction = ParameterDirection.Input; BoxingID_int.IsNullable = false; BoxingID_int.Value = businessObjectKey.BoxingID_int; this.Command.Parameters.Add(BoxingID_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.BoxingBLL.BLLBoxing_T businessObject, HPS.BLL.BoxingBLL.BLLBoxing_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Boxing_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter BoxingCode_nvc = new SqlParameter(); BoxingCode_nvc.ParameterName = "@BoxingCode_nvc"; BoxingCode_nvc.SqlDbType = SqlDbType.NVarChar; BoxingCode_nvc.Direction = ParameterDirection.Input; BoxingCode_nvc.IsNullable = false; BoxingCode_nvc.Value = businessObject.BoxingCode_nvc; this.Command.Parameters.Add(BoxingCode_nvc); SqlParameter BoxingType_nvc = new SqlParameter(); BoxingType_nvc.ParameterName = "@BoxingType_nvc"; BoxingType_nvc.SqlDbType = SqlDbType.NVarChar; BoxingType_nvc.Direction = ParameterDirection.Input; BoxingType_nvc.IsNullable = false; BoxingType_nvc.Value = businessObject.BoxingType_nvc; this.Command.Parameters.Add(BoxingType_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 pk_BoxingID_int = new SqlParameter(); pk_BoxingID_int.ParameterName = "@pk_BoxingID_int"; pk_BoxingID_int.SqlDbType = SqlDbType.Int; pk_BoxingID_int.Direction = ParameterDirection.Input; pk_BoxingID_int.IsNullable = false; pk_BoxingID_int.Value = businessObjectKey.BoxingID_int; this.Command.Parameters.Add(pk_BoxingID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public BoxingEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.BoxingBLL.BLLBoxing_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }