Example #1
0
        public bool DeleteEmrNote(int series)
        {
            XmlNode emrNote = GetEmrNoteBySeries(series);

            if (emrNote == null)
            {
                return(Return.Failed);
            }

            string registryID = emrDoc.DocumentElement.GetAttribute(AttributeNames.RegistryID);
            string noteID     = emrNote.Attributes[AttributeNames.NoteID].Value;

            if (!Globals.offline)
            {
                if (ThisAddIn.DeleteOneEmrNote(registryID, noteID, series)
                    == Return.Failed)
                {
                    return(Return.Failed);
                }
            }
            /* Update the local storage. */
            string LastWriteTime = ThisAddIn.Today().ToFileTime().ToString();

            emrDoc.DocumentElement.SetAttribute(AttributeNames.LastWriteTime, LastWriteTime);
            emrDoc.DocumentElement.RemoveChild(emrNote);
            emrDoc.Save(emrDocFile);
            udt.jj.EncodeEmrDocument(emrDocFile);

            string wdDocName = udt.MakeWdDocumentFileName(registryID, noteID, series, Globals.workFolder);

            File.Delete(wdDocName);

            return(Return.Successful);
        }