Exemplo n.º 1
0
        public ActionResult EnrollmentComplete(string token)
        {
            var model        = new EnrollmentCompleteViewModel();
            var args         = Security.Decrypt(token);
            var hasOrder     = args["OrderID"] != null;
            var hasAutoOrder = args["AutoOrderID"] != null;

            model.CustomerID = Convert.ToInt32(args["CustomerID"]);
            if (hasOrder)
            {
                model.OrderID = Convert.ToInt32(args["OrderID"]);
                model.Order   = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
                {
                    CustomerID          = model.CustomerID,
                    OrderID             = model.OrderID,
                    IncludeOrderDetails = true,
                    IncludePayments     = true
                }).FirstOrDefault();
            }
            if (hasAutoOrder)
            {
                model.AutoOrderID = Convert.ToInt32(args["AutoOrderID"]);
                try
                {
                    model.AutoOrder = Exigo.GetCustomerAutoOrders(Identity.Customer.CustomerID, model.AutoOrderID).FirstOrDefault();
                }
                catch { }
            }

            return(View(model));
        }
        public ActionResult OrderInvoice(string token)
        {
            var orderID = Convert.ToInt32(Security.Decrypt(token, Identity.Current.CustomerID));

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

            return(View("OrderInvoice", model));
        }
        public ActionResult OrderDetail(string token)
        {
            SetCommonViewBagData();

            var orderID = Convert.ToInt32(Security.Decrypt(token, Identity.Current.CustomerID));
            var model   = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                OrderID             = orderID,
                IncludeOrderDetails = true
            }).ToList();

            return(View("OrderList", model));
        }
        public ActionResult SearchOrdersList(int id)
        {
            SetCommonViewBagData();
            ViewBag.IsSearch = true;

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                OrderID             = id,
                IncludeOrderDetails = true
            }).Where(c => c.Other11.IsNullOrEmpty()).ToList();

            return(View("OrderList", model));
        }
        public ActionResult CancelledOrdersList(int page)
        {
            SetCommonViewBagData();

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                Page                = page,
                RowCount            = RowCount,
                OrderStatuses       = new int[] { OrderStatuses.Cancelled },
                IncludeOrderDetails = true
            }).Where(c => c.Other11.IsNullOrEmpty()).ToList();

            return(View("OrderList", model));
        }
        public ActionResult OrderList(int page, DateTime?StartDate, DateTime?EndDate, int?OrderID)
        {
            SetCommonViewBagData();

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID          = Identity.Current.CustomerID,
                Page                = page,
                RowCount            = RowCount,
                OrderID             = OrderID,   //20161228 80967 DV.
                StartDate           = StartDate, //20161211 82887 DV. Client requested ability to work with date range.
                EndDate             = EndDate,   //20161211 82887 DV. Client requested ability to work with date range.
                IncludeOrderDetails = true
            });                                  //.Where(c => c.Other11.IsNullOrEmpty()).ToList(); //20161216 80967 DV. Per client remove this filter entirely.  If we bring it back move it inside the GetCustomerOrders method

            return(View("OrderList", model));
        }
        public ActionResult FeesOrdersList(int page, DateTime?StartDate, DateTime?EndDate, int?OrderID)
        {
            SetCommonViewBagData();

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID                    = Identity.Current.CustomerID,
                Page                          = page,
                RowCount                      = RowCount,
                OrderID                       = OrderID,   //20161228 80967 DV.
                StartDate                     = StartDate, //20161222 80967 DV. Client requested ability to work with date range.
                EndDate                       = EndDate,   //20161222 80967 DV. Client requested ability to work with date range.
                IncludeOrderDetails           = true,
                ShowOnlyFeesAndServicesOrders = true       //20161222 80967 DV. Use this to only show orders that contain ItemID 58 or 627
            });                                            //.Where(c => !c.Other11.IsNullOrEmpty()).ToList(); //20121222 80967 DV. Per client remove this filter entirely.  If we bring it back move it inside the GetCustomerOrders method since it was not working correctly anyway

            return(View("OrderList", model));
        }
        public ActionResult OpenOrdersList(int page)
        {
            SetCommonViewBagData();

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID    = Identity.Current.CustomerID,
                Page          = page,
                RowCount      = RowCount,
                OrderStatuses = new int[] {
                    OrderStatuses.Incomplete,
                    OrderStatuses.Pending,
                    OrderStatuses.CCDeclined,
                    OrderStatuses.ACHDeclined,
                    OrderStatuses.CCPending,
                    OrderStatuses.ACHPending,
                    OrderStatuses.PendingInventory,
                    OrderStatuses.Accepted
                },
                IncludeOrderDetails = true
            }).Where(c => c.Other11.IsNullOrEmpty()).ToList();

            return(View("OrderList", model));
        }
        public ActionResult Index()
        {
            var model      = new DashboardViewModel();
            var tasks      = new List <Task>();
            var customerID = Identity.Current.CustomerID;

            if (!GlobalSettings.Globalization.HideForLive)
            {
                tasks.Add(Task.Factory.StartNew(() =>
                {
                    try
                    {
                        model.RecentOrders = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
                        {
                            CustomerID          = customerID,
                            IncludeOrderDetails = false,
                            Page     = 1,
                            RowCount = 4
                        }).ToList();
                    }
                    catch (Exception ex) { }
                }));
            }
            // Get the volumes
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.Volumes = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest
                    {
                        CustomerID   = customerID,
                        PeriodTypeID = PeriodTypes.Default,
                        VolumeIDs    = new[] { 1, 2, 4, 16, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 91 }
                    });
                }
                catch (Exception ex) { }
            }));

            // Get the current commissions
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.CurrentCommissions = Exigo.GetCustomerRealTimeCommissions(new GetCustomerRealTimeCommissionsRequest
                    {
                        CustomerID = customerID
                    }).ToList();
                }
                catch (Exception) { }
            }));

            // Get the customer's recent organization activity
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.RecentActivities = Exigo.GetCustomerRecentActivity(new GetCustomerRecentActivityRequest
                    {
                        CustomerID = customerID,
                        Page       = 1,
                        RowCount   = 50
                    }).ToList();
                }
                catch (Exception ex) { }
            }));


            // Get the newest distributors
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.NewestDistributors = Exigo.GetNewestDistributors(new GetNewestDistributorsRequest
                    {
                        CustomerID = customerID,
                        RowCount   = 12,
                        MaxLevel   = 99999
                    }).Where(c => c.CustomerID != customerID).ToList();
                }
                catch (Exception ex) { }
            }));


            // Perform all tasks
            Task.WaitAll(tasks.ToArray());
            tasks.Clear();

            return(View(model));
        }
Exemplo n.º 10
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));
        }