public HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_T SelectByPrimaryKey(HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_SensorsStatus_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter sensorsStatusID_int = new SqlParameter(); sensorsStatusID_int.ParameterName = "@sensorsStatusID_int"; sensorsStatusID_int.SqlDbType = SqlDbType.Int; sensorsStatusID_int.Direction = ParameterDirection.Input; sensorsStatusID_int.IsNullable = false; sensorsStatusID_int.Value = businessObjectKey.sensorsStatusID_int; this.Command.Parameters.Add(sensorsStatusID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_T businessObject = new HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_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.BLLSensorsStatus.BLLSensorsStatus_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.BLLSensorsStatus.BLLSensorsStatus_T GetBy(HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_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_SensorsStatus_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter sensorsStatusID_int = new SqlParameter(); sensorsStatusID_int.ParameterName = "@sensorsStatusID_int"; sensorsStatusID_int.SqlDbType = SqlDbType.Int; sensorsStatusID_int.Direction = ParameterDirection.Input; sensorsStatusID_int.IsNullable = false; sensorsStatusID_int.Value = businessObjectKey.sensorsStatusID_int; this.Command.Parameters.Add(sensorsStatusID_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.BLLSensorsStatus.BLLSensorsStatus_T businessObject, HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_TKeys businessObjectKey) { try { List <string> ExceptList = new List <string>(); if (businessObject.sensorsStatusID_int == businessObjectKey.sensorsStatusID_int) { ExceptList.Add("UniquesensorsStatusID_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.BLLSensorsStatus.BLLSensorsStatus_T businessObject, HPS.BLL.BLLSensorsStatus.BLLSensorsStatus_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_SensorsStatus_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter inSensor_bit = new SqlParameter(); inSensor_bit.ParameterName = "@inSensor_bit"; inSensor_bit.SqlDbType = SqlDbType.Bit; inSensor_bit.Direction = ParameterDirection.Input; inSensor_bit.IsNullable = false; if (businessObject.inSensor_bit.HasValue == false) { inSensor_bit.Value = DBNull.Value; } else { inSensor_bit.Value = businessObject.inSensor_bit; } this.Command.Parameters.Add(inSensor_bit); SqlParameter inGateSensor_bit = new SqlParameter(); inGateSensor_bit.ParameterName = "@inGateSensor_bit"; inGateSensor_bit.SqlDbType = SqlDbType.Bit; inGateSensor_bit.Direction = ParameterDirection.Input; inGateSensor_bit.IsNullable = true; if (businessObject.inGateSensor_bit.HasValue == false) { inGateSensor_bit.Value = DBNull.Value; } else { inGateSensor_bit.Value = businessObject.inGateSensor_bit; } this.Command.Parameters.Add(inGateSensor_bit); SqlParameter outSensor_bit = new SqlParameter(); outSensor_bit.ParameterName = "@outSensor_bit"; outSensor_bit.SqlDbType = SqlDbType.Bit; outSensor_bit.Direction = ParameterDirection.Input; outSensor_bit.IsNullable = true; if (businessObject.outSensor_bit.HasValue == false) { outSensor_bit.Value = DBNull.Value; } else { outSensor_bit.Value = businessObject.outSensor_bit; } this.Command.Parameters.Add(outSensor_bit); SqlParameter outGateSensor_bit = new SqlParameter(); outGateSensor_bit.ParameterName = "@outGateSensor_bit"; outGateSensor_bit.SqlDbType = SqlDbType.Bit; outGateSensor_bit.Direction = ParameterDirection.Input; outGateSensor_bit.IsNullable = true; if (businessObject.outGateSensor_bit.HasValue == false) { outGateSensor_bit.Value = DBNull.Value; } else { outGateSensor_bit.Value = businessObject.outGateSensor_bit; } this.Command.Parameters.Add(outGateSensor_bit); SqlParameter pk_sensorsStatusID_int = new SqlParameter(); pk_sensorsStatusID_int.ParameterName = "@pk_sensorsStatusID_int"; pk_sensorsStatusID_int.SqlDbType = SqlDbType.Int; pk_sensorsStatusID_int.Direction = ParameterDirection.Input; pk_sensorsStatusID_int.IsNullable = false; pk_sensorsStatusID_int.Value = businessObjectKey.sensorsStatusID_int; this.Command.Parameters.Add(pk_sensorsStatusID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }