Exemple #1
0
        protected List <PromList> SetPromSingle(DataTable dt, bool landing, bool staleDated)
        {
            ///获取网站ip
            string          web_url = BaseConfiguration.SercerIp;
            List <PromList> list    = new List <PromList>();

            foreach (DataRow dr in dt.Rows)
            {
                PromList prom = new PromList();
                prom.EntId          = dr["entid"].ToString();
                prom.Fabh           = dr["fabh"].ToString();
                prom.FaTitle        = dr["faTitle"].ToString();
                prom.Fabs           = dr["fabs"].ToString();
                prom.StartDate      = dr["startDate"].ToString();
                prom.EndDate        = dr["endDate"].ToString();
                prom.Amount         = BasisConfig.ObjToDecimal(dr["Amount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                prom.YAmount        = BasisConfig.ObjToDecimal(dr["yAmount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                prom.KhAmount       = BasisConfig.ObjToDecimal(dr["KhAmount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                prom.Describe       = dr["describe"].ToString();
                prom.Article_Id     = dr["article_id"].ToString();
                prom.Sub_Title      = dr["sub_title"].ToString();
                prom.Drug_Spec      = dr["drug_spec"].ToString();
                prom.Drug_Factory   = dr["drug_factory"].ToString();
                prom.Big_Package    = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                prom.Stock_Quantity = BasisConfig.ObjToDecimal(dr["Stock_Quantity"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                prom.ProposalPrice  = BasisConfig.ObjToDecimal(dr["proposalPrice"].ToString(), BaseConfiguration.PricePlace, 0.00M);
                prom.GoodsLimit     = dr["goodslimit"].ToString();
                //大包装控制 Y-取大包装 N-不取大包装
                string packControl = dr["packControl"].ToString().Trim();
                //中包装控制 Y-取中包装,不拆零 N-不取中包装,拆零
                string scattered = dr["scattered"].ToString().Trim();
                if (packControl == "Y")
                {
                    prom.Min_Package = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                }
                else
                {
                    if (scattered == "Y")
                    {
                        prom.Min_Package = BasisConfig.ObjToDecimal(dr["min_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                    }
                    else
                    {
                        prom.Min_Package = BasisConfig.ObjToDecimal(dr["scatteredPackage"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                    }
                }
                //价格
                if (landing && !staleDated)
                {
                    prom.Price = BasisConfig.ObjToDecimal(dr["price"].ToString(), BaseConfiguration.PricePlace, 0.00M).ToString();
                    prom.Limit = dr["limit"].ToString();
                }
                else
                {
                    prom.Price = "会员可见";
                    prom.Limit = "Y";
                }
                if (dr["img_url"].ToString() != "")
                {
                    prom.Img_Url = web_url + dr["img_url"].ToString();
                }
                else
                {
                    prom.Img_Url = "";
                }
                list.Add(prom);
            }
            return(list);
        }
Exemple #2
0
        protected List <PromFlashSale> SetDate(DataTable tBegin, DataTable tAfter, bool landing, bool staleDated)
        {
            ///获取网站ip
            string web_url             = BaseConfiguration.SercerIp;
            List <PromFlashSale> pList = new List <PromFlashSale>();

            /*正在进行的活动商品*/
            if (tBegin.Rows.Count > 0)
            {
                PromFlashSale mt = new PromFlashSale();
                mt.Title     = "正在进行中";
                mt.Start     = 2;
                mt.StartDate = tBegin.Rows[0]["startDate"].ToString();
                mt.EndDat    = tBegin.Rows[0]["endDate"].ToString();
                List <PromList> beginList = new List <PromList>();
                foreach (DataRow dr in tBegin.Rows)
                {
                    PromList prom = new PromList();
                    prom.EntId        = dr["entid"].ToString();
                    prom.EntId        = dr["entname"].ToString();
                    prom.Fabh         = dr["fabh"].ToString();
                    prom.FaTitle      = dr["faTitle"].ToString();
                    prom.Fabs         = dr["fabs"].ToString();
                    prom.StartDate    = dr["startDate"].ToString();
                    prom.EndDate      = dr["endDate"].ToString();
                    prom.Amount       = BasisConfig.ObjToDecimal(dr["Amount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                    prom.YAmount      = BasisConfig.ObjToDecimal(dr["yAmount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                    prom.KhAmount     = BasisConfig.ObjToDecimal(dr["KhAmount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                    prom.Describe     = dr["describe"].ToString();
                    prom.Article_Id   = dr["article_id"].ToString();
                    prom.Sub_Title    = dr["sub_title"].ToString();
                    prom.Drug_Spec    = dr["drug_spec"].ToString();
                    prom.Drug_Factory = dr["drug_factory"].ToString();
                    prom.Big_Package  = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                    prom.GoodsLimit   = dr["goodslimit"].ToString();
                    //大包装控制 Y-取大包装 N-不取大包装
                    string packControl = dr["packControl"].ToString().Trim();
                    //中包装控制 Y-取中包装,不拆零 N-不取中包装,拆零
                    string scattered = dr["scattered"].ToString().Trim();
                    if (packControl == "Y")
                    {
                        prom.Min_Package = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                    }
                    else
                    {
                        if (scattered == "Y")
                        {
                            prom.Min_Package = BasisConfig.ObjToDecimal(dr["min_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                        }
                        else
                        {
                            prom.Min_Package = BasisConfig.ObjToDecimal(dr["scatteredPackage"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                        }
                    }
                    prom.Stock_Quantity = BasisConfig.ObjToDecimal(dr["Stock_Quantity"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                    prom.Quantity       = BasisConfig.ObjToDecimal(dr["giftquantity"].ToString(), BaseConfiguration.InventoryPlace, 0.000M);
                    if (landing && !staleDated)
                    {
                        prom.Price  = BasisConfig.ObjToDecimal(dr["price"].ToString(), BaseConfiguration.PricePlace, 0.00M).ToString();
                        prom.CPrice = BasisConfig.ObjToDecimal(dr["cprice"].ToString(), BaseConfiguration.PricePlace, 0.00M).ToString();
                        prom.Limit  = dr["limit"].ToString();
                    }
                    else
                    {
                        prom.Price  = "会员可见";
                        prom.CPrice = "会员可见";
                        prom.Limit  = "Y";
                    }
                    if (dr["img_url"].ToString() != "")
                    {
                        prom.Img_Url = web_url + dr["img_url"].ToString();
                    }
                    else
                    {
                        prom.Img_Url = "";
                    }
                    beginList.Add(prom);
                }
                mt.list = beginList;
                pList.Add(mt);
            }

            /*未开始的活动商品*/
            if (tAfter.Rows.Count > 0)
            {
                var query = from q in tAfter.AsEnumerable()
                            group q by new { t1 = q.Field <string>("StartDate"), t2 = q.Field <string>("endDate") } into active
                    select new { start = active.Key.t1, end = active.Key.t2 };
                foreach (var item in query)
                {
                    DataRow[] row   = tAfter.Select(" StartDate='" + item.start.ToString() + "'  ");
                    DataTable table = tAfter.Clone();
                    foreach (var r in row)
                    {
                        table.ImportRow(r);
                    }
                    PromFlashSale prom = new PromFlashSale();
                    prom.Title = item.start.ToString() + "——" + item.end.ToString();
                    //prom.Title = item.start.ToString().Substring(11,5) +"-"+ item.end.ToString().Substring(11, 5);
                    prom.StartDate = item.start.ToString();
                    prom.EndDat    = item.end.ToString();
                    prom.Start     = 1;
                    List <PromList> afterList = new List <PromList>();

                    foreach (DataRow dr in table.Rows)
                    {
                        PromList prom1 = new PromList();
                        prom1.EntId        = dr["entname"].ToString();
                        prom1.EntId        = dr["entid"].ToString();
                        prom1.Fabh         = dr["fabh"].ToString();
                        prom1.FaTitle      = dr["faTitle"].ToString();
                        prom1.Fabs         = dr["fabs"].ToString();
                        prom1.StartDate    = dr["startDate"].ToString();
                        prom1.EndDate      = dr["endDate"].ToString();
                        prom1.Amount       = BasisConfig.ObjToDecimal(dr["Amount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                        prom1.YAmount      = BasisConfig.ObjToDecimal(dr["yAmount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                        prom1.KhAmount     = BasisConfig.ObjToDecimal(dr["KhAmount"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                        prom1.Describe     = dr["describe"].ToString();
                        prom1.Article_Id   = dr["article_id"].ToString();
                        prom1.Sub_Title    = dr["sub_title"].ToString();
                        prom1.Drug_Spec    = dr["drug_spec"].ToString();
                        prom1.Drug_Factory = dr["drug_factory"].ToString();
                        prom1.Big_Package  = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                        prom1.GoodsLimit   = dr["goodslimit"].ToString();
                        //大包装控制 Y-取大包装 N-不取大包装
                        string packControl = dr["packControl"].ToString().Trim();
                        //中包装控制 Y-取中包装,不拆零 N-不取中包装,拆零
                        string scattered = dr["scattered"].ToString().Trim();
                        if (packControl == "Y")
                        {
                            prom1.Min_Package = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                        }
                        else
                        {
                            if (scattered == "Y")
                            {
                                prom1.Min_Package = BasisConfig.ObjToDecimal(dr["min_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                            }
                            else
                            {
                                prom1.Min_Package = BasisConfig.ObjToDecimal(dr["scatteredPackage"].ToString(), BaseConfiguration.PackagePlace, 0.00M);
                            }
                        }
                        prom1.Stock_Quantity = BasisConfig.ObjToDecimal(dr["Stock_Quantity"].ToString(), BaseConfiguration.InventoryPlace, 0.00M);
                        prom1.Quantity       = BasisConfig.ObjToDecimal(dr["giftquantity"].ToString(), BaseConfiguration.InventoryPlace, 0.000M);
                        if (landing && !staleDated)
                        {
                            prom1.Price  = BasisConfig.ObjToDecimal(dr["price"].ToString(), BaseConfiguration.PricePlace, 0.00M).ToString();
                            prom1.CPrice = BasisConfig.ObjToDecimal(dr["cprice"].ToString(), BaseConfiguration.PricePlace, 0.00M).ToString();
                            prom1.Limit  = dr["limit"].ToString();
                        }
                        else
                        {
                            prom1.Price  = "会员可见";
                            prom1.CPrice = "会员可见";
                            prom1.Limit  = "Y";
                        }
                        if (dr["img_url"].ToString() != "")
                        {
                            prom1.Img_Url = web_url + dr["img_url"].ToString();
                        }
                        else
                        {
                            prom1.Img_Url = "";
                        }
                        afterList.Add(prom1);
                    }
                    prom.list = afterList;
                    pList.Add(prom);
                }
            }
            return(pList);
        }