示例#1
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            PricingApplyDetail pricingapplydetail = new PricingApplyDetail();

            int indexDetailId = dr.GetOrdinal("DetailId");
            pricingapplydetail.DetailId = Convert.ToInt32(dr[indexDetailId]);

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

            int indexStockId = dr.GetOrdinal("StockId");
            if (dr["StockId"] != DBNull.Value)
            {
                pricingapplydetail.StockId = Convert.ToInt32(dr[indexStockId]);
            }

            int indexStockLogId = dr.GetOrdinal("StockLogId");
            if (dr["StockLogId"] != DBNull.Value)
            {
                pricingapplydetail.StockLogId = Convert.ToInt32(dr[indexStockLogId]);
            }

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

            int indexDetailStatus = dr.GetOrdinal("DetailStatus");
            if (dr["DetailStatus"] != DBNull.Value)
            {
                pricingapplydetail.DetailStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexDetailStatus]);
            }

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

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

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

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

            return pricingapplydetail;
        }
示例#2
0
        public ResultModel Load(UserModel user, int pricingApplyId, Common.StatusEnum status = StatusEnum.已生效)
        {
            ResultModel result = new ResultModel();
            try
            {
                string cmdText = string.Format("select * from dbo.Pri_PricingApplyDetail where PricingApplyId={0} and DetailStatus>={1}", pricingApplyId, (int)StatusEnum.已生效);
                DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.ConnectionStringNFMT, cmdText, null, CommandType.Text);

                List<PricingApplyDetail> pricingApplyDetails = new List<PricingApplyDetail>();

                foreach (DataRow dr in dt.Rows)
                {
                    PricingApplyDetail pricingapplydetail = new PricingApplyDetail();
                    pricingapplydetail.DetailId = Convert.ToInt32(dr["DetailId"]);

                    if (dr["PricingApplyId"] != DBNull.Value)
                    {
                        pricingapplydetail.PricingApplyId = Convert.ToInt32(dr["PricingApplyId"]);
                    }
                    if (dr["StockId"] != DBNull.Value)
                    {
                        pricingapplydetail.StockId = Convert.ToInt32(dr["StockId"]);
                    }
                    if (dr["PricingWeight"] != DBNull.Value)
                    {
                        pricingapplydetail.PricingWeight = Convert.ToDecimal(dr["PricingWeight"]);
                    }
                    if (dr["DetailStatus"] != DBNull.Value)
                    {
                        pricingapplydetail.DetailStatus = (Common.StatusEnum)Convert.ToInt32(dr["DetailStatus"]);
                    }
                    if (dr["CreatorId"] != DBNull.Value)
                    {
                        pricingapplydetail.CreatorId = Convert.ToInt32(dr["CreatorId"]);
                    }
                    if (dr["CreateTime"] != DBNull.Value)
                    {
                        pricingapplydetail.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
                    }
                    if (dr["LastModifyId"] != DBNull.Value)
                    {
                        pricingapplydetail.LastModifyId = Convert.ToInt32(dr["LastModifyId"]);
                    }
                    if (dr["LastModifyTime"] != DBNull.Value)
                    {
                        pricingapplydetail.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
                    }
                    pricingApplyDetails.Add(pricingapplydetail);
                }
                result.AffectCount = dt.Rows.Count;
                result.Message = "获取列表成功";
                result.ResultStatus = 0;
                result.ReturnValue = pricingApplyDetails;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return result;
        }
示例#3
0
        public override IModel CreateModel(DataRow dr)
        {
            PricingApplyDetail pricingapplydetail = new PricingApplyDetail();

            pricingapplydetail.DetailId = Convert.ToInt32(dr["DetailId"]);

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

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

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

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

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

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

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

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

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

            return pricingapplydetail;
        }