// vrátí všechny záznamy public void GetTableView() { List <VERSION_COMPANY> companiesFromDB = dbRepository.GetCompanies(); TableData = companiesFromDB.Select(x => new CompanyEntity(HelpsMethods.GetIntFromDecimal(x.VER_COMPANY_ID), x.VER_COMPANY, x.VER_COMPANY_ACTIVE, x.VER_COMPANY_DESC, x.VER_COMPANY_INTERFACE, x.VER_COMPANY_TYPE, x.VER_COMPANY_LANGUAGE)) .OrderByDescending(a => a.Id) .ToList(); }
// vrátí vybraný záznam pro potvrzení vymazání public void GetCompanyForDeletionAndUpdate(int companyId) { VERSION_COMPANY companyFromDB = dbRepository.GetCompanyForDeletion(companyId); CompanyEntity.Actives = new List <System.Web.Mvc.SelectListItem>(); CompanyEntity = new CompanyEntity(HelpsMethods.GetIntFromDecimal(companyFromDB.VER_COMPANY_ID), companyFromDB.VER_COMPANY, companyFromDB.VER_COMPANY_ACTIVE, companyFromDB.VER_COMPANY_DESC, companyFromDB.VER_COMPANY_INTERFACE, companyFromDB.VER_COMPANY_TYPE, companyFromDB.VER_COMPANY_LANGUAGE, "not used" ); }
// najde všechny template do DropDownListu pro nové verze z V_VERSION_LOG_TEMPLATE public void GetTemplateVersionsAndCompanies() { // Template versions: List <V_VERSION_LOG_TEMPLATE> templateVersionsFromDb = dbRepository.GetTemplateVersions(); if (TemplateVersions == null) { TemplateVersions = new List <TemplateVersionsSelectListItem>(); } TemplateVersions.Clear(); TemplateVersions.Add(new TemplateVersionsSelectListItem { Text = "option", Value = 0 }); foreach (V_VERSION_LOG_TEMPLATE templateVersion in templateVersionsFromDb) { TemplateVersions.Add(new TemplateVersionsSelectListItem { Text = $"{templateVersion.VER_ID.ToString()} {templateVersion.VER_NAME}", Value = templateVersion.VER_ID } ); } // Companies: if (Companies == null) { List <VERSION_COMPANY> companiesFromDB = dbRepository.GetCompanies(); List <CompanyEntity> companies = companiesFromDB.Select(x => new CompanyEntity(HelpsMethods.GetIntFromDecimal(x.VER_COMPANY_ID), x.VER_COMPANY)).OrderBy(company => company.Name).ToList(); Companies = new List <SelectListItem>(); Companies.Add(new SelectListItem { Text = "option", Value = null }); foreach (var company in companies) { Companies.Add(new SelectListItem { Text = company.Name, Value = company.Name }); } } }
//pro zobrazení vyhledávací masky public void GetSelectionMask() { if (SelectionMaskEntity == null) { SelectionMaskEntity = new SelectionMaskEntity(); } SelectionMaskEntity.VersionDateFrom = DateTime.Now.Date; List <EX_COMPANY_TYPE> companyTypesFromDB = dbRepository.GetCompanyTypes(); List <VERSION_COMPANY> companiesFromDB = dbRepository.GetCompanies(); List <V_COMPANY_GROUP> companiesWithGroupsFromDB = dbRepository.GetCompaniesWithGroupsWithoutEF(); List <CompanyTypeEntity> companyTypes = companyTypesFromDB.Select(x => new CompanyTypeEntity(x.EX_COMPANY_TYPE1, x.EX_DESC)).ToList(); List <CompanyEntity> companies = companiesFromDB.Select(x => new CompanyEntity(HelpsMethods.GetIntFromDecimal(x.VER_COMPANY_ID), x.VER_COMPANY)).OrderBy(company => company.Name) .ToList(); CompanyTypes = new List <SelectListItem>(); Companies = new List <SelectListItem>(); CompaniesWithGroups = new List <SelectListItem>(); //GlobalStatusChoice = new List<SelectListItem>(); CompanyTypes.Add(new SelectListItem { Text = "option", Value = null }); foreach (var companyType in companyTypes) { CompanyTypes.Add(new SelectListItem { Text = companyType.Description, Value = companyType.Type }); } Companies.Add(new SelectListItem { Text = "option", Value = null }); foreach (var company in companies) { Companies.Add(new SelectListItem { Text = company.Name, Value = company.Name }); } CompaniesWithGroups.Add(new SelectListItem { Text = "option", Value = null }); foreach (var companyWithGroup in companiesWithGroupsFromDB) { if (companyWithGroup.VER_GROUP != null) { CompaniesWithGroups.Add(new SelectListItem { Text = $"{companyWithGroup.VER_COMPANY}, {companyWithGroup.VER_GROUP}", Value = $"{companyWithGroup.VER_COMPANY },{companyWithGroup.VER_GROUP }" }); } } //GlobalStatusChoice.Add(new SelectListItem { Text = "options", Value = null }); //GlobalStatusChoice.Add(new SelectListItem { Text = "Silver", Value = "Silver" }); //GlobalStatusChoice.Add(new SelectListItem { Text = "Gold", Value = "Gold" }); }