// GET: Admin/Order public ActionResult Index(string searchString, int page = 1, int pagesize = 5) { var model = new CodeOrder(); var result = model.ListPaging(searchString, page, pagesize); return(View(result)); }
public JsonResult ChangeStatus(long Id) { var result = new CodeOrder().ChangeStatus(Id); return(Json(new { status = result })); }
public ActionResult Payments() { UserLogin session = (UserLogin)Session[CommonConstants.USER_SESSION]; if (session == null) { return(RedirectToAction("Login", "Home")); } else { var order = new Order(); order.CustomerID = session.UserID; order.CreatedDate = DateTime.Now; order.Status = false; try { long id = new CodeOrder().Insert(order); var cart = (List <CartItem>)Session[CommonConstants.CartSession]; var detailDao = new CodeOrderDetail(); decimal total = 0; foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductID = item.Product.ID; orderDetail.OrderID = id; orderDetail.Price = item.Product.Price; orderDetail.Quantity = item.Quantity; detailDao.Insert(orderDetail); total += (item.Product.Price.GetValueOrDefault(0) * item.Quantity); } //var model = new CodeUser().ViewDetailID(session.UserID); //string content = System.IO.File.ReadAllText(Server.MapPath("/Accset/Client/template/neworder.html")); //content = content.Replace("{{CustomerName}}", model.Name); //content = content.Replace("{{Phone}}", model.Phone); //content = content.Replace("{{Email}}", model.Email); //content = content.Replace("{{Address}}", model.Address); //content = content.Replace("{{Total}}", total.ToString("N0")); //var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); //new MailHelper().SendMail(model.Email, "Đơn hàng mới từ ShopElectronic", content); //new MailHelper().SendMail(toEmail, "Đơn hàng mới từ ShopElectronic", content); } catch (Exception ex) { //ghi log return(Redirect("/loi-thanh-toan")); } return(RedirectToAction("Success", "Cart")); } }
public override int GetHashCode() { return(CodeOrder.GetHashCode()); }