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> GetCompanies(UserModel userModel)
        {
            var companyController = new CompanyController();
            var companies         = new List <CompanyModel>();

            companies = userModel.CompaniesModel;
            if (companies == null || companies.Count == 0)
            {
                companies = companyController.GetCompanies(userModel);
            }

            foreach (var company in companies)
            {
                company.CheckBox  = true;
                company.ShortName = string.Format("{0} - {1}", company.CodeCompany, company.ShortName);
            }
            return(companies);
        }
Esempio n. 3
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);
        }