Exemple #1
0
        public HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_T SelectByPrimaryKey(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InCameraPictures_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter InCameraPicturesID_bint = new SqlParameter();
                InCameraPicturesID_bint.ParameterName = "@InCameraPicturesID_bint";
                InCameraPicturesID_bint.SqlDbType     = SqlDbType.BigInt;
                InCameraPicturesID_bint.Direction     = ParameterDirection.Input;
                InCameraPicturesID_bint.IsNullable    = false;
                InCameraPicturesID_bint.Value         = businessObjectKey.InCameraPicturesID_bint;
                this.Command.Parameters.Add(InCameraPicturesID_bint);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_T businessObject = new HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_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;
            }
        }
Exemple #2
0
 public void GetBy(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_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);
     }
 }
Exemple #3
0
 public HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_T GetBy(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #4
0
 public void Delete(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #5
0
        public void SelectByPrimaryKey(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_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_InCameraPictures_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter InCameraPicturesID_bint = new SqlParameter();
                InCameraPicturesID_bint.ParameterName = "@InCameraPicturesID_bint";
                InCameraPicturesID_bint.SqlDbType     = SqlDbType.BigInt;
                InCameraPicturesID_bint.Direction     = ParameterDirection.Input;
                InCameraPicturesID_bint.IsNullable    = false;
                InCameraPicturesID_bint.Value         = businessObjectKey.InCameraPicturesID_bint;
                this.Command.Parameters.Add(InCameraPicturesID_bint);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemple #6
0
        public void Update(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_T businessObject, HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.InCameraPicturesID_bint == businessObjectKey.InCameraPicturesID_bint)
                {
                    ExceptList.Add("UniqueInCameraPicturesID_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);
            }
        }
Exemple #7
0
        public void Update(HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_T businessObject, HPS.BLL.InCameraPicturesBLL.BLLInCameraPictures_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InCameraPictures_T_Update]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter InCameraPicturesID_bint = new SqlParameter();
                InCameraPicturesID_bint.ParameterName = "@InCameraPicturesID_bint";
                InCameraPicturesID_bint.SqlDbType     = SqlDbType.BigInt;
                InCameraPicturesID_bint.Direction     = ParameterDirection.Input;
                InCameraPicturesID_bint.IsNullable    = false;
                InCameraPicturesID_bint.Value         = businessObject.InCameraPicturesID_bint;
                this.Command.Parameters.Add(InCameraPicturesID_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 Picture_img = new SqlParameter();
                Picture_img.ParameterName = "@Picture_img";
                Picture_img.SqlDbType     = SqlDbType.Image;
                Picture_img.Direction     = ParameterDirection.Input;
                Picture_img.IsNullable    = false;
                Picture_img.Value         = businessObject.Picture_img;
                this.Command.Parameters.Add(Picture_img);

                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 TrafficTypeID_int = new SqlParameter();
                TrafficTypeID_int.ParameterName = "@TrafficTypeID_int";
                TrafficTypeID_int.SqlDbType     = SqlDbType.Int;
                TrafficTypeID_int.Direction     = ParameterDirection.Input;
                TrafficTypeID_int.IsNullable    = true;
                if (businessObject.TrafficTypeID_int.HasValue == false)
                {
                    TrafficTypeID_int.Value = DBNull.Value;
                }
                else
                {
                    TrafficTypeID_int.Value = businessObject.TrafficTypeID_int;
                }
                this.Command.Parameters.Add(TrafficTypeID_int);


                SqlParameter pk_InCameraPicturesID_bint = new SqlParameter();
                pk_InCameraPicturesID_bint.ParameterName = "@pk_InCameraPicturesID_bint";
                pk_InCameraPicturesID_bint.SqlDbType     = SqlDbType.BigInt;
                pk_InCameraPicturesID_bint.Direction     = ParameterDirection.Input;
                pk_InCameraPicturesID_bint.IsNullable    = false;
                pk_InCameraPicturesID_bint.Value         = businessObjectKey.InCameraPicturesID_bint;
                this.Command.Parameters.Add(pk_InCameraPicturesID_bint);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }