public Common.DTOContainer.ServiceJobDtoContainer GetServiceJobTree() { PersonelTDataAccess pers = new PersonelTDataAccess(); ServiceJobDtoContainer container = new ServiceJobDtoContainer(); ServiceCategoryTDataAccess serviceCatDa = new ServiceCategoryTDataAccess(); ServiceCategoryJobTDataAccess serviceCategoryJobDa = new ServiceCategoryJobTDataAccess(); var serviceCategoris = serviceCatDa.GetAll(); var serviceCatJobs = serviceCategoryJobDa.GetAll(); var serviceJobs = this.dataAccess.GetAll(); container.ServiceCategoryDtos.AddRange(serviceCategoris); container.ServiceCategoryJobs.AddRange(serviceCatJobs); container.ServiceJobs.AddRange(serviceJobs); return(container); }
public Common.DTOContainer.ServiceJobDtoContainer LoadServiveCategoryJobs(int serviceCategoryId) { ServiceJobDtoContainer container = new ServiceJobDtoContainer(); ServiceCategoryJobTDataAccess serviceCategoryJobDa = new ServiceCategoryJobTDataAccess(); var serviceCatJobs = serviceCategoryJobDa.GetAll(it => it.Servicecategoryid == serviceCategoryId); var serviceJobs = LoadServiceJobs(-1).ServiceJobs; foreach (var item in serviceJobs) { var serviceCat = serviceCatJobs.FirstOrDefault(it => it.Servicejobid == item.ServiceJobId); if (serviceCat != null) { serviceCat.ServiceJob = item; container.ServiceCategoryJobs.Add(serviceCat); } else { container.ServiceJobs.Add(item); } } return(container); }