コード例 #1
0
        public ActionResult OrderDetail(string token)
        {
            var orderID = Convert.ToInt32(Security.Decrypt(token, Identity.Current.CustomerID));
            var model   = new GetCustomerOrdersResponse();

            ViewBag.IsSearch = true;

            model = Exigo.GetCustomerOrders_SQL(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                Page                = 1,
                RowCount            = RowCount,
                LanguageID          = Exigo.GetSelectedLanguageID(),
                IncludeOrderDetails = true,
                OrderID             = orderID,
                TotalRowCount       = 1
            });

            model.RowCount = RowCount;
            model.Page     = 1;

            model.OrderCount = 1;


            return(View("OrderList", model));
        }
コード例 #2
0
        public ActionResult OpenOrdersList(int page = 1, int count = 0)
        {
            var model = new GetCustomerOrdersResponse();

            try
            {
                model = Exigo.GetCustomerOrders_SQL(new GetCustomerOrdersRequest
                {
                    CustomerID          = Identity.Current.CustomerID,
                    Page                = page,
                    RowCount            = RowCount,
                    LanguageID          = Exigo.GetSelectedLanguageID(),
                    IncludeOrderDetails = true,
                    OrderStatuses       = new int[] {
                        OrderStatuses.Incomplete,
                        OrderStatuses.Pending,
                        OrderStatuses.CCDeclined,
                        OrderStatuses.ACHDeclined,
                        OrderStatuses.CCPending,
                        OrderStatuses.ACHPending,
                        OrderStatuses.PendingInventory,
                        OrderStatuses.Accepted
                    },
                    TotalRowCount = count
                });

                model.RowCount = RowCount;
                model.Page     = page;


                if (Request.IsAjaxRequest())
                {
                    model.Page = page++;
                    var orderNodes = this.RenderPartialViewToString("Partials/_OrderListRows", model);
                    var pagination = this.RenderPartialViewToString("Partials/_OrderListPagination", model);

                    return(new JsonNetResult(new
                    {
                        success = true,
                        orderNodes,
                        pagination
                    }));
                }
            }
            catch (Exception ex)
            {
                if (Request.IsAjaxRequest())
                {
                    return(new JsonNetResult(new
                    {
                        success = false,
                        message = ex.Message
                    }));
                }
            }
            return(View("OrderList", model));
        }
コード例 #3
0
        public ActionResult OrderInvoice(string token)
        {
            var orderID = Convert.ToInt32(Security.Decrypt(token, Identity.Current.CustomerID));

            var model = Exigo.GetCustomerOrders_SQL(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                OrderID             = orderID,
                IncludeOrderDetails = true,
                LanguageID          = Exigo.GetSelectedLanguageID(),
                IncludePayments     = true
            }).Orders.FirstOrDefault();

            return(View("OrderInvoice", model));
        }
コード例 #4
0
        public JsonNetResult GetRecentOrders()
        {
            var customerID = Identity.Current.CustomerID;

            try
            {
                var orders = Cache.Get("Dashboard_OrdersCard_{0}".FormatWith(customerID),
                                       TimeSpan.FromMinutes(WidgetCacheTimeout),
                                       () =>
                                       Exigo.GetCustomerOrders_SQL(new GetCustomerOrdersRequest
                {
                    CustomerID          = customerID,
                    IncludeOrderDetails = false,
                    OrderStatuses       = new int[] {
                        OrderStatuses.Accepted,
                        OrderStatuses.Printed,
                        OrderStatuses.Shipped
                    },
                    Page     = 1,
                    RowCount = 4
                }).Orders
                                       );



                var html = this.RenderPartialViewToString("Cards/RecentOrders", orders);

                return(new JsonNetResult(new
                {
                    success = true,
                    html
                }));
            }
            catch (Exception ex)
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }
コード例 #5
0
        public ActionResult SearchOrdersList(int id)
        {
            ViewBag.IsSearch = true;
            var model = new GetCustomerOrdersResponse();

            model = Exigo.GetCustomerOrders_SQL(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                Page                = 1,
                RowCount            = RowCount,
                LanguageID          = Exigo.GetSelectedLanguageID(),
                IncludeOrderDetails = true,
                OrderID             = id,
                TotalRowCount       = 1
            });

            model.RowCount = RowCount;
            model.Page     = 1;

            model.OrderCount = model.Orders.Count();

            return(View("OrderList", model));
        }
コード例 #6
0
        public ActionResult OrderList(int page = 1, int count = 0)
        {
            var model = new GetCustomerOrdersResponse();

            try
            {
                model = Exigo.GetCustomerOrders_SQL(new GetCustomerOrdersRequest
                {
                    CustomerID          = Identity.Current.CustomerID,
                    Page                = page,
                    RowCount            = RowCount,
                    LanguageID          = Exigo.GetSelectedLanguageID(),
                    IncludeOrderDetails = true,
                    TotalRowCount       = count
                });

                // Check for brand new Orders in our NewOrders cookie
                #region New Order Logic
                // Create a cookie to store our newest Order ID to ensure it shows on the Order History page
                var orderIDCookie = Request.Cookies["NewOrder_{0}".FormatWith(Identity.Current.CustomerID)];

                if (orderIDCookie != null && orderIDCookie.Value.CanBeParsedAs <int>())
                {
                    int newOrderID = Convert.ToInt32(orderIDCookie.Value);

                    if (model.Orders.Any(c => c.OrderID == newOrderID))
                    {
                        Response.Cookies["NewOrder_{0}".FormatWith(Identity.Current.CustomerID)].Expires = DateTime.Now.AddDays(-1);
                    }
                    else
                    {
                        var newApiOrder = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
                        {
                            CustomerID          = Identity.Current.CustomerID,
                            IncludeOrderDetails = true,
                            LanguageID          = Exigo.GetSelectedLanguageID(),
                            OrderID             = newOrderID,
                            TotalRowCount       = 1
                        }).FirstOrDefault();

                        if (newApiOrder != null)
                        {
                            model.Orders.Add(newApiOrder);
                            RowCount = RowCount + 1;
                        }
                    }
                }
                #endregion

                model.RowCount = RowCount;
                model.Page     = page;

                if (Request.IsAjaxRequest())
                {
                    model.Page = page++;
                    var orderNodes = this.RenderPartialViewToString("Partials/_OrderListRows", model);
                    var pagination = this.RenderPartialViewToString("Partials/_OrderListPagination", model);

                    return(new JsonNetResult(new
                    {
                        success = true,
                        orderNodes,
                        pagination
                    }));
                }
            }
            catch (Exception ex)
            {
                if (Request.IsAjaxRequest())
                {
                    return(new JsonNetResult(new
                    {
                        success = false,
                        message = ex.Message
                    }));
                }
            }

            return(View("OrderList", model));
        }