public HPS.BLL.BLLYear_T SelectByPrimaryKey(HPS.BLL.BLLYear_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Year_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter YearID_int = new SqlParameter(); YearID_int.ParameterName = "@YearID_int"; YearID_int.SqlDbType = SqlDbType.Int; YearID_int.Direction = ParameterDirection.Input; YearID_int.IsNullable = false; YearID_int.Value = businessObjectKey.YearID_int; this.Command.Parameters.Add(YearID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.BLLYear_T businessObject = new HPS.BLL.BLLYear_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.BLLYear_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.BLLYear_T GetBy(HPS.BLL.BLLYear_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.BLLYear_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.BLLYear_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_Year_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter YearID_int = new SqlParameter(); YearID_int.ParameterName = "@YearID_int"; YearID_int.SqlDbType = SqlDbType.Int; YearID_int.Direction = ParameterDirection.Input; YearID_int.IsNullable = false; YearID_int.Value = businessObjectKey.YearID_int; this.Command.Parameters.Add(YearID_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.BLLYear_T businessObject, HPS.BLL.BLLYear_TKeys businessObjectKey) { try { List <string> ExceptList = new List <string>(); if (businessObject.YearID_int == businessObjectKey.YearID_int) { ExceptList.Add("UniqueYearID_int"); } if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.ToArray()) == 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.BLLYear_T businessObject, HPS.BLL.BLLYear_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Year_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter Year_nvc = new SqlParameter(); Year_nvc.ParameterName = "@Year_nvc"; Year_nvc.SqlDbType = SqlDbType.NVarChar; Year_nvc.Direction = ParameterDirection.Input; Year_nvc.IsNullable = false; Year_nvc.Value = businessObject.Year_nvc; this.Command.Parameters.Add(Year_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; 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; EndDate_nvc.Value = businessObject.EndDate_nvc; this.Command.Parameters.Add(EndDate_nvc); SqlParameter Description_nvc = new SqlParameter(); Description_nvc.ParameterName = "@Description_nvc"; Description_nvc.SqlDbType = SqlDbType.NText; Description_nvc.Direction = ParameterDirection.Input; Description_nvc.IsNullable = false; if (String.IsNullOrEmpty(businessObject.Description_nvc)) { Description_nvc.Value = DBNull.Value; } else { Description_nvc.Value = businessObject.Description_nvc; } this.Command.Parameters.Add(Description_nvc); SqlParameter CurrencyID_int = new SqlParameter(); CurrencyID_int.ParameterName = "@CurrencyID_int"; CurrencyID_int.SqlDbType = SqlDbType.Int; CurrencyID_int.Direction = ParameterDirection.Input; CurrencyID_int.IsNullable = true; CurrencyID_int.Value = businessObject.CurrencyID_int; this.Command.Parameters.Add(CurrencyID_int); SqlParameter Default_bit = new SqlParameter(); Default_bit.ParameterName = "@Default_bit"; Default_bit.SqlDbType = SqlDbType.Bit; Default_bit.Direction = ParameterDirection.Input; Default_bit.IsNullable = false; Default_bit.Value = businessObject.Default_bit; this.Command.Parameters.Add(Default_bit); SqlParameter SourceYearID_int = new SqlParameter(); SourceYearID_int.ParameterName = "@SourceFiscalYearID_int"; SourceYearID_int.SqlDbType = SqlDbType.Int; SourceYearID_int.Direction = ParameterDirection.Input; SourceYearID_int.IsNullable = false; if (businessObject.SourceFiscalYearID_int.HasValue == false) { SourceYearID_int.Value = DBNull.Value; } else { SourceYearID_int.Value = businessObject.SourceFiscalYearID_int; } this.Command.Parameters.Add(SourceYearID_int); SqlParameter DataBase_nvc = new SqlParameter(); DataBase_nvc.ParameterName = "@DataBase_nvc"; DataBase_nvc.SqlDbType = SqlDbType.NVarChar; DataBase_nvc.Direction = ParameterDirection.Input; DataBase_nvc.IsNullable = true; if (String.IsNullOrEmpty(businessObject.DataBase_nvc)) { DataBase_nvc.Value = DBNull.Value; } else { DataBase_nvc.Value = businessObject.DataBase_nvc; } this.Command.Parameters.Add(DataBase_nvc); SqlParameter pk_YearID_int = new SqlParameter(); pk_YearID_int.ParameterName = "@pk_YearID_int"; pk_YearID_int.SqlDbType = SqlDbType.Int; pk_YearID_int.Direction = ParameterDirection.Input; pk_YearID_int.IsNullable = false; pk_YearID_int.Value = businessObjectKey.YearID_int; this.Command.Parameters.Add(pk_YearID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }