public ActionResult RatingOrder(string OrderGuid, int?OrderStatus, string Description) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); OrderStatus = C.Core.Common.OrderStatus.DaGiaoHang_DaXacNhan.GetHashCode(); string MemberGuid = null; if (User.Identity.GetMemberLogin() != null) { MemberGuid = User.Identity.GetMemberLogin().MemberGuid; } shOrderHistoryService _orderHistory = new shOrderHistoryService(); shOrderHistory orderHistory = _orderHistory.Insert_Update( null, order.OrderGuid, OrderStatus, MemberGuid, Description, null, true, DateTime.Now); order.OrderStatus = OrderStatus; _order.Update(order); if (Request.IsAjaxRequest()) { return(Json("OK", JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }
public ActionResult Details(string OrderGuid) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); if (order == null) { order = new shOrder(); } return(PartialView("Details", order)); }
public ActionResult RatingOrder(string OrderGuid) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); List <DropDownList> ds = OrderHelper.DanhSachTrangThaiGioHang(null); ViewBag.OrderStatus = new SelectList(ds, "Value", "Text", C.Core.Common.OrderStatus.DaGiaoHang_DaXacNhan.GetHashCode()); return(PartialView("RatingOrder", order)); }
public ActionResult ChuyenXuLyDonHang(string OrderGuid) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); qtUserService _user = new qtUserService(); IEnumerable <qtUser> ds = _user.DanhSachUser(null, TypeHelper.ToInt32(User.Identity.GetUserLogin().Unitid), null); ViewBag.UserId = new SelectList(ds, "UserId", "UserName", order.UserId); return(PartialView("ChuyenXuLyDonHang", order)); }
public static MvcHtmlString GiaTriDonhang(this HtmlHelper helper, string OrderGuid) { string html = string.Empty; shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); if (order != null) { html = "Giá trị đơn hàng: " + Format.FormatDecimalToString(order.Total.GetValueOrDefault(0) - order.FeeShip.GetValueOrDefault(0)); } return(new MvcHtmlString(html)); }
public static MvcHtmlString ThongTinDonhang(this HtmlHelper helper, string OrderGuid) { string html = string.Empty; shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); if (order != null) { html = "Thông tin đơn hàng: " + order.FullName + "/" + order.Phone + "/" + order.Email + "/" + order.Address; } return(new MvcHtmlString(html)); }
public ActionResult DetailOrder(string OrderGuid) { shOrderService _service = new shOrderService(); shOrder order = _service.FindByKey(OrderGuid); if (order == null) { order = new shOrder(); } shOrderHistoryService _orderHistory = new shOrderHistoryService(); IEnumerable <shOrderHistory> ds = _orderHistory.FindList().Where(x => x.OrderGuid == OrderGuid && x.Status == true).OrderBy(x => x.CreateDate); ViewBag.dsOrderHistory = ds; return(PartialView("DetailOrder", order)); }
public ActionResult OrderProcessing(string OrderGuid) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); List <DropDownList> ds = OrderHelper.DanhSachTrangThaiGioHang(null); ViewBag.OrderStatus = new SelectList(ds, "Value", "Text", C.Core.Common.OrderStatus.DangGiaoHang.GetHashCode()); if (order == null) { order = new shOrder(); } return(PartialView("OrderProcessing", order)); }
public ActionResult CheckOrderProcessing(string OrderGuid, int?OrderStatus, string Description) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); string message = "OK"; shOrderDetailService _orderdetail = new shOrderDetailService(); IEnumerable <shOrderDetail> ds = _orderdetail.DanhSachOrderDetailBy(order.OrderGuid, order.MemberGuid, null); bool check = false; shSizeService _size = new shSizeService(); shSetSize size = new shSetSize(); foreach (var item in ds) { size = _size.FindByKey(item.SizeGuid); if (item.Number > size.Inventory) { check = true; } } if (check) { message = "Số lượng hàng tồn trong kho không đủ. Xin vui lòng thao tác lại"; } if (Request.IsAjaxRequest()) { return(Json(message, JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }
public ActionResult OrderStatus(string OrderGuid, int?Status, string Description) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); using (var context = new ShopOnlineDb()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { if (order != null) { shOrderHistoryService _orderHistory = new shOrderHistoryService(); // 1. Hủy đơn hàng int UserId = 0; if (User.Identity.GetUserLogin() != null) { UserId = User.Identity.GetUserLogin().Userid; } string MemberGuid = null; shOrderHistory orderHistory = _orderHistory.Insert_Update( null, order.OrderGuid, order.OrderStatus, MemberGuid, Description, UserId, true, DateTime.Now); order.OrderStatus = C.Core.Common.OrderStatus.HuyDonHang.GetHashCode(); _order.Update(order); // 2. Thông báo cho member đơn hàng hủy shMemberService _member = new shMemberService(); shMember member = _member.FindByKey(order.MemberGuid); int MemberId = member != null ? member.MemberId : 0; ThongBaoService _thongbao = new ThongBaoService(); _thongbao.InsertOrUpdate( null, "Thông báo đơn hàng bị hủy", "Đơn hàng của bạn đã bị hủy. Nếu có thắc mắc vui lòng liên hệ với quản trị viên để biết thêm chi tiết", null, UserId, MemberId, DateTime.Now, false, Config.THONG_BAO_DA_XU_LY_DON_HANG, null ); // 3. gửi email thông báo hủy đơn hàng string noidungdonhang = EmailHelper.NoiDungDonHang(order, new List <CartItem>()); string noidungEmail = EmailHelper.NoiDungMailThongBaoHuyDatHang(noidungdonhang); EmailHelper.ThongBaoEmailDonHangMoiToiNguoiDatHang(member.Email, noidungEmail); } dbContextTransaction.Commit(); } catch (Exception ex) { dbContextTransaction.Rollback(); } } } if (Request.IsAjaxRequest()) { return(Json("OK", JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }