Пример #1
0
        public void Insert(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter inOutPicturesID_bint = new SqlParameter();
                inOutPicturesID_bint.ParameterName = "@inOutPicturesID_bint";
                inOutPicturesID_bint.SqlDbType     = SqlDbType.BigInt;
                inOutPicturesID_bint.Direction     = ParameterDirection.Output;
                inOutPicturesID_bint.IsNullable    = false;
                inOutPicturesID_bint.Value         = businessObject.inOutPicturesID_bint;
                this.Command.Parameters.Add(inOutPicturesID_bint);

                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         = businessObject.inOutID_bint;
                this.Command.Parameters.Add(inOutID_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);



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

                this.Command.ExecuteNonQuery();

                businessObject.inOutPicturesID_bint = (Int64)(this.Command.Parameters["@inOutPicturesID_bint"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Пример #2
0
        public HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T SelectByPrimaryKey(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T businessObject = new HPS.BLL.InOutPicturesBLL.BLLInOutPictures_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;
            }
        }
Пример #3
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T businessObject, IDataReader dataReader)
 {
     try
     {
         businessObject.inOutPicturesID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T.InOutPictures_TField.inOutPicturesID_bint.ToString()));
         businessObject.inOutID_bint         = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T.InOutPictures_TField.inOutID_bint.ToString()));
         businessObject.picture_vbnry        = (Byte[])dataReader.GetValue(dataReader.GetOrdinal(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T.InOutPictures_TField.picture_vbnry.ToString()));
     }
     catch (System.Exception ex)
     {
         dataReader.Close();
         throw ex;
     }
 }
Пример #4
0
        public void Insert(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueinOutPicturesID_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);
            }
        }
Пример #5
0
 public List <HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T> PopulateObjectsFromReader(IDataReader dataReader)
 {
     try
     {
         List <HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T> list = new List <HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T>();
         while (dataReader.Read())
         {
             HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T businessObject = new HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T();
             PopulateBusinessObjectFromReader(businessObject, dataReader);
             list.Add(businessObject);
         }
         return(list);
     }
     catch (System.Exception ex)
     {
         dataReader.Close();
         throw ex;
     }
 }
Пример #6
0
        public void Update(HPS.BLL.InOutPicturesBLL.BLLInOutPictures_T businessObject, HPS.BLL.InOutPicturesBLL.BLLInOutPictures_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.inOutPicturesID_bint == businessObjectKey.inOutPicturesID_bint)
                {
                    ExceptList.Add("UniqueinOutPicturesID_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);
            }
        }