public void Update(HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T businessObject, HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_LadBillCreditCancelComment_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter LadBillCreditID_int = new SqlParameter(); LadBillCreditID_int.ParameterName = "@LadBillCreditID_int"; LadBillCreditID_int.SqlDbType = SqlDbType.Int; LadBillCreditID_int.Direction = ParameterDirection.Input; LadBillCreditID_int.IsNullable = false; LadBillCreditID_int.Value = businessObject.LadBillCreditID_int; this.Command.Parameters.Add(LadBillCreditID_int); SqlParameter LadBillCancelCommentID_int = new SqlParameter(); LadBillCancelCommentID_int.ParameterName = "@LadBillCancelCommentID_int"; LadBillCancelCommentID_int.SqlDbType = SqlDbType.Int; LadBillCancelCommentID_int.Direction = ParameterDirection.Input; LadBillCancelCommentID_int.IsNullable = false; LadBillCancelCommentID_int.Value = businessObject.LadBillCancelCommentID_int; this.Command.Parameters.Add(LadBillCancelCommentID_int); SqlParameter LadbillCancelComment_nvc = new SqlParameter(); LadbillCancelComment_nvc.ParameterName = "@LadbillCancelComment_nvc"; LadbillCancelComment_nvc.SqlDbType = SqlDbType.NVarChar; LadbillCancelComment_nvc.Direction = ParameterDirection.Input; LadbillCancelComment_nvc.IsNullable = false; LadbillCancelComment_nvc.Value = businessObject.LadbillCancelComment_nvc; this.Command.Parameters.Add(LadbillCancelComment_nvc); SqlParameter pk_LadBillCreditCancelCommentID_int = new SqlParameter(); pk_LadBillCreditCancelCommentID_int.ParameterName = "@pk_LadBillCreditCancelCommentID_int"; pk_LadBillCreditCancelCommentID_int.SqlDbType = SqlDbType.Int; pk_LadBillCreditCancelCommentID_int.Direction = ParameterDirection.Input; pk_LadBillCreditCancelCommentID_int.IsNullable = false; pk_LadBillCreditCancelCommentID_int.Value = businessObjectKey.LadBillCreditCancelCommentID_int; this.Command.Parameters.Add(pk_LadBillCreditCancelCommentID_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.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T businessObject, HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TKeys businessObjectKey) { try { if (businessObject.LadBillCreditCancelCommentID_int == businessObjectKey.LadBillCreditCancelCommentID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueLadBillCreditCancelCommentID_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 HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T SelectByPrimaryKey(HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_LadBillCreditCancelComment_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter LadBillCreditCancelCommentID_int = new SqlParameter(); LadBillCreditCancelCommentID_int.ParameterName = "@LadBillCreditCancelCommentID_int"; LadBillCreditCancelCommentID_int.SqlDbType = SqlDbType.Int; LadBillCreditCancelCommentID_int.Direction = ParameterDirection.Input; LadBillCreditCancelCommentID_int.IsNullable = false; LadBillCreditCancelCommentID_int.Value = businessObjectKey.LadBillCreditCancelCommentID_int; this.Command.Parameters.Add(LadBillCreditCancelCommentID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T businessObject = new HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_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; } }