public static void Archive_Single(DateTime endDischargedDate, String RegistryID, ListBox archiveList) { /* Get a set of registryIDs from local storage. */ //XmlNode inRegistryIDs = GetInRegistryIDs(); XmlDocument doc = new XmlDocument(); XmlNode inRegistryIDs = doc.CreateElement(EmrConstant.ElementNames.RegistryIDs); XmlElement inRegistryID = doc.CreateElement(EmrConstant.ElementNames.RegistryID); inRegistryID.InnerText = RegistryID; inRegistryIDs.AppendChild(inRegistryID); XmlNode outRegistryIDs = doc.CreateElement(EmrConstant.ElementNames.RegistryIDs); /* Are there discharged in this set. */ using (gjtEmrPatients.emrPatients ep = new gjtEmrPatients.emrPatients()) { try { ep.IsDischarged(inRegistryIDs, endDischargedDate, ref outRegistryIDs); } catch (Exception ex) { Globals.logAdapter.Record("EX7569874508", ex.Message + ">>" + ex.ToString(), true); return; } } /* No discharged patients */ if (outRegistryIDs.ChildNodes.Count == 0) { return; } /* Set lock flag of the emrDocuments for these patients. */ using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml()) { try { es.ArchiveBatch(outRegistryIDs); } catch (Exception ex) { Globals.logAdapter.Record("EX756987451988", ex.Message + ">>" + ex.ToString(), true); return; } } /* Clear the loacl storage. */ foreach (XmlNode outRegistryID in outRegistryIDs) { Directory.Delete(Path.Combine(Globals.workFolder, outRegistryID.InnerText), true); if (archiveList != null) { archiveList.Items.Remove(outRegistryID.InnerText); archiveList.Update(); } } }
public static void Archive_Search(DateTime endDischargedDate, ListBox archiveList) { /* Get a set of registryIDs from local storage. */ XmlNode inRegistryIDs = GetInRegistryIDs(); XmlDocument doc = new XmlDocument(); XmlNode outRegistryIDs = doc.CreateElement(EmrConstant.ElementNames.RegistryIDs); /* Are there discharged in this set. */ using (gjtEmrPatients.emrPatients ep = new gjtEmrPatients.emrPatients()) { try { ep.IsDischarged(inRegistryIDs, endDischargedDate, ref outRegistryIDs); } catch (Exception ex) { Globals.logAdapter.Record("EX756987457749", ex.Message + ">>" + ex.ToString(), true); return; } } /* No discharged patients */ if (outRegistryIDs.ChildNodes.Count == 0) { return; } /* Add to archiveList. */ archiveList.Items.Clear(); foreach (XmlNode outRegistryID in outRegistryIDs) { if (archiveList != null) { archiveList.Items.Add(outRegistryID.InnerText); archiveList.Update(); } } }