コード例 #1
0
        /// <summary>
        /// Orders the view.
        /// </summary>
        /// <param name="fcode">The order code.</param>
        /// <returns>Order view</returns>
        public ActionResult Order_view(string fcode)
        {
            if (!this.CheckMemberlogin())
            {
                return(this.RedirectToAction("login", "account", new { return_url = string.Empty + Url.Action("order_view", "account", new { fcode = fcode }) }));
            }
            else
            {
                var    order_view = new Order_register_view();
                string strBread;
                ViewBag.Title           = App_GlobalResources.Lang.strOrderCode + "  " + fcode;
                strBread                = string.Format("<li><a href=\"" + Url.Action("my_account", "account") + "\">" + App_GlobalResources.Lang.strPersonalInformation + "</a></li>");
                strBread                = string.Format("<li><a href=\"" + Url.Action("order_history", "account") + "\">" + App_GlobalResources.Lang.strOrderHistory + "</a></li>");
                strBread               += "<li>" + fcode + "</li>";
                ViewBag.heading         = App_GlobalResources.Lang.strOrderCode + "  " + fcode;
                ViewBag.str_breadcrumbs = strBread;
                this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.strOrderCode + "  " + fcode);
                this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.strOrderCode + "  " + fcode);

                DetailOrderModels detailsv    = new DetailOrderModels();
                OrderModels       orderModels = new OrderModels();

                if (string.IsNullOrEmpty(fcode))
                {
                    return(this.HttpNotFound());
                }

                C_User usr = new C_User();
                order_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
                order_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
                order_view.ContentShipping   = GeneralModels.GetContent(CommonGlobal.ContentShipping, this.Lang);
                UserModels sv = new UserModels();
                usr = sv.GetUserbyUserName(Session["mem"].ToString());

                var orders = orderModels.GetOrdersbyCode(fcode, usr.Username);
                if (orders == null)
                {
                    order_view.Message = App_GlobalResources.Lang.messOrderNotFound;
                    return(this.PartialView("../page/order_view", order_view));
                }

                order_view.Message             = string.Empty;
                order_view.Email               = orders.Email;
                order_view.Name                = orders.Name;
                order_view.Phone               = orders.Phone;
                order_view.Address             = orders.Address;
                order_view.Gender              = orders.Gender;
                order_view.Sub_total           = CommonGlobal.FormatMoney(orders.Total);
                order_view.Content             = orders.Note;
                order_view.Order_code          = fcode;
                order_view.Payment_status_text = CommonGlobal.GetPaymentStatusString(int.Parse(orders.Payment ?? "0"));
                order_view.Process_status_text = CommonGlobal.GetOrderStatusString(orders.Process ?? 0);

                var list_order_detail = detailsv.GetAllOrderDetail(fcode);
                if (list_order_detail.Count > 0)
                {
                    order_view.ShoppingCart = new ArrayList(list_order_detail.ToArray());
                }

                return(this.PartialView("../page/order_view", order_view));
            }
        }