コード例 #1
0
ファイル: PricingDAL.cs プロジェクト: weiliji/NFMT
        public override IModel CreateModel(SqlDataReader dr)
        {
            Pricing pricing = new Pricing();

            int indexPricingId = dr.GetOrdinal("PricingId");
            pricing.PricingId = Convert.ToInt32(dr[indexPricingId]);

            int indexPricingApplyId = dr.GetOrdinal("PricingApplyId");
            if (dr["PricingApplyId"] != DBNull.Value)
            {
                pricing.PricingApplyId = Convert.ToInt32(dr[indexPricingApplyId]);
            }

            int indexPricingWeight = dr.GetOrdinal("PricingWeight");
            if (dr["PricingWeight"] != DBNull.Value)
            {
                pricing.PricingWeight = Convert.ToDecimal(dr[indexPricingWeight]);
            }

            int indexMUId = dr.GetOrdinal("MUId");
            if (dr["MUId"] != DBNull.Value)
            {
                pricing.MUId = Convert.ToInt32(dr[indexMUId]);
            }

            int indexExchangeId = dr.GetOrdinal("ExchangeId");
            if (dr["ExchangeId"] != DBNull.Value)
            {
                pricing.ExchangeId = Convert.ToInt32(dr[indexExchangeId]);
            }

            int indexFuturesCodeId = dr.GetOrdinal("FuturesCodeId");
            if (dr["FuturesCodeId"] != DBNull.Value)
            {
                pricing.FuturesCodeId = Convert.ToInt32(dr[indexFuturesCodeId]);
            }

            int indexFuturesCodeEndDate = dr.GetOrdinal("FuturesCodeEndDate");
            if (dr["FuturesCodeEndDate"] != DBNull.Value)
            {
                pricing.FuturesCodeEndDate = Convert.ToDateTime(dr[indexFuturesCodeEndDate]);
            }

            int indexSpotQP = dr.GetOrdinal("SpotQP");
            if (dr["SpotQP"] != DBNull.Value)
            {
                pricing.SpotQP = Convert.ToDateTime(dr[indexSpotQP]);
            }

            int indexDelayFee = dr.GetOrdinal("DelayFee");
            if (dr["DelayFee"] != DBNull.Value)
            {
                pricing.DelayFee = Convert.ToDecimal(dr[indexDelayFee]);
            }

            int indexSpread = dr.GetOrdinal("Spread");
            if (dr["Spread"] != DBNull.Value)
            {
                pricing.Spread = Convert.ToDecimal(dr[indexSpread]);
            }

            int indexOtherFee = dr.GetOrdinal("OtherFee");
            if (dr["OtherFee"] != DBNull.Value)
            {
                pricing.OtherFee = Convert.ToDecimal(dr[indexOtherFee]);
            }

            int indexAvgPrice = dr.GetOrdinal("AvgPrice");
            if (dr["AvgPrice"] != DBNull.Value)
            {
                pricing.AvgPrice = Convert.ToDecimal(dr[indexAvgPrice]);
            }

            int indexPricingTime = dr.GetOrdinal("PricingTime");
            if (dr["PricingTime"] != DBNull.Value)
            {
                pricing.PricingTime = Convert.ToDateTime(dr[indexPricingTime]);
            }

            int indexCurrencyId = dr.GetOrdinal("CurrencyId");
            if (dr["CurrencyId"] != DBNull.Value)
            {
                pricing.CurrencyId = Convert.ToInt32(dr[indexCurrencyId]);
            }

            int indexPricinger = dr.GetOrdinal("Pricinger");
            if (dr["Pricinger"] != DBNull.Value)
            {
                pricing.Pricinger = Convert.ToInt32(dr[indexPricinger]);
            }

            int indexAssertId = dr.GetOrdinal("AssertId");
            if (dr["AssertId"] != DBNull.Value)
            {
                pricing.AssertId = Convert.ToInt32(dr[indexAssertId]);
            }

            int indexPricingDirection = dr.GetOrdinal("PricingDirection");
            if (dr["PricingDirection"] != DBNull.Value)
            {
                pricing.PricingDirection = Convert.ToInt32(dr[indexPricingDirection]);
            }

            int indexPricingStatus = dr.GetOrdinal("PricingStatus");
            if (dr["PricingStatus"] != DBNull.Value)
            {
                pricing.PricingStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexPricingStatus]);
            }

            int indexFinalPrice = dr.GetOrdinal("FinalPrice");
            if (dr["FinalPrice"] != DBNull.Value)
            {
                pricing.FinalPrice = Convert.ToDecimal(dr[indexFinalPrice]);
            }

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            if (dr["CreatorId"] != DBNull.Value)
            {
                pricing.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
            }

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            if (dr["CreateTime"] != DBNull.Value)
            {
                pricing.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
            }

            int indexLastModifyId = dr.GetOrdinal("LastModifyId");
            if (dr["LastModifyId"] != DBNull.Value)
            {
                pricing.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
            }

            int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
            if (dr["LastModifyTime"] != DBNull.Value)
            {
                pricing.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
            }

            return pricing;
        }
コード例 #2
0
ファイル: PricingDAL.cs プロジェクト: weiliji/NFMT
        public override IModel CreateModel(DataRow dr)
        {
            Pricing pricing = new Pricing();

            pricing.PricingId = Convert.ToInt32(dr["PricingId"]);

            if (dr["PricingApplyId"] != DBNull.Value)
            {
                pricing.PricingApplyId = Convert.ToInt32(dr["PricingApplyId"]);
            }

            if (dr["PricingWeight"] != DBNull.Value)
            {
                pricing.PricingWeight = Convert.ToDecimal(dr["PricingWeight"]);
            }

            if (dr["MUId"] != DBNull.Value)
            {
                pricing.MUId = Convert.ToInt32(dr["MUId"]);
            }

            if (dr["ExchangeId"] != DBNull.Value)
            {
                pricing.ExchangeId = Convert.ToInt32(dr["ExchangeId"]);
            }

            if (dr["FuturesCodeId"] != DBNull.Value)
            {
                pricing.FuturesCodeId = Convert.ToInt32(dr["FuturesCodeId"]);
            }

            if (dr["FuturesCodeEndDate"] != DBNull.Value)
            {
                pricing.FuturesCodeEndDate = Convert.ToDateTime(dr["FuturesCodeEndDate"]);
            }

            if (dr["SpotQP"] != DBNull.Value)
            {
                pricing.SpotQP = Convert.ToDateTime(dr["SpotQP"]);
            }

            if (dr["DelayFee"] != DBNull.Value)
            {
                pricing.DelayFee = Convert.ToDecimal(dr["DelayFee"]);
            }

            if (dr["Spread"] != DBNull.Value)
            {
                pricing.Spread = Convert.ToDecimal(dr["Spread"]);
            }

            if (dr["OtherFee"] != DBNull.Value)
            {
                pricing.OtherFee = Convert.ToDecimal(dr["OtherFee"]);
            }

            if (dr["AvgPrice"] != DBNull.Value)
            {
                pricing.AvgPrice = Convert.ToDecimal(dr["AvgPrice"]);
            }

            if (dr["PricingTime"] != DBNull.Value)
            {
                pricing.PricingTime = Convert.ToDateTime(dr["PricingTime"]);
            }

            if (dr["CurrencyId"] != DBNull.Value)
            {
                pricing.CurrencyId = Convert.ToInt32(dr["CurrencyId"]);
            }

            if (dr["Pricinger"] != DBNull.Value)
            {
                pricing.Pricinger = Convert.ToInt32(dr["Pricinger"]);
            }

            if (dr["AssertId"] != DBNull.Value)
            {
                pricing.AssertId = Convert.ToInt32(dr["AssertId"]);
            }

            if (dr["PricingDirection"] != DBNull.Value)
            {
                pricing.PricingDirection = Convert.ToInt32(dr["PricingDirection"]);
            }

            if (dr["PricingStatus"] != DBNull.Value)
            {
                pricing.PricingStatus = (Common.StatusEnum)Convert.ToInt32(dr["PricingStatus"]);
            }

            if (dr["FinalPrice"] != DBNull.Value)
            {
                pricing.FinalPrice = Convert.ToDecimal(dr["FinalPrice"]);
            }

            if (dr["CreatorId"] != DBNull.Value)
            {
                pricing.CreatorId = Convert.ToInt32(dr["CreatorId"]);
            }

            if (dr["CreateTime"] != DBNull.Value)
            {
                pricing.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
            }

            if (dr["LastModifyId"] != DBNull.Value)
            {
                pricing.LastModifyId = Convert.ToInt32(dr["LastModifyId"]);
            }

            if (dr["LastModifyTime"] != DBNull.Value)
            {
                pricing.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
            }

            return pricing;
        }