private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.ColorBLL.BLLColor_TFactory Color_TFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); HPS.BLL.ColorBLL.BLLColor_TKeys ColorKey = new HPS.BLL.ColorBLL.BLLColor_TKeys(); ColorKey.ColorID_int = (Int32)ColorGridView.CurrentRow.Cells["colColorID_int"].Value; ColorFactory.Delete(ColorKey); DataRow[] dr = ((DataTable)this.ColorGridView.DataSource).Select(HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorID_int.ToString() + "='" + ColorKey.ColorID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.ColorGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public void GetBy(HPS.BLL.ColorBLL.BLLColor_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.ColorBLL.BLLColor_T GetBy(HPS.BLL.ColorBLL.BLLColor_TKeys keys) { try{ return(_dataObject.SelectByPrimaryKey(keys)); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.ColorBLL.BLLColor_TKeys keys) { try{ _dataObject.Delete(keys); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.ColorBLL.BLLColor_TKeys ColorKey = new HPS.BLL.ColorBLL.BLLColor_TKeys(); ColorKey.ColorID_int = (Int32)this.ColorGridView.CurrentRow.Cells["colColorID_int"].Value; ColorEntityForm Color = new ColorEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.ColorGridView.DataSource, ColorKey); Color.ShowDialog(); }
public HPS.BLL.ColorBLL.BLLColor_T SelectByPrimaryKey(HPS.BLL.ColorBLL.BLLColor_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Color_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter ColorID_int = new SqlParameter(); ColorID_int.ParameterName = "@ColorID_int"; ColorID_int.SqlDbType = SqlDbType.Int; ColorID_int.Direction = ParameterDirection.Input; ColorID_int.IsNullable = false; ColorID_int.Value = businessObjectKey.ColorID_int; this.Command.Parameters.Add(ColorID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.ColorBLL.BLLColor_T businessObject = new HPS.BLL.ColorBLL.BLLColor_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.ColorBLL.BLLColor_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_Color_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter ColorID_int = new SqlParameter(); ColorID_int.ParameterName = "@ColorID_int"; ColorID_int.SqlDbType = SqlDbType.Int; ColorID_int.Direction = ParameterDirection.Input; ColorID_int.IsNullable = false; ColorID_int.Value = businessObjectKey.ColorID_int; this.Command.Parameters.Add(ColorID_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.ColorBLL.BLLColor_T businessObject, HPS.BLL.ColorBLL.BLLColor_TKeys businessObjectKey) { try{ if (businessObject.ColorID_int == businessObjectKey.ColorID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueColorID_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); } }
public void Update(HPS.BLL.ColorBLL.BLLColor_T businessObject, HPS.BLL.ColorBLL.BLLColor_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Color_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter Color_nvc = new SqlParameter(); Color_nvc.ParameterName = "@Color_nvc"; Color_nvc.SqlDbType = SqlDbType.NVarChar; Color_nvc.Direction = ParameterDirection.Input; Color_nvc.IsNullable = false; Color_nvc.Value = businessObject.Color_nvc; this.Command.Parameters.Add(Color_nvc); SqlParameter ColorCode_nvc = new SqlParameter(); ColorCode_nvc.ParameterName = "@ColorCode_nvc"; ColorCode_nvc.SqlDbType = SqlDbType.NVarChar; ColorCode_nvc.Direction = ParameterDirection.Input; ColorCode_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.ColorCode_nvc)) { ColorCode_nvc.Value = DBNull.Value; } else { ColorCode_nvc.Value = businessObject.ColorCode_nvc; } this.Command.Parameters.Add(ColorCode_nvc); SqlParameter pk_ColorID_int = new SqlParameter(); pk_ColorID_int.ParameterName = "@pk_ColorID_int"; pk_ColorID_int.SqlDbType = SqlDbType.Int; pk_ColorID_int.Direction = ParameterDirection.Input; pk_ColorID_int.IsNullable = false; pk_ColorID_int.Value = businessObjectKey.ColorID_int; this.Command.Parameters.Add(pk_ColorID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public ColorEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.ColorBLL.BLLColor_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }