private static List <ModuleTemplateWrap> ConvertToModuleWrapperClass(List <Module> modules, IEncounterViewModel encounterViewModel) { List <ModuleTemplateWrap> moduleTemplateWraps = new List <ModuleTemplateWrap>(); foreach (var module in modules) { var moduleTemplate = new ModuleTemplate(module); var formTemplateWraps = new List <FormTemplateWrap>(); foreach (var form in module.Forms) { // form.ClientEncounters = _interviewService.LoadEncounters(Client.Id, form.Id).ToList(); foreach (var program in form.Programs) { var formTemplate = new FormTemplate(form, program); //formTemplate.Block = isBlocked; var encounters = form.ClientEncounters.Where(x => x.EncounterTypeId == program.EncounterTypeId).ToList(); formTemplate.Encounters = ConvertToEncounterWrapperClass(encounters, encounterViewModel, formTemplate.Display); var formTemplateWrap = new FormTemplateWrap(encounterViewModel, formTemplate); formTemplateWraps.Add(formTemplateWrap); } } moduleTemplate.AllForms = formTemplateWraps.Count > 0 ? formTemplateWraps.OrderBy(x => x.FormTemplate.Rank).ToList() : formTemplateWraps; var moduleTemplateWrap = new ModuleTemplateWrap(encounterViewModel, moduleTemplate); moduleTemplateWraps.Add(moduleTemplateWrap); } moduleTemplateWraps = moduleTemplateWraps.OrderBy(x => x.ModuleTemplate.Rank).ToList(); return(moduleTemplateWraps); }
private static List <FormTemplateWrap> ConvertToFormWrapperClass(List <Form> forms, ClientDashboardViewModel clientDashboardViewModel) { List <FormTemplateWrap> list = new List <FormTemplateWrap>(); foreach (var r in forms) { var f = new FormTemplate(r); f.Encounters = ConvertToEncounterWrapperClass(r.ClientEncounters, clientDashboardViewModel, f.Display); var fw = new FormTemplateWrap(clientDashboardViewModel, f); list.Add(fw); } return(list); }
private static List <FormTemplateWrap> ConvertToFormWrapperClass(List <Form> forms, IEncounterViewModel encounterViewModel) { List <FormTemplateWrap> list = new List <FormTemplateWrap>(); foreach (var r in forms) { foreach (var program in r.Programs) { var f = new FormTemplate(r, program); var pe = r.ClientEncounters.Where(x => x.EncounterTypeId == program.EncounterTypeId).ToList(); f.Encounters = ConvertToEncounterWrapperClass(pe, encounterViewModel, f.Display); var fw = new FormTemplateWrap(encounterViewModel, f); list.Add(fw); } } list = list.OrderBy(x => x.FormTemplate.Rank).ToList(); return(list); }