public void Update(HPS.BLL.MessageBLL.BLLMessage_T businessObject, HPS.BLL.MessageBLL.BLLMessage_TKeys businessObjectKey) { try { if (businessObject.MessageID_bint == businessObjectKey.MessageID_bint) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueMessageID_bint") == 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.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.MessageBLL.BLLMessage_TFactory Message_TFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory(); HPS.BLL.MessageBLL.BLLMessage_TKeys MessageKey = new HPS.BLL.MessageBLL.BLLMessage_TKeys(); MessageKey.MessageID_bint = (Int64?)MessageGridView.CurrentRow.Cells["colMessageID_bint"].Value; MessageFactory.Delete(MessageKey); DataRow[] dr = ((DataTable)this.MessageGridView.DataSource).Select(HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString() + "='" + MessageKey.MessageID_bint.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.MessageGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.MessageBLL.BLLMessage_TKeys MessageKey = new HPS.BLL.MessageBLL.BLLMessage_TKeys(); MessageKey.MessageID_bint = (Int64?)this.MessageGridView.CurrentRow.Cells["colMessageID_bint"].Value; MessageEntityForm Message = new MessageEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.MessageGridView.DataSource, MessageKey); Message.ShowDialog(); }
public HPS.BLL.MessageBLL.BLLMessage_T SelectByPrimaryKey(HPS.BLL.MessageBLL.BLLMessage_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Message_T_SelectByPrimaryKey]"; 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 = businessObjectKey.MessageID_bint; this.Command.Parameters.Add(MessageID_bint); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.MessageBLL.BLLMessage_T businessObject = new HPS.BLL.MessageBLL.BLLMessage_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.MessageBLL.BLLMessage_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.MessageBLL.BLLMessage_T GetBy(HPS.BLL.MessageBLL.BLLMessage_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.MessageBLL.BLLMessage_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.MessageBLL.BLLMessage_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_Message_T_SelectByPrimaryKey]"; 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 = businessObjectKey.MessageID_bint; this.Command.Parameters.Add(MessageID_bint); if (ControlConnection) { this.BeginTransaction(); } sqlDataAdapter.Fill(dataTable); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public MessageEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.MessageBLL.BLLMessage_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }
public void Update(HPS.BLL.MessageBLL.BLLMessage_T businessObject, HPS.BLL.MessageBLL.BLLMessage_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Message_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter MessageTitle_nvc = new SqlParameter(); MessageTitle_nvc.ParameterName = "@MessageTitle_nvc"; MessageTitle_nvc.SqlDbType = SqlDbType.NVarChar; MessageTitle_nvc.Direction = ParameterDirection.Input; MessageTitle_nvc.IsNullable = false; MessageTitle_nvc.Value = businessObject.MessageTitle_nvc; this.Command.Parameters.Add(MessageTitle_nvc); SqlParameter Message_nvc = new SqlParameter(); Message_nvc.ParameterName = "@Message_nvc"; Message_nvc.SqlDbType = SqlDbType.NVarChar; Message_nvc.Direction = ParameterDirection.Input; Message_nvc.IsNullable = false; Message_nvc.Value = businessObject.Message_nvc; this.Command.Parameters.Add(Message_nvc); SqlParameter StartDate_nvc = new SqlParameter(); StartDate_nvc.ParameterName = "@StartDate_nvc"; StartDate_nvc.SqlDbType = SqlDbType.NVarChar; StartDate_nvc.Direction = ParameterDirection.Input; StartDate_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.StartDate_nvc)) { StartDate_nvc.Value = DBNull.Value; } else { 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 = true; 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 Visited_bit = new SqlParameter(); Visited_bit.ParameterName = "@Visited_bit"; Visited_bit.SqlDbType = SqlDbType.Bit; Visited_bit.Direction = ParameterDirection.Input; Visited_bit.IsNullable = true; Visited_bit.Value = businessObject.Visited_bit; this.Command.Parameters.Add(Visited_bit); SqlParameter RecipientUserName_nvc = new SqlParameter(); RecipientUserName_nvc.ParameterName = "@RecipientUserName_nvc"; RecipientUserName_nvc.SqlDbType = SqlDbType.NVarChar; RecipientUserName_nvc.Direction = ParameterDirection.Input; RecipientUserName_nvc.IsNullable = false; if (string.IsNullOrEmpty(businessObject.RecipientUserName_nvc)) { RecipientUserName_nvc.Value = DBNull.Value; } else { RecipientUserName_nvc.Value = businessObject.RecipientUserName_nvc; } this.Command.Parameters.Add(RecipientUserName_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_MessageID_bint = new SqlParameter(); pk_MessageID_bint.ParameterName = "@pk_MessageID_bint"; pk_MessageID_bint.SqlDbType = SqlDbType.BigInt; pk_MessageID_bint.Direction = ParameterDirection.Input; pk_MessageID_bint.IsNullable = false; pk_MessageID_bint.Value = businessObjectKey.MessageID_bint; this.Command.Parameters.Add(pk_MessageID_bint); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }