private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddress_TFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys DestinationAddressKey = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys(); DestinationAddressKey.DestinationAddressID_int = (Int32)DestinationAddressGridView.CurrentRow.Cells["colDestinationAddressID_int"].Value; DestinationAddressFactory.Delete(DestinationAddressKey); DataRow[] dr = ((DataTable)this.DestinationAddressGridView.DataSource).Select(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddressID_int.ToString() + "='" + DestinationAddressKey.DestinationAddressID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.DestinationAddressGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public void GetBy(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_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.DestinationAddressBLL.BLLDestinationAddress_T GetBy(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys keys) { try{ return(_dataObject.SelectByPrimaryKey(keys)); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_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.DestinationAddressBLL.BLLDestinationAddress_TKeys DestinationAddressKey = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys(); DestinationAddressKey.DestinationAddressID_int = (Int32)this.DestinationAddressGridView.CurrentRow.Cells["colDestinationAddressID_int"].Value; DestinationAddressEntityForm DestinationAddress = new DestinationAddressEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.DestinationAddressGridView.DataSource, DestinationAddressKey); DestinationAddress.ShowDialog(); }
public void SelectByPrimaryKey(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_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_DestinationAddress_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter DestinationAddressID_int = new SqlParameter(); DestinationAddressID_int.ParameterName = "@DestinationAddressID_int"; DestinationAddressID_int.SqlDbType = SqlDbType.Int; DestinationAddressID_int.Direction = ParameterDirection.Input; DestinationAddressID_int.IsNullable = false; DestinationAddressID_int.Value = businessObjectKey.DestinationAddressID_int; this.Command.Parameters.Add(DestinationAddressID_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.DestinationAddressBLL.BLLDestinationAddress_T businessObject, HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys businessObjectKey) { try{ if (businessObject.DestinationAddressID_int == businessObjectKey.DestinationAddressID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueDestinationAddressID_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.DestinationAddressBLL.BLLDestinationAddress_T businessObject, HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_DestinationAddress_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter DestinationAddress_nvc = new SqlParameter(); DestinationAddress_nvc.ParameterName = "@DestinationAddress_nvc"; DestinationAddress_nvc.SqlDbType = SqlDbType.NVarChar; DestinationAddress_nvc.Direction = ParameterDirection.Input; DestinationAddress_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.DestinationAddress_nvc)) { DestinationAddress_nvc.Value = DBNull.Value; } else { DestinationAddress_nvc.Value = businessObject.DestinationAddress_nvc; } this.Command.Parameters.Add(DestinationAddress_nvc); SqlParameter pk_DestinationAddressID_int = new SqlParameter(); pk_DestinationAddressID_int.ParameterName = "@pk_DestinationAddressID_int"; pk_DestinationAddressID_int.SqlDbType = SqlDbType.Int; pk_DestinationAddressID_int.Direction = ParameterDirection.Input; pk_DestinationAddressID_int.IsNullable = false; pk_DestinationAddressID_int.Value = businessObjectKey.DestinationAddressID_int; this.Command.Parameters.Add(pk_DestinationAddressID_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.DestinationAddressBLL.BLLDestinationAddress_T SelectByPrimaryKey(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_DestinationAddress_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter DestinationAddressID_int = new SqlParameter(); DestinationAddressID_int.ParameterName = "@DestinationAddressID_int"; DestinationAddressID_int.SqlDbType = SqlDbType.Int; DestinationAddressID_int.Direction = ParameterDirection.Input; DestinationAddressID_int.IsNullable = false; DestinationAddressID_int.Value = businessObjectKey.DestinationAddressID_int; this.Command.Parameters.Add(DestinationAddressID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T businessObject = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_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 DestinationAddressEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }