public IEnumerable <JournalDocument> GetChildJournalDocuments(int CaseID) { List <JournalDocument> journalDocuments = new List <JournalDocument>(); AcadreServiceV7.BUCaseFileType Case = (AcadreServiceV7.BUCaseFileType)caseService.GetCase(CaseID.ToString()); AcadreServiceV7.AdvancedSearchCaseCriterionType2 searchCriterion = new AcadreServiceV7.AdvancedSearchCaseCriterionType2(); searchCriterion.CaseFileTitleText = Case.CaseFileTitleText.Substring(0, 10) + "*"; searchCriterion.CaseFileTypeCode = CaseFileTypeCode; // Henter dokumenter foreach (AcadreServiceV7.CaseSearchResponseType foundCase in caseService.SearchCases(searchCriterion)) { journalDocuments.AddRange(GetChildCaseDocuments(int.Parse(foundCase.CaseFileReference))); } //FlowDocument document = new FlowDocument(); foreach (var memo in memoService4.GetAllMemo(CaseID.ToString())) { if (memo == null) { throw new Exception("Der opstod en fejl ved udtræk af journalnotater: Den kaldte metode returnerede null værdier"); } //var outputbinary = documentService4.GetPhysicalDocument(new AcadreServiceV4.FileVersionReferenceType() //{ // FileReference = memo.MemoFileReference, // Version = "1" //}); //TextRange txtRange; //using (MemoryStream stream = new MemoryStream(outputbinary)) //{ // // create a TextRange around the entire document // txtRange = new TextRange(document.ContentStart, document.ContentEnd); // txtRange.Load(stream, DataFormats.Rtf); //} journalDocuments.Add(new JournalDocument { Type = "Memo", DocumentID = int.Parse(memo.MemoIdentifier), Title = memo.MemoTitleText, LastChangedDate = memo.MemoEventDate, CaseID = CaseID, CaseNumberIdentifier = Case.CaseFileNumberIdentifier, DocumentMemoDescription = "", // txtRange.Text // Her skal der bruges indholdet af notatet FileReferenceID = memo.MemoFileReference }); } return(journalDocuments); }
public IEnumerable <ChildCase> GetChildCases(int CaseID) { List <ChildCase> childCases = new List <ChildCase>(); AcadreServiceV7.BUCaseFileType Case = (AcadreServiceV7.BUCaseFileType)caseService.GetCase(CaseID.ToString()); string CPR = Case.CaseFileTitleText.Substring(0, 10); AcadreServiceV7.AdvancedSearchCaseCriterionType2 searchCriterion = new AcadreServiceV7.AdvancedSearchCaseCriterionType2(); searchCriterion.CaseFileTitleText = CPR; searchCriterion.CaseFileTypeCode = CaseFileTypeCode; var userList = configurationService.GetUserList(new AcadreServiceV7.EmptyRequestType()).ToList(); foreach (AcadreServiceV7.CaseSearchResponseType foundCase in caseService.SearchCases(searchCriterion)) { Case = (AcadreServiceV7.BUCaseFileType)caseService.GetCase(foundCase.CaseFileReference); var user = userList.SingleOrDefault(ut => ut.Id == Case.CaseFileManagerReference); if (user == null) { user = new AcadreServiceV7.UserType() { Initials = "", Name = "" }; } childCases.Add(new ChildCase { CaseID = int.Parse(foundCase.CaseFileReference), CaseContent = Case.CustomFields.df1, ChildCPR = CPR, CaseNumberIdentifier = Case.CaseFileNumberIdentifier, CaseManagerInitials = user.Initials, CaseManagerName = user.Name, Note = Case.Note, ChildName = Case.TitleAlternativeText, IsClosed = Case.CaseFileStatusCode == "A" }); } return(childCases); }
// Changes the Responsible CaseManager on all the childrens cases where the CaseManagerInitials = oldCaseManagerInitials. If oldCaseManagerInitials is "" then all child cases CaseManager is changed to newCaseManagerInitials. public void ChangeChildResponsible(string oldCaseManagerInitials, string newCaseManagerInitials, int newAcadreOrgID, int CaseID) { var userList = configurationService.GetUserList(new AcadreServiceV7.EmptyRequestType()).ToList(); var newUser = userList.SingleOrDefault(ut => ut.Initials == newCaseManagerInitials); if (newUser == null) { throw new Exception("Der fandtes ikke en bruger i Acadre med initialerne " + newCaseManagerInitials); } AcadreServiceV7.BUCaseFileType Case = (AcadreServiceV7.BUCaseFileType)caseService.GetCase(CaseID.ToString()); if (!Case.CustomFieldCollection.Single(x => x.Name == "df1").Value.Contains("Løbende ")) { Case.CaseFileManagerReference = newUser.Id; Case.AdministrativeUnit = new AcadreServiceV7.AdministrativeUnitType[] { new AcadreServiceV7.AdministrativeUnitType() { AdministrativeUnitReference = newAcadreOrgID.ToString() } }; try { caseService.UpdateCase(Case); } catch (Exception e) { throw new Exception("Kunne ikke opdatere Acadre sagen", e); } return; } string CPR = Case.CaseFileTitleText.Substring(0, 10); AcadreServiceV7.AdvancedSearchCaseCriterionType2 searchCriterion = new AcadreServiceV7.AdvancedSearchCaseCriterionType2(); searchCriterion.CaseFileTitleText = CPR + "*"; searchCriterion.CaseFileTypeCode = CaseFileTypeCode; foreach (AcadreServiceV7.CaseSearchResponseType foundCase in caseService.SearchCases(searchCriterion)) { Case = (AcadreServiceV7.BUCaseFileType)caseService.GetCase(foundCase.CaseFileReference); var user = userList.SingleOrDefault(ut => ut.Id == Case.CaseFileManagerReference); if (user == null) { user = new AcadreServiceV7.UserType { Initials = "" } } ; if (user.Initials == oldCaseManagerInitials || oldCaseManagerInitials == "" || user.Initials == "") { Case.CaseFileManagerReference = newUser.Id; Case.AdministrativeUnit = new AcadreServiceV7.AdministrativeUnitType[] { new AcadreServiceV7.AdministrativeUnitType() { AdministrativeUnitReference = newAcadreOrgID.ToString() } }; try { caseService.UpdateCase(Case); } catch (Exception e) { throw new Exception("Kunne ikke opdatere Acadre sagen", e); } } } }