public async Task <PartialViewResult> CreateOrUpdateModal(long?id = null) { ITaxRuleAppService taxRuleAppService = this._taxRuleAppService; NullableIdInput <long> nullableIdInput = new NullableIdInput <long>() { Id = id }; GetTaxRuleForEditOutput taxRuleForEdit = await taxRuleAppService.GetTaxRuleForEdit(nullableIdInput); return(this.PartialView("_CreateOrUpdateModal", new CreateOrUpdateTaxRuleModalViewModel(taxRuleForEdit))); }
public ProductsController(IProductAppService productAppService, IPriceAppService priceAppService, ICustomerAppService customerAppService, ISpecificPriceAppService specificPriceAppService, ITaxRuleAppService taxRuleAppService, ISupplierAppService supplierAppService, IBinaryObjectManager binaryObjectManager, IOrganizationUnitAppService organizationUnitAppService, IRepository <ProductOption, long> productOptionRepository) { this._productAppService = productAppService; this._priceAppService = priceAppService; this._customerAppService = customerAppService; this._specificPriceAppService = specificPriceAppService; this._taxRuleAppService = taxRuleAppService; this._supplierAppService = supplierAppService; this._binaryObjectManager = binaryObjectManager; this._organizationUnitAppService = organizationUnitAppService; this._productOptionRepository = productOptionRepository; }
public async Task <PartialViewResult> CreateOrUpdatePriceModal(long productId, long?id = null) { IPriceAppService priceAppService = this._priceAppService; NullableIdInput <long> nullableIdInput = new NullableIdInput <long>() { Id = id }; CreateOrUpdatePriceModalViewModel createOrUpdatePriceModalViewModel = new CreateOrUpdatePriceModalViewModel(await priceAppService.GetProductPriceForEdit(nullableIdInput)); Product product = await this._productAppService.GetProduct(productId); createOrUpdatePriceModalViewModel.ProductIsCurrentlyActive = product.IsActive; List <SelectListItem> selectListItems = new List <SelectListItem>(); ITaxRuleAppService taxRuleAppService = this._taxRuleAppService; int?tenantId = this.AbpSession.TenantId; ListResultDto <TaxRuleListDto> taxRulesByTenantId = await taxRuleAppService.GetTaxRulesByTenantId(tenantId.Value, true); if (!taxRulesByTenantId.Items.Any <TaxRuleListDto>()) { this.ViewData["TaxRules"] = null; } else { foreach (TaxRuleListDto item in taxRulesByTenantId.Items) { List <SelectListItem> selectListItems1 = selectListItems; SelectListItem selectListItem = new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = false }; selectListItems1.Add(selectListItem); } this.ViewData["TaxRules"] = selectListItems.AsEnumerable <SelectListItem>(); } return(this.PartialView("_CreateOrUpdatePriceModal", createOrUpdatePriceModalViewModel)); }
public async Task <PartialViewResult> CreateOrUpdateTaxRuleRuleModal(long taxRuleId, long?id = null) { ITaxRuleAppService taxRuleAppService = this._taxRuleAppService; NullableIdInput <long> nullableIdInput = new NullableIdInput <long>() { Id = id }; GetTaxRuleRuleForEditOutput taxRuleRuleForEdit = await taxRuleAppService.GetTaxRuleRuleForEdit(nullableIdInput); if (!taxRuleRuleForEdit.TaxRuleRule.Id.HasValue) { taxRuleRuleForEdit.TaxRuleRule.TaxRuleId = taxRuleId; } CreateOrUpdateTaxRuleRuleModalViewModel createOrUpdateTaxRuleRuleModalViewModel = new CreateOrUpdateTaxRuleRuleModalViewModel(taxRuleRuleForEdit); List <SelectListItem> selectListItems = new List <SelectListItem>(); using (HttpClient httpClient = new HttpClient()) { string str = this.Url.RouteUrl("DefaultApiWithAction", new { httproute = "", controller = "Generic", action = "GetCountriesAsSelectListItems", countryId = 0, selectedCountryId = createOrUpdateTaxRuleRuleModalViewModel.TaxRuleRule.CountryId }, this.Request.Url.Scheme); using (HttpResponseMessage async = await httpClient.GetAsync(str)) { if (async.IsSuccessStatusCode) { string str1 = await async.Content.ReadAsStringAsync(); selectListItems = JsonConvert.DeserializeObject <List <SelectListItem> >(str1); } } } List <SelectListItem> selectListItems1 = selectListItems; SelectListItem selectListItem = new SelectListItem() { Text = "", Value = "", Disabled = false }; selectListItems1.Insert(0, selectListItem); this.ViewData["Countries"] = selectListItems.AsEnumerable <SelectListItem>(); List <SelectListItem> selectListItems2 = new List <SelectListItem>(); foreach (Tax taxesForTaxRule in await this._taxAppService.GetTaxesForTaxRules()) { List <SelectListItem> selectListItems3 = selectListItems2; SelectListItem selectListItem1 = new SelectListItem() { Text = string.Format("{0} - {1}%", taxesForTaxRule.Name, taxesForTaxRule.Rate), Value = taxesForTaxRule.Id.ToString(), Disabled = false, Selected = false }; selectListItems3.Add(selectListItem1); } List <SelectListItem> selectListItems4 = selectListItems2; SelectListItem selectListItem2 = new SelectListItem() { Text = "", Value = "", Disabled = false }; selectListItems4.Insert(0, selectListItem2); this.ViewData["Taxes"] = selectListItems2.AsEnumerable <SelectListItem>(); List <SelectListItem> selectListItems5 = new List <SelectListItem>(); foreach (Lookup lookupItem in (new LookupFill("TaxRuleBehaviors", this.AbpSession.TenantId.Value)).LookupItems) { SelectListItem selectListItem3 = new SelectListItem() { Text = lookupItem.Text, Value = lookupItem.Value, Disabled = lookupItem.Disabled, Selected = lookupItem.Selected }; selectListItems5.Add(selectListItem3); } SelectListItem selectListItem4 = new SelectListItem() { Text = "", Value = "", Disabled = false }; selectListItems5.Insert(0, selectListItem4); this.ViewData["TaxRuleBehaviors"] = selectListItems5; return(this.PartialView("_CreateOrUpdateTaxRuleRuleModal", createOrUpdateTaxRuleRuleModalViewModel)); }
public TaxRulesController(ITaxRuleAppService taxRuleAppService, ITaxAppService taxAppService) { this._taxRuleAppService = taxRuleAppService; this._taxAppService = taxAppService; }