Beispiel #1
0
        public override IModel CreateModel(DataRow dr)
        {
            PricingApply pricingapply = new PricingApply();

            pricingapply.PricingApplyId = Convert.ToInt32(dr["PricingApplyId"]);

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

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

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

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

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

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

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

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

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

            if (dr["OtherDesc"] != DBNull.Value)
            {
                pricingapply.OtherDesc = Convert.ToString(dr["OtherDesc"]);
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            return pricingapply;
        }
Beispiel #2
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            PricingApply pricingapply = new PricingApply();

            int indexPricingApplyId = dr.GetOrdinal("PricingApplyId");
            pricingapply.PricingApplyId = Convert.ToInt32(dr[indexPricingApplyId]);

            int indexApplyId = dr.GetOrdinal("ApplyId");
            if (dr["ApplyId"] != DBNull.Value)
            {
                pricingapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
            }

            int indexSubContractId = dr.GetOrdinal("SubContractId");
            if (dr["SubContractId"] != DBNull.Value)
            {
                pricingapply.SubContractId = Convert.ToInt32(dr[indexSubContractId]);
            }

            int indexContractId = dr.GetOrdinal("ContractId");
            if (dr["ContractId"] != DBNull.Value)
            {
                pricingapply.ContractId = Convert.ToInt32(dr[indexContractId]);
            }

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

            int indexQPDate = dr.GetOrdinal("QPDate");
            if (dr["QPDate"] != DBNull.Value)
            {
                pricingapply.QPDate = Convert.ToDateTime(dr[indexQPDate]);
            }

            int indexDelayAmount = dr.GetOrdinal("DelayAmount");
            if (dr["DelayAmount"] != DBNull.Value)
            {
                pricingapply.DelayAmount = Convert.ToDecimal(dr[indexDelayAmount]);
            }

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

            int indexDelayQPDate = dr.GetOrdinal("DelayQPDate");
            if (dr["DelayQPDate"] != DBNull.Value)
            {
                pricingapply.DelayQPDate = Convert.ToDateTime(dr[indexDelayQPDate]);
            }

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

            int indexOtherDesc = dr.GetOrdinal("OtherDesc");
            if (dr["OtherDesc"] != DBNull.Value)
            {
                pricingapply.OtherDesc = Convert.ToString(dr[indexOtherDesc]);
            }

            int indexStartTime = dr.GetOrdinal("StartTime");
            if (dr["StartTime"] != DBNull.Value)
            {
                pricingapply.StartTime = Convert.ToDateTime(dr[indexStartTime]);
            }

            int indexEndTime = dr.GetOrdinal("EndTime");
            if (dr["EndTime"] != DBNull.Value)
            {
                pricingapply.EndTime = Convert.ToDateTime(dr[indexEndTime]);
            }

            int indexMinPrice = dr.GetOrdinal("MinPrice");
            if (dr["MinPrice"] != DBNull.Value)
            {
                pricingapply.MinPrice = Convert.ToDecimal(dr[indexMinPrice]);
            }

            int indexMaxPrice = dr.GetOrdinal("MaxPrice");
            if (dr["MaxPrice"] != DBNull.Value)
            {
                pricingapply.MaxPrice = Convert.ToDecimal(dr[indexMaxPrice]);
            }

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

            int indexPricingBlocId = dr.GetOrdinal("PricingBlocId");
            if (dr["PricingBlocId"] != DBNull.Value)
            {
                pricingapply.PricingBlocId = Convert.ToInt32(dr[indexPricingBlocId]);
            }

            int indexPricingCorpId = dr.GetOrdinal("PricingCorpId");
            if (dr["PricingCorpId"] != DBNull.Value)
            {
                pricingapply.PricingCorpId = Convert.ToInt32(dr[indexPricingCorpId]);
            }

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

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

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

            int indexPricingPersoinId = dr.GetOrdinal("PricingPersoinId");
            if (dr["PricingPersoinId"] != DBNull.Value)
            {
                pricingapply.PricingPersoinId = Convert.ToInt32(dr[indexPricingPersoinId]);
            }

            int indexPricingStyle = dr.GetOrdinal("PricingStyle");
            if (dr["PricingStyle"] != DBNull.Value)
            {
                pricingapply.PricingStyle = Convert.ToInt32(dr[indexPricingStyle]);
            }

            int indexDeclareDate = dr.GetOrdinal("DeclareDate");
            if (dr["DeclareDate"] != DBNull.Value)
            {
                pricingapply.DeclareDate = Convert.ToDateTime(dr[indexDeclareDate]);
            }

            int indexAvgPriceStart = dr.GetOrdinal("AvgPriceStart");
            if (dr["AvgPriceStart"] != DBNull.Value)
            {
                pricingapply.AvgPriceStart = Convert.ToDateTime(dr[indexAvgPriceStart]);
            }

            int indexAvgPriceEnd = dr.GetOrdinal("AvgPriceEnd");
            if (dr["AvgPriceEnd"] != DBNull.Value)
            {
                pricingapply.AvgPriceEnd = Convert.ToDateTime(dr[indexAvgPriceEnd]);
            }

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

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

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

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

            return pricingapply;
        }
Beispiel #3
0
        public ResultModel GetModelByApplyId(UserModel user, int applyId)
        {
            ResultModel result = new ResultModel();

            SqlDataReader dr = null;
            try
            {
                string sql = string.Format("select * from dbo.Pri_PricingApply where ApplyId = {0}", applyId);
                dr = SqlHelper.ExecuteReader(ConnectString, CommandType.Text, sql, null);

                Model.PricingApply model = new PricingApply();

                if (dr.Read())
                {
                    model = CreateModel(dr) as PricingApply;

                    result.AffectCount = 1;
                    result.Message = "读取成功";
                    result.ResultStatus = 0;
                    result.ReturnValue = model;
                }
                else
                {
                    result.Message = "读取失败或无数据";
                    result.AffectCount = 0;
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }
            finally
            {
                if (dr != null)
                    dr.Dispose();
            }
            return result;
        }