From 4ea2dbbe1d7152728de3fc8275ffd9de8bb6de1a Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 5 Feb 2015 03:48:21 +0000 Subject: [PATCH] Added code to store the xml representation of the approved version of the procedure in the database for future support of temp mods, etc. Added code to support handling of Floating Foldouts, implement inclusion of audit reocords and converting invalid referenced objects and invalid transitions to text during import/export operations Added code to support storage of email addresses and cell phone numbers of users which are used as part of the batch refresh process. --- .../dlgApproveProcedure.cs | 8 + .../VEPROMS User Interface/dlgExportImport.cs | 447 +++++++++++++++--- PROMS/VEPROMS User Interface/frmManageUser.cs | 20 + 3 files changed, 418 insertions(+), 57 deletions(-) diff --git a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs index f82fece7..773e310c 100644 --- a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs +++ b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs @@ -1138,7 +1138,15 @@ namespace VEPROMS int selectedSlave = pi.MyDocVersion.DocVersionConfig.SelectedSlave; pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0; if (si.IsApproved == 1) + { + dlgExportImport dlg = new dlgExportImport("Export", pi); + System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); + dlg.ExportItem(xd, pi, "procedure"); + version.ApprovedXML = xd.OuterXml; + version.Save(); + dlg.Dispose(); UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, DateTime.Now, selectedSlave); + } else UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS, selectedSlave); //UpdateProcedureDTS(pi, DateTime.Now); diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 896de3d3..3c195901 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -15,6 +15,7 @@ namespace VEPROMS { public partial class dlgExportImport : Form { + private Dictionary floatFoldout; private Dictionary oldFormat; private Dictionary newFormat; private int oldRODbID; @@ -109,7 +110,7 @@ namespace VEPROMS } else if (MyProcedure != null) { - txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber); + txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/","_")); } } private void txtExport_TextChanged(object sender, EventArgs e) @@ -183,6 +184,7 @@ namespace VEPROMS { TurnChangeManagerOff.Execute(); LoadImportDataDocument(); + MyDocVersion = null; TurnChangeManagerOn.Execute(); } if (MyDocVersion != null) @@ -192,7 +194,34 @@ namespace VEPROMS xd.Load(txtImport.Text); bool isImported = false; pbImportProcedure.Maximum = 1; - MyRODb = RODb.GetByFolderPath(MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath); + string rofolderpath = xd.DocumentElement.Attributes.GetNamedItem("rofolderpath").InnerText; + int rodbid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rodbid").InnerText); + int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText); + List localROPaths = new List(); + RODbInfoList rolist = RODbInfoList.Get(); + foreach (RODbInfo dbi in rolist) + { + if (dbi.FolderPath == rofolderpath && dbi.RODbID == rodbid) + { + MyRODb = RODb.GetJustRoDb(rodbid); + oldRODbID = newRODbID = rodbid; + break; + } + else + { + DirectoryInfo di = new DirectoryInfo(dbi.FolderPath); + if (di.Exists) + localROPaths.Add(dbi.FolderPath); + } + } + if (MyRODb == null) + { + if (localROPaths.Count == 0) + MessageBox.Show("need new ro folder assigned"); + else + MessageBox.Show("pick an ro folder"); + return; + } foreach (ProcedureInfo pi in MyDocVersion.Procedures) { if (pi.ItemID == int.Parse(xd.SelectSingleNode("procedure/@itemid").InnerText) || pi.MyContent.Number == xd.SelectSingleNode("procedure/content/@number").InnerText) @@ -252,7 +281,8 @@ namespace VEPROMS _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); //update transitions AddTransitions(PendingTransitions); - File.Delete(fn); + PendingTransitions.Save(fn); + //File.Delete(fn); } private void ImportProcedureCopy(XmlDocument xd) { @@ -321,6 +351,7 @@ namespace VEPROMS } private void LoadImportDataDocument() { + floatFoldout = new Dictionary(); ZipEntry ze = MyExpxZipFile[0]; string fn = PEIPath + @"\" + ze.FileName; ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); @@ -336,6 +367,7 @@ namespace VEPROMS _MyNewFolder = FolderInfo.Get(ff.FolderID); AddAnnotationTypes(xd); DocVersionInfo dvi = AddDocVersion(ff, xd); + MyDocVersion = dvi; xd = null; lblImportStatus.Text = "Creating Procedures..."; Application.DoEvents(); @@ -357,9 +389,27 @@ namespace VEPROMS dis[d].Delete(true); lblImportStatus.Text = "Updating Transitions"; AddTransitions(); + FixFloatingFoldouts(); SaveTransitionAndItemContentIDs(); } + private void FixFloatingFoldouts() + { + foreach (int key in floatFoldout.Keys) + { + lblImportStatus.Text = "Updating Floating Foldouts"; + int cid = Old2NewContent[key]; + int iid = Old2NewItem[floatFoldout[key]]; + Content c = Content.Get(cid); + XmlDocument xd = new XmlDocument(); + xd.LoadXml(c.Config); + XmlNode xn = xd.SelectSingleNode("Config/Step/@FloatingFoldout"); + xn.InnerText = iid.ToString(); + c.Config = xd.OuterXml; + c.Save(); + } + } + private void LoadFormats(XmlDocument xd) { oldFormat = new Dictionary(); @@ -899,7 +949,11 @@ namespace VEPROMS Old2NewLibDoc = new Dictionary(); PendingTransitions = new XmlDocument(); FileInfo fi = new FileInfo(ofd.FileName); - string dn = fi.Name.Substring(0, fi.Name.IndexOf("-")); + string dn; + if (fi.Name.IndexOf("-") > 0) + dn = fi.Name.Substring(0, fi.Name.IndexOf("-")); + else + dn = fi.Name.Substring(0,fi.Name.IndexOf(".")); txtImport.Text = ofd.FileName; ReadOptions ro = new ReadOptions(); ro.Encoding = Encoding.UTF8; @@ -1309,9 +1363,16 @@ namespace VEPROMS MyWriter.WriteAttributeString("userid", db.UserID.ToString()); MyWriter.WriteEndElement(); } - private void ExportItem(XmlDocument xd, ItemInfo ii, string nodename) + public void ExportItem(XmlDocument xd, ItemInfo ii, string nodename) { XmlElement xe = xd.CreateElement(nodename); + if (ii.IsProcedure) + { + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.RODbID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofolderpath", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstid", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFstID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstdts", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + } xd.AppendChild(xe); ExportItem(xe, ii, nodename); } @@ -1382,15 +1443,18 @@ namespace VEPROMS XmlElement xe = xn.OwnerDocument.CreateElement("audits"); foreach (ItemAuditInfo audit in audits) { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "previousid", audit.PreviousID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xe.AppendChild(xee); + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "previousid", audit.PreviousID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xe.AppendChild(xee); + } } xn.AppendChild(xe); } @@ -1461,6 +1525,7 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ci.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ci.UserID.ToString())); //content audits + ExportContentAudits(xe, ci); xn.AppendChild(xe); if (ci.ContentTransitionCount > 0) foreach (TransitionInfo ti in ci.ContentTransitions) @@ -1476,6 +1541,37 @@ namespace VEPROMS foreach (PartInfo pi in ci.ContentParts) ExportPart(xe, pi, ((E_FromTypes)pi.FromType).ToString().ToLower()); } + + private void ExportContentAudits(XmlElement xn, ContentInfo ci) + { + if (cbxExportAudits.Checked) + { + ContentAuditInfoList audits = ContentAuditInfoList.Get(ci.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (ContentAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "number", audit.Number)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "text", audit.Text)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "type", audit.Type.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "formatid", audit.FormatID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "actiondts", audit.ActionWhen.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.AppendChild(xee); + } + } + } + } + } private void ExportContent(ContentInfo ci, string nodename) { /* @@ -1528,8 +1624,38 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", gi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", gi.UserID.ToString())); //grid audits + ExportGridAudits(xe, gi); xn.AppendChild(xe); } + + private void ExportGridAudits(XmlElement xn, GridInfo gi) + { + if (cbxExportAudits.Checked) + { + GridAuditInfoList audits = GridAuditInfoList.Get(gi.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (GridAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "data", audit.Data)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentauditid", audit.ContentAuditID.ToString())); + xe.AppendChild(xee); + + } + } + } + } + } private void ExportGrid(GridInfo gi, string nodename) { /* @@ -1561,9 +1687,36 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ei.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ei.UserID.ToString())); //entry audits + ExportEntryAudits(xe, ei); xn.AppendChild(xe); ExportDocument(xe, ei.MyDocument, "document"); } + + private void ExportEntryAudits(XmlElement xn, EntryInfo ei) + { + if (cbxExportAudits.Checked) + { + EntryAuditInfoList audits = EntryAuditInfoList.Get(ei.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (EntryAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docid", audit.DocID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xe.AppendChild(xee); + } + } + } + } + } private void ExportEntry(EntryInfo ei, string nodename) { /* @@ -1602,8 +1755,39 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", di.UserID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "fileextension", di.FileExtension)); //document audits + ExportDocumentAudits(xe, di); xn.AppendChild(xe); } + + private void ExportDocumentAudits(XmlElement xn, DocumentInfo di) + { + if (cbxExportAudits.Checked) + { + DocumentAuditInfoList audits = DocumentAuditInfoList.Get(di.DocID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (DocumentAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docid", audit.DocID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "libtitle", audit.LibTitle)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "doccontent",Convert.ToBase64String(audit.DocContent))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docascii", audit.DocAscii)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "fileextension", audit.FileExtension)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xe.AppendChild(xee); + } + } + } + } + } private void ExportDocument(DocumentInfo di, string nodename) { /* @@ -1647,8 +1831,16 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ri.UserID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", ri.RODbID.ToString())); //rousage audits + ExportROUsageAudits(xe, ri); xn.AppendChild(xe); } + + private void ExportROUsageAudits(XmlElement xe, RoUsageInfo ri) + { + if (cbxExportAudits.Checked) + { + } + } private void ExportROUsage(RoUsageInfo ri, string nodename) { /* @@ -1686,10 +1878,38 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", pi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", pi.UserID.ToString())); //part audits + ExportPartAudits(xe, pi); xn.AppendChild(xe); foreach (ItemInfo ii in pi.MyItems) ExportItem(xe, ii, pi.PartType.ToString().ToLower()); } + + private void ExportPartAudits(XmlElement xn, PartInfo pi) + { + if (cbxExportAudits.Checked) + { + PartAuditInfoList audits = PartAuditInfoList.Get(pi.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (PartAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "fromtype", audit.FromType.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xe.AppendChild(xee); + } + } + } + } + } private void ExportPart(PartInfo pi, string nodename) { /* @@ -1733,8 +1953,16 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ti.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ti.UserID.ToString())); //transition audits + ExportTransitionAudits(xe, ti); xn.AppendChild(xe); } + + private void ExportTransitionAudits(XmlElement xe, TransitionInfo ti) + { + if (cbxExportAudits.Checked) + { + } + } private void ExportTransition(TransitionInfo ti, string nodename) { /* @@ -1797,8 +2025,41 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ai.UserID.ToString())); //annotation audits + ExportAnnotationAudits(xe, ai); xn.AppendChild(xe); } + + private void ExportAnnotationAudits(XmlElement xn, AnnotationInfo ai) + { + if (cbxExportAudits.Checked) + { + AnnotationAuditInfoList audits = AnnotationAuditInfoList.GetByAnnotationID(ai.AnnotationID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (AnnotationAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "annotationid", audit.AnnotationID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "typeid", audit.TypeID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "rtftext", audit.RtfText)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "searchtext", audit.SearchText)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "actiondts", audit.ActionWhen.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.AppendChild(xee); + } + } + xn.AppendChild(xe); + } + } + } private void ExportAnnotation(AnnotationInfo ai, string nodename) { /* @@ -1927,6 +2188,7 @@ namespace VEPROMS else replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); content.Text = content.Text.Replace(lookfor, replacewith); + content.FixTransitionText(TransitionInfo.Get(tt.TransitionID)); content.Save(); } else @@ -1966,34 +2228,70 @@ namespace VEPROMS int fromid = int.Parse(nd.Attributes.GetNamedItem("fromid").InnerText); int toid = int.Parse(nd.Attributes.GetNamedItem("toid").InnerText); int rangeid = int.Parse(nd.Attributes.GetNamedItem("rangeid").InnerText); - if (Old2NewContent.ContainsKey(fromid) && Old2NewItem.ContainsKey(toid) && Old2NewItem.ContainsKey(rangeid)) - { - int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText); - int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText); - int trantype = int.Parse(nd.Attributes.GetNamedItem("trantype").InnerText); - string config = nd.Attributes.GetNamedItem("config").InnerText; - string userid = nd.Attributes.GetNamedItem("userid").InnerText; - DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); - string lookfor; - if (isrange == 0) - lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); - else - lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); - fromid = Old2NewContent[fromid]; - toid = Old2NewItem[toid]; - rangeid = Old2NewItem[rangeid]; - Content cc = Content.Get(fromid); - Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); - transitionid = tt.TransitionID; - string replacewith; - if (isrange == 0) - replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); - else - replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); - cc.Text = cc.Text.Replace(lookfor, replacewith); - cc.Save(); - nd.InnerText = "done"; - } + int trantype = int.Parse(nd.Attributes.GetNamedItem("trantype").InnerText); + if (Old2NewContent.ContainsKey(fromid)) //transition from new contentid + { + if (Old2NewItem.ContainsKey(toid) && Old2NewItem.ContainsKey(rangeid)) //transition to new itemid (internal) + { + int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText); + int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText); + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + string lookfor; + if (isrange == 0) + lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + fromid = Old2NewContent[fromid]; + toid = Old2NewItem[toid]; + rangeid = Old2NewItem[rangeid]; + Content cc = Content.Get(fromid); + Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); + transitionid = tt.TransitionID; + string replacewith; + if (isrange == 0) + replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + cc.Text = cc.Text.Replace(lookfor, replacewith); + bool forceConvertToText; + SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; + forceConvertToText = (sc.SubSection_Edit == "N"); + cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + cc.Save(); + nd.InnerText = "done"; + } + else //transition to existing itemid (external) + { + int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText); + int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText); + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + string lookfor; + if (isrange == 0) + lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + fromid = Old2NewContent[fromid]; + Content cc = Content.Get(fromid); + Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); + transitionid = tt.TransitionID; + string replacewith; + if (isrange == 0) + replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + cc.Text = cc.Text.Replace(lookfor, replacewith); + bool forceConvertToText; + SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; + forceConvertToText = (sc.SubSection_Edit == "N"); + cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + cc.Save(); + nd.InnerText = "done"; + } + } } } private Dictionary Old2NewItem; @@ -2249,16 +2547,27 @@ namespace VEPROMS string config = nd.Attributes.GetNamedItem("config").InnerText; string userid = nd.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); - RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb); - rou.Save(); - string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); - string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); - if (lookFor != replaceWith) - { - content.Text = content.Text.Replace(lookFor, replaceWith); - content.Save(); - } - } + ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion); + string roval = lookup.GetRoValue(roid); + if (roval == "?") + { + RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid)); + } + else + { + RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb); + rou.Save(); + RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID); + string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); + string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); + if (lookFor != replaceWith) + { + content.Text = content.Text.Replace(lookFor, replaceWith); + content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst); + } + } + content.Save(); + } } private void AddAnnotation(XmlReader xr) { @@ -2370,7 +2679,9 @@ namespace VEPROMS int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table); step.DTS = dts; @@ -2448,7 +2759,9 @@ namespace VEPROMS int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step); step.DTS = dts; @@ -2524,7 +2837,9 @@ namespace VEPROMS int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO); step.DTS = dts; @@ -2600,7 +2915,9 @@ namespace VEPROMS int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note); step.DTS = dts; @@ -2676,7 +2993,9 @@ namespace VEPROMS int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution); step.DTS = dts; @@ -2758,6 +3077,8 @@ namespace VEPROMS int sectiontype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); sect = Section.MakeSection(parentInfo, prevInfo, number, text, sectiontype); @@ -2784,6 +3105,18 @@ namespace VEPROMS AddParts(xc, prevInfo); return prevInfo; } + + private void CheckForFloatingFoldout(int contentid, string config) + { + if (config != string.Empty) + { + XmlDocument xd = new XmlDocument(); + xd.LoadXml(config); + XmlNode xn = xd.SelectSingleNode("Config/Step/@FloatingFoldout"); + if (xn != null) + floatFoldout.Add(contentid, int.Parse(xn.InnerText)); + } + } private void AddGrid(XmlReader xr) { int contentid = int.Parse(xr.GetAttribute("contentid")); diff --git a/PROMS/VEPROMS User Interface/frmManageUser.cs b/PROMS/VEPROMS User Interface/frmManageUser.cs index b127b668..6e1c6f96 100644 --- a/PROMS/VEPROMS User Interface/frmManageUser.cs +++ b/PROMS/VEPROMS User Interface/frmManageUser.cs @@ -53,6 +53,7 @@ namespace VEPROMS internal class SimpleUser { private User _MyUser; + private UserConfig _MyUC; [Browsable(false)] public User MyUser { @@ -61,6 +62,7 @@ namespace VEPROMS public SimpleUser(User myUser) { _MyUser = myUser; + _MyUC = new UserConfig(myUser.Config); } public string CourtesyTitle { @@ -92,6 +94,24 @@ namespace VEPROMS get { return _MyUser.PhoneNumber; } set { _MyUser.PhoneNumber = value; } } + public string Email + { + get { return _MyUC.User_UserEmail; } + set + { + _MyUC.User_UserEmail = value; + _MyUser.Config = _MyUC.ToString(); + } + } + public string CellPhone + { + get { return _MyUC.User_CellPhone; } + set + { + _MyUC.User_CellPhone = value; + _MyUser.Config = _MyUC.ToString(); + } + } public string UserID { get { return _MyUser.UserID; }