Exemple #1
0
        public string GetAllEmployeesByType(string Type)
        {
            try
            {
                List <EmployeeViewModel> employeeViewModelList = Mapper.Map <List <Employee>, List <EmployeeViewModel> >(_otherExpenseBusiness.GetAllEmployeesByType(Type));
                var empList = employeeViewModelList != null?employeeViewModelList.Select(i => new { i.ID, i.Name }).ToList() : null;

                return(JsonConvert.SerializeObject(new { Result = "OK", Records = empList }));
            }
            catch (Exception ex)
            {
                AppConstMessage cm = c.GetMessage(ex.Message);
                return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
            }
        }
Exemple #2
0
        public ActionResult Index(string id)
        {
            ViewBag.value = id;
            List <SelectListItem>     selectListItem = new List <SelectListItem>();
            SupplierInvoicesViewModel SI             = new SupplierInvoicesViewModel();

            SI.suppliersObj    = new SuppliersViewModel();
            SI.paymentTermsObj = new PaymentTermsViewModel();
            SI.companiesObj    = new CompaniesViewModel();
            SI.TaxTypeObj      = new TaxTypesViewModel();
            Settings s = new Settings();

            SI.InvoiceDateFormatted      = DateTime.Today.ToString(s.dateformat);
            SI.suppliersObj.SupplierList = new List <SelectListItem>();
            selectListItem = new List <SelectListItem>();
            List <SuppliersViewModel> SuppList = Mapper.Map <List <Supplier>, List <SuppliersViewModel> >(_supplierBusiness.GetAllSuppliers());

            foreach (SuppliersViewModel Supp in SuppList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = Supp.CompanyName,
                    Value    = Supp.ID.ToString(),
                    Selected = false
                });
            }
            SI.suppliersObj.SupplierList = selectListItem;

            SI.paymentTermsObj.PaymentTermsList = new List <SelectListItem>();
            selectListItem = new List <SelectListItem>();
            List <PaymentTermsViewModel> PayTermList = Mapper.Map <List <PaymentTerms>, List <PaymentTermsViewModel> >(_paymentTermsBusiness.GetAllPayTerms());

            foreach (PaymentTermsViewModel PayT in PayTermList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = PayT.Description,
                    Value    = PayT.Code,
                    Selected = false
                });
            }
            SI.paymentTermsObj.PaymentTermsList = selectListItem;

            SI.companiesObj.CompanyList = new List <SelectListItem>();
            selectListItem = new List <SelectListItem>();
            List <CompaniesViewModel> CompaniesList = Mapper.Map <List <Companies>, List <CompaniesViewModel> >(_companiesBusiness.GetAllCompanies());

            foreach (CompaniesViewModel Cmp in CompaniesList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = Cmp.Name,
                    Value    = Cmp.Code,
                    Selected = false
                });
            }
            SI.companiesObj.CompanyList = selectListItem;

            SI.TaxTypeObj.TaxTypesList = new List <SelectListItem>();
            selectListItem             = new List <SelectListItem>();
            List <TaxTypesViewModel> TaxTypeList = Mapper.Map <List <TaxTypes>, List <TaxTypesViewModel> >(_taxTypesBusiness.GetAllTaxTypes());

            foreach (TaxTypesViewModel TaTy in TaxTypeList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = TaTy.Description,
                    Value    = TaTy.Code,
                    Selected = false
                });
            }
            SI.TaxTypeObj.TaxTypesList = selectListItem;

            selectListItem = new List <SelectListItem>();
            List <ChartOfAccountsViewModel> chartOfAccountList = Mapper.Map <List <ChartOfAccounts>, List <ChartOfAccountsViewModel> >(_otherExpenseBusiness.GetAllAccountTypes("SUP"));

            foreach (ChartOfAccountsViewModel cav in chartOfAccountList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = cav.TypeDesc,
                    Value    = cav.Code + ":" + cav.ISEmploy,
                    Selected = false,
                });
            }
            SI.AccountTypesList = selectListItem;

            selectListItem = new List <SelectListItem>();
            List <EmployeeViewModel> employeeViewModelList = Mapper.Map <List <Employee>, List <EmployeeViewModel> >(_otherExpenseBusiness.GetAllEmployeesByType("OTH"));

            foreach (EmployeeViewModel EVM in employeeViewModelList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = EVM.Name,
                    Value    = EVM.ID.ToString(),
                    Selected = false,
                });
            }
            SI.SubTypeList = selectListItem;
            return(View(SI));
        }