private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory MessageRecipientFactory = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory MessageRecipient_TFactory = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory(); HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys MessageRecipientKey = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys(); MessageRecipientKey.MessageRecipientID_int = (Int32?)MessageRecipientGridView.CurrentRow.Cells["colMessageRecipientID_int"].Value; MessageRecipientFactory.Delete(MessageRecipientKey); DataRow[] dr = ((DataTable)this.MessageRecipientGridView.DataSource).Select(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.MessageRecipientID_int.ToString() + "='" + MessageRecipientKey.MessageRecipientID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.MessageRecipientGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys MessageRecipientKey = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys(); MessageRecipientKey.MessageRecipientID_int = (Int32?)this.MessageRecipientGridView.CurrentRow.Cells["colMessageRecipientID_int"].Value; MessageRecipientEntityForm MessageRecipient = new MessageRecipientEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.MessageRecipientGridView.DataSource, MessageRecipientKey); MessageRecipient.ShowDialog(); }
public HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T SelectByPrimaryKey(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_MessageRecipient_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter MessageRecipientID_int = new SqlParameter(); MessageRecipientID_int.ParameterName = "@MessageRecipientID_int"; MessageRecipientID_int.SqlDbType = SqlDbType.Int; MessageRecipientID_int.Direction = ParameterDirection.Input; MessageRecipientID_int.IsNullable = false; MessageRecipientID_int.Value = businessObjectKey.MessageRecipientID_int; this.Command.Parameters.Add(MessageRecipientID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_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.MessageRecipientBLL.BLLMessageRecipient_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.MessageRecipientBLL.BLLMessageRecipient_T GetBy(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_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_MessageRecipient_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter MessageRecipientID_int = new SqlParameter(); MessageRecipientID_int.ParameterName = "@MessageRecipientID_int"; MessageRecipientID_int.SqlDbType = SqlDbType.Int; MessageRecipientID_int.Direction = ParameterDirection.Input; MessageRecipientID_int.IsNullable = false; MessageRecipientID_int.Value = businessObjectKey.MessageRecipientID_int; this.Command.Parameters.Add(MessageRecipientID_int); if (ControlConnection) { this.BeginTransaction(); } sqlDataAdapter.Fill(dataTable); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public MessageRecipientEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }
public void Update(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject, HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_MessageRecipient_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter MessageID_bint = new SqlParameter(); MessageID_bint.ParameterName = "@MessageID_bint"; MessageID_bint.SqlDbType = SqlDbType.BigInt; MessageID_bint.Direction = ParameterDirection.Input; MessageID_bint.IsNullable = false; MessageID_bint.Value = businessObject.MessageID_bint; this.Command.Parameters.Add(MessageID_bint); SqlParameter UserGroupID_int = new SqlParameter(); UserGroupID_int.ParameterName = "@UserGroupID_int"; UserGroupID_int.SqlDbType = SqlDbType.Int; UserGroupID_int.Direction = ParameterDirection.Input; UserGroupID_int.IsNullable = false; UserGroupID_int.Value = businessObject.UserGroupID_int; this.Command.Parameters.Add(UserGroupID_int); SqlParameter StartDate_nvc = new SqlParameter(); StartDate_nvc.ParameterName = "@StartDate_nvc"; StartDate_nvc.SqlDbType = SqlDbType.NVarChar; StartDate_nvc.Direction = ParameterDirection.Input; StartDate_nvc.IsNullable = false; StartDate_nvc.Value = businessObject.StartDate_nvc; this.Command.Parameters.Add(StartDate_nvc); SqlParameter EndDate_nvc = new SqlParameter(); EndDate_nvc.ParameterName = "@EndDate_nvc"; EndDate_nvc.SqlDbType = SqlDbType.NVarChar; EndDate_nvc.Direction = ParameterDirection.Input; EndDate_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.EndDate_nvc)) { EndDate_nvc.Value = DBNull.Value; } else { EndDate_nvc.Value = businessObject.EndDate_nvc; } this.Command.Parameters.Add(EndDate_nvc); SqlParameter Date_nvc = new SqlParameter(); Date_nvc.ParameterName = "@Date_nvc"; Date_nvc.SqlDbType = SqlDbType.NVarChar; Date_nvc.Direction = ParameterDirection.Input; Date_nvc.IsNullable = true; Date_nvc.Value = businessObject.Date_nvc; this.Command.Parameters.Add(Date_nvc); SqlParameter Time_nvc = new SqlParameter(); Time_nvc.ParameterName = "@Time_nvc"; Time_nvc.SqlDbType = SqlDbType.NVarChar; Time_nvc.Direction = ParameterDirection.Input; Time_nvc.IsNullable = false; Time_nvc.Value = businessObject.Time_nvc; this.Command.Parameters.Add(Time_nvc); SqlParameter UserName_nvc = new SqlParameter(); UserName_nvc.ParameterName = "@UserName_nvc"; UserName_nvc.SqlDbType = SqlDbType.NVarChar; UserName_nvc.Direction = ParameterDirection.Input; UserName_nvc.IsNullable = false; UserName_nvc.Value = businessObject.UserName_nvc; this.Command.Parameters.Add(UserName_nvc); SqlParameter pk_MessageRecipientID_int = new SqlParameter(); pk_MessageRecipientID_int.ParameterName = "@pk_MessageRecipientID_int"; pk_MessageRecipientID_int.SqlDbType = SqlDbType.Int; pk_MessageRecipientID_int.Direction = ParameterDirection.Input; pk_MessageRecipientID_int.IsNullable = false; pk_MessageRecipientID_int.Value = businessObjectKey.MessageRecipientID_int; this.Command.Parameters.Add(pk_MessageRecipientID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public void Update(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject, HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys businessObjectKey) { try { if (businessObject.MessageRecipientID_int == businessObjectKey.MessageRecipientID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueMessageRecipientID_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); } }