public HPS.BLL.BLLPlateNumber_T SelectByPrimaryKey(HPS.BLL.BLLPlateNumber_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_PlateNumber_T_SelectByPrimaryKey]"; 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 = businessObjectKey.cameraPicturesID_bint; this.Command.Parameters.Add(cameraPicturesID_bint); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.BLLPlateNumber_T businessObject = new HPS.BLL.BLLPlateNumber_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.BLLPlateNumber_T businessObject) { try { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniquecameraPicturesID_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.BLLPlateNumber_T businessObject, IDataReader dataReader) { try { businessObject.cameraPicturesID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.BLLPlateNumber_T.PlateNumber_TField.cameraPicturesID_bint.ToString())); businessObject.plateNumber_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLPlateNumber_T.PlateNumber_TField.plateNumber_nvc.ToString())); businessObject.plateSerial_vc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLPlateNumber_T.PlateNumber_TField.plateSerial_vc.ToString())); businessObject.date_vc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLPlateNumber_T.PlateNumber_TField.date_vc.ToString())); businessObject.time_vc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLPlateNumber_T.PlateNumber_TField.time_vc.ToString())); businessObject.PlateColor_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BLLPlateNumber_T.PlateNumber_TField.PlateColor_nvc.ToString())); } catch (System.Exception ex) { dataReader.Close(); throw ex; } }
public List <HPS.BLL.BLLPlateNumber_T> PopulateObjectsFromReader(IDataReader dataReader) { try { List <HPS.BLL.BLLPlateNumber_T> list = new List <HPS.BLL.BLLPlateNumber_T>(); while (dataReader.Read()) { HPS.BLL.BLLPlateNumber_T businessObject = new HPS.BLL.BLLPlateNumber_T(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); } catch (System.Exception ex) { dataReader.Close(); throw ex; } }
public void Update(HPS.BLL.BLLPlateNumber_T businessObject, HPS.BLL.BLLPlateNumber_TKeys businessObjectKey) { try { List <string> ExceptList = new List <string>(); if (businessObject.cameraPicturesID_bint == businessObjectKey.cameraPicturesID_bint) { ExceptList.Add("UniquecameraPicturesID_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 Insert(HPS.BLL.BLLPlateNumber_T businessObject) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_PlateNumber_T_Add]"; 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.Output; cameraPicturesID_bint.IsNullable = false; cameraPicturesID_bint.Value = businessObject.cameraPicturesID_bint; this.Command.Parameters.Add(cameraPicturesID_bint); SqlParameter plateNumber_nvc = new SqlParameter(); plateNumber_nvc.ParameterName = "@plateNumber_nvc"; plateNumber_nvc.SqlDbType = SqlDbType.NVarChar; plateNumber_nvc.Direction = ParameterDirection.Input; plateNumber_nvc.IsNullable = false; plateNumber_nvc.Value = businessObject.plateNumber_nvc; this.Command.Parameters.Add(plateNumber_nvc); SqlParameter plateSerial_vc = new SqlParameter(); plateSerial_vc.ParameterName = "@plateSerial_vc"; plateSerial_vc.SqlDbType = SqlDbType.VarChar; plateSerial_vc.Direction = ParameterDirection.Input; plateSerial_vc.IsNullable = false; plateSerial_vc.Value = businessObject.plateSerial_vc; this.Command.Parameters.Add(plateSerial_vc); 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 PlateColor_nvc = new SqlParameter(); PlateColor_nvc.ParameterName = "@PlateColor_nvc"; PlateColor_nvc.SqlDbType = SqlDbType.NVarChar; PlateColor_nvc.Direction = ParameterDirection.Input; PlateColor_nvc.IsNullable = false; PlateColor_nvc.Value = businessObject.PlateColor_nvc; this.Command.Parameters.Add(PlateColor_nvc); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); businessObject.cameraPicturesID_bint = (Int64)(this.Command.Parameters["@cameraPicturesID_bint"].Value); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }