public void Update(HPS.BLL.GoodBLL.BLLGood_T businessObject, HPS.BLL.GoodBLL.BLLGood_TKeys businessObjectKey) { try { if (businessObject.GoodID_int == businessObjectKey.GoodID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueGoodID_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.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.GoodBLL.BLLGood_TFactory Good_TFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); HPS.BLL.GoodBLL.BLLGood_TKeys GoodKey = new HPS.BLL.GoodBLL.BLLGood_TKeys(); GoodKey.GoodID_int = (Int32?)GoodGridView.CurrentRow.Cells["colGoodID_int"].Value; GoodFactory.Delete(GoodKey); DataRow[] dr = ((DataTable)this.GoodGridView.DataSource).Select(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString() + "='" + GoodKey.GoodID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.GoodGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.GoodBLL.BLLGood_TKeys GoodKey = new HPS.BLL.GoodBLL.BLLGood_TKeys(); GoodKey.GoodID_int = (Int32?)this.GoodGridView.CurrentRow.Cells["colGoodID_int"].Value; GoodEntityForm Good = new GoodEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.GoodGridView.DataSource, GoodKey); Good.ShowDialog(); }
public HPS.BLL.GoodBLL.BLLGood_T SelectByPrimaryKey(HPS.BLL.GoodBLL.BLLGood_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Good_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter GoodID_int = new SqlParameter(); GoodID_int.ParameterName = "@GoodID_int"; GoodID_int.SqlDbType = SqlDbType.Int; GoodID_int.Direction = ParameterDirection.Input; GoodID_int.IsNullable = false; GoodID_int.Value = businessObjectKey.GoodID_int; this.Command.Parameters.Add(GoodID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.GoodBLL.BLLGood_T businessObject = new HPS.BLL.GoodBLL.BLLGood_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.GoodBLL.BLLGood_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.GoodBLL.BLLGood_T GetBy(HPS.BLL.GoodBLL.BLLGood_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.GoodBLL.BLLGood_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 (GoodGridView.CurrentRow != null) { HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); HPS.BLL.GoodBLL.BLLGood_TKeys GoodKey = new HPS.BLL.GoodBLL.BLLGood_TKeys(); GoodKey.GoodID_int = (Int32)GoodGridView.CurrentRow.Cells[colGoodID_int.Name].Value; GoodEntity = GoodFactory.GetBy(GoodKey); if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetEntityValue(GoodGridView.CurrentRow.Cells[colGoodID_int.Name].Value, TypeCode.String).ToString()) == false) { GoodEntity.Good_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodGridView.CurrentRow.Cells[colGood_nvc.Name].Value, TypeCode.String).ToString(); GoodEntity.GoodCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodGridView.CurrentRow.Cells[colGoodCode_nvc.Name].Value, TypeCode.String).ToString(); } } this.Close(); }
public void SelectByPrimaryKey(HPS.BLL.GoodBLL.BLLGood_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_Good_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter GoodID_int = new SqlParameter(); GoodID_int.ParameterName = "@GoodID_int"; GoodID_int.SqlDbType = SqlDbType.Int; GoodID_int.Direction = ParameterDirection.Input; GoodID_int.IsNullable = false; GoodID_int.Value = businessObjectKey.GoodID_int; this.Command.Parameters.Add(GoodID_int); if (ControlConnection) { this.BeginTransaction(); } sqlDataAdapter.Fill(dataTable); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public GoodEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.GoodBLL.BLLGood_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }
public void Update(HPS.BLL.GoodBLL.BLLGood_T businessObject, HPS.BLL.GoodBLL.BLLGood_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Good_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter GoodCode_nvc = new SqlParameter(); GoodCode_nvc.ParameterName = "@GoodCode_nvc"; GoodCode_nvc.SqlDbType = SqlDbType.NVarChar; GoodCode_nvc.Direction = ParameterDirection.Input; GoodCode_nvc.IsNullable = false; GoodCode_nvc.Value = businessObject.GoodCode_nvc; this.Command.Parameters.Add(GoodCode_nvc); SqlParameter Good_nvc = new SqlParameter(); Good_nvc.ParameterName = "@Good_nvc"; Good_nvc.SqlDbType = SqlDbType.NVarChar; Good_nvc.Direction = ParameterDirection.Input; Good_nvc.IsNullable = false; Good_nvc.Value = businessObject.Good_nvc; this.Command.Parameters.Add(Good_nvc); SqlParameter Avtive_bit = new SqlParameter(); Avtive_bit.ParameterName = "@Avtive_bit"; Avtive_bit.SqlDbType = SqlDbType.Bit; Avtive_bit.Direction = ParameterDirection.Input; Avtive_bit.IsNullable = false; Avtive_bit.Value = businessObject.Avtive_bit; this.Command.Parameters.Add(Avtive_bit); SqlParameter pk_GoodID_int = new SqlParameter(); pk_GoodID_int.ParameterName = "@pk_GoodID_int"; pk_GoodID_int.SqlDbType = SqlDbType.Int; pk_GoodID_int.Direction = ParameterDirection.Input; pk_GoodID_int.IsNullable = false; pk_GoodID_int.Value = businessObjectKey.GoodID_int; this.Command.Parameters.Add(pk_GoodID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }