예제 #1
0
        public CreateAutoOrderRequest(Common.Api.ExigoOData.AutoOrder autoOrder)
        {
            var model = new CreateAutoOrderRequest();

            if (autoOrder == null)
            {
                return;
            }

            CustomerID                 = autoOrder.CustomerID;
            ExistingAutoOrderID        = autoOrder.AutoOrderID;
            OverwriteExistingAutoOrder = true;

            Frequency    = Exigo.GetFrequencyType(autoOrder.FrequencyTypeID);
            StartDate    = autoOrder.StartDate;
            StopDate     = autoOrder.StopDate;
            CurrencyCode = autoOrder.CurrencyCode;
            WarehouseID  = autoOrder.WarehouseID;
            ShipMethodID = autoOrder.ShipMethodID;
            PriceType    = PriceTypes.Wholesale;
            PaymentType  = Exigo.GetAutoOrderPaymentType(autoOrder.AutoOrderPaymentTypeID);
            ProcessType  = Exigo.GetAutoOrderProcessType(autoOrder.AutoOrderProcessTypeID);
            Details      = autoOrder.Details.Select(c => new OrderDetailRequest()
            {
                ItemCode                         = c.ItemCode,
                Quantity                         = c.Quantity,
                ParentItemCode                   = c.ParentItemCode,
                BusinessVolumeEachOverride       = c.BusinessVolumeEachOverride,
                CommissionableVolumeEachOverride = c.CommissionableVolumeEachOverride,
                DescriptionOverride              = c.ItemDescription,
                PriceEachOverride                = c.PriceEachOverride,
                ShippingPriceEachOverride        = c.ShippingPriceEachOverride,
                TaxableEachOverride              = c.TaxableEachOverride
            }).ToArray();

            FirstName = autoOrder.FirstName;
            LastName  = autoOrder.LastName;
            Company   = autoOrder.Company;
            Address1  = autoOrder.Address1;
            Address2  = autoOrder.Address2;
            City      = autoOrder.City;
            State     = autoOrder.State;
            Zip       = autoOrder.Zip;
            Country   = autoOrder.Country;
            Email     = autoOrder.Email;
            Phone     = autoOrder.Phone;

            Notes       = autoOrder.Notes;
            Other11     = autoOrder.Other11;
            Other12     = autoOrder.Other12;
            Other13     = autoOrder.Other13;
            Other14     = autoOrder.Other14;
            Other15     = autoOrder.Other15;
            Other16     = autoOrder.Other16;
            Other17     = autoOrder.Other17;
            Other18     = autoOrder.Other18;
            Other19     = autoOrder.Other19;
            Other20     = autoOrder.Other20;
            Description = autoOrder.AutoOrderDescription;
        }
        public ActionResult UpdateAutoOrderDate(AutoOrderDateViewModel dateVM)
        {
            if (dateVM.NextDate > dateVM.CreatedDate)
            {
                try
                {
                    var autoorderid   = dateVM.AutoorderID;
                    var frequencyType = Exigo.GetFrequencyType((int)dateVM.Frequency);

                    Exigo.UpdateCustomerAutoOrderRunDate(Identity.Customer.CustomerID, autoorderid, dateVM.NextDate, frequencyType);


                    var model   = Exigo.GetCustomerAutoOrder(Identity.Customer.CustomerID, autoorderid);
                    var partial = RenderPartialViewToString("displaytemplates/autoorderrow", model);

                    return(new JsonNetResult(new
                    {
                        success = true,
                        html = partial,
                        autoorderid = autoorderid
                    }));
                }
                catch (Exception ex)
                {
                    return(new JsonNetResult(new
                    {
                        success = false,
                        message = ex.Message
                    }));
                }
            }
            else
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = "Please Select A Valid Date"
                }));
            }
        }