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