public void AskState(OrderLookupResponse response) { TaxManager taxManager = TaxFactory.Create(); while (true) { Console.Clear(); Console.Write($"Enter State ({response.Order.State}): "); string state = (Console.ReadLine()).ToUpper(); TaxResponse taxResponse = taxManager.TaxRate(state); if (string.IsNullOrEmpty(state)) { ConsoleIO.DisplayOrderDetails(response.Order); return; } else { if (taxResponse.Success) { response.Order.State = taxResponse.Tax.StateAbbreviation; //set state response.Order.TaxRate = taxResponse.Tax.TaxRate; //make sure the new tax goes through ConsoleIO.DisplayOrderDetails(response.Order); break; } else { Console.WriteLine(taxResponse.Message); ConsoleIO.PressAnyKey(); continue; //Console.Clear(); } } } }
public IngTaxesPurchasingController() { _factory = new TaxFactory(); _factoryProduct = new ProductFactory(); ViewBag.ListStore = GetListStore(); var xero = Commons.GetIntegrateInfo(CurrentUser.StoreId); //if (xero != null) ViewBag.ListTaxXero = new List <SelectListItem>(); }
public STaxController() { _factory = new TaxFactory(); _factoryProduct = new ProductFactory(); ViewBag.ListStore = GetListStore(); //if(Commons.isIntegrateXero) // ViewBag.ListTaxXero = ListTaxXero(); //var xero = Commons.GetIntegrateInfo(CurrentUser.StoreId); //if (xero != null) ViewBag.ListTaxXero = new List <SelectListItem>(); }
public ResultModels InsertTax(List <TaxModels> lstInfo) { NSLog.Logger.Info("Start insert Tax data.......................", lstInfo); var result = new ResultModels(); if (lstInfo != null && lstInfo.Any()) { TaxFactory taxFactory = new TaxFactory(); result.IsOk = taxFactory.Insert(lstInfo); } return(result); }
[TestCase("New York", "NY", 8.0)]//true public void TaxGetTest(string state, string abb, decimal taxi) { Tax tax = new Tax { StateName = state, StateAbbreviation = abb, TaxRate = taxi }; TaxManager manager = TaxFactory.Create(); TaxResponse response = manager.TaxRate(state); Assert.AreEqual(response.Tax.StateName, state); Assert.AreEqual(response.Tax.StateAbbreviation, abb); Assert.AreEqual(response.Tax.TaxRate, taxi); }
public tax_rule_group GetTaxRuleGroupByRate(decimal rate) { var taxRules = TaxRuleFactory.GetByFilter(PsFilter.Create("id_country", DefaultCountry.id), null, null); foreach (var taxRule in taxRules) { if (taxRule.id_tax.HasValue && taxRule.id_tax_rules_group.HasValue) { var tax = TaxFactory.Get(taxRule.id_tax.Value); if (tax.rate == rate) { return(TaxRuleGroupFactory.Get(taxRule.id_tax_rules_group.Value)); } } } return(null); }
public void SetState(Order order) { TaxManager taxManager = TaxFactory.Create(); while (true) { Console.Clear(); Console.WriteLine("State Choices: "); foreach (Tax t in taxManager.GetTaxes()) { Console.WriteLine($"{t.StateAbbreviation},{t.StateName},Tax Rate: {t.TaxRate}"); } Console.Write($"Enter State: "); string state = (Console.ReadLine()).ToUpper(); TaxResponse taxResponse = taxManager.TaxRate(state); if (string.IsNullOrEmpty(state)) { Console.WriteLine("The entry was null or empty"); ConsoleIO.PressAnyKey(); continue; } else { if (taxResponse.Success) { order.State = taxResponse.Tax.StateAbbreviation; //set state order.TaxRate = taxResponse.Tax.TaxRate; //make sure the new tax goes through break; } else { Console.WriteLine(taxResponse.Message); ConsoleIO.PressAnyKey(); continue; //Console.Clear(); } } } }
public STaxController() { _factory = new TaxFactory(); _productFactory = new ProductFactory(); }