Esempio n. 1
0
        public List <CompanyModel> GetCompaniesUpdate(string CompaniesSplit)
        {
            var companyController = new CompanyController();
            var companies         = companyController.List();
            var companiesSplit    = new List <string>();

            if (!string.IsNullOrEmpty(CompaniesSplit))
            {
                companiesSplit = CompaniesSplit.Split(
                    separator: new char[] { ',' },
                    options: StringSplitOptions.RemoveEmptyEntries).ToList();
            }

            foreach (var company in companies)
            {
                if (companiesSplit.Exists(item => item == company.CodeCompany))
                {
                    company.CheckBox = true;
                }
                else
                {
                    company.CheckBox = false;
                }
                company.ShortName = string.Format("{0} - {1}", company.CodeCompany, company.ShortName);
            }
            return(companies);
        }
Esempio n. 2
0
        public List <CompanyModel> GetCompaniesUpdate(UserModel userModel)
        {
            var companyController = new CompanyController();
            var companies         = companyController.List();
            var companiesUser     = GetCompanies(userModel);

            foreach (var company in companies)
            {
                if (companiesUser.Exists(item => item.CodeCompany == company.CodeCompany))
                {
                    company.CheckBox = true;
                }
                else
                {
                    company.CheckBox = false;
                }
                company.ShortName = string.Format("{0} - {1}", company.CodeCompany, company.ShortName);
            }
            return(companies);
        }