private List<ViewModel.Account.Order.orderItem> getOrderList(string orderDatailLinkPrefix, int userId, bool isRegisteredUser) { orderShared os = new orderShared(db); List<ViewModel.Account.Order.orderItem> helper = new List<ViewModel.Account.Order.orderItem>(); var orderList = os.getOrderList(userId, isRegisteredUser); var moneyCulture = CultureInfo.CreateSpecificCulture("en-US"); foreach (var item in orderList) { ViewModel.Account.Order.orderItem helperItem = new ViewModel.Account.Order.orderItem(); helperItem.orderDateStr = item.createDate.ToString("dd.mm.yyyy"); helperItem.orderDetailLink = orderDatailLinkPrefix + item.orderGuid; helperItem.orderNo = item.orderNo; helperItem.orderStatu = os.getOrderStatuString(item.orderStatu); helperItem.totalPriceStr = item.totalCheckoutPrice.ToString("F2", moneyCulture); helper.Add(helperItem); } return helper; }
public ActionResult OrderDetail(int pageId, string orderGuid) { orderShared os = new orderShared(db); addressShared ads = new addressShared(db); if (!string.IsNullOrWhiteSpace(orderGuid)) { var orderItem = os.getOrderByGuid(orderGuid); if (orderItem != null) { pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); var orderPage = ps.getPageByType(pageType.accountOrders, langId); helperOrderDetail pageHelper = new helperOrderDetail(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.orderSummary = os.getOrderSummary(orderItem); pageHelper.orderNo = orderItem.orderNo; pageHelper.orderStatuHtml = os.getOrderStatuString(orderItem.orderStatu); // On Cargo Add Track Url if ((orderStatu)orderItem.orderStatu == orderStatu.onCargo && !string.IsNullOrWhiteSpace(orderItem.shipmentNo)) { pageHelper.orderStatuHtml = pageHelper.orderStatuHtml + " " + os.getCargoTrackHtml(orderItem); } pageHelper.salesAgreement = orderItem.salesAgreement; pageHelper.preSalesAgreement = orderItem.preSalesAgreement; var deliveryAddressItem = ads.getAddressHtmlFromObj(orderItem.deliveryAddressId, orderItem.deliveryAddressObj); var billingAddressItem = ads.getAddressHtmlFromObj(orderItem.billingAddressId, orderItem.billingAddressObj); pageHelper.deliveryAddress = ads.getAddressHtml(deliveryAddressItem, AddressHtmlType.orderDetail, this); pageHelper.billingAddress = ads.getAddressHtml(billingAddressItem, AddressHtmlType.orderDetail, this); pageHelper.orderNote = orderItem.orderNote; topCart cartItem = (topCart)ViewData["topCart"]; if (cartItem.isRegisteredUser) { pageHelper.isGoBackExist = true; var mainAccountPage = ps.getPageByType(pageType.account, langId); var orderListPage = ps.getPageByType(pageType.accountOrders, langId); pageHelper.goBackLink = langCode + "/" + mainAccountPage.url + "/" + orderListPage.url + ".html"; } return View(pageHelper); } } return null; }
public ActionResult OrderSearch(helperOrderSearch pageHelper, int pageId) { topCart cartItem = (topCart)ViewData["topCart"]; pageShared ps = new pageShared(db); var pageMainAccount = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); if (cartItem.isRegisteredUser) { var pageOrderList = ps.getPageByType(pageType.accountOrders, langId); return Redirect("~/" + langCode + "/" + pageMainAccount.url + "/" + pageOrderList.url + ".html"); } var pageItem = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.detail = pageItem.detail; pageHelper.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == pageItem.tbl_category.parentId && a.statu).ToList(); pageHelper.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId); // Redirect to Login Page With Session if (!string.IsNullOrWhiteSpace(pageHelper.toLogin)) { Session["redirectPage"] = Request.Url.ToString(); var loginPage = ps.getPageByType(pageType.registerLogin, langId); if (loginPage == null) { errorSend(new Exception("loginPage gelmemesi, checkout Step 0"), "LoginPage gelmemesi, checkout Step 0", true); return null; } return Redirect("~/" + langCode + "/" + loginPage.url + ".html"); } else // Search Order { if (ModelState.IsValid) { orderShared os = new orderShared(db); var orderItem = os.getUnregisteredOrder(pageHelper.email, pageHelper.orderNo); if (orderItem != null) { var orderDetailPage = ps.getPageByType(pageType.accountOrderDetail, langId); return Redirect("~/" + langCode + "/" + orderDetailPage.url + ".html?orderGuid=" + orderItem.orderGuid); } else { pageHelper.isMessageExist = true; pageHelper.message = getErrorMessage(lang.orderSearchNotFound); return View(pageHelper); } } else { pageHelper.isMessageExist = true; pageHelper.message = getErrorMessage(getModelStateError(ModelState)); return View(pageHelper); } } }
public ActionResult Complete(int pageId) { helperComplete pageHelper = new helperComplete(); orderShared os = new orderShared(db); checkoutShared cs = new checkoutShared(db); checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"]; if (Request.QueryString["orderGuid"] != null) { string orderNo = ""; string orderDetailLink = ""; sharedCheckoutItemLoad(pageId, pageHelper, checkoutItem); Session["checkoutProcess"] = null; var orderItem = os.getOrderByGuid(Request.QueryString["orderGuid"]); if (orderItem != null) { // orderNo orderNo = orderItem.orderNo; pageHelper.detail = pageHelper.detail.Replace("[order_no]", orderNo); // orderDetail Link orderDetailLink = os.getOrderDetailLink(orderItem.orderGuid, langId, langCode); pageHelper.detail = pageHelper.detail.Replace("[orderNoDetail]", Url.Content("~/" + orderDetailLink)); if (orderItem.paymentTypeId == (int)paymentOption.transfer) { pageHelper.isTransferOrder = true; pageHelper.transferAcountHtml = cs.getTransferInfoHtml(orderItem.eftId, langId, this, TransferHtmlType.orderDetail); } return View(pageHelper); } } // Return Basket return returnBasketMainPage(null); }