private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory CarSystemFactory = new HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory CarSystem_TFactory = new HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory(); HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys CarSystemKey = new HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys(); CarSystemKey.CarSystemID_int = (Int32)CarSystemGridView.CurrentRow.Cells["colCarSystemID_int"].Value; CarSystemFactory.Delete(CarSystemKey); DataRow[] dr = ((DataTable)this.CarSystemGridView.DataSource).Select(HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystemID_int.ToString() + "='" + CarSystemKey.CarSystemID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.CarSystemGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public HPS.BLL.CarSystemBLL.BLLCarSystem_T GetBy(HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys keys) { try{ return(_dataObject.SelectByPrimaryKey(keys)); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys CarSystemKey = new HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys(); CarSystemKey.CarSystemID_int = (Int32)this.CarSystemGridView.CurrentRow.Cells["colCarSystemID_int"].Value; CarSystemEntityForm CarSystem = new CarSystemEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.CarSystemGridView.DataSource, CarSystemKey); CarSystem.ShowDialog(); }
public void GetBy(HPS.BLL.CarSystemBLL.BLLCarSystem_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 void Delete(HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys keys) { try{ _dataObject.Delete(keys); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Update(HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject, HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_CarSystem_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter CarSystem_nvc = new SqlParameter(); CarSystem_nvc.ParameterName = "@CarSystem_nvc"; CarSystem_nvc.SqlDbType = SqlDbType.NVarChar; CarSystem_nvc.Direction = ParameterDirection.Input; CarSystem_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.CarSystem_nvc)) { CarSystem_nvc.Value = DBNull.Value; } else { CarSystem_nvc.Value = businessObject.CarSystem_nvc; } this.Command.Parameters.Add(CarSystem_nvc); SqlParameter pk_CarSystemID_int = new SqlParameter(); pk_CarSystemID_int.ParameterName = "@pk_CarSystemID_int"; pk_CarSystemID_int.SqlDbType = SqlDbType.Int; pk_CarSystemID_int.Direction = ParameterDirection.Input; pk_CarSystemID_int.IsNullable = false; pk_CarSystemID_int.Value = businessObjectKey.CarSystemID_int; this.Command.Parameters.Add(pk_CarSystemID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public HPS.BLL.CarSystemBLL.BLLCarSystem_T SelectByPrimaryKey(HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_CarSystem_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter CarSystemID_int = new SqlParameter(); CarSystemID_int.ParameterName = "@CarSystemID_int"; CarSystemID_int.SqlDbType = SqlDbType.Int; CarSystemID_int.Direction = ParameterDirection.Input; CarSystemID_int.IsNullable = false; CarSystemID_int.Value = businessObjectKey.CarSystemID_int; this.Command.Parameters.Add(CarSystemID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject = new HPS.BLL.CarSystemBLL.BLLCarSystem_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.CarSystemBLL.BLLCarSystem_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_CarSystem_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter CarSystemID_int = new SqlParameter(); CarSystemID_int.ParameterName = "@CarSystemID_int"; CarSystemID_int.SqlDbType = SqlDbType.Int; CarSystemID_int.Direction = ParameterDirection.Input; CarSystemID_int.IsNullable = false; CarSystemID_int.Value = businessObjectKey.CarSystemID_int; this.Command.Parameters.Add(CarSystemID_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.CarSystemBLL.BLLCarSystem_T businessObject, HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys businessObjectKey) { try{ if (businessObject.CarSystemID_int == businessObjectKey.CarSystemID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueCarSystemID_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 CarSystemEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }