public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new HOADON(); order.Ngay = DateTime.Now; order.DiaChi = address; order.DienThoai = mobile; order.TenKH = shipName; order.email = email; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CartSession]; var detailDao = new OrderDetailDao(); decimal total = 0; foreach (var item in cart) { var orderDetail = new HOADON_CHITIET(); orderDetail.IdSP = item.SanPham.ID; orderDetail.MaHD = id; orderDetail.TongTien = item.SanPham.Gia; orderDetail.SoLuong = item.SoLuong; detailDao.Insert(orderDetail); total += (item.SanPham.Gia.GetValueOrDefault(0) * item.SoLuong); } } catch (Exception ex) { //ghi log return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
public JsonResult UpdateQuantity(string cartModel, long orderId) { var jsonCart = new JavaScriptSerializer().Deserialize <List <CartItem> >(cartModel); var listCartItem = (List <CartItem>) this.ListCartItemByOrderId(orderId); foreach (var item in listCartItem) { var jsonItem = jsonCart.SingleOrDefault(x => x.Product.ID == item.Product.ID); if (jsonItem != null) { item.Quantity = jsonItem.Quantity; } } var detailDao = new OrderDetailDao(); OrderDetail orderDetail = new OrderDetail(); foreach (var item in listCartItem) { orderDetail.OrderID = orderId; orderDetail.ProductID = item.Product.ID; orderDetail.Quantity = item.Quantity; orderDetail.Price = item.Product.Price; detailDao.Update(orderDetail); } return(Json(new { status = true })); }
// GET: Admin/OrderDetail public ActionResult Index() { var orderDetaiDao = new OrderDetailDao(); var orderDetail = orderDetaiDao.GetOrderDetail(); return(View(orderDetail)); }
public ActionResult SaveOrderPay(string shipName, string mobile, string address, string email) { var order = new Order(); order.CreatedDate = DateTime.Now; var userSession = (UserLogin)Session[OnlineShop.Common.CommonConstants.USER_SESSION]; order.CustomerID = userSession.UserID; order.ShipName = shipName; order.ShipMobile = mobile; order.ShipAddress = address; order.ShipEmail = email; var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CommonConstants.CartSession]; var detailDao = new OrderDetailDao(); 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); } return(Json(new { status = true })); }
// GET: Admin/OrderDetail public ActionResult Index(string searchString, int page = 1, int pagesize = 10) { var dao = new OrderDetailDao(); var model = dao.ListAll(searchString, page, pagesize); return(View(model)); }
public ActionResult MyOrder() { var ses = (ShopDao.EF.User)Session[Constrain.User_Session]; var list = new OrderDetailDao().GetOrderDetails(ses.ID); return(View(list)); }
public JsonResult OrdersDetailsSubgridData(long id) { var model = new OrderDetailDao(); var result = model.GetOrderDetails((Convert.ToInt64(id))); return(Json(new { rows = result })); }
public ActionResult Payment(string ShipName, string ShipMobile, string ShipAddress, string ShipEmail) { var order = new Order(); order.CreateDate = DateTime.Now; order.ShipAddress = ShipAddress; order.ShipName = ShipName; order.ShipEmail = ShipEmail; order.ShipMobile = ShipMobile; //add 1 order va lay ra ID de add product vao orderdetail long id = new OrderDao().Insert(order); var listOrderDetail = (List <CartItem>)Session[CartSession]; var orderdetaildao = new OrderDetailDao(); foreach (var item in listOrderDetail) { var OrderDetail = new OrderDetail(); OrderDetail.OrderID = id; OrderDetail.ProductID = item.Product.ID; OrderDetail.Quantity = item.Quantity; OrderDetail.Price = item.Product.Price; OrderDetail.ProductName = item.Product.Name; orderdetaildao.Insert(OrderDetail); } return(Redirect("/hoan-thanh")); }
// GET: Order public ActionResult OrderDetail(Guid orderID) { var ordDao = new OrderDao(); var order = ordDao.FindByID(orderID); var checkStatus = ordDao.SwitchStatus(orderID); ViewBag.Status = order.Status; if (order.Status == "Complete") { ViewBag.ShippedDate = order.ShippedDate; } ViewBag.ID = order.ID.ToString().Substring(0, 8); ViewBag.OrderDate = order.OrderDate; string typeOfCost = ""; if (order.CostBy == 1) { typeOfCost = "Trả tiền mặt khi nhận hàng"; } else { typeOfCost = "Chuyển khoản qua ngân hàng"; } ViewBag.TypeOfCost = typeOfCost; var model = new OrderDetailDao().ListByID(orderID); var sumOfCost = new decimal(); foreach (var item in model) { sumOfCost += (item.Price * item.Amount); } ViewBag.SumOfCost = sumOfCost; return(View(model)); }
public ActionResult Payment(string name, string address, string mobile, string email) { var order = new Order(); order.CreatedDate = DateTime.Now; order.ShipName = name; order.ShipAddress = address; order.ShipMobile = mobile; order.ShipEmail = email; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CommonConstants.CartSession]; var detailDao = new OrderDetailDao(); 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; orderDetail.ProductName = item.Product.Name; orderDetail.SubTotalProduct = (item.Quantity) * (item.Product.Price); detailDao.Insert(orderDetail); } } catch (Exception) { return(Redirect("/erro-payment")); } return(Redirect("/success")); }
public ActionResult Payment(string shipName, string phone, string address, string email) { try { var order = new Order() { CreateDate = DateTime.Now, ShipName = shipName, ShipEmail = email, ShipAddress = address, ShipMobile = phone }; var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CommonConstants.CartSession]; var detailDao = new OrderDetailDao(); foreach (var item in cart) { var orderDetail = new OrderDetail() { OrderID = id, ProductID = item.Product.ID, Price = item.Product.Price, Quanlity = item.Quanlity }; detailDao.Insert(orderDetail); } } catch { throw; } return(Redirect("/hoan-thanh")); }
public ActionResult Payment(string name, string number, string address, string email) { var order = new Order(); order.CreateDate = DateTime.Now; order.ShipAddress = address; order.ShipName = name; order.ShipMobile = number; order.ShipEmail = email; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CartSession]; var detailDao = new OrderDetailDao(); 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); } } catch (Exception ex) { return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
public JsonResult Payment(string email, string name, string province, string district, string ward, string address, string phone) { var order = new Order(); order.ShipName = name; order.ShipMobile = phone; order.ShipAdress = address + "-" + ward + "-" + district + "-" + province; order.ShipEmail = email; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CommonConst.CartSession]; var orderdetail = new OrderDetailDao(); foreach (var item in cart) { var detail = new OrderDetail(); detail.OrderID = id; detail.ProductID = item.Product.ID; detail.Price = item.Product.Price; detail.Quantity = item.Quantity; orderdetail.Insert(detail); } } catch { } return(Json(new { status = true })); // return RedirectToAction("Index", "Home"); }
public ActionResult DeleteDetail(int id, int orderid) { var dao = new OrderDetailDao(); var result = dao.Delete(id, orderid); return(Redirect("/Admin/AdminManage/OrderDetail")); }
public JsonResult AddRow(string row) { var json = new JavaScriptSerializer().Deserialize <OrderDetail>(row); OrderDetail orderDetail = new OrderDetail(); orderDetail.OrderID = json.OrderID; orderDetail.ProductID = json.ProductID; orderDetail.Price = json.Price; orderDetail.Quantity = json.Quantity; var dao = new OrderDetailDao(); if (dao.CheckExistRow(orderDetail.OrderID, orderDetail.ProductID) == false) { dao.Insert(orderDetail); return(Json(new { status = true })); } else { return(Json(new { status = false })); } }
public ActionResult OrderDetail(long id) { var dao = new OrderDetailDao(); var model = dao.OrderDetail(id); return(View(model)); }
public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new Order(); order.CreatedDate = DateTime.Now; order.CustomerID = null; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CartSession]; var detailDao = new OrderDetailDao(); foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductID = item.Product.ProductID; orderDetail.OrderID = id; orderDetail.Price = item.Product.Price; orderDetail.Quantity = item.Quantity; detailDao.Insert(orderDetail); } } catch (Exception e) { throw; } return(Redirect("/Cart/Success")); }
public ActionResult ThanhToan(string nguoinhan, string dienthoai, string diachi, string email) { var order = new Order(); order.NgayTao = DateTime.Now; order.TenKH = nguoinhan; order.DiaChi = diachi; order.DienThoai = dienthoai; order.Email = email; order.TrangThai = false; try { var id = new OrderDao().Insert(order); var cart = (List <GioHang>)Session["GioHang"]; var detailDao = new OrderDetailDao(); foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.IDProduct = item.iMaSP; orderDetail.IDOrder = id; orderDetail.Price = item.ThanhTien; orderDetail.Quantity = item.iSoLuong; detailDao.Insert(orderDetail); Session["GioHang"] = null; } } catch (Exception ex) { return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
public ActionResult Payment(string shipName, string mobile, string address, string email) { MyDB db = new MyDB(); var order = new Order(); order.ShipName = shipName; order.ShipMobile = mobile; order.ShipAddress = address; order.ShipEmail = email; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CartSesion]; var detailDao = new OrderDetailDao(); var qtt = new ProductDao(); decimal total = 0; foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductID = item.product.ID; orderDetail.OrderID = id; if (item.product.PromotionPrice == null) { total = (item.product.Price.GetValueOrDefault(0) * item.Quantity); orderDetail.Price = total; } else { total = (item.product.PromotionPrice.GetValueOrDefault(0) * item.Quantity); orderDetail.Price = total; } orderDetail.Quantity = item.Quantity; detailDao.Insert(orderDetail); var quantityProduct = new Product(); quantityProduct.ID = item.product.ID; var mode = db.Products.Find(quantityProduct.ID); mode.Quantity = (item.product.Quantity - item.Quantity); db.SaveChanges(); } string content = System.IO.File.ReadAllText(Server.MapPath("/Assets/Client/template/neworder.html")); // content = content.Replace("{{CustomerName}}", shipName); //content = content.Replace("{{Phone}}", mobile); //content = content.Replace("{{Email}}", email); //content = content.Replace("{{Address}}", email); //content = content.Replace("{{Total}}", total.ToString("N0")); //var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); // new MailHelper().SenMail(email, "Đơn hàng mới từ OnlineShop", content); // new MailHelper().SenMail(toEmail, "Đơn hàng mới từ OnlineShop", content); } catch { return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
// GET: Admin/OrderDetail public ActionResult Index(DateTime?date, int page = 1, int pageSize = 5) { var dao = new OrderDetailDao(); var model = dao.ListOrder(date, page, pageSize); ViewBag.SearchString = date; return(View(model)); }
public ActionResult Order(OrderDetail order, string address2, string shiptosecond) { User user = (User)Session[Constrain.User_Session]; OrderDetail orderDetail = new OrderDetail(); OrderDao dao = new ShopDao.Dao.OrderDao(); List <CartItem> cart = (List <CartItem>)Session[Constrain.Cart_Session]; ///check data if (shiptosecond == null) { if (!((order.ShipName == user.Name) && (order.ShipMobile == user.Phone) && (order.ShipEmail == user.Email) && (order.ShipAddress == user.Address))) { ///update user } } else { if (String.IsNullOrEmpty(address2)) { ModelState.AddModelError("", "Second Address can't not be blank"); return(View("Index")); } else { if (!((order.ShipName == user.Name) && (order.ShipMobile == user.Phone) && (order.ShipEmail == user.Email) && (order.ShipAddress == user.Address))) { ///update user } order.ShipAddress = address2; } } order.CreateDate = DateTime.Now; //Create bill if ((Coupon)Session[Constrain.Coupon_Session] != null) { order.CouponID = ((Coupon)Session[Constrain.Coupon_Session]).ID; } int orderID = new OrderDetailDao().Insert(order); foreach (CartItem item in cart) { Order o = new Order() { ProductID = item.Product.ID, OrderID = orderID, Price = (item.Product.Price - (item.Product.Price * item.Product.PromotionPrice / 100)), Quantity = item.Quantity }; dao.Insert(o); } Session[Constrain.Cart_Session] = null; return(View("Success")); }
public ActionResult payment(string shipName, string mobile, string address, string email) { var order = new DonDatHang(); order.NgayDat = DateTime.Now; order.DiaChiGiaoHang = address; order.SoDienThoai = mobile; order.TenNguoiDat = shipName; order.Email = email; order.TrangThai = 1; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CommonConstants.CART_SEDSSION]; var detailDao = new OrderDetailDao(); decimal total = 0; foreach (var item in cart) { var orderDetail = new ChiTietDatHang(); orderDetail.MaDon = id; orderDetail.MaSP = item.Product.MaSP; if (item.Product.GiaKhuyenMai != null) { orderDetail.DonGia = item.Product.GiaKhuyenMai; } else { orderDetail.DonGia = item.Product.DonGia; } orderDetail.SoLuong = item.Quantity; detailDao.Insert(orderDetail); //total += (item.Product.DonGia.GetValueOrDefault(0) * item.Quantity); } Session[CommonConstants.CART_SEDSSION] = null; //string content = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/neworder.html")); //content = content.Replace("{{CustomerName}}", shipName); //content = content.Replace("{{Phone}}", mobile); //content = content.Replace("{{Email}}", email); //content = content.Replace("{{Address}}", address); //content = content.Replace("{{Total}}", total.ToString("N0")); //var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); //new MailHelper().SendMail(email, "Đơn hàng mới từ Shop", content); //new MailHelper().SendMail(toEmail, "Đơn hàng mới từ Shop", content); } catch (Exception ex) { //ghi log return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
// GET: CheckoutClient public ActionResult Checkout() { var orderID = new OrderDao().Find(); var total = new OrderDetailDao().Find(orderID); ViewBag.orderID = orderID; ViewBag.total = total; return(View()); }
public ActionResult Edit(long id) { var order = new OrderDao().GetByID(id); var orderDetail = new OrderDetailDao().ListDetailByOrderId(id); ViewBag.OrderDetail = orderDetail; SetStatusViewBag(); return(View(order)); }
public ActionResult Checkout() { var userSession = (UserLogin)Session[BankOnlineShopConsumer.Common.CommonConstants.USER_SESSION]; var orderID = new OrderDao().Find(userSession.UserID); var total = new OrderDetailDao().Find(orderID); ViewBag.orderID = orderID; ViewBag.total = total; return(View()); }
public ActionResult Payment(string shipName, string phone, string address, string email, string note) { var order = new Order(); order.CreatedDate = DateTime.Now; order.ShipName = shipName; order.ShipEmail = email; order.ShipMobile = phone; order.ShipAddress = address; order.Note = note; order.Status = 1; try { var cart = (List <CartItem>)Session[Common.CommonConstants.CartSession]; if (cart == null || cart.Count < 1) { return(Redirect("/hoan-thanh")); } var id = new OrderDao().Insert(order); TempData["ID"] = id; var detailDao = new OrderDetailDao(); foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductID = item.Product.ID; orderDetail.OrderID = id; if (item.Product.PromotionPrice == 0) { orderDetail.Price = item.Product.Price; } else { orderDetail.Price = item.Product.PromotionPrice; } orderDetail.Quantity = item.Quantity; detailDao.Insert(orderDetail); var dao = new ProductDao(); item.Product.Quantity -= item.Quantity; var product = item.Product; dao.ChangeQuantity(product); } } catch (Exception ex) { throw; } return(Redirect("/hoan-thanh")); }
public JsonResult CreateOrder(string orderViewModel) { var order = new JavaScriptSerializer().Deserialize <OrderViewModel>(orderViewModel); var orderDao = new OrderDao(); var orderNew = new Order(); orderNew.CreatedDate = DateTime.Now; orderNew.CustomerAddress = order.CustomerAddress; orderNew.CustomerMobile = order.CustomerMobile; orderNew.CustomerName = order.CustomerName; orderNew.CustomerEmail = order.CustomerEmail; orderNew.CustomerMessage = order.CustomerMessage; orderNew.PaymentMethod = order.PaymentMethod; orderNew.PaymentStatus = order.PaymentStatus; orderNew.Status = true; orderDao.Insert(orderNew); var detailDao = new OrderDetailDao(); var sessionCart = (List <ShoppingCartViewModel>)Session[CommonConstants.SessionCart]; decimal total = 0; foreach (var item in sessionCart) { var detail = new OrderDetail(); detail.OrderID = orderNew.ID; detail.ProductID = item.ProductId; detail.Quantitty = item.Quantity; if (item.Product.PromotionPrice.HasValue) { detail.Price = item.Product.PromotionPrice.Value; total += (item.Product.PromotionPrice.GetValueOrDefault(0) * item.Quantity); } else { detail.Price = item.Product.Price; total += (item.Product.Price * item.Quantity); } detailDao.Insert(detail); } string content = System.IO.File.ReadAllText(Server.MapPath("~/Assets/client/template/neworder.html")); content = content.Replace("{{CustomerName}}", order.CustomerName); content = content.Replace("{{Phone}}", order.CustomerMobile); content = content.Replace("{{Email}}", order.CustomerEmail); content = content.Replace("{{Address}}", order.CustomerAddress); content = content.Replace("{{Total}}", total.ToString("N0")); MailHelper.SendMail(order.CustomerEmail, "Thông tin đơn đặt hàng từ BookStore", content); Session[CommonConstants.SessionCart] = null; return(Json(new { status = true })); }
public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new Order { CreatedDate = DateTime.Now, ShipName = shipName, ShipAddress = address, ShipMobile = mobile, ShipEmail = email }; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[Common.CommonConstants.CartSession]; var detailDao = new OrderDetailDao(); decimal total = 0; foreach (var item in cart) { var orderDetail = new OrderDetail { ProductID = item.Product.ID, OrderID = id, Price = item.Product.Price, Quantity = item.Quantity }; detailDao.Insert(orderDetail); total += (item.Product.Price.GetValueOrDefault(0) * item.Quantity); } string content = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/neworder.html")); content = content.Replace("{{CustomerName}}", shipName); content = content.Replace("{{Phone}}", mobile); content = content.Replace("{{Email}}", email); content = content.Replace("{{Address}}", address); content = content.Replace("{{Total}}", total.ToString("N0")); var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); new MailHelper().SendEmail(email, "Đơn hàng mới từ OnlineShop", content); new MailHelper().SendEmail(toEmail, "Đơn hàng mới từ OnlineShop", content); } catch (Exception) { // logs return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
public ActionResult Payment() { var cart = (List <CartItem>)Session[Constant.CartSession]; if (cart != null) { var orderDao = new OrderDao(); var order = new Order(); var user = (Model.EF.User)Session[Constant.USER_SESSION]; order.IDCustomer = user.ID; order.ShipName = user.Name; order.ShipPhone = user.Phone; order.ShipAddress = user.Address; order.Status = false; order.CreatedDate = DateTime.Now; long orderId = orderDao.Insert(order); if (orderId != -1) { foreach (var item in cart) { var orderDetailDao = new OrderDetailDao(); var orderDetail = new OrderDetail(); decimal price = item.product.PromotionPrice != null ? item.product.PromotionPrice : item.product.Price; orderDetail.ProductID = item.product.ID; orderDetail.OrderID = orderId; orderDetail.Price = price; orderDetail.Quantity = item.Quantity; if (orderDetailDao.Insert(orderDetail) != true) { TempData["ErrPay"] = ""; return(Redirect("/gio-hang")); } } } else { TempData["ErrPay"] = ""; return(Redirect("/gio-hang")); } Session[Constant.CartSession] = null; TempData["PayOke"] = ""; return(Redirect("/")); } else { TempData["NullCart"] = ""; return(Redirect("/gio-hang")); } }
public ActionResult Payment(string shipName, string mobile, string address) { decimal total = 0; var user = ((UserLoginSession)Session[ConstantSession.USER_CLIENT_SESSION]); var order = new Order(); order.CreateDate = DateTime.Now; order.UserID = user.UserID; order.ShipAddress = address; order.ShipName = shipName; order.ShipMobile = mobile; order.ShipEmail = user.Email; order.Status = 1; try { var id = new OrderDao().Insert(order); var cart = (List <CartItemViewModel>)Session[CartSession]; var detailDao = new OrderDetailDao(); foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductID = item.Product.ID; orderDetail.OrderID = id; var price = item.Product.PromotionPrice.GetValueOrDefault(0) > 0 ? item.Product.PromotionPrice : item.Product.Price; orderDetail.Price = price.Value; orderDetail.Quantity = item.Quantity; detailDao.Insert(orderDetail); total += (price.Value * item.Quantity); } string content = System.IO.File.ReadAllText(Server.MapPath("~/Asset/Client/template/neworder.html")); content = content.Replace("{{CustomerName}}", shipName); content = content.Replace("{{Phone}}", mobile); content = content.Replace("{{Email}}", user.Email); content = content.Replace("{{Address}}", address); content = content.Replace("{{Total}}", total.ToString("N0")); var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); new MailHelper().SendMail(user.Email, "Đơn hàng mới", content);//gui mail khach hang //new MailHelper().SendMail(toEmail, "Đơn hàng mới", content);//gui mail cho quan tri vien } catch (Exception) { //ghi log //return Redirect("/trang-loi"); throw; } Session[CartSession] = null; return(Redirect("/hoan-thanh")); }
public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new Order(); order.CreatedDate = DateTime.Now; order.ShipAddress = address; order.ShipMobile = mobile; order.ShipName = shipName; order.ShipEmail = email; try { var id = new OrderDao().Insert(order); var cart = (List<CartItem>)Session[CartSession]; var detailDao = new OrderDetailDao(); 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); } string content = System.IO.File.ReadAllText(Server.MapPath("~/Assets/client/template/newOrder.html")); content = content.Replace("{{CustomerName}}",shipName); content = content.Replace("{{Phone}}", mobile); content = content.Replace("{{Email}}", email); content = content.Replace("{{Address}}", address); content = content.Replace("{{Total}}", total.ToString("N0")); new MailHelper().SendEmail(email, "Đơn hàng mới từ OnlineShop",content); } catch (Exception ex) { //ghi log return Redirect("/loi-thanh-toan"); } return Redirect("/hoan-thanh"); }