/// <summary>
        /// 获取待送货的订单数据
        /// </summary>
        /// <returns></returns>
        private string GetSendGoodesCount()
        {
            MstaticSendOrder model = new OrderBus().SaticSendGoodesCount();

            return(string.Format(@"代发货的订单总数为:{0}。其中送货超时的订单数为:{1},其中半小时内需要送货的订单数为:{2},其中今天需要送货的订单数为:{3}",
                                 model.sendGoodsCount, model.delayedSendGoodsCount,
                                 model.halfhourSendGoodsCount, model.todaySendGoodsCount));
        }
Example #2
0
        public JsonResult ChangeStatus(int id)
        {
            var result = OrderBus.ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Example #3
0
        // GET: AdminIndex
        public ActionResult Index()
        {
            if (!base.CheckIsLogin())
            {
                return(RedirectToAction("Index", "Login"));
            }

            ViewData["Static"] = new OrderBus().Static();

            return(View());
        }
Example #4
0
        public ActionResult Payment(Order order)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // insert into orders
                    order.OrderDate = DateTime.Now;
                    order.Status    = 1;
                    int total = 0;
                    var cart  = (List <CartItem>)Session[CartSession];
                    foreach (var item in cart)
                    {
                        total += item.Product.Price * item.Quantity;
                    }
                    order.Total  = total;
                    order.UserId = User.Identity.GetUserId();
                    int id = OrderBus.Insert(order);
                    // insert into orderdetails
                    foreach (var item in cart)
                    {
                        var orderDetail = new OrderDetail();
                        orderDetail.ProductId = item.Product.Id;
                        orderDetail.OrderId   = id;
                        orderDetail.UnitPrice = item.Product.Price;
                        orderDetail.Quantity  = item.Quantity;
                        OrderDetailBus.Add(orderDetail);
                    }
                    // send mail to admin and client
                    string content = System.IO.File.ReadAllText(Server.MapPath("~/Assets/Client/template/neworder.html"));

                    content = content.Replace("{{CustomerName}}", order.Name);
                    content = content.Replace("{{Phone}}", order.Phone);
                    content = content.Replace("{{Email}}", order.Email);
                    content = content.Replace("{{Address}}", order.Address);
                    content = content.Replace("{{Total}}", order.Total.ToString());
                    var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString();

                    new MailHelper().SendMail(order.Email, "Đơn hàng mới từ OnlineShop", content);
                    new MailHelper().SendMail(toEmail, "Đơn hàng mới từ OnlineShop", content);

                    return(Redirect("/Cart/Finish"));
                }
                catch (Exception ex)
                {
                    return(View(ex.Message));
                }
            }
            else
            {
                ModelState.AddModelError("", "An error has ocurred, please try again");
                return(View(order));
            }
        }
        /// <summary>
        /// 订单详情
        /// </summary>
        /// <param name="groupid"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult orderDetail(string groupid, string id)
        {
            if (!this.CheckIsLogin())
            {
                return(RedirectToAction("userCenter", "market"));
            }

            //// 获取订单详情
            if (!string.IsNullOrEmpty(groupid))
            {
                ViewData["OrderDetile"] = new OrderBus().GetOrderInfoByGroupId(groupid);
            }
            else
            {
                ViewData["OrderDetile"] = new OrderBus().GetOrderInfoById(id);
            }
            return(View());
        }
Example #6
0
        public JsonResult LoadData(string status, int page, int pageSize)
        {
            var model = OrderBus.List();


            if (!string.IsNullOrEmpty(status))
            {
                var statusInt = int.Parse(status);
                model = model.Where(x => x.Status == statusInt);
            }
            int totalRow = model.Count();

            model = model.Skip((page - 1) * pageSize).Take(pageSize);
            return(Json(new
            {
                data = model,
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }