public ActionResult Index(int id) { FactorSettings factor; var cart = Carts.GetFactor(id); ViewBag.Message = Utilities.MellatBankResult(cart.ResCode.ToString()); // پرداخت موفقیت آمیز if (cart.CartStatus == CartStatus.Success || cart.CartStatus == CartStatus.FuturePay) { #region Success Payment ViewBag.Message += "<br/> کد رهگیری: " + cart.SaleReferenceID; var cartItems = CartItems.GetOrderItems(cart.ID); var user = OSUsers.GetByID(cart.UserID); #region Mapp To Buyer var buyer = Mapper.Map <ViewBuyerInfo>(user); buyer.StateName = user.StateID.HasValue ? Cities.GetCityName(user.StateID.Value) : String.Empty; buyer.CityName = user.CityID.HasValue ? Cities.GetCityName(user.CityID.Value) : String.Empty; #endregion Mapp To Buyer factor = new FactorSettings { IsSuccess = true, CartItems = cartItems, FactorInfo = cart, BuyerInfo = buyer, CompanyEmail = StaticValues.Email, CompanyLogo = StaticValues.Logo, CompanyName = StaticValues.WebsiteTitle, CompanyWebsite = StaticValues.WebsiteUrl, CompanyPhone = StaticValues.Phone }; #endregion Success Payment } else { #region Fail Payment factor = new FactorSettings { IsSuccess = false }; #endregion Fail Payment } return(View("/Areas/User/Views/Factor/Index.cshtml", model: factor)); }
public ActionResult Edit(int id) { var cart = Carts.GetByID(id); EditCart editCart = Mapper.Map <EditCart>(cart); editCart.SendMethodType = cart.SendMethodType; editCart.PaymentMethodType = cart.PaymentMethodType; editCart.Notes = OrderNotes.GetByCartID(id); editCart.OrderItems = CartItems.GetOrderItems(id); return(View("/Areas/Admin/Views/Orders/Edit.cshtml", model: editCart)); }
public JsonResult Get(int pageIndex, int pageSize, string pageOrder, int id) { var list = CartItems.GetOrderItems(id); foreach (var item in list) { string[] name = new string[item.Gifts.Count]; if (item.Gifts.Count > 0) { int i = 0; foreach (var gift in item.Gifts) { name[i] = gift.GiftTitle; i++; } item.ProductTitle += "<br/>" + "<i class='icon-gift'></i>" + String.Join(",", name); } } int total = CartItems.CountOrderItems(id); int totalPage = (int)Math.Ceiling((decimal)total / pageSize); if (pageSize > total) { pageSize = total; } if (list.Count < pageSize) { pageSize = list.Count; } JsonResult result = new JsonResult() { Data = new { TotalPages = totalPage, PageIndex = pageIndex, PageSize = pageSize, Rows = list }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return(result); }
public ActionResult OrderItems(int id) { var model = CartItems.GetOrderItems(id); return(View(url + "OrderItems.cshtml", model: model)); }