Пример #1
0
        public ShipDateReturn GetShipDates(UserSelectedContext customerInfo)
        {
            ShipDateReturn retVal = new ShipDateReturn();

            try {
                System.IO.StringWriter requestBody = new System.IO.StringWriter();
                GetRequestBody(customerInfo.BranchId, customerInfo.CustomerId).WriteXml(requestBody);

                com.benekeith.ShipDateService.ShipDateSoapClient shipdayService = new com.benekeith.ShipDateService.ShipDateSoapClient();

                ShippingDateResponseMain             response    = GetResponse(shipdayService.GetShipDates(requestBody.ToString()));
                ShippingDateResponseMain.CustomerRow customerRow = response.Customer[0];

                foreach (ShippingDateResponseMain.ShipDateRow shipDates in response.ShipDate)
                {
                    DateTime workDate = DateTime.Parse(shipDates.ShipDate_Column);

                    retVal.ShipDates.Add(new ShipDate()
                    {
                        CutOffDateTime = GetCutOffTime(workDate, customerRow.CutOffTime),
                        Date           = workDate.ToString("yyyy-MM-dd"),
                        DayOfWeek      = GetDayOfWeek(workDate)
                    });
                }
            } catch {
            }

            return(retVal);
        }
Пример #2
0
        public Guid ImportFromPowerMenu(VendorPurchaseOrderRequest powerMenuRequest)
        {
            UserProfile user = _profileLogic.GetUserProfile(powerMenuRequest.Login.Username).UserProfiles.FirstOrDefault();

            Core.Models.ShoppingCart.ShoppingCart newCart = new Core.Models.ShoppingCart.ShoppingCart();
            newCart.Items = new List <ShoppingCartItem>();

            // Get the customer information needed
            List <Customer> customers = _customerRepo.GetCustomersForUser(user.UserId);
            Customer        customer  = customers.Distinct()
                                        .Where(x =>
                                               x.CustomerNumber.Equals(powerMenuRequest.Order.OrderHeader.CustomerNumber) &&
                                               x.IsPowerMenu.Equals(true)
                                               )
                                        .FirstOrDefault();

            // Set the selected user context
            UserSelectedContext context = new UserSelectedContext();

            context.BranchId   = customer.CustomerBranch;
            context.CustomerId = customer.CustomerNumber;

            // Build the generated cart
            newCart.BranchId = customer.CustomerBranch;
            newCart.PONumber = string.Format("eMenuManage Order {0} ", powerMenuRequest.Order.OrderHeader.PurchaseOrderNumber);
            newCart.Name     = string.Format("eMenuManage Order - {0}", DateTime.Now.ToString());

            List <ShoppingCartItem> shoppingCartItems = powerMenuRequest.Order.OrderItem.ToShoppingCartItems(context.BranchId.ToLower());

            newCart.Items.AddRange(shoppingCartItems);

            ShipDateReturn validDates = _shipDateRepository.GetShipDates(context);

            newCart.RequestedShipDate = validDates.ShipDates.FirstOrDefault().Date;

            return(_shoppingCartLogic.CreateCart(user, context, newCart));
        }