public string getUserCollection(int currentpage,int num)
        {
            string result = "";

            string sctemp = "<li class=\"clf\"><a href=\"shop_list_detail.aspx?pro_id={0}\"><span class=\"smallImgbox fl\"><img width=\"70px\" src=\"images/smallDefaultPic.png\" alt=\"{1}\" class=\"lazy boxshowdow\"></span><span class=\"Pdesc fl\"><b>{2}</b> <span class=\"Titledesc\">{3}</span> <span class=\"red\">¥{4}</span><span class=\"yj\">¥{5}</span> </span><span class=\"zk\" onclick=\"deleteIt(this,{6})\">取消</span> </a></li>";//0 产品链接地址 1产品图片 2产品名称 3产品描述 4商城价 5市场价 6删除收藏id
            UserCollectionBll ucbll = new UserCollectionBll();
            ProductBll pbll = new ProductBll();
            int userid = 1;
            var uclist = ucbll.GetAll("*", 1, num, " userid=" + userid, null, "id").Entity;
            if (uclist.Items.Count > 0)
            {
                for (int i = 0; i < uclist.Items.Count; i++)
                {
                    var p = pbll.GetByPrimaryKey(uclist.Items[i].Productid.ToString().ToInt()).Entity;
                    if (p != null)
                    {
                        result += string.Format(sctemp, uclist.Items[i].Productid, ApplicationSettings.Get("imgurl") + p.BigThumPic, p.ProductName, p.Keyword, ((decimal)p.OemPrice).ToString("f0"), ((decimal)p.MarketPrice).ToString("f0"), uclist.Items[i].Id);
                    }
                }
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + num + "\" pagecount=\"" + uclist.PageCount + "\" page=\""+currentpage+"\"></span>";
            }
            else
            {
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + num + "\" pagecount=\"1\" page=\"1\"></span>";
            }
            return result;
        }
        public string getPro(int page, int pagesize)
        {
            string result = "";
            string sctemp = @"<li class=""bdradius6""><a href=""shop_list_detail.aspx?pro_id={0}"">
              <span class=""smallImgbox""><img src=""/images/smallPic.png"" alt=""{1}"" class=""lazy"" ></span>
              <span class=""prodTitle"">{2}</span>
              <span class=""prodPrice clf""> {6}<i class=""fl"">已售 {3}</i></span>
              <span class=""prodPrice clf""><i class=""red fl"">¥{4}</i> <i class=""fl"">¥{5}</i></span>
            </a></li>";
               var list= new ProductBll().GetAll("*", page, pagesize, "", "", " newid()").Entity;
            if (list.Items.Count > 0)
            {
                for (int i = 0; i < list.Items.Count; i++)
                {
                    result += string.Format(sctemp, list.Items[i].Id,
                        "/" + ApplicationSettings.Get("imgurl") + list.Items[i].BigThumPic, list.Items[i].ProductName,
                        list.Items[i].Sale ?? new Random().Next(500), list.Items[i].OemPrice.ToString().Split('.')[0],
                        list.Items[i].MarketPrice.ToString().Split('.')[0], list.Items[i].IsFree == true ? "<i class=\"fl\">包邮</i>" : list.Items[i].OemPrice.ToString().Split('.')[0].ToInt() > 199 ? "<i class=\"fl\">包邮</i>" : "");

                }
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + pagesize + "\" pagecount=\"" +
                              list.PageCount + "\" page=\"" + page + "\"></span>";
            }
            else
            {
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + pagesize + "\" pagecount=\"1\" page=\"1\"></span>";
            }
            return result;
        }
Пример #3
0
        public void LoadUserOrder(int orderId)
        {
            OrderBll obll = new OrderBll();
            OrderListBll olistbll = new OrderListBll();
            ProductBll pbll = new ProductBll();
            if (HttpContext.Current.Request.Cookies["AdminInfo"] != null)
            {
                HttpCookie cookie = Cookie.Get("AdminInfo");
                string useridstr = HttpUtility.UrlDecode(cookie.Values["AdminId"]);
                int userid = useridstr.ToInt();
                orderEntity = obll.GetAll("*", "userid=" + userid + " and status=0 and id=" + orderId, null, "").Entity.SingleOrDefault();

                if (orderEntity != null)
                {
                    orderListEntity = olistbll.GetAll("*", " orderid=" + orderEntity.Id, null, "id desc").Entity;
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //获取购物车
            string productId = "";
            if (HttpContext.Current.Request.Cookies["shop"] != null)
            {
                //HttpCookie cookie = Cookie.Get("shop");

                //HttpCookie cookie = new HttpCookie("shop");
                //cookie.Expires = DateTime.Now.AddMonths(-10);
                //Response.Cookies.Add(cookie);
                //Request.Cookies.Remove("shop");

                HttpCookie cookies = Cookie.Get("shop");
                productId = cookies.Values["productId"].ToString();
                if (pro_id.NoEmpty() && productId.IndexOf("," + pro_id + ",") == -1)
                    productId += pro_id + ",";
            }
            else
            {
                if (pro_id.NoEmpty())
                    productId = "," + pro_id + ",";
                pro2();
            }

            if (productId.Trim2().Length > 1)
            {
                productId = productId.Substring(1, productId.Length - 2);
                ProductBll pbll = new ProductBll();
                productList = pbll.GetAll("", "id in (" + productId + ")", "", "").Entity;
                foreach (var p in productList)
                {
                    //判断是否在限时抢购里
                    var list = new Bll.Db.TimeSaleBll().GetAllandProduct(1, 1, " A.classid =(select Top 1 Id from TimeSaleClass where GETDATE() between StartTime and EndTime order by EndTime desc) and A.objectid=" + p.Id, null, " A.orderid desc").Entity;
                    if (list.Items != null && list.Items.Count > 0)
                        p.OemPrice = list.Items[0].SalePrice;
                    isLinepayment = true;
                    if (!p.Linepayment)
                    {
                        isLinepayment = false;
                    }
                    isFree = p.Linepayment;

                }

                var model = pbll.GetByPrimaryKey(pro_id.ToInt()).Entity;
                if (model != null)
                {
                    proname = model.ProductName;
                    proimg = ApplicationSettings.Get("imgurl") + model.BigThumPic;
                    proprice = ((decimal)model.OemPrice).ToString("f0");
                    prono = model.ProductNo;
                }
            }

            if (Cookie.Get("AdminInfo") != null)
            {
                HttpCookie cookie = Cookie.Get("AdminInfo");
                string useridstr = HttpUtility.UrlDecode(cookie.Values["AdminId"]);
                int userid = useridstr.ToInt();

                current = new UsersBll().GetByPrimaryKey(userid).Entity;

                var lastorder = new OrderBll().GetAll("*", " userid=" + userid, null, "id desc").Entity;
                if (lastorder != null)
                {
                    if (lastorder.Count > 0)
                    {
                        string address = lastorder[0].RevicerAddress;

                        string[] arr = address.Split(' ');
                        userp = arr[0].Replace("省", "");
                        userc = arr[1].Replace("市", "");
                        if (address.IndexOf("市") > -1)
                        {
                            ads = address.Split('市')[1].Replace(" ", "");
                        }
                    }
                }

            }
        }
Пример #5
0
        public string AddOrder(int userid, int productid, int pronum)
        {
            string result = "1";
            Order order = new Order();
            OrderBll orderbll = new OrderBll();
            OrderList orderlist = new OrderList();
            OrderListBll orderlistbll = new OrderListBll();

            ProductBll pbll = new ProductBll();
            UsersBll ubll = new UsersBll();
            try
            {
                //检查 当前用户是否有末完成的订单  有不能
                //if (orderbll.GetAll("*", " [status]=1 and userid=" + userid, null, "id").Entity.Count <= 0)
                //{

                var p = pbll.GetByPrimaryKey(productid).Entity;
                var u = ubll.GetByPrimaryKey(userid).Entity;
                order.UserId = userid;
                order.ReciverName = u.UserName;
                order.PayMentTypeId = 1;//货到付款
                order.RevicerAddress = u.Address;
                order.RevicerTel = u.Mobile;
                order.Status = 1;//
                order.RealPrice = pronum * p.OemPrice;
                order.TotalPrice = pronum * p.OemPrice;
                order.Count = 1;
                order.OrderTime = DateTime.Now;
                order.OrderNo = OrderHelper.GetProNo();
                //添加订单
                int orderaddid = orderbll.AddAndReturn(order);

                //添加订单详情
                orderlist.Count = order.Count;
                orderlist.Productid = productid;
                orderlist.Orderid = orderaddid;
                orderlist.OemPrice = p.OemPrice;
                orderlist.MarketPrice = p.MarketPrice;
                orderlistbll.Add(orderlist);
                //}
                //else
                //{
                //    result = "-2";
                //}

            }
            catch
            {

                result = "-1";
            }

            return result;
        }
Пример #6
0
        public void AddOrderList(Users u, int productid, int num, int orderid)
        {
            OrderList orderlist = new OrderList();
            OrderListBll orderlistbll = new OrderListBll();

            ProductBll pbll = new ProductBll();
            var p = pbll.GetByPrimaryKey(productid).Entity;

            //添加订单详情
            orderlist.Count = num;
            orderlist.Productid = productid;
            orderlist.Orderid = orderid;
            orderlist.OemPrice = p.OemPrice;
            orderlist.MarketPrice = p.MarketPrice;
            orderlistbll.Add(orderlist);
        }
        public string LoadUserOrder(int currentpage, int num, string where, string order)
        {
            string result = "";
            //if (Cookie.Get("AdminInfo") != null)
            //{
            //    string temp = " <li class=\"clf\"><a href=\"#\"><span class=\"smallImgbox fl\"><img src=\"images/smallDefaultPic.png\" alt=\"{0}\" class=\"lazy boxshowdow\"></span> <span class=\"Pdesc fl\"><b>{1}</b> <span class=\"Titledesc\">{2}</span></span><span class=\"zk\">¥{3}</span> </a></li>";//0产品图片 1产品名称 2产品描述 3订单价格
            //    OrderBll obll = new OrderBll();
            //    OrderListBll olistbll = new OrderListBll();
            //    ProductBll pbll = new ProductBll();
            //    int userid = Cookie.Get("AdminInfo").Values["AdminId"].ToInt();
            //    var blllist = obll.GetAll("*", currentpage, num, "userid=" + userid + " " + where + "", null, order).Entity;

            //    if (blllist.Items.Count > 0)
            //    {
            //        for (int i = 0; i < blllist.Items.Count; i++)
            //        {
            //            var olist = olistbll.GetAll("*", " orderid=" + blllist.Items[i].Id, null, "id desc").Entity;
            //            if (olist.Count > 0)
            //            {
            //                var p = pbll.GetByPrimaryKey(olist[0].Productid.ToString().ToInt()).Entity;
            //                if (p != null)
            //                {
            //                    result += string.Format(temp, ApplicationSettings.Get("imgurl") + p.BigThumPic, p.ProductName, p.Keyword, ((decimal)blllist.Items[i].TotalPrice).ToString("f1"));
            //                }
            //            }
            //        }
            //        result += "<span id=\"pager\" page=\"" + currentpage + "\" pagecount=\"" + blllist.PageCount + "\" style=\"display:none\">";
            //    }
            //    else
            //    {
            //        result += "<span id=\"pager\" page=\"1\" pagecount=\"1\" style=\"display:none\">";
            //    }
            //}
            //return result;
            if (Cookie.Get("AdminInfo") != null)
            {
                //string temp = " <li class=\"clf\"><a href=\"#\"><span class=\"smallImgbox fl\"><img src=\"images/smallDefaultPic.png\" alt=\"{0}\" class=\"lazy boxshowdow\"></span> <span class=\"Pdesc fl\"><b>{1}</b> <span class=\"Titledesc\">{2}</span></span><span class=\"zk\">¥{3}</span> </a></li>";//0产品图片 1产品名称 2产品描述 3订单价格
                string temp1 = "<li class=\"clf\"><p class=\"orderTitle\">订单号:<span class=\"red\">{0}</span>金额:<span class=\"red\">¥{1}</span></p>{2}</li>";
                string temp2 = "<a href=\"#\"><span class=\"smallImgbox fl\"><img src=\"images/smallDefaultPic.png\"  alt=\"{0}\" class=\"lazy boxshowdow\"></span><span class=\"Pdesc fl\"><b>{1}</b><span class=\"Titledesc\"><i>单价:¥{2}</i> <i>数量:{3}</i>  </span></span></a>";
                OrderBll obll = new OrderBll();
                OrderListBll olistbll = new OrderListBll();
                ProductBll pbll = new ProductBll();
                HttpCookie cookie = Cookie.Get("AdminInfo");
                string useridstr = HttpUtility.UrlDecode(cookie.Values["AdminId"]);
                int userid = useridstr.ToInt();
                var blllist = obll.GetAll("*", currentpage, num, "userid=" + userid + " " + where + "", null, order).Entity;

                if (blllist.Items.Count > 0)
                {
                    for (int i = 0; i < blllist.Items.Count; i++)
                    {
                        string orderlist = "";
                        var olist = olistbll.GetAll("*", " orderid=" + blllist.Items[i].Id, null, "id desc").Entity;
                        if (olist.Count > 0)
                        {
                            foreach (var o in olist)
                            {
                                var p = pbll.GetByPrimaryKey(o.Productid.ToString().ToInt()).Entity;
                                if (p != null)
                                {
                                    orderlist += string.Format(temp2, ApplicationSettings.Get("imgurl") + p.SmallThumPic, p.ProductName, ((decimal)p.OemPrice).ToString("f0"), o.Count);
                                }
                            }
                        }
                        result += string.Format(temp1, blllist.Items[i].OrderNo, ((decimal)blllist.Items[i].TotalPrice).ToString("f0"), orderlist);
                    }
                    result += "<span id=\"pager\" page=\"" + currentpage + "\"  pagesize=\"" + num + "\" pagecount=\"" + blllist.PageCount + "\" style=\"display:none\">";
                }
                else
                {
                    result += "<span id=\"pager\" page=\"" + currentpage + "\"  pagesize=\"" + num + "\"  pagecount=\"1\" style=\"display:none\">";
                }
            }
            return result;
        }
Пример #8
0
        public string getprolist(int page, int pagesize, string type,int userid)
        {
            OrderListBll orderlistbll = new OrderListBll();
            ProductBll probll = new ProductBll();
            string result = "";
            string temp = "";
            string sctemp = @" <li class=""clf"">
              <p class=""orderTitle clf""><span class=""fl"">订单号:<i class=""red"">{0}</i></span> </p>
            {2}
            <a class=""fl"">金额:<i class=""red"">¥{1}</i></a>
            <a href=""javascript:void(0);"" class=""fr""  onclick=""btdelete({3})"" >删除</a><a href=""http://m.kuaidi100.com/"" class=""fr""><span class=""red"">查看物流</span></a>

            </li> ";

            string sctemplist = @"<a href=""#"" class=""shop_list_detail"">
            <span class=""smallImgbox fl""><img src=""{0}""  alt=""{0}"" class=""lazy boxshowdow""></span>
            <span class=""Pdesc fl"">
               <b>{1}</b>
               <span class=""Titledesc""><i>单价:¥{2}</i> <i>数量:{3}</i>  </span>
            </span>
            </a>";
            if (type == "待付款")
            {
                type = "0";
            }

            else if (type == "待发货")
            {
                type = "1";
            }
            else if (type == "已完结")
            {
                type = "2";
            }
            else if (type == "")
            {
                type = "0";
            }

            var list = new OrderBll().GetAll("*", page, pagesize, " userid="+userid+" and Status="+type, "", "ordertime desc").Entity;
            if (list.Items.Count > 0)
            {
                for (int i = 0; i < list.Items.Count; i++)
                {
                    var orderlist =
                        orderlistbll.GetAll("productid,count", " orderid=" + list.Items[i].Id, "", " id").Entity;
                    if (orderlist.Count > 0)
                    {
                        for (int j = 0; j < orderlist.Count; j++)
                        {
                           // var prolist = probll.GetAll("*", " id=" + orderlist[j].Productid, "", "").Entity;
                            var prolist = probll.GetByPrimaryKey(orderlist[j].Productid.ToString().ToInt()).Entity;
                            temp+= string.Format(sctemplist,
                                "/" + ApplicationSettings.Get("imgurl") + prolist.BigThumPic,
                                prolist.ProductName, prolist.OemPrice.ToString().Split('.')[0], orderlist[j].Count);

                        }

                    }
                    result += string.Format(sctemp, list.Items[i].OrderNo, list.Items[i].RealPrice, temp,  list.Items[i].Id);
                    temp = "";

                }
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + pagesize + "\" pagecount=\"" +
                          list.PageCount + "\" page=\"" + page + "\"></span>";
            }
            else
            {
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + pagesize + "\" pagecount=\"1\" page=\"1\"></span>";
            }
            return result;
        }
        public string getprolist(int page, int pagesize, string order,string type,string type2)
        {
            string result = "";
            string sctemp = @"<li class=""bdradius6""><a href=""shop_list_detail.aspx?pro_id={0}"">
              <span class=""smallImgbox""><img src=""/images/smallPic.png"" alt=""{1}"" class=""lazy"" ></span>
              <span class=""prodTitle"">{2}</span>
              <span class=""prodPrice clf""> {6}<i class=""fl"">已售 {3}</i></span>
              <span class=""prodPrice clf""><i class=""red fl"">¥{4}</i> <i class=""fl"">¥{5}</i></span>
              </a></li>";

            if (order == "推荐")
            {
                order = "orderid desc";
            }
            else if (order == "价格↑")
            {
                order = "OemPrice asc";
            }
            else if (order == "价格↓")
            {
                order = "OemPrice desc";
            }
            else if (order == "销量↓")
            {
                order = "sale desc";
            }
            else if (order == "销量↑")
            {
                order = "sale asc";
            }
            else
            {
                order = "orderid desc";
            }

            if (type == "男性用品" || type == "男用玩具")
            {
                type = "1";
            }
            else if (type == "女性用品" || type == "女用玩具")
            {
                type = "4";
            }
            else if (type == "延时锻炼" || type == "锁住幸福")
            {
                type = "12";
            }
            else if (type == "情趣服饰" )
            {
                type = "41";
            }
            else if (type == "调情助兴")
            {
                type = "13";
            }
            else if (type == "套套")
            {
                type = "6";
            }

            //var list = new ProductBll().GetJoinAll("*", page, pagesize, " adid=3", "", " " + order + " desc").Entity;

            var list = new ProductBll().GetAll("*", page, pagesize, getQuery(type,type2), "",order).Entity;
            if (list.Items.Count > 0)
            {
                for (int i = 0; i < list.Items.Count; i++)
                {
                    result += string.Format(sctemp, list.Items[i].Id,
                        "/" + ApplicationSettings.Get("imgurl") + list.Items[i].BigThumPic, list.Items[i].ProductName,
                        list.Items[i].Sale ?? new Random().Next(500), list.Items[i].OemPrice.ToString().Split('.')[0],
                        list.Items[i].MarketPrice.ToString().Split('.')[0], list.Items[i].IsFree == true ? "<i class=\"fl\">包邮</i>" : list.Items[i].OemPrice.ToString().Split('.')[0].ToInt() > 199 ? "<i class=\"fl\">包邮</i>" : "");

                }
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + pagesize + "\" pagecount=\"" +
                              list.PageCount + "\" page=\"" + page + "\"></span>";
            }
            else
            {
                result += "<span id=\"pager\" style=\"display:none\" pagesize=\"" + pagesize + "\" pagecount=\"1\" page=\"1\"></span>";
            }
            return result;
        }