public HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_T SelectByPrimaryKey(HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_TrafficPictures_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter TrafficID_bint = new SqlParameter(); TrafficID_bint.ParameterName = "@TrafficID_bint"; TrafficID_bint.SqlDbType = SqlDbType.BigInt; TrafficID_bint.Direction = ParameterDirection.Input; TrafficID_bint.IsNullable = false; TrafficID_bint.Value = businessObjectKey.TrafficID_bint; this.Command.Parameters.Add(TrafficID_bint); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_T businessObject = new HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_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.TrafficPicturesBLL.BLLTrafficPictures_TKeys keys, ref System.Data.DataSet dataSet) { try { _dataObject.SelectByPrimaryKey(keys, ref dataSet); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_T GetBy(HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_TKeys keys) { try { return(_dataObject.SelectByPrimaryKey(keys)); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_TKeys keys) { try { _dataObject.Delete(keys); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_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_TrafficPictures_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter TrafficID_bint = new SqlParameter(); TrafficID_bint.ParameterName = "@TrafficID_bint"; TrafficID_bint.SqlDbType = SqlDbType.BigInt; TrafficID_bint.Direction = ParameterDirection.Input; TrafficID_bint.IsNullable = false; TrafficID_bint.Value = businessObjectKey.TrafficID_bint; this.Command.Parameters.Add(TrafficID_bint); 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.TrafficPicturesBLL.BLLTrafficPictures_T businessObject, HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_TKeys businessObjectKey) { try { List <string> ExceptList = new List <string>(); if (businessObject.TrafficID_bint == businessObjectKey.TrafficID_bint) { ExceptList.Add("UniqueTrafficID_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); // if (businessObject.Picture_vbnry != null) // { // File.WriteAllBytes($@"{BLLTrafficPictures_T.TrafficPicturePath}{businessObject.TrafficID_bint}.jpg", businessObject.Picture_vbnry); // } } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Update(HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_T businessObject, HPS.BLL.TrafficPicturesBLL.BLLTrafficPictures_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_TrafficPictures_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter TrafficID_bint = new SqlParameter(); TrafficID_bint.ParameterName = "@TrafficID_bint"; TrafficID_bint.SqlDbType = SqlDbType.BigInt; TrafficID_bint.Direction = ParameterDirection.Input; TrafficID_bint.IsNullable = false; TrafficID_bint.Value = businessObject.TrafficID_bint; this.Command.Parameters.Add(TrafficID_bint); SqlParameter Picture_vbnry = new SqlParameter(); Picture_vbnry.ParameterName = "@Picture_vbnry"; Picture_vbnry.SqlDbType = SqlDbType.VarBinary; Picture_vbnry.Direction = ParameterDirection.Input; Picture_vbnry.IsNullable = false; Picture_vbnry.Value = businessObject.Picture_vbnry; this.Command.Parameters.Add(Picture_vbnry); SqlParameter pk_TrafficID_bint = new SqlParameter(); pk_TrafficID_bint.ParameterName = "@pk_TrafficID_bint"; pk_TrafficID_bint.SqlDbType = SqlDbType.BigInt; pk_TrafficID_bint.Direction = ParameterDirection.Input; pk_TrafficID_bint.IsNullable = false; pk_TrafficID_bint.Value = businessObjectKey.TrafficID_bint; this.Command.Parameters.Add(pk_TrafficID_bint); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }