コード例 #1
0
        public JsonNetResult GetAutoOrderModal(string orderid)
        {
            var context = Exigo.OData();
            int OrderID = Convert.ToInt32(orderid);
            AutoOrderAddEditCartViewModel model = new AutoOrderAddEditCartViewModel();

            var autoorder = (ExigoService.AutoOrder)Exigo.OData().AutoOrders.Expand("Details")
                .Where(a => a.CustomerID == Identity.Customer.CustomerID)
                .Where(a => a.AutoOrderID == Convert.ToInt32(orderid))
                .First();

            foreach (var detail in autoorder.Details)
            {
                detail.ImageUrl = context.Items.Where(c => c.ItemCode == detail.ItemCode).FirstOrDefault().TinyImageUrl;
            }

            model.AutoOrder = autoorder;

            var products = Exigo.GetItems(new ExigoService.GetItemsRequest
            {
                Configuration = Identity.Customer.Market.Configuration.Orders,
                IncludeChildCategories = true
            }).ToList();

            var orderItems = autoorder.Details.ToList();
            var itemCodeList = orderItems.Select(c => c.ItemCode).ToList();

            products.Where(p => itemCodeList.Contains(p.ItemCode)).ToList().ForEach(p => products.Remove(p));

            model.ProductsList = products;

            var html = this.RenderPartialViewToString("../AutoOrders/DisplayTemplates/AutoOrderEditOrder", model);

            return new JsonNetResult(new
            {
                html = html
            });
        }
コード例 #2
0
        // Edit Order Module
        public ActionResult FetchEditAutoOrderOrderModule(int autoorderid)
        {
            var autoorder = Exigo.GetCustomerAutoOrder(Identity.Customer.CustomerID, autoorderid);

            var configuration = Identity.Customer.Market.Configuration.BackOfficeAutoOrders;
            var products = Exigo.GetItems(new ExigoService.GetItemsRequest
            {
                Configuration = configuration,
                IncludeChildCategories = true
            }).ToList();

            var orderItems = autoorder.Details.ToList();
            var itemCodeList = orderItems.Select(c => c.ItemCode).ToList();

            products.Where(p => itemCodeList.Contains(p.ItemCode)).ToList().ForEach(p => products.Remove(p));


            // Populate our model with the products and the Auto Order
            var model = new AutoOrderAddEditCartViewModel();
            model.AutoOrder = autoorder;
            model.ProductsList = products;


            string html = RenderPartialViewToString("displaytemplates/autoordereditorder", model);

            return new JsonNetResult(new
            {
                success = true,
                module = html
            });
        }