public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); int id = context.Request.QueryString["id"].ToInt(); var falg = 0; if (id > 0) { falg= new OrderBll().DeleteList("id=" + id).ResultStatus.Code; } context.Response.Write(falg); }
public string AddOrder(int userid, string data, int price, string pno, string payMentType, int bananaCount) { string result = "0"; Order order = new Order(); OrderBll orderbll = new OrderBll(); UsersBll ubll = new UsersBll(); var u = ubll.GetByPrimaryKey(userid).Entity; try { order.UserId = userid; order.ReciverName = u.UserName; order.PayMentTypeId = (byte?) (payMentType == "货到付款" ? 1 : 2);//货到付款 order.RevicerAddress = u.Address; order.RevicerTel = u.Mobile; order.Status = 0;//等待确认 order.RealPrice = price; order.TotalPrice = price; order.Count = 1; order.OrderTime = DateTime.Now; order.OrderNo = OrderHelper.GetProNo(); order.Pno = pno == "" ? null : pno; order.BananaCount = bananaCount; //添加订单 int orderaddid = orderbll.AddAndReturn(order); sendYzm("18758177964", "26871", new string[] { u.UserName + u.Mobile, DateTime.Now.ToString() }); string[] dataArr = data.Split(','); if (dataArr.Length > 0) { for (int d = 0; d < dataArr.Length; d++) { if (!string.IsNullOrEmpty(dataArr[d])) { if (dataArr[d].IndexOf("|") > -1) { string[] arr = dataArr[d].Split('|'); AddOrderList(u, Convert.ToInt32(arr[0]), Convert.ToInt32(arr[1]), orderaddid); result = orderaddid.ToString(); } } } } } catch { result = "-1"; } return result; }
public string delete(int id) { string result = ""; OrderBll order = new OrderBll(); if (order.DeleteList("id=" + id).ResultStatus.Success) { result = "1"; } else { result = "0"; } return result; }
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; } } }
protected void Page_Load(object sender, EventArgs e) { string number = Request.QueryString["number"].Trim2(); string backUrl = Request.QueryString["backUrl"].Trim2(); //todo 逻辑需要放到notify的请求中,此处只处理跳转 SortedDictionary<string, string> sPara = GetRequestGet(); if (sPara.Count > 0) //判断是否有带返回参数 { var aliNotify = new Notify(); var verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); if (verifyResult) //验证成功 { OrderBll oorderbll = new OrderBll(); string where = "orderno='" + number + "'"; oorderbll.Update("status=1", "",where ); if (Request.Cookies["AdminInfo"] != null) { var BananaCount= new Bll.Db.OrderBll().GetAll("BananaCount", where, "", "id").Entity[0].BananaCount; HttpCookie cookieadmin = Cookie.Get("AdminInfo"); var userId = HttpUtility.UrlDecode(cookieadmin.Values["AdminId"]).ToInt(); BananaCount = new Bll.Db.UsersBll().GetByPrimaryKey(userId).Entity.BananaCount - BananaCount; new Bll.Db.UsersBll().Update("BananaCount=" + BananaCount, "", "id=" + userId); } State = 1; Number = number; BackUrl = backUrl; } } else { State = 0; Number = number; BackUrl = backUrl; } }
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(" ", ""); } } } } }
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 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; }