예제 #1
0
        public void PopulateBusinessObjectFromReader(HPS.BLL.PriceNormBLL.BLLPriceNorm_T businessObject, IDataReader dataReader)
        {
            businessObject.PriceNormID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.PriceNormID_int.ToString()));
            businessObject.CityID_int      = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.CityID_int.ToString()));
            businessObject.LaderTypeID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.LaderTypeID_int.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.GoodID_int.ToString())) == false)
            {
                businessObject.GoodID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.GoodID_int.ToString()));
            }
            else
            {
                businessObject.GoodID_int = null;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.Price_dec.ToString())) == false)
            {
                businessObject.Price_dec = dataReader.GetDecimal(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.Price_dec.ToString()));
            }
            else
            {
                businessObject.Price_dec = null;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.OldPrice_dec.ToString())) == false)
            {
                businessObject.OldPrice_dec = dataReader.GetDecimal(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.OldPrice_dec.ToString()));
            }
            else
            {
                businessObject.OldPrice_dec = null;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.CreateDate_nvc.ToString())) == false)
            {
                businessObject.CreateDate_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.CreateDate_nvc.ToString()));
            }
            else
            {
                businessObject.CreateDate_nvc = String.Empty;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.UpdateDate_nvc.ToString())) == false)
            {
                businessObject.UpdateDate_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.UpdateDate_nvc.ToString()));
            }
            else
            {
                businessObject.UpdateDate_nvc = String.Empty;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.OriginCityID_int.ToString())) == false)
            {
                businessObject.OriginCityID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PriceNormBLL.BLLPriceNorm_T.PriceNorm_TField.OriginCityID_int.ToString()));
            }
            else
            {
                businessObject.OriginCityID_int = null;
            }
        }
예제 #2
0
        public HPS.BLL.PriceNormBLL.BLLPriceNorm_T SelectByPrimaryKey(HPS.BLL.PriceNormBLL.BLLPriceNorm_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.PriceNormBLL.BLLPriceNorm_T businessObject = new HPS.BLL.PriceNormBLL.BLLPriceNorm_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 List <HPS.BLL.PriceNormBLL.BLLPriceNorm_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.PriceNormBLL.BLLPriceNorm_T> list = new List <HPS.BLL.PriceNormBLL.BLLPriceNorm_T>();

            while (dataReader.Read())
            {
                HPS.BLL.PriceNormBLL.BLLPriceNorm_T businessObject = new HPS.BLL.PriceNormBLL.BLLPriceNorm_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
예제 #4
0
        public void Insert(HPS.BLL.PriceNormBLL.BLLPriceNorm_T businessObject)
        {
            try{
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "PriceNormID_int") == 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 void Update(HPS.BLL.PriceNormBLL.BLLPriceNorm_T businessObject, HPS.BLL.PriceNormBLL.BLLPriceNorm_TKeys businessObjectKey)
        {
            try{
                if (businessObject.PriceNormID_int == businessObjectKey.PriceNormID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniquePriceNormID_int") == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == 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);
            }
        }
예제 #6
0
        public void Update(HPS.BLL.PriceNormBLL.BLLPriceNorm_T businessObject, HPS.BLL.PriceNormBLL.BLLPriceNorm_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter CityID_int = new SqlParameter();
                CityID_int.ParameterName = "@CityID_int";
                CityID_int.SqlDbType     = SqlDbType.Int;
                CityID_int.Direction     = ParameterDirection.Input;
                CityID_int.IsNullable    = false;
                CityID_int.Value         = businessObject.CityID_int;
                this.Command.Parameters.Add(CityID_int);

                SqlParameter LaderTypeID_int = new SqlParameter();
                LaderTypeID_int.ParameterName = "@LaderTypeID_int";
                LaderTypeID_int.SqlDbType     = SqlDbType.Int;
                LaderTypeID_int.Direction     = ParameterDirection.Input;
                LaderTypeID_int.IsNullable    = false;
                LaderTypeID_int.Value         = businessObject.LaderTypeID_int;
                this.Command.Parameters.Add(LaderTypeID_int);

                SqlParameter GoodID_int = new SqlParameter();
                GoodID_int.ParameterName = "@GoodID_int";
                GoodID_int.SqlDbType     = SqlDbType.Int;
                GoodID_int.Direction     = ParameterDirection.Input;
                GoodID_int.IsNullable    = false;
                if (businessObject.GoodID_int.HasValue == false)
                {
                    GoodID_int.Value = DBNull.Value;
                }
                else
                {
                    GoodID_int.Value = businessObject.GoodID_int;
                }
                this.Command.Parameters.Add(GoodID_int);

                SqlParameter Price_dec = new SqlParameter();
                Price_dec.ParameterName = "@Price_dec";
                Price_dec.SqlDbType     = SqlDbType.Decimal;
                Price_dec.Direction     = ParameterDirection.Input;
                Price_dec.IsNullable    = true;
                if (businessObject.Price_dec.HasValue == false)
                {
                    Price_dec.Value = DBNull.Value;
                }
                else
                {
                    Price_dec.Value = businessObject.Price_dec;
                }
                this.Command.Parameters.Add(Price_dec);

                SqlParameter OldPrice_dec = new SqlParameter();
                OldPrice_dec.ParameterName = "@OldPrice_dec";
                OldPrice_dec.SqlDbType     = SqlDbType.Decimal;
                OldPrice_dec.Direction     = ParameterDirection.Input;
                OldPrice_dec.IsNullable    = true;
                if (businessObject.OldPrice_dec.HasValue == false)
                {
                    OldPrice_dec.Value = DBNull.Value;
                }
                else
                {
                    OldPrice_dec.Value = businessObject.OldPrice_dec;
                }
                this.Command.Parameters.Add(OldPrice_dec);

                SqlParameter CreateDate_nvc = new SqlParameter();
                CreateDate_nvc.ParameterName = "@CreateDate_nvc";
                CreateDate_nvc.SqlDbType     = SqlDbType.NVarChar;
                CreateDate_nvc.Direction     = ParameterDirection.Input;
                CreateDate_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.CreateDate_nvc))
                {
                    CreateDate_nvc.Value = DBNull.Value;
                }
                else
                {
                    CreateDate_nvc.Value = businessObject.CreateDate_nvc;
                }
                this.Command.Parameters.Add(CreateDate_nvc);

                SqlParameter UpdateDate_nvc = new SqlParameter();
                UpdateDate_nvc.ParameterName = "@UpdateDate_nvc";
                UpdateDate_nvc.SqlDbType     = SqlDbType.NVarChar;
                UpdateDate_nvc.Direction     = ParameterDirection.Input;
                UpdateDate_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.UpdateDate_nvc))
                {
                    UpdateDate_nvc.Value = DBNull.Value;
                }
                else
                {
                    UpdateDate_nvc.Value = businessObject.UpdateDate_nvc;
                }
                this.Command.Parameters.Add(UpdateDate_nvc);

                SqlParameter OriginCityID_int = new SqlParameter();
                OriginCityID_int.ParameterName = "@OriginCityID_int";
                OriginCityID_int.SqlDbType     = SqlDbType.Int;
                OriginCityID_int.Direction     = ParameterDirection.Input;
                OriginCityID_int.IsNullable    = true;
                if (businessObject.OriginCityID_int.HasValue == false)
                {
                    OriginCityID_int.Value = DBNull.Value;
                }
                else
                {
                    OriginCityID_int.Value = businessObject.OriginCityID_int;
                }
                this.Command.Parameters.Add(OriginCityID_int);


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



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

                this.Command.ExecuteNonQuery();

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