protected override void Edit() { HPS.BLL.LadeCommentBLL.BLLLadeComment_TFactory LadeCommentFactory = new HPS.BLL.LadeCommentBLL.BLLLadeComment_TFactory(); try { HPS.BLL.LadeCommentBLL.BLLLadeComment_T LadeCommentEntity = new HPS.BLL.LadeCommentBLL.BLLLadeComment_T(); LadeCommentEntity.LadeComment_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LadeComment_nvcTextBox.Text, TypeCode.String).ToString(); LadeCommentEntity.UserGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { LadeCommentFactory.BeginProc(); LadeCommentFactory.Update(LadeCommentEntity, (HPS.BLL.LadeCommentBLL.BLLLadeComment_TKeys)Key); LadeCommentFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.LadeCommentID_int.ToString() + "='" + ((HPS.BLL.LadeCommentBLL.BLLLadeComment_TKeys)Key).LadeCommentID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.LadeComment_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(LadeCommentEntity.LadeComment_nvc, TypeCode.String); dr[0]["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox); } DataTable.AcceptChanges(); } } } catch (Exception ex) { LadeCommentFactory.RollBackProc(); throw ex; } }
protected override void Insert() { HPS.BLL.LadeCommentBLL.BLLLadeComment_TFactory LadeCommentFactory = new HPS.BLL.LadeCommentBLL.BLLLadeComment_TFactory(); try { HPS.BLL.LadeCommentBLL.BLLLadeComment_T LadeCommentEntity = new HPS.BLL.LadeCommentBLL.BLLLadeComment_T(); LadeCommentEntity.LadeComment_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LadeComment_nvcTextBox.Text, TypeCode.String).ToString(); LadeCommentEntity.UserGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32); LadeCommentFactory.BeginProc(); LadeCommentFactory.Insert(LadeCommentEntity); LadeCommentFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.LadeCommentID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(LadeCommentEntity.LadeCommentID_int, TypeCode.Int32); dr[HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.LadeComment_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(LadeCommentEntity.LadeComment_nvc, TypeCode.String); dr[HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.UserGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(LadeCommentEntity.UserGroupID_int, TypeCode.Int32); dr["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { LadeCommentFactory.RollBackProc(); throw ex; } }
public HPS.BLL.LadeCommentBLL.BLLLadeComment_T SelectByPrimaryKey(HPS.BLL.LadeCommentBLL.BLLLadeComment_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_LadeComment_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter LadeCommentID_int = new SqlParameter(); LadeCommentID_int.ParameterName = "@LadeCommentID_int"; LadeCommentID_int.SqlDbType = SqlDbType.Int; LadeCommentID_int.Direction = ParameterDirection.Input; LadeCommentID_int.IsNullable = false; LadeCommentID_int.Value = businessObjectKey.LadeCommentID_int; this.Command.Parameters.Add(LadeCommentID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.LadeCommentBLL.BLLLadeComment_T businessObject = new HPS.BLL.LadeCommentBLL.BLLLadeComment_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 List <HPS.BLL.LadeCommentBLL.BLLLadeComment_T> PopulateObjectsFromReader(IDataReader dataReader) { List <HPS.BLL.LadeCommentBLL.BLLLadeComment_T> list = new List <HPS.BLL.LadeCommentBLL.BLLLadeComment_T>(); while (dataReader.Read()) { HPS.BLL.LadeCommentBLL.BLLLadeComment_T businessObject = new HPS.BLL.LadeCommentBLL.BLLLadeComment_T(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); }
protected override void ShowForm() { this.FillCombo(); HPS.BLL.LadeCommentBLL.BLLLadeComment_TFactory LadeCommentFactory = new HPS.BLL.LadeCommentBLL.BLLLadeComment_TFactory(); HPS.BLL.LadeCommentBLL.BLLLadeComment_T LadeCommentEntity = LadeCommentFactory.GetBy((HPS.BLL.LadeCommentBLL.BLLLadeComment_TKeys)Key); if (LadeCommentEntity == null) { throw new HPS.Exceptions.LadeCommentNotFound(); } LadeComment_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(LadeCommentEntity.LadeComment_nvc, TypeCode.String).ToString(); Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref UserGroupID_intComboBox, LadeCommentEntity.UserGroupID_int, TypeCode.Int32); }
public void PopulateBusinessObjectFromReader(HPS.BLL.LadeCommentBLL.BLLLadeComment_T businessObject, IDataReader dataReader) { businessObject.LadeCommentID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.LadeCommentID_int.ToString())); businessObject.LadeComment_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.LadeComment_nvc.ToString())); if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.UserGroupID_int.ToString())) == false) { businessObject.UserGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.LadeCommentBLL.BLLLadeComment_T.LadeComment_TField.UserGroupID_int.ToString())); } else { businessObject.UserGroupID_int = null; } }
public void Insert(HPS.BLL.LadeCommentBLL.BLLLadeComment_T businessObject) { try { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "LadeCommentID_int") == false) { throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString()); } _dataObject.Insert(businessObject); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
private void SearchButton_Click(object sender, EventArgs e) { try { LadeCommentList.Clear(); foreach (Janus.Windows.GridEX.GridEXRow item in LadeCommentGridView.GetCheckedRows()) { HPS.BLL.LadeCommentBLL.BLLLadeComment_T LadeCommentEntity = new HPS.BLL.LadeCommentBLL.BLLLadeComment_T(); LadeCommentEntity.LadeCommentID_int = Convert.ToInt32(item.Cells["LadeCommentID_int"].Value); LadeCommentEntity.LadeComment_nvc = Convert.ToString(item.Cells["LadeComment_nvc"].Value); LadeCommentList.Add(LadeCommentEntity); } this.Close(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public void Update(HPS.BLL.LadeCommentBLL.BLLLadeComment_T businessObject, HPS.BLL.LadeCommentBLL.BLLLadeComment_TKeys businessObjectKey) { try { HPS.BLL.LadeCommentBLL.BLLLadeComment_T tmpBill = this.GetBy(businessObjectKey); List <string> Except = new List <string>(); if (businessObject.LadeCommentID_int == businessObjectKey.LadeCommentID_int) { Except.Add("UniqueLadeCommentID_int"); } if (businessObject.LadeComment_nvc == tmpBill.LadeComment_nvc) { Except.Add("UniqueLadeComment_nvc"); } if (Except.Count > 0) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, Except.ToArray()) == 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.LadeCommentBLL.BLLLadeComment_T businessObject, HPS.BLL.LadeCommentBLL.BLLLadeComment_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_LadeComment_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter LadeComment_nvc = new SqlParameter(); LadeComment_nvc.ParameterName = "@LadeComment_nvc"; LadeComment_nvc.SqlDbType = SqlDbType.NVarChar; LadeComment_nvc.Direction = ParameterDirection.Input; LadeComment_nvc.IsNullable = false; LadeComment_nvc.Value = businessObject.LadeComment_nvc; this.Command.Parameters.Add(LadeComment_nvc); SqlParameter UserGroupID_int = new SqlParameter(); UserGroupID_int.ParameterName = "@UserGroupID_int"; UserGroupID_int.SqlDbType = SqlDbType.Int; UserGroupID_int.Direction = ParameterDirection.Input; UserGroupID_int.IsNullable = false; if (businessObject.UserGroupID_int.HasValue == false) { UserGroupID_int.Value = DBNull.Value; } else { UserGroupID_int.Value = businessObject.UserGroupID_int; } this.Command.Parameters.Add(UserGroupID_int); SqlParameter pk_LadeCommentID_int = new SqlParameter(); pk_LadeCommentID_int.ParameterName = "@pk_LadeCommentID_int"; pk_LadeCommentID_int.SqlDbType = SqlDbType.Int; pk_LadeCommentID_int.Direction = ParameterDirection.Input; pk_LadeCommentID_int.IsNullable = false; pk_LadeCommentID_int.Value = businessObjectKey.LadeCommentID_int; this.Command.Parameters.Add(pk_LadeCommentID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }