Пример #1
0
        public void LoadCreditCardTypes()
        {
            var service      = new LookUpService();
            var allcardTypes = service.GetAllCreditCardTypes();

            Assert.IsTrue(allcardTypes.Count > 0);
        }
Пример #2
0
        internal static List <string> GenerateCountryIDs()
        {
            var service   = new LookUpService();
            var countries = service.GetAllCountries();

            return(countries.Select(c => c.CountryID.TrimEnd()).OrderBy(c => c).ToList());
        }
        public string GetAmazonServerName(string ipAddress)
        {
            string getCountry = LookUpService.GetCountry(ipAddress).ToLower();

            string getServerName = (string)HttpContext.Current.Cache[getCountry + "-serverName"];

            if (string.IsNullOrEmpty(getServerName))
            {
                using (Searchwar_netEntities db = new Searchwar_netEntities()) {
                    AmazonServerolumnNoPosition paramaters = new AmazonServerolumnNoPosition()
                    {
                        getCountry = getCountry
                    };

                    getServerName = GetFastServerName.Invoke(db, paramaters).ToString();
                }

                HttpContext.Current.Cache.Add(getCountry + "-serverName", getServerName, null, TimeZoneManager.DateTimeNow.AddDays(10),
                                              System.Web.Caching.Cache.NoSlidingExpiration,
                                              System.Web.Caching.CacheItemPriority.Normal,
                                              null);
            }

            return(getServerName);
        }
Пример #4
0
        internal static List <string> GenerateStateIDsByCountry(string countryId)
        {
            var service = new LookUpService();
            var states  = service.GetStatesByCountryID(countryId);

            return(states);
        }
Пример #5
0
        public async Task ICanGetAllDropDownValuesForRouteStatus()
        {
            var svc    = new LookUpService();
            var result = await svc.GetAllRouteFilters((int)RouteFilterTypes.RouteStatus);

            Assert.IsTrue(result.Count > 0);
        }
Пример #6
0
        public void GetCountryWithStatesRelationship()
        {
            var service   = new LookUpService();
            var countries = service.GetAllCountries();

            Assert.IsTrue(countries.Count > 0);
            Assert.IsTrue(countries.First().States.Count > 0);
        }
Пример #7
0
        public TurboTenKeyControl()
        {
            InitializeComponent();

            service = new LookUpService();
            tapes   = new List <Tape>();
            batches = new List <Batch>();
        }
        public async Task <JsonResult> ConceptsForCenter(int SygmaCenterNumber)
        {
            var model = await LookUpService.GetConceptsForCenter(SygmaCenterNumber);

            model = model.OrderBy(o => o.Concept).ToList();
            return(Json(JsonConvert.SerializeObject(model), JsonRequestBehavior.AllowGet));
            //return Json(List<ConceptType>RouteFilterService.GetConceptsForCenter(SygmaCenterNumber));
        }
Пример #9
0
        public void LoadGroupByGroupIDShouldReturnData()
        {
            var service = new LookUpService();
            var group   = service.GetGroupByGroupID("Nerds");

            Assert.IsNotNull(group);
            Assert.IsNotNull(group.Users.FirstOrDefault(c => c.UserID == "DomingoG"));
        }
        public async Task <ActionResult> List(SearchRouteSortableViewModel criteria)
        {
            var model = new RouteListViewModel(await RouteService.SearchAsync(criteria))
            {
                RouteColumnOption = new ColumnOptionViewModel(await LookUpService.GetColumnOptionsForUserAndPage(UserName, "ROUTETRACKERROUTES"), ColumnTypes.Route)
            };

            return(PartialView("_routeList", model));
        }
        public async Task <ActionResult> Stops(int routeId)
        {
            var routeWithStops = await RouteService.GetByRouteIdAsync(routeId);

            var model = new RouteStopViewModel(routeWithStops)
            {
                StopColumnOption = new ColumnOptionViewModel(await LookUpService.GetColumnOptionsForUserAndPage(UserName, "ROUTETRACKERSTOPS"), ColumnTypes.Stop)
            };

            return(PartialView("_stopList", model));
        }
Пример #12
0
        private Tuple <int, int> GetWarehouseAndTerritory(string state)
        {
            var lookupService = new LookUpService();
            var branchID      = lookupService.GetBranchIDByState(state);
            var warehouses    = lookupService.GetBranches();

            var whseKey           = warehouses.FirstOrDefault(wh => wh.BranchID == branchID).Key;
            var salesTerritoryKey = warehouses.FirstOrDefault(wh => wh.BranchID == branchID).SalesTerritoryKey;

            return(new Tuple <int, int>(whseKey, salesTerritoryKey));
        }
        public async Task <ActionResult> ColumnOption()
        {
            var rco = new ColumnOptionViewModel(await LookUpService.GetColumnOptionsForUserAndPage(UserName, "ROUTETRACKERROUTES"), ColumnTypes.Route);
            var sco = new ColumnOptionViewModel(await LookUpService.GetColumnOptionsForUserAndPage(UserName, "ROUTETRACKERSTOPS"), ColumnTypes.Stop);
            RouteTrackerColumnOptionViewModel model = new RouteTrackerColumnOptionViewModel
            {
                RouteColumnOption = rco,
                StopColumnOption  = sco
            };

            return(PartialView("_trackerColumnOptions", model));
        }
Пример #14
0
 //PUBLIC FUNCTIONS
 public void Initialize(int _custKey, Module _module)
 {
     service      = new CustomerService();
     luService    = new LookUpService();
     cardTypes    = luService.GetAllCreditCardTypes();
     customer     = service.LoadCustomer(_custKey);
     creditCards  = service.LoadCreditCardsByCustKey(_custKey);
     selectedCard = creditCards.Count > 0 ? creditCards.FirstOrDefault(c => c.Preferred == -1) : new CreditCard();
     module       = _module;
     custKey      = _custKey;
     SelectPreferredCard();
 }
        public async Task <ActionResult> Index()
        {
            if (CurrentAPIEnvironment != "PROD")
            {
                ViewBag.Title = $"Route Tracker (ATM VER: {ViewBag.Version}, API: {CurrentAPIEnvironment})";
            }
            else
            {
                ViewBag.Title = "Route Tracker";
            }
            var ModifiedTypes = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Removed", Value = "removed"
                },
                new SelectListItem {
                    Text = "Added", Value = "added"
                },
                new SelectListItem {
                    Text = "Time Adjusted", Value = "timeChanged"
                }
            };

            var model = new RouteTrackerViewModel
            {
                CenterSelectList = new SelectList(await CenterService.GetAll(UserName), "SygmaCenterNo", "Center"),
                //FilterByDispatchDay = new MultiSelectList((await LookUpService.GetAllRouteFilters((int)RouteFilterTypes.RouteNumbers)).OrderBy(x => x.DisplayOrder), "Value", "Text"),
                ModifiedTypeSelectList = new SelectList(ModifiedTypes, "Value", "Text"),
                ConceptTypeList        = new SelectList(await LookUpService.GetAllConcepts(), "ConceptId", "Concept")
            };

            var dates = (await LookUpService.GetAllRouteFilters((int)RouteFilterTypes.DateRange)).Where(s => s.IsActive == 1).OrderBy(x => x.DisplayOrder);

            foreach (var d in dates)
            {
                if (d.Value == "0")
                {
                    d.Text = d.Text + " - " + (((((int)DateTime.Today.DayOfWeek)) % 7) + 1).ToString() + "00s";
                }
                else if (d.Value == "1")
                {
                    d.Text = d.Text + " - " + (((((int)DateTime.Today.DayOfWeek) + 1) % 7) + 1).ToString() + "00s";
                }
                else if (d.Value == "3")
                {
                    d.Text = d.Text + " - " + (DateTime.Today.DayOfWeek == DayOfWeek.Sunday ? "7" : (((((int)DateTime.Today.DayOfWeek) - 1) % 7) + 1).ToString()) + "00s";
                }
            }
            model.DateRangeList = new SelectList(dates, "Value", "Text");

            return(View(model));
        }
        //-----------------------LOAD-------------------------
        private void Billing_Load(object sender, EventArgs e)
        {
            settings = new AccountSettings();
            service  = new LookUpService();

            var custClasses = service.GetCustClasses();

            custClass = custClasses.FirstOrDefault(c => c.Key == CustClassKey);

            custTypes    = service.GetCustClasses();
            paymentTerms = service.GetPaymentTerms();
            shipMethods  = service.GetShipMethods();

            //do we need?
            invoiceCopies = service.GetDistinctInvoiceCopies();
            invoiceCopies = invoiceCopies.OrderBy(c => c).ToList();
            invoiceCopies.Insert(0, "");
            invoiceCopies.RemoveAll(c => c == null);

            cboPaymentTerms.DisplayMember = "Id";
            cboPaymentTerms.ValueMember   = "Key";
            cboPaymentTerms.DataSource    = paymentTerms;

            cboShipMethod.DisplayMember = "ShipMethID";
            cboShipMethod.ValueMember   = "Key";
            cboShipMethod.DataSource    = shipMethods;

            lblStatus.Text      = "Set additional account settings.";
            lblStatus.ForeColor = Color.Red;

            if (CustClassKey == 0)
            {
                rdoEndUser.Checked = true;
            }
            else
            {
                SetControlsFromPassedInFields();
            }

            containerValidator.Validate();
        }
Пример #17
0
        private void SetTaxRateTextBox()
        {
            if (currentCustAddress.TaxSchedule == null)
            {
                var lookup = new LookUpService();
                if (currentCustAddress.STaxSchdKey != null)
                {
                    var schdKey = (int)currentCustAddress.STaxSchdKey;

                    var taxSchedule = lookup.GetTaxScheduleByKey(schdKey);
                    txtTaxRate.Text = string.Format("{0:G29} %", taxSchedule.Rate);
                }
                else
                {
                    txtTaxRate.Text = string.Format("0.0 %");
                }
            }
            else
            {
                var taxSchedule = currentCustAddress.TaxSchedule;
                txtTaxRate.Text = string.Format("{0:G29} %", taxSchedule.Rate);
            }
        }
        public async Task <ActionResult> MovedStopPopup(int routePlanId, int modifiedType)
        {
            //call service layer to get collection of stops with the route plan ID
            var matchingStopCollection = new List <Stop>(await RouteService.GetStopsByRoutePlanIdAsync(routePlanId));

            //stop collection should only ever have 2 entries
            if (matchingStopCollection.Count != 2)
            {
                throw new UnexpectedStopException("An unexpected number of Stops was encountered");
            }
            //decide which stop is destination based on direction you are coming from
            int desiredRouteId = matchingStopCollection.First(s => s.RoutePlanModificationTypeId != modifiedType).RouteId;

            //get route info from routeID
            var model = new MovedStopPopupRouteStopViewModel(await RouteService.GetByRouteIdAsync(desiredRouteId))
            {
                //need both route and stop column options
                StopColumnOption  = new ColumnOptionViewModel(await LookUpService.GetColumnOptionsForUserAndPage(UserName, "ROUTETRACKERSTOPS"), ColumnTypes.Stop),
                RouteColumnOption = new ColumnOptionViewModel(await LookUpService.GetColumnOptionsForUserAndPage(UserName, "ROUTETRACKERROUTES"), ColumnTypes.Route)
            };

            //send model of route info to popup
            return(PartialView("_movedStopPopup", model));
        }
        public async Task SaveColumnOption(UpdateRouteTrackerColumnOptionViewModel model)
        {
            await LookUpService.UpdateColumnOptionAsync(UserName, "ROUTETRACKERROUTES", JsonConvert.SerializeObject(model.RouteColumnOption));

            await LookUpService.UpdateColumnOptionAsync(UserName, "ROUTETRACKERSTOPS", JsonConvert.SerializeObject(model.StopColumnOption));
        }
Пример #20
0
        public void AddCustomerWithDependencies()
        {
            var custId        = "VMLOP91900-2";
            var custService   = new CustomerService();
            var lookupService = new LookUpService();


            var custclasses     = lookupService.GetCustClasses();
            var dealerCustClass = custclasses.Where(c => c.Key == 40).First();

            var primaryAddress     = GetHydratedAddress("877 Monterey Pass Road");
            var primaryCustAddress = GetHydratedCustAddress(dealerCustClass, API.Enums.CustAddrType.Primary);

            var billtoAddress     = GetHydratedAddress("875 Monterey Pass Road");
            var billtoCustAddress = GetHydratedCustAddress(dealerCustClass, API.Enums.CustAddrType.BillTo);

            var shiptoAddress     = GetHydratedAddress("876 Monterey Pass Road");
            var shiptoCustAddress = GetHydratedCustAddress(dealerCustClass, API.Enums.CustAddrType.ShipTo);

            var primaryContact = new Contact()
            {
                Name            = "Victor Lopez",
                FirstName       = "Victor",
                LastName        = "Lopez",
                Title           = "Accounting",
                Email           = "*****@*****.**",
                MobilePhone     = "6262325365",
                Phone           = "6262325365",
                PhoneExt        = "",
                Fax             = "",
                FaxExt          = "",
                CCCreditMemo    = 0,
                CCCustStmnt     = 0,
                CCDebitMemo     = 0,
                CCEFTRemittance = 0,
                CCFinanceCharge = 0,
                CCInvoice       = 0,
                CCPurchaseOrder = 0,
                CCRMA           = 0,
                CCSalesOrder    = 0,
                Deleted         = 0,
                EMailFormat     = 3,
                EntityType      = 501,
                UpdateCounter   = 1
            };

            var newCustomer = new Customer();

            newCustomer.PrimaryAddress       = primaryAddress;
            newCustomer.DefaultBillToAddress = billtoAddress;
            newCustomer.DefaultShipToAddress = shiptoAddress;
            newCustomer.PrimaryContact       = primaryContact;
            //newCustomer.Contacts = new List<Contact>();
            //newCustomer.Contacts.Add(primaryContact);


            newCustomer.Id = custId;
            newCustomer.AllowCustRefund          = dealerCustClass.AllowCustRefund;
            newCustomer.AllowWriteOff            = dealerCustClass.AllowWriteOff;
            newCustomer.BillingType              = dealerCustClass.BillingType;
            newCustomer.BillToNationalAcctParent = 0;
            newCustomer.CompanyId             = "CPC";
            newCustomer.ConsolidatedStatement = 0;
            newCustomer.CreateDate            = DateTime.Now;
            newCustomer.CreateUserID          = Environment.UserName;
            newCustomer.CreateType            = 1;
            newCustomer.CreditLimit           = dealerCustClass.CreditLimit;
            newCustomer.CreditLimitAgeCat     = dealerCustClass.CreditLimitAgeCat;
            newCustomer.CreditLimitUsed       = 1;
            newCustomer.CustClassKey          = dealerCustClass.Key;
            newCustomer.DateEstab             = DateTime.Now;
            newCustomer.DfltSalesAcctKey      = dealerCustClass.DfltSalesAcctKey;
            newCustomer.DfltMaxUpCharge       = 0;
            newCustomer.DfltMaxUpChargeType   = 0;
            newCustomer.Name                    = "Victor Refrig";
            newCustomer.FinChgFlatAmt           = dealerCustClass.FinChgFlatAmt;
            newCustomer.FinChgPct               = dealerCustClass.FinChgPct;
            newCustomer.Hold                    = 0;
            newCustomer.PmtByNationalAcctParent = 0;
            newCustomer.PrintDunnMsg            = dealerCustClass.PrintDunnMsg;
            newCustomer.ReqCreditLimit          = 0;
            newCustomer.ReqPO                   = dealerCustClass.ReqPO;
            newCustomer.RetntPct                = dealerCustClass.RetntPct;
            newCustomer.StmtCycleKey            = dealerCustClass.StmtCycleKey;
            newCustomer.StmtFormKey             = dealerCustClass.StmtFormKey;
            newCustomer.ShipPriority            = 3;
            newCustomer.Status                  = 1;
            newCustomer.StmtFormKey             = dealerCustClass.StmtFormKey;
            newCustomer.TradeDiscPct            = dealerCustClass.TradeDiscPct;
            newCustomer.UpdateCounter           = 1;
            //newCustomer.UserFld2 = accountSettings.PricePackSlip;
            //newCustomer.SalesSourceKey = accountSettings.SalesSourceKey;


            newCustomer.CustAddresses = new List <CustAddress>();
            newCustomer.CustAddresses.Add(primaryCustAddress);
            newCustomer.CustAddresses.Add(billtoCustAddress);
            newCustomer.CustAddresses.Add(shiptoCustAddress);


            var transmittals = new List <DocTransmittal>
            {
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 501
                },
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 502
                },
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 503
                },
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 505
                },
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 522
                },
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 801
                },
                new DocTransmittal {
                    EMail = 0, EMailFormat = 3, Fax = 0, HardCopy = 0, IncludeCC = 0, TranType = 835
                }
            };

            newCustomer.DocTransmittals = new List <DocTransmittal>();
            newCustomer.DocTransmittals.AddRange(transmittals);

            custService.AddCustomerWithDependencies(newCustomer);
        }
Пример #21
0
        public void AddCustAddressAndAssignDefaultShipTo()
        {
            var service       = new CustomerService();
            var lookupService = new LookUpService();
            var custClass     = lookupService.GetCustClasses().First();

            var custAddress = new CustAddress();

            custAddress.AllowInvtSubst         = custClass.AllowInvtSubst;
            custAddress.BackOrdPrice           = 0;
            custAddress.BOLReqd                = 0;
            custAddress.CarrierBillMeth        = 6;
            custAddress.CloseSOLineOnFirstShip = 0;
            custAddress.CloseSOOnFirstShip     = 0;
            custAddress.CreateDate             = DateTime.Now;
            custAddress.CreateType             = 0;
            custAddress.CreateUserID           = Environment.UserName;
            custAddress.CurrID               = custClass.CurrID;
            custAddress.CustAddrID           = "Test";
            custAddress.CustKey              = 65932;
            custAddress.FOBKey               = custClass.FOBKey;
            custAddress.FreightMethod        = 2;
            custAddress.InvoiceReqd          = 0;
            custAddress.LanguageID           = custClass.LanguageID;
            custAddress.PackListContentsReqd = 0;
            custAddress.PackListReqd         = 0;
            custAddress.PriceAdj             = 0;
            custAddress.PriceBase            = 0;
            custAddress.PrintOrderAck        = 0;
            custAddress.RequireSOAck         = custClass.RequireSOAck;
            custAddress.ShipComplete         = custClass.ShipComplete;
            custAddress.ShipDays             = 3;
            custAddress.ShipLabelFormKey     = custClass.ShipLabelFormKey;
            custAddress.ShipLabelsReqd       = 0;
            custAddress.SOAckFormKey         = custClass.SOAckFormKey;
            custAddress.SOAckMeth            = 0;
            custAddress.SperKey              = custClass.SperKey;
            custAddress.WhseKey              = 23;
            custAddress.UsePromoPrice        = 0;
            custAddress.ShipMethKey          = custClass.ShipMethKey;
            custAddress.InvcFormKey          = custClass.InvcFormKey;
            custAddress.PackListFormKey      = 84;
            custAddress.SalesTerritoryKey    = 2;

            var address = new Address()
            {
                Name                = "Case Parts",
                Line1               = "877 Monterey Pass Rd",
                City                = "Monterey Park",
                State               = "CA",
                Zip                 = "91754",
                Country             = "USA",
                Residential         = 1,
                TransactionOverride = 0,
                UpdateCounter       = 1
            };

            custAddress.Address = address;

            Customer customer = service.LoadCustomerWithDependenciesByKey(29301);

            service.InsertCustAddrAndAssignCustomerDefaultAddress(customer, custAddress, true, true);

            Assert.IsTrue(true);
        }