public ActionResult Index() { ICompanyCodeService svc = new CompanyCodeService(); var model = svc.GetAll(); return(View("~/Views/Master/CompanyCode/Index.cshtml", model)); }
public ActionResult Download(Company_Code model) { try { XLWorkbook xlWorkBook = new XLWorkbook(); var xlWorkSheet = xlWorkBook.Worksheets.Add("Master CompanyCode");// xlWorkSheet; xlWorkSheet.Cell(1, 1).Value = "CompanyCode"; xlWorkSheet.Cell(1, 2).Value = "CompanyName"; ICompanyCodeService svc = new CompanyCodeService(); var Data = svc.GetAll(); int Row = 2; if (Data.Count > 0) { for (int i = 0; i < Data.Count; i++) { xlWorkSheet.Cell(Row + i, 1).Value = Data[i].companyCode; xlWorkSheet.Cell(Row + i, 2).Value = Data[i].companyName; } xlWorkSheet.Columns().AdjustToContents(); var path = Server.MapPath("..") + "\\Master-CompanyCode.xlsx"; xlWorkBook.SaveAs(path); xlWorkBook.Dispose(); return(File(path, "application/vnd.ms-excel", "Master-CompanyCode.xlsx")); } return(RedirectToAction("Index")); } catch (Exception ex) { general.AddLogError("CompanyCode Download", ex.Message, ex.StackTrace); return(View("~/Views/Master/CompanyCode/Index.cshtml", model)); } }
public ActionResult Edit(string companyCode) { ICompanyCodeService svc = new CompanyCodeService(); var model = svc.Getdata(companyCode); if (model.status == null) { model.status = "Non Active"; } this.ViewBag.Status = new SelectList(this.GetStatus(), "Key", "Value"); return(View("~/Views/Master/CompanyCode/Edit.cshtml", model)); }
public ActionResult Edit(string companyCode, Company_Code model) { try { ICompanyCodeService svc = new CompanyCodeService(); var result = svc.Edit(companyCode, model); return(RedirectToAction("Index")); } catch (Exception ex) { general.AddLogError("CompanyCode Edit", ex.Message, ex.StackTrace); return(View("~/Views/Master/CompanyCode/Index.cshtml", model)); } }
public ActionResult Add(Company_Code model) { try { ICompanyCodeService svc = new CompanyCodeService(); var result = svc.Add(model); this.ViewBag.Status = new SelectList(this.GetStatus(), "Key", "Value"); this.AddNotification("Your Data Has Been Successfully Saved. ", NotificationType.SUCCESS); return(RedirectToAction("Index")); } catch (Exception ex) { general.AddLogError("CompanyCode Add", ex.Message, ex.StackTrace); this.AddNotification("ID exist", NotificationType.ERROR); this.ViewBag.Status = new SelectList(this.GetStatus(), "Key", "Value"); return(View("~/Views/Master/CompanyCode/Add.cshtml")); } }
public async void UpdateCompany() { foreach (int delete in CompanyCodesToDelete) { CompanyCodeService.DeleteCompanyCode(delete); } foreach (CompanyCode code in CompanyCodes) { if (code.Id == 0) { await CompanyCodeService.CreateCompanyCode(code); } else { CompanyCodeService.UpdateCompanyCode(code.Id, code); } } }
protected async override Task OnInitializedAsync() { profile = $"/profile_admin/{Id}"; country = $"/country_view/{Id}"; user = $"/user_view/{Id}"; article = $"/article_view/{Id}"; overview = $"/overview_admin/{Id}"; CurrentCountry = new Country(); CurrentCountry = await CountryService.GetCountry(Id); Customers = await VailedForCustomerService.GetVailedCustomers(CurrentCountry.Id); if (Customers == null) { Customers = new List <VailedForCustomer> { new VailedForCustomer() { Id = 0 } }; } else { NumberOfCustomers = Customers.Count - 1; } CompanyCodes = new List <CompanyCode>(); CompanyCodes = await CompanyCodeService.GetCompanyCodes(CurrentCountry.Id); if (CompanyCodes.Count == 0) { CompanyCodes.Add(new CompanyCode()); } else { NumberOfCodes = CompanyCodes.Count - 1; } Units = new List <SupplierDeliveryUnit>(); Units = await SupplierDeliveryUnitService.GetSupplierDeliveryUnits(CurrentCountry.Id); if (Units.Count == 0) { Units.Add(new SupplierDeliveryUnit()); } else { NumberOfUnits = Units.Count - 1; } OrderPickGroups = new List <Ilosorderpickgroup>(); OrderPickGroups = await ILOSOrderpickgroupService.GetILOSOrderpickgroup(CurrentCountry.Id); if (OrderPickGroups.Count == 0) { OrderPickGroups.Add(new Ilosorderpickgroup()); } else { NumberOfOrders = OrderPickGroups.Count - 1; } ILOSCodes = new List <PrimaryDciloscode>(); ILOSCodes = await PrimaryDCILOSCodeService.GetPrimaryDCILOSCodes(CurrentCountry.Id); if (ILOSCodes.Count == 0) { ILOSCodes.Add(new PrimaryDciloscode()); } else { NumberOfPrim = ILOSCodes.Count - 1; } TaxCodes = new List <VatTaxCode>(); TaxCodes = await VatTaxCodeService.GetVatTaxCodes(CurrentCountry.Id); if (TaxCodes.Count == 0) { TaxCodes.Add(new VatTaxCode()); } else { NumberOfTAX = TaxCodes.Count - 1; } ILOSCategories = new List <Iloscategory>(); ILOSCategories = await ILOSCategoriesService.GetILOSCategories(CurrentCountry.Id); if (ILOSCategories.Count == 0) { ILOSCategories.Add(new Iloscategory()); } else { NumberOfCat = ILOSCategories.Count - 1; } }