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; } } }
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; }
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; }
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 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; }