private IncidentLookupListsCacheObject GetIncidentAndLookups() { UcbServiceClient sc = new UcbServiceClient(); try { // Get instance of Language Manager LanguageManager language = new LanguageManager(); // Get users localisation string locale = language.GetLocale(); IncidentVMDC returnObject = sc.GetIncident(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "Ucb", "", null, locale); sc.Close(); IncidentLookupListsCacheObject CachedLists = new IncidentLookupListsCacheObject(); CachedLists.JobRoleList = Mapper.Map <IEnumerable <JobRoleDC>, List <JobRoleModel> >(returnObject.JobRoleList); CachedLists.ReferrerList = Mapper.Map <IEnumerable <ReferrerDC>, List <ReferrerModel> >(returnObject.ReferrerList); CachedLists.StaffMemberBusinessList = Mapper.Map <IEnumerable <OrganisationDC>, List <OrganisationModel> >(returnObject.StaffMemberBusinessList.OrderBy(x => x.Name)); CachedLists.StaffMemberBusinessAreaList = Mapper.Map <IEnumerable <OrganisationDC>, List <OrganisationModel> >(returnObject.StaffMemberBusinessAreaList.OrderBy(x => x.Name)); //***Note - have removed sites/home offices from cache*** //CachedLists.StaffMemberHomeOfficeList = Mapper.Map<IEnumerable<OrganisationDC>, List<OrganisationModel>>(returnObject.StaffMemberHomeOfficeList); CachedLists.EventLeadingToIncidentList = Mapper.Map <IEnumerable <EventLeadingToIncidentDC>, List <EventLeadingToIncidentModel> >(returnObject.EventLeadingToIncidentList); CachedLists.IncidentLocationList = Mapper.Map <IEnumerable <IncidentLocationDC>, List <IncidentLocationModel> >(returnObject.IncidentLocationList); CachedLists.IncidentCategoryList = Mapper.Map <IEnumerable <IncidentCategoryDC>, List <IncidentCategoryModel> >(returnObject.IncidentCategoryList); CachedLists.IncidentTypeList = Mapper.Map <IEnumerable <IncidentTypeDC>, List <IncidentTypeModel> >(returnObject.IncidentTypeList); CachedLists.IncidentDetailsList = Mapper.Map <IEnumerable <IncidentDetailDC>, List <IncidentDetailModel> >(returnObject.IncidentDetailsList); CachedLists.AbuseTypeList = Mapper.Map <IEnumerable <AbuseTypeDC>, List <AbuseTypeModel> >(returnObject.AbuseTypeList); CachedLists.FastTrackAttachmentList = Mapper.Map <IEnumerable <AttachmentDC>, List <AttachmentModel> >(returnObject.FastTrackAttachmentList); CachedLists.RIDDORAttachmentList = Mapper.Map <IEnumerable <AttachmentDC>, List <AttachmentModel> >(returnObject.RIDDORAttachmentList); CachedLists.AdminEmail = returnObject.AdminEmail; CachedLists.DeputyAdminEmail = returnObject.DeputyAdminEmail; CachedLists.RelationshipToCustomerList = Mapper.Map <IEnumerable <RelationshipToCustomerDC>, List <RelationshipToCustomerModel> >(returnObject.RelationshipToCustomerList); CachedLists.ContingencyArrangementBaseList = Mapper.Map <IEnumerable <ContingencyArrangementDC>, List <ContingencyArrangementModel> >(returnObject.ContingencyArrangementList); CachedLists.ControlMeasureBaseList = Mapper.Map <IEnumerable <ControlMeasureDC>, List <ControlMeasureModel> >(returnObject.ControlMeasureList); CachedLists.SystemMarkedBaseList = Mapper.Map <IEnumerable <SystemMarkedDC>, List <SystemMarkedModel> >(returnObject.SystemMarkedList); CachedLists.InterestedPartyBaseList = Mapper.Map <IEnumerable <InterestedPartyDC>, List <InterestedPartyModel> >(returnObject.InterestedPartyList); //Select Lists CachedLists.ContingencyArrangementList = returnObject.ContingencyArrangementList.Select(x => new SelectListItem() { Value = x.Code.ToString(), Text = x.Description }).ToList(); CachedLists.ControlMeasureList = returnObject.ControlMeasureList.Select(x => new SelectListItem() { Value = x.Code.ToString(), Text = x.ControlMeasureDescription }).ToList(); CachedLists.SystemMarkedList = returnObject.SystemMarkedList.Select(x => new SelectListItem() { Value = x.Code.ToString(), Text = x.Description }).ToList(); CachedLists.InterestedPartyList = returnObject.InterestedPartyList.Select(x => new SelectListItem() { Value = x.Code.ToString(), Text = x.Description }).ToList(); return(CachedLists); } catch (Exception e) { // Handle the exception string message = ExceptionManager.HandleException(e, sc); return(null); } }