Exemple #1
0
        //все данные для, например, EmployeeList будут должго грузится - будут создаваться репозитории
        //надо как-то объединить эти вещи, либо раздавать непосредственно из UnitOfWork, что тоже не очень гуд
        //сначала сделать правильно, потестить производительность, потом уже что-то решать
        public EmployeeList CreateEmployeeList()
        {
            EmployeeList list = new EmployeeList();

            try
            {
                list.AddressList          = AddressList.CreateAddressList(context);
                list.EmployeeLanguageList = EmployeeLanguageList.CreateEmployeeLanguageList(context);

                list.EmployeeOfficeList = new EmployeeOfficeList();

                list.EmployeeOfficeList.Offices     = context.Offices.ToList().Select(d => d.ToDTO()).OrderBy(d => d.ShortName);
                list.EmployeeOfficeList.Professions = context.Professions.Where(d => d.Deleted != true).ToList().Select(d => d.ToDTO());
                list.EmployeeOfficeList.Departments = context.Departments.Where(d => d.Deleted != true).ToList().Select(d => d.ToDTO());

                list.ContactTypes        = context.ContactTypes.Where(d => d.Deleted != true).ToList().Select(d => d.ToDTO());
                list.FoundationDocuments = context.FoundationDocuments.Where(d => d.Deleted != true).ToList().Select(d => d.ToDTO());
                list.EducationStudyForms = context.EducationStudyForms.ToList().Select(d => d.ToDTO());
            }
            catch (Exception e)
            {
                string mes = e.Message;
            }
            return(list);
        }