public HPS.BLL.BLLInOut_T SelectByPrimaryKey(HPS.BLL.BLLInOut_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_InOut_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter inOutID_bint = new SqlParameter(); inOutID_bint.ParameterName = "@inOutID_bint"; inOutID_bint.SqlDbType = SqlDbType.BigInt; inOutID_bint.Direction = ParameterDirection.Input; inOutID_bint.IsNullable = false; inOutID_bint.Value = businessObjectKey.inOutID_bint; this.Command.Parameters.Add(inOutID_bint); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.BLLInOut_T businessObject = new HPS.BLL.BLLInOut_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 Insert(HPS.BLL.BLLInOut_T businessObject) { try { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueinOutID_bint") == 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); } }
public void PopulateBusinessObjectFromReader(HPS.BLL.BLLInOut_T businessObject, IDataReader dataReader) { try { businessObject.inOutID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.BLLInOut_T.InOut_TField.inOutID_bint.ToString())); businessObject.cameraPicturesID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.BLLInOut_T.InOut_TField.cameraPicturesID_bint.ToString())); businessObject.date_vc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLInOut_T.InOut_TField.date_vc.ToString())); businessObject.time_vc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLInOut_T.InOut_TField.time_vc.ToString())); businessObject.gate_tint = dataReader.GetByte(dataReader.GetOrdinal(HPS.BLL.BLLInOut_T.InOut_TField.gate_tint.ToString())); } catch (System.Exception ex) { dataReader.Close(); throw ex; } }
public List <HPS.BLL.BLLInOut_T> PopulateObjectsFromReader(IDataReader dataReader) { try { List <HPS.BLL.BLLInOut_T> list = new List <HPS.BLL.BLLInOut_T>(); while (dataReader.Read()) { HPS.BLL.BLLInOut_T businessObject = new HPS.BLL.BLLInOut_T(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); } catch (System.Exception ex) { dataReader.Close(); throw ex; } }
public void Update(HPS.BLL.BLLInOut_T businessObject, HPS.BLL.BLLInOut_TKeys businessObjectKey) { try { List <string> ExceptList = new List <string>(); if (businessObject.inOutID_bint == businessObjectKey.inOutID_bint) { ExceptList.Add("UniqueinOutID_bint"); } 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.BLLInOut_T businessObject, HPS.BLL.BLLInOut_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_InOut_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter cameraPicturesID_bint = new SqlParameter(); cameraPicturesID_bint.ParameterName = "@cameraPicturesID_bint"; cameraPicturesID_bint.SqlDbType = SqlDbType.BigInt; cameraPicturesID_bint.Direction = ParameterDirection.Input; cameraPicturesID_bint.IsNullable = false; cameraPicturesID_bint.Value = businessObject.cameraPicturesID_bint; this.Command.Parameters.Add(cameraPicturesID_bint); SqlParameter date_vc = new SqlParameter(); date_vc.ParameterName = "@date_vc"; date_vc.SqlDbType = SqlDbType.VarChar; date_vc.Direction = ParameterDirection.Input; date_vc.IsNullable = false; date_vc.Value = businessObject.date_vc; this.Command.Parameters.Add(date_vc); SqlParameter time_vc = new SqlParameter(); time_vc.ParameterName = "@time_vc"; time_vc.SqlDbType = SqlDbType.VarChar; time_vc.Direction = ParameterDirection.Input; time_vc.IsNullable = false; time_vc.Value = businessObject.time_vc; this.Command.Parameters.Add(time_vc); SqlParameter gate_tint = new SqlParameter(); gate_tint.ParameterName = "@gate_tint"; gate_tint.SqlDbType = SqlDbType.TinyInt; gate_tint.Direction = ParameterDirection.Input; gate_tint.IsNullable = false; gate_tint.Value = businessObject.gate_tint; this.Command.Parameters.Add(gate_tint); SqlParameter pk_inOutID_bint = new SqlParameter(); pk_inOutID_bint.ParameterName = "@pk_inOutID_bint"; pk_inOutID_bint.SqlDbType = SqlDbType.BigInt; pk_inOutID_bint.Direction = ParameterDirection.Input; pk_inOutID_bint.IsNullable = false; pk_inOutID_bint.Value = businessObjectKey.inOutID_bint; this.Command.Parameters.Add(pk_inOutID_bint); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }