diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 9a84a952..c14da438 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -1297,6 +1297,7 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", fst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", fst.UserID.ToString())); xn.AppendChild(xe); + ExportFigures(xe, fst); ExportRODb(xe, fst.MyRODb, "rodb"); } private void ExportROFst(ROFstInfo fst, string nodename) @@ -1319,6 +1320,38 @@ namespace VEPROMS ExportRODb(fst.MyRODb, "rodb"); MyWriter.WriteEndElement(); } + private void ExportFigures(XmlElement xn, ROFstInfo fst) + { + if (fst.ROFstFigureCount > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("figures"); + xn.AppendChild(xe); + foreach (FigureInfo figure in fst.ROFstFigures) + { + XmlElement xee = xn.OwnerDocument.CreateElement("figure"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "figureid", figure.FigureID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "rofstid", figure.ROFstID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "imageid", figure.ImageID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", figure.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", figure.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", figure.UserID)); + xe.AppendChild(xee); + ExportROImage(xee, figure.MyROImage); + } + } + } + private void ExportROImage(XmlElement xn, ROImageInfo image) + { + XmlElement xe = xn.OwnerDocument.CreateElement("image"); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "imageid", image.ImageID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", image.RODbID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "filename", image.FileName)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "content", Convert.ToBase64String(image.Content))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", image.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", image.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", image.UserID)); + xn.AppendChild(xe); + } private void ExportRODb(XmlElement xn, RODbInfo db, string nodename) { /* @@ -1541,7 +1574,6 @@ 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) @@ -1627,7 +1659,6 @@ namespace VEPROMS ExportGridAudits(xe, gi); xn.AppendChild(xe); } - private void ExportGridAudits(XmlElement xn, GridInfo gi) { if (cbxExportAudits.Checked) @@ -1691,7 +1722,6 @@ namespace VEPROMS xn.AppendChild(xe); ExportDocument(xe, ei.MyDocument, "document"); } - private void ExportEntryAudits(XmlElement xn, EntryInfo ei) { if (cbxExportAudits.Checked) @@ -1758,7 +1788,6 @@ namespace VEPROMS ExportDocumentAudits(xe, di); xn.AppendChild(xe); } - private void ExportDocumentAudits(XmlElement xn, DocumentInfo di) { if (cbxExportAudits.Checked) @@ -1834,7 +1863,6 @@ namespace VEPROMS ExportROUsageAudits(xe, ri); xn.AppendChild(xe); } - private void ExportROUsageAudits(XmlElement xe, RoUsageInfo ri) { if (cbxExportAudits.Checked) @@ -1883,7 +1911,6 @@ namespace VEPROMS foreach (ItemInfo ii in pi.MyItems) ExportItem(xe, ii, pi.PartType.ToString().ToLower()); } - private void ExportPartAudits(XmlElement xn, PartInfo pi) { if (cbxExportAudits.Checked) @@ -1956,7 +1983,6 @@ namespace VEPROMS ExportTransitionAudits(xe, ti); xn.AppendChild(xe); } - private void ExportTransitionAudits(XmlElement xe, TransitionInfo ti) { if (cbxExportAudits.Checked) @@ -2028,7 +2054,6 @@ namespace VEPROMS ExportAnnotationAudits(xe, ai); xn.AppendChild(xe); } - private void ExportAnnotationAudits(XmlElement xn, AnnotationInfo ai) { if (cbxExportAudits.Checked) @@ -2264,6 +2289,7 @@ namespace VEPROMS } else //transition to existing itemid (external) { + bool forceConvertToText = false; 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; @@ -2277,32 +2303,41 @@ namespace VEPROMS 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); + if (tt.TransitionID < 0) + { + forceConvertToText = true; + cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + cc.Save(); + nd.InnerText = "done"; + } else - replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); - cc.Text = cc.Text.Replace(lookfor, replacewith); - bool forceConvertToText = false; - SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; - forceConvertToText = (sc.SubSection_Edit == "N"); - if (!forceConvertToText) //check to see if external with internal format { - TransitionInfo tran = TransitionInfo.Get(transitionid); - if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID) - if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc")) + 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); + SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; + forceConvertToText = (sc.SubSection_Edit == "N"); + if (!forceConvertToText) //check to see if external with internal format + { + TransitionInfo tran = TransitionInfo.Get(transitionid); + if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID) + if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc")) + forceConvertToText = true; + } + if (!forceConvertToText) //check to see if external to different doc version + { + TransitionInfo tran = TransitionInfo.Get(transitionid); + if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID) forceConvertToText = true; + } + cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + cc.Save(); + nd.InnerText = "done"; } - if (!forceConvertToText) //check to see if external to different doc version - { - TransitionInfo tran = TransitionInfo.Get(transitionid); - if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID) - forceConvertToText = true; - } - cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); - cc.Save(); - nd.InnerText = "done"; } } } @@ -2429,9 +2464,39 @@ namespace VEPROMS ROFst rv = null; rv = ROFst.GetByRODbID_DTS(MyRODb.RODbID, dts); //MyRODb.DTS); if (rv == null) + { rv = ROFst.MakeROFst(MyRODb, rolookup, config, dts, userid); + XmlNode xfigures = xrofst.SelectSingleNode("figures"); + if (xfigures != null) + AddFigures(xfigures, rv); + } return rv; } + private void AddFigures(XmlNode xfigures, ROFst rofst) + { + foreach (XmlNode nd in xfigures.SelectNodes("figure")) + { + XmlNode image = nd.SelectSingleNode("image"); + int imageid = int.Parse(image.Attributes.GetNamedItem("imageid").InnerText); + ROImage roimage = ROImage.Get(imageid); + string config; + DateTime dts; + string userid; + if (roimage == null) + { + string filename = image.Attributes.GetNamedItem("filename").InnerText; + byte[] content = Convert.FromBase64String(image.Attributes.GetNamedItem("content").InnerText); + config = image.Attributes.GetNamedItem("config").InnerText; + dts = DateTime.Parse(image.Attributes.GetNamedItem("dts").InnerText); + userid = image.Attributes.GetNamedItem("userid").InnerText; + roimage = ROImage.MakeROImage(MyRODb, filename, content, config, dts, userid); + } + config = nd.Attributes.GetNamedItem("config").InnerText; + dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + userid = nd.Attributes.GetNamedItem("userid").InnerText; + Figure fig = Figure.MakeFigure(rofst, roimage, config, dts, userid); + } + } private RODb AddRODb(XmlReader xr) { oldRODbID = int.Parse(xr.GetAttribute("rodbid")); diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs index 92290bdc..00beb36d 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs @@ -30,11 +30,11 @@ namespace VEPROMS { this.scBatch = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.rbBoth = new System.Windows.Forms.RadioButton(); + this.lblWarning = new System.Windows.Forms.Label(); + this.lblDescription = new System.Windows.Forms.Label(); + this.lblCaption = new System.Windows.Forms.Label(); + this.cbxAdminTools = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); - this.rbRefObj = new System.Windows.Forms.RadioButton(); - this.rbTransition = new System.Windows.Forms.RadioButton(); - this.rbUpdate = new System.Windows.Forms.RadioButton(); this.myTV = new System.Windows.Forms.TreeView(); this.label2 = new System.Windows.Forms.Label(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); @@ -48,15 +48,13 @@ namespace VEPROMS this.dtpTime = new System.Windows.Forms.DateTimePicker(); this.dtpDate = new System.Windows.Forms.DateTimePicker(); this.btnRefresh = new System.Windows.Forms.Button(); - this.rbLater = new System.Windows.Forms.RadioButton(); - this.rbNow = new System.Windows.Forms.RadioButton(); + this.chkLater = new System.Windows.Forms.CheckBox(); this.label4 = new System.Windows.Forms.Label(); this.txtResults = new System.Windows.Forms.TextBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnSave = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); - this.btBatch = new DevComponents.DotNetBar.BalloonTip(); this.scBatch.Panel1.SuspendLayout(); this.scBatch.Panel2.SuspendLayout(); this.scBatch.SuspendLayout(); @@ -100,30 +98,55 @@ namespace VEPROMS // // splitContainer2.Panel1 // - this.splitContainer2.Panel1.Controls.Add(this.rbBoth); + this.splitContainer2.Panel1.Controls.Add(this.lblWarning); + this.splitContainer2.Panel1.Controls.Add(this.lblDescription); + this.splitContainer2.Panel1.Controls.Add(this.lblCaption); + this.splitContainer2.Panel1.Controls.Add(this.cbxAdminTools); this.splitContainer2.Panel1.Controls.Add(this.label1); - this.splitContainer2.Panel1.Controls.Add(this.rbRefObj); - this.splitContainer2.Panel1.Controls.Add(this.rbTransition); - this.splitContainer2.Panel1.Controls.Add(this.rbUpdate); // // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.myTV); this.splitContainer2.Panel2.Controls.Add(this.label2); this.splitContainer2.Size = new System.Drawing.Size(300, 472); - this.splitContainer2.SplitterDistance = 120; + this.splitContainer2.SplitterDistance = 219; this.splitContainer2.TabIndex = 0; // - // rbBoth + // lblWarning // - this.rbBoth.AutoSize = true; - this.rbBoth.Location = new System.Drawing.Point(12, 72); - this.rbBoth.Name = "rbBoth"; - this.rbBoth.Size = new System.Drawing.Size(195, 17); - this.rbBoth.TabIndex = 2; - this.rbBoth.Text = "Refresh Transitions and Referenced Objects"; - this.rbBoth.UseVisualStyleBackColor = true; - this.rbBoth.Click += new System.EventHandler(this.Options_Changed); + this.lblWarning.BackColor = System.Drawing.Color.PaleGoldenrod; + this.lblWarning.ForeColor = System.Drawing.Color.Red; + this.lblWarning.Location = new System.Drawing.Point(5, 175); + this.lblWarning.Name = "lblWarning"; + this.lblWarning.Size = new System.Drawing.Size(290, 38); + this.lblWarning.TabIndex = 4; + this.lblWarning.Visible = false; + // + // lblDescription + // + this.lblDescription.Location = new System.Drawing.Point(5, 66); + this.lblDescription.Name = "lblDescription"; + this.lblDescription.Size = new System.Drawing.Size(290, 109); + this.lblDescription.TabIndex = 3; + // + // lblCaption + // + this.lblCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblCaption.Location = new System.Drawing.Point(5, 48); + this.lblCaption.Name = "lblCaption"; + this.lblCaption.Size = new System.Drawing.Size(290, 19); + this.lblCaption.TabIndex = 2; + this.lblCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // cbxAdminTools + // + this.cbxAdminTools.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxAdminTools.FormattingEnabled = true; + this.cbxAdminTools.Location = new System.Drawing.Point(5, 27); + this.cbxAdminTools.Name = "cbxAdminTools"; + this.cbxAdminTools.Size = new System.Drawing.Size(290, 21); + this.cbxAdminTools.TabIndex = 1; + this.cbxAdminTools.SelectedIndexChanged += new System.EventHandler(this.cbxAdminTools_SelectedIndexChanged); // // label1 // @@ -137,46 +160,13 @@ namespace VEPROMS this.label1.Text = "Options"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // rbRefObj - // - this.rbRefObj.AutoSize = true; - this.rbRefObj.Location = new System.Drawing.Point(12, 49); - this.rbRefObj.Name = "rbRefObj"; - this.rbRefObj.Size = new System.Drawing.Size(144, 17); - this.rbRefObj.TabIndex = 1; - this.rbRefObj.Text = "Refresh Referenced Objects Only"; - this.rbRefObj.UseVisualStyleBackColor = true; - this.rbRefObj.Click += new System.EventHandler(this.Options_Changed); - // - // rbTransition - // - this.rbTransition.AutoSize = true; - this.rbTransition.Location = new System.Drawing.Point(12, 26); - this.rbTransition.Name = "rbTransition"; - this.rbTransition.Size = new System.Drawing.Size(100, 17); - this.rbTransition.TabIndex = 0; - this.rbTransition.Text = "Refresh Transitions Only"; - this.rbTransition.UseVisualStyleBackColor = true; - this.rbTransition.Click += new System.EventHandler(this.Options_Changed); - // - // rbUpdate - // - this.rbUpdate.AutoSize = true; - this.rbUpdate.Location = new System.Drawing.Point(12, 94); - this.rbUpdate.Name = "rbUpdate"; - this.rbUpdate.Size = new System.Drawing.Size(100, 17); - this.rbUpdate.TabIndex = 0; - this.rbUpdate.Text = "Update RO Values"; - this.rbUpdate.UseVisualStyleBackColor = true; - this.rbUpdate.Click += new System.EventHandler(this.Options_Changed); - // // myTV // this.myTV.CheckBoxes = true; this.myTV.Dock = System.Windows.Forms.DockStyle.Fill; this.myTV.Location = new System.Drawing.Point(0, 23); this.myTV.Name = "myTV"; - this.myTV.Size = new System.Drawing.Size(300, 338); + this.myTV.Size = new System.Drawing.Size(300, 226); this.myTV.TabIndex = 4; this.myTV.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.myTV_AfterCheck); // @@ -231,17 +221,17 @@ namespace VEPROMS this.txtProcess.AcceptsReturn = true; this.txtProcess.Dock = System.Windows.Forms.DockStyle.Fill; this.txtProcess.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtProcess.Location = new System.Drawing.Point(0, 188); + this.txtProcess.Location = new System.Drawing.Point(0, 145); this.txtProcess.Multiline = true; this.txtProcess.Name = "txtProcess"; this.txtProcess.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtProcess.Size = new System.Drawing.Size(298, 259); + this.txtProcess.Size = new System.Drawing.Size(298, 302); this.txtProcess.TabIndex = 5; // // pbProcess // this.pbProcess.Dock = System.Windows.Forms.DockStyle.Top; - this.pbProcess.Location = new System.Drawing.Point(0, 165); + this.pbProcess.Location = new System.Drawing.Point(0, 122); this.pbProcess.Name = "pbProcess"; this.pbProcess.Size = new System.Drawing.Size(298, 23); this.pbProcess.TabIndex = 6; @@ -251,7 +241,7 @@ namespace VEPROMS this.label6.BackColor = System.Drawing.SystemColors.ActiveCaption; this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.label6.Dock = System.Windows.Forms.DockStyle.Top; - this.label6.Location = new System.Drawing.Point(0, 142); + this.label6.Location = new System.Drawing.Point(0, 99); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(298, 23); this.label6.TabIndex = 3; @@ -262,13 +252,12 @@ namespace VEPROMS // this.panel3.Controls.Add(this.pnlLater); this.panel3.Controls.Add(this.btnRefresh); - this.panel3.Controls.Add(this.rbLater); - this.panel3.Controls.Add(this.rbNow); + this.panel3.Controls.Add(this.chkLater); this.panel3.Dock = System.Windows.Forms.DockStyle.Top; this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Name = "panel3"; this.panel3.Padding = new System.Windows.Forms.Padding(6); - this.panel3.Size = new System.Drawing.Size(298, 142); + this.panel3.Size = new System.Drawing.Size(298, 99); this.panel3.TabIndex = 2; // // pnlLater @@ -278,7 +267,7 @@ namespace VEPROMS this.pnlLater.Controls.Add(this.dtpDate); this.pnlLater.Dock = System.Windows.Forms.DockStyle.Top; this.pnlLater.Enabled = false; - this.pnlLater.Location = new System.Drawing.Point(6, 66); + this.pnlLater.Location = new System.Drawing.Point(6, 23); this.pnlLater.Name = "pnlLater"; this.pnlLater.Padding = new System.Windows.Forms.Padding(6); this.pnlLater.Size = new System.Drawing.Size(286, 37); @@ -314,7 +303,7 @@ namespace VEPROMS // btnRefresh // this.btnRefresh.Dock = System.Windows.Forms.DockStyle.Bottom; - this.btnRefresh.Location = new System.Drawing.Point(6, 108); + this.btnRefresh.Location = new System.Drawing.Point(6, 65); this.btnRefresh.Name = "btnRefresh"; this.btnRefresh.Size = new System.Drawing.Size(286, 28); this.btnRefresh.TabIndex = 1; @@ -322,29 +311,17 @@ namespace VEPROMS this.btnRefresh.UseVisualStyleBackColor = true; this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); // - // rbLater + // chkLater // - this.rbLater.Dock = System.Windows.Forms.DockStyle.Top; - this.rbLater.Location = new System.Drawing.Point(6, 36); - this.rbLater.Name = "rbLater"; - this.rbLater.Size = new System.Drawing.Size(286, 30); - this.rbLater.TabIndex = 2; - this.rbLater.Text = "Process Later"; - this.rbLater.UseVisualStyleBackColor = true; - this.rbLater.CheckedChanged += new System.EventHandler(this.schedule_Click); - // - // rbNow - // - this.rbNow.Checked = true; - this.rbNow.Dock = System.Windows.Forms.DockStyle.Top; - this.rbNow.Location = new System.Drawing.Point(6, 6); - this.rbNow.Name = "rbNow"; - this.rbNow.Size = new System.Drawing.Size(286, 30); - this.rbNow.TabIndex = 1; - this.rbNow.TabStop = true; - this.rbNow.Text = "Process Now"; - this.rbNow.UseVisualStyleBackColor = true; - this.rbNow.CheckedChanged += new System.EventHandler(this.schedule_Click); + this.chkLater.AutoSize = true; + this.chkLater.Dock = System.Windows.Forms.DockStyle.Top; + this.chkLater.Location = new System.Drawing.Point(6, 6); + this.chkLater.Name = "chkLater"; + this.chkLater.Size = new System.Drawing.Size(286, 17); + this.chkLater.TabIndex = 4; + this.chkLater.Text = "Process Later"; + this.chkLater.UseVisualStyleBackColor = true; + this.chkLater.CheckedChanged += new System.EventHandler(this.chkLater_CheckedChanged); // // label4 // @@ -414,11 +391,6 @@ namespace VEPROMS this.label3.Text = "Results"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // btBatch - // - this.btBatch.AutoCloseTimeOut = 0; - this.btBatch.BalloonDisplaying += new System.EventHandler(this.btBatch_BalloonDisplaying); - // // frmBatchRefresh // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -430,13 +402,12 @@ namespace VEPROMS this.MinimizeBox = false; this.Name = "frmBatchRefresh"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Batch Refresh"; + this.Text = "Administrative Tools"; this.Load += new System.EventHandler(this.frmBatchRefresh_Load); this.scBatch.Panel1.ResumeLayout(false); this.scBatch.Panel2.ResumeLayout(false); this.scBatch.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false); - this.splitContainer2.Panel1.PerformLayout(); this.splitContainer2.Panel2.ResumeLayout(false); this.splitContainer2.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false); @@ -446,6 +417,7 @@ namespace VEPROMS this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); this.pnlLater.ResumeLayout(false); this.pnlLater.PerformLayout(); this.panel1.ResumeLayout(false); @@ -456,10 +428,6 @@ namespace VEPROMS #endregion private System.Windows.Forms.SplitContainer scBatch; - private System.Windows.Forms.RadioButton rbBoth; - private System.Windows.Forms.RadioButton rbRefObj; - private System.Windows.Forms.RadioButton rbTransition; - private System.Windows.Forms.RadioButton rbUpdate; private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnClear; @@ -476,13 +444,15 @@ namespace VEPROMS private System.Windows.Forms.TreeView myTV; private System.Windows.Forms.DateTimePicker dtpTime; private System.Windows.Forms.DateTimePicker dtpDate; - private System.Windows.Forms.RadioButton rbLater; - private System.Windows.Forms.RadioButton rbNow; private System.Windows.Forms.Panel pnlLater; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox txtProcess; private System.Windows.Forms.ProgressBar pbProcess; - private DevComponents.DotNetBar.BalloonTip btBatch; + private System.Windows.Forms.ComboBox cbxAdminTools; + private System.Windows.Forms.Label lblCaption; + private System.Windows.Forms.Label lblDescription; + private System.Windows.Forms.Label lblWarning; + private System.Windows.Forms.CheckBox chkLater; } } \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index bce4441e..8169b858 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -23,32 +23,27 @@ namespace VEPROMS public frmBatchRefresh() { InitializeComponent(); - SetUpBalloons(); } - - private void SetUpBalloons() + private AdminTools adminToolsList; + private AdminTool selectedAdminTool; + private void SetUpAdminTools() { - btBatch.SetBalloonCaption(rbTransition, "Transitions Only Guidance"); - btBatch.SetBalloonText(rbTransition, "Occasionally, transitions do not get updated." + Environment.NewLine + Environment.NewLine + "This function will refresh transitions in all procedures selected below whether they were selected individually or as a group via a procedure set."); - btBatch.SetBalloonCaption(rbRefObj, "Referenced Objects Only Guidance"); - btBatch.SetBalloonText(rbRefObj, "Occasionally, referenced objects do not get updated. One cause of this is a failure to allow the RO update to complete." + Environment.NewLine + Environment.NewLine + "This function will refresh referenced objects (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set."); - btBatch.SetBalloonCaption(rbBoth, "Transitions and Referenced Objects Guidance"); - btBatch.SetBalloonText(rbBoth, "Occasionally, transitions and referenced objects do not get updated." + Environment.NewLine + Environment.NewLine + "This function will refresh transitions and referenced objects (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set."); - btBatch.SetBalloonCaption(rbNow, "Process Now Guidance"); - btBatch.SetBalloonText(rbNow, "When the button below is pressed the process option selected (as indicated the the title of the button below) will be performed immediately. If during the process a procedure selected to be processed is checked out to a user, you will be notified." + Environment.NewLine + Environment.NewLine + "You will then be given the option of terminating the process without processing the procedures checked out or contacting the appropriate users to check in the procedures and then continue the process to completion."); - btBatch.SetBalloonCaption(rbLater, "Process Later Guidance"); - btBatch.SetBalloonText(rbLater, "NOTE: It is highly recommended that this function be used on off hours" + Environment.NewLine + Environment.NewLine + "When the button below is pressed the process option selected (as indicated the the title of the button below) will be performed when the date and time set has arrived." + Environment.NewLine + Environment.NewLine + "If during the process a procedure selected to be processed is checked out to a user, the procedures will be forced checked in and the process will be allowed to complete."); - btBatch.SetBalloonCaption(rbUpdate, "Update RO Values"); - btBatch.SetBalloonText(rbUpdate, "This allows the user to update referenced objects values for multiple working drafts in a batch mode. It is recommended that this be done during off hours."); + adminToolsList = new AdminTools(); + adminToolsList.Add("Update RO Values", "Update RO Values Guidance", "This allows the user to update referenced objects values for multiple working drafts in a batch mode.", "It is recommended that this be done during off hours.", "WARNING:", true, false, UpdateROValues); + adminToolsList.Add("Refresh Referenced Objects", "Refresh Referenced Objects Guidance", "Occasionally, referenced objects do not get updated. One cause of this is a failure to allow the RO update to complete.\r\n\r\nThis function will refresh referenced objects (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set.", "If more than one procedure is selected, it is recommened that this be performed during off hours.", "WARNING:", false, false, RefreshReferencedObjects); + adminToolsList.Add("Refresh Transitions", "Refresh Transitions Guidance", "Occasionally, transitions do not get updated.\r\n\r\nThis function will refresh transitions in all procedures selected below whether they were selected individually or as a group via a procedure set.", "If more than one procedure is selected, it is recommened that this be performed during off hours.", "WARNING:", false, false, RefreshTransitions); + adminToolsList.Add("Refresh Referenced Objects and Transitions", "Referenced Objects and Transitions Guidance", "Occasionally, referenced objects and transitions do not get updated." + Environment.NewLine + Environment.NewLine + "This function will refresh referenced objects and transitions (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set.", "If more than one procedure is selected, it is recommened that this be performed during off hours.", "WARNING:", false, false, RefreshReferencedObjectsAndTransitions); + adminToolsList.Add("Delete PDFs", "Delete PDFs Guidance", "It is sometimes desirable to clean up the database by removing extra pdf files. This process allows for this to occur", "", "", true, true, "vesp_DeletePDFs", DeletePDFs); + cbxAdminTools.DataSource = adminToolsList; + cbxAdminTools.DisplayMember = "Title"; + cbxAdminTools.SelectedIndex = -1; } - //private DocVersionInfoList myDVIL; private Dictionary myProcedures = new Dictionary(); private Dictionary myDocVersions = new Dictionary(); private void frmBatchRefresh_Load(object sender, EventArgs e) { - //rbUpdate.Visible = false; - //Options_Changed(rbTransition, e); - //ResetTV(); + SetUpAdminTools(); + lblWarning.Visible = false; } private void ResetTV() { @@ -58,13 +53,16 @@ namespace VEPROMS { this.Cursor = Cursors.WaitCursor; myTV.Nodes.Clear(); - FolderInfo fi = FolderInfo.GetTop(); - TreeNode tn = myTV.Nodes.Add(fi.Name); - tn.Tag = fi; - if (fi.ChildFolderCount > 0) - LoadChildFolders(fi, tn, noProcs); - if (myTV.SelectedNode != null) - myTV.SelectedNode.Expand(); + if (!selectedAdminTool.NoTreeView) + { + FolderInfo fi = FolderInfo.GetTop(); + TreeNode tn = myTV.Nodes.Add(fi.Name); + tn.Tag = fi; + if (fi.ChildFolderCount > 0) + LoadChildFolders(fi, tn, noProcs); + if (myTV.SelectedNode != null) + myTV.SelectedNode.Expand(); + } this.Cursor = Cursors.Default; } private void LoadChildFolders(FolderInfo fi, TreeNode tn, bool noProcs) @@ -109,6 +107,294 @@ namespace VEPROMS foreach (FolderInfo cf in f.ChildFolders) LoadFolderInfo(cf); } + private void UpdateROValues() + { + this.Cursor = Cursors.WaitCursor; + List dvil = new List(); + foreach (TreeNode tn in myDocVersions.Keys) + if (tn.Checked) + dvil.Add(myDocVersions[tn]); + DateTime pStart = DateTime.Now; + txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(Environment.NewLine); + Application.DoEvents(); + pbProcess.Minimum = 0; + pbProcess.Maximum = dvil.Count; + pbProcess.Step = 1; + while (dvil.Count > 0) + { + StringBuilder sbDocVersions = new StringBuilder(); + Queue dviq = new Queue(); + foreach (DocVersionInfo dvi in dvil) + dviq.Enqueue(dvi); + dvil.Clear(); + while (dviq.Count > 0) + { + string msg = string.Empty; + DocVersionInfo dq = dviq.Dequeue(); + if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg)) + { + dvil.Add(dq); + sbDocVersions.AppendLine(msg); + } + else + { + ProcessUpdateROValues(dq); + pbProcess.PerformStep(); + Application.DoEvents(); + } + } + DateTime pEnd = DateTime.Now; + txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); + Application.DoEvents(); + if (dvil.Count > 0) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("The batch update process was not usccessful for all working drafts selected."); + sb.AppendLine("The following working drafts were not able to be refreshed..."); + sb.AppendLine(); + sb.AppendLine(sbDocVersions.ToString()); + sb.AppendLine(); + sb.AppendLine("If you want to update these working drafts, please contact the respective users and have them close any procedures in the working draft."); + sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); + sb.AppendLine(); + sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); + frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); + frmCO.MySessionInfo = MySessionInfo; + //frmCO.CheckedOutProcedures = dvil; + frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); + frmCO.Show(this); + while (!this.Visible) + Application.DoEvents(); + } + } + this.Cursor = Cursors.Default; + MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title)); + } + private void RefreshReferencedObjects() + { + this.Cursor = Cursors.WaitCursor; + List pil = new List(); + foreach (TreeNode tn in myProcedures.Keys) + if (tn.Checked) + pil.Add(myProcedures[tn]); + //PopulateTransitionInfoLists(pil); + DateTime pStart = DateTime.Now; + txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(Environment.NewLine); + Application.DoEvents(); + pbProcess.Minimum = 0; + pbProcess.Maximum = pil.Count; + pbProcess.Step = 1; + while (pil.Count > 0) + { + ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); + StringBuilder sbProcs = new StringBuilder(); + Queue piq = new Queue(); + foreach (ProcedureInfo pi in pil) + piq.Enqueue(pi); + pil.Clear(); + while (piq.Count > 0) + { + string msg = string.Empty; + ProcedureInfo pq = piq.Dequeue(); + if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) + { + pil.Add(pq); + sbProcs.AppendLine(msg); + } + else + { + RefreshProcedureReferencedObjects(pq); + pbProcess.PerformStep(); + Application.DoEvents(); + } + } + ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); + DateTime pEnd = DateTime.Now; + txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); + Application.DoEvents(); + if (pil.Count > 0) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("The batch refresh process was not usccessful for all procedures selected."); + sb.AppendLine("The following procedures were not able to be refreshed..."); + sb.AppendLine(); + sb.AppendLine(sbProcs.ToString()); + sb.AppendLine(); + sb.AppendLine("If you want to refresh these prcoedures, please contact the respective users and have them close the procedures."); + sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); + sb.AppendLine(); + sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); + frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); + frmCO.MySessionInfo = MySessionInfo; + frmCO.CheckedOutProcedures = pil; + frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); + frmCO.Show(this); + while (!this.Visible) + Application.DoEvents(); + } + } + this.Cursor = Cursors.Default; + MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title)); + } + private void RefreshTransitions() + { + this.Cursor = Cursors.WaitCursor; + List pil = new List(); + foreach (TreeNode tn in myProcedures.Keys) + if (tn.Checked) + pil.Add(myProcedures[tn]); + //PopulateTransitionInfoLists(pil); + DateTime pStart = DateTime.Now; + txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(Environment.NewLine); + Application.DoEvents(); + pbProcess.Minimum = 0; + pbProcess.Maximum = pil.Count; + pbProcess.Step = 1; + while (pil.Count > 0) + { + ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); + StringBuilder sbProcs = new StringBuilder(); + Queue piq = new Queue(); + foreach (ProcedureInfo pi in pil) + piq.Enqueue(pi); + pil.Clear(); + while (piq.Count > 0) + { + string msg = string.Empty; + ProcedureInfo pq = piq.Dequeue(); + if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) + { + pil.Add(pq); + sbProcs.AppendLine(msg); + } + else + { + RefreshProcedureTransitions(pq); + pbProcess.PerformStep(); + Application.DoEvents(); + } + } + ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); + DateTime pEnd = DateTime.Now; + txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); + Application.DoEvents(); + if (pil.Count > 0) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("The batch refresh process was not usccessful for all procedures selected."); + sb.AppendLine("The following procedures were not able to be refreshed..."); + sb.AppendLine(); + sb.AppendLine(sbProcs.ToString()); + sb.AppendLine(); + sb.AppendLine("If you want to refresh these prcoedures, please contact the respective users and have them close the procedures."); + sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); + sb.AppendLine(); + sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); + frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); + frmCO.MySessionInfo = MySessionInfo; + frmCO.CheckedOutProcedures = pil; + frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); + frmCO.Show(this); + while (!this.Visible) + Application.DoEvents(); + } + } + this.Cursor = Cursors.Default; + MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title)); + } + private void RefreshReferencedObjectsAndTransitions() + { + this.Cursor = Cursors.WaitCursor; + List pil = new List(); + foreach (TreeNode tn in myProcedures.Keys) + if (tn.Checked) + pil.Add(myProcedures[tn]); + //PopulateTransitionInfoLists(pil); + DateTime pStart = DateTime.Now; + txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(Environment.NewLine); + Application.DoEvents(); + pbProcess.Minimum = 0; + pbProcess.Maximum = pil.Count; + pbProcess.Step = 1; + while (pil.Count > 0) + { + ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); + StringBuilder sbProcs = new StringBuilder(); + Queue piq = new Queue(); + foreach (ProcedureInfo pi in pil) + piq.Enqueue(pi); + pil.Clear(); + while (piq.Count > 0) + { + string msg = string.Empty; + ProcedureInfo pq = piq.Dequeue(); + if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) + { + pil.Add(pq); + sbProcs.AppendLine(msg); + } + else + { + RefreshProcedureTransitions(pq); + RefreshProcedureReferencedObjects(pq); + pbProcess.PerformStep(); + Application.DoEvents(); + } + } + ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); + DateTime pEnd = DateTime.Now; + txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); + Application.DoEvents(); + if (pil.Count > 0) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("The batch refresh process was not usccessful for all procedures selected."); + sb.AppendLine("The following procedures were not able to be refreshed..."); + sb.AppendLine(); + sb.AppendLine(sbProcs.ToString()); + sb.AppendLine(); + sb.AppendLine("If you want to refresh these prcoedures, please contact the respective users and have them close the procedures."); + sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); + sb.AppendLine(); + sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); + frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); + frmCO.MySessionInfo = MySessionInfo; + frmCO.CheckedOutProcedures = pil; + frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); + frmCO.Show(this); + while (!this.Visible) + Application.DoEvents(); + } + } + this.Cursor = Cursors.Default; + MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title)); + } + private void DeletePDFs() + { + this.Cursor = Cursors.WaitCursor; + DateTime pStart = DateTime.Now; + txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(Environment.NewLine); + Application.DoEvents(); + int affectedRows = ExecuteStoredProcedure.Execute(selectedAdminTool.StoredProcedure); + txtProcess.AppendText(string.Format("Deleted {0} PDFs", affectedRows)); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(Environment.NewLine); + DateTime pEnd = DateTime.Now; + txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); + Application.DoEvents(); + this.Cursor = Cursors.Default; + MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title)); + } private void btnRefresh_Click(object sender, EventArgs e) { if (btnRefresh.Text == "NO OPTION SELECTED") @@ -116,154 +402,8 @@ namespace VEPROMS MessageBox.Show("You must select an option under the Option panel", btnRefresh.Text); return; } - this.Cursor = Cursors.WaitCursor; - if (rbNow.Checked) + if (chkLater.Checked) { - #region now - if (rbUpdate.Checked) - { - List dvil = new List(); - foreach(TreeNode tn in myDocVersions.Keys) - if (tn.Checked) - dvil.Add(myDocVersions[tn]); - DateTime pStart = DateTime.Now; - txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); - txtProcess.AppendText(Environment.NewLine); - txtProcess.AppendText(Environment.NewLine); - Application.DoEvents(); - pbProcess.Minimum = 0; - pbProcess.Maximum = dvil.Count; - pbProcess.Step = 1; - while (dvil.Count > 0) - { - StringBuilder sbDocVersions = new StringBuilder(); - Queue dviq = new Queue(); - foreach (DocVersionInfo dvi in dvil) - dviq.Enqueue(dvi); - dvil.Clear(); - while (dviq.Count > 0) - { - string msg = string.Empty; - DocVersionInfo dq = dviq.Dequeue(); - if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg)) - { - dvil.Add(dq); - sbDocVersions.AppendLine(msg); - } - else - { - ProcessUpdateROValues(dq); - pbProcess.PerformStep(); - Application.DoEvents(); - } - } - DateTime pEnd = DateTime.Now; - txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); - Application.DoEvents(); - if (dvil.Count > 0) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("The batch update process was not usccessful for all working drafts selected."); - sb.AppendLine("The following working drafts were not able to be refreshed..."); - sb.AppendLine(); - sb.AppendLine(sbDocVersions.ToString()); - sb.AppendLine(); - sb.AppendLine("If you want to update these working drafts, please contact the respective users and have them close any procedures in the working draft."); - sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); - sb.AppendLine(); - sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); - frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); - frmCO.MySessionInfo = MySessionInfo; - //frmCO.CheckedOutProcedures = dvil; - frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); - frmCO.Show(this); - while (!this.Visible) - Application.DoEvents(); - } - } - } - else - { - List pil = new List(); - foreach (TreeNode tn in myProcedures.Keys) - if (tn.Checked) - pil.Add(myProcedures[tn]); - PopulateTransitionInfoLists(pil); - DateTime pStart = DateTime.Now; - txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); - txtProcess.AppendText(Environment.NewLine); - txtProcess.AppendText(Environment.NewLine); - Application.DoEvents(); - pbProcess.Minimum = 0; - pbProcess.Maximum = pil.Count; - pbProcess.Step = 1; - while (pil.Count > 0) - { - ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); - StringBuilder sbProcs = new StringBuilder(); - Queue piq = new Queue(); - foreach (ProcedureInfo pi in pil) - piq.Enqueue(pi); - pil.Clear(); - while (piq.Count > 0) - { - string msg = string.Empty; - ProcedureInfo pq = piq.Dequeue(); - if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) - { - pil.Add(pq); - sbProcs.AppendLine(msg); - } - else - { - if (rbTransition.Checked) - { - RefreshProcedureTransitions(pq); - } - else if (rbRefObj.Checked) - { - RefreshProcedureReferencedObjects(pq); - } - else - { - RefreshProcedureTransitions(pq); - RefreshProcedureReferencedObjects(pq); - } - pbProcess.PerformStep(); - Application.DoEvents(); - } - } - ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); - DateTime pEnd = DateTime.Now; - txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); - Application.DoEvents(); - if (pil.Count > 0) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("The batch refresh process was not usccessful for all procedures selected."); - sb.AppendLine("The following procedures were not able to be refreshed..."); - sb.AppendLine(); - sb.AppendLine(sbProcs.ToString()); - sb.AppendLine(); - sb.AppendLine("If you want to refresh these prcoedures, please contact the respective users and have them close the procedures."); - sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); - sb.AppendLine(); - sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); - frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); - frmCO.MySessionInfo = MySessionInfo; - frmCO.CheckedOutProcedures = pil; - frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); - frmCO.Show(this); - while (!this.Visible) - Application.DoEvents(); - } - } - } - #endregion - } - else - { - #region later long later = long.Parse(dtpDate.Value.ToString("yyyyMMdd") + dtpTime.Value.ToString("HHmm")); long now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm")); while (now < later) @@ -273,149 +413,9 @@ namespace VEPROMS System.Threading.Thread.Sleep(60000); now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm")); } - if (rbUpdate.Checked) - { - List dvil = new List(); - foreach (TreeNode tn in myDocVersions.Keys) - if (tn.Checked) - dvil.Add(myDocVersions[tn]); - DateTime pStart = DateTime.Now; - txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); - txtProcess.AppendText(Environment.NewLine); - txtProcess.AppendText(Environment.NewLine); - Application.DoEvents(); - pbProcess.Minimum = 0; - pbProcess.Maximum = dvil.Count; - pbProcess.Step = 1; - while (dvil.Count > 0) - { - StringBuilder sbDocVersions = new StringBuilder(); - Queue dviq = new Queue(); - foreach (DocVersionInfo dvi in dvil) - dviq.Enqueue(dvi); - dvil.Clear(); - while (dviq.Count > 0) - { - string msg = string.Empty; - DocVersionInfo dq = dviq.Dequeue(); - if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg)) - { - dvil.Add(dq); - sbDocVersions.AppendLine(msg); - } - else - { - ProcessUpdateROValues(dq); - pbProcess.PerformStep(); - Application.DoEvents(); - } - } - DateTime pEnd = DateTime.Now; - txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); - Application.DoEvents(); - if (dvil.Count > 0) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("The batch update process was not usccessful for all working drafts selected."); - sb.AppendLine("The following working drafts were not able to be refreshed..."); - sb.AppendLine(); - sb.AppendLine(sbDocVersions.ToString()); - sb.AppendLine(); - sb.AppendLine("If you want to update these working drafts, please contact the respective users and have them close any procedures in the working draft."); - sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); - sb.AppendLine(); - sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); - frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); - frmCO.MySessionInfo = MySessionInfo; - //frmCO.CheckedOutProcedures = dvil; - frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); - frmCO.Show(this); - while (!this.Visible) - Application.DoEvents(); - } - } - } - else - { - List pil = new List(); - foreach (TreeNode tn in myProcedures.Keys) - if (tn.Checked) - pil.Add(myProcedures[tn]); - DateTime pStart = DateTime.Now; - txtProcess.AppendText(Environment.NewLine); - txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); - txtProcess.AppendText(Environment.NewLine); - txtProcess.AppendText(Environment.NewLine); - Application.DoEvents(); - pbProcess.Minimum = 0; - pbProcess.Maximum = pil.Count; - pbProcess.Step = 1; - while (pil.Count > 0) - { - ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); - StringBuilder sbProcs = new StringBuilder(); - Queue piq = new Queue(); - foreach (ProcedureInfo pi in pil) - piq.Enqueue(pi); - pil.Clear(); - while (piq.Count > 0) - { - string msg = string.Empty; - ProcedureInfo pq = piq.Dequeue(); - if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) - { - pil.Add(pq); - sbProcs.AppendLine(msg); - } - else - { - if (rbTransition.Checked) - { - RefreshProcedureTransitions(pq); - } - else if (rbRefObj.Checked) - { - RefreshProcedureReferencedObjects(pq); - } - else - { - RefreshProcedureTransitions(pq); - RefreshProcedureReferencedObjects(pq); - } - pbProcess.PerformStep(); - Application.DoEvents(); - } - } - ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); - DateTime pEnd = DateTime.Now; - txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm")); - Application.DoEvents(); - if (pil.Count > 0) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("The batch refresh process was not usccessful for all procedures selected."); - sb.AppendLine("The following procedures were not able to be refreshed..."); - sb.AppendLine(); - sb.AppendLine(sbProcs.ToString()); - sb.AppendLine(); - sb.AppendLine("These procedures were forced checked in and the process was allowed to complete."); - foreach (ProcedureInfo pi in pil) - { - OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure); - MySessionInfo.CheckInItem(oi.OwnerID); - } - txtProcess.AppendText(sb.ToString()); - txtProcess.AppendText(Environment.NewLine); - Application.DoEvents(); - } - } - } - #endregion } - this.Cursor = Cursors.Default; - MessageBox.Show("Batch Refresh Process Completed", "Batch Refresh Complete"); + selectedAdminTool.Execute(); } - private void ProcessUpdateROValues(DocVersionInfo dq) { InitialProgressBarMessage = string.Format("Updating ROs for {0}", dq.MyFolder.Name); @@ -483,7 +483,6 @@ namespace VEPROMS txtProcess.AppendText(Environment.NewLine); return; } - private void RefreshProcedureReferencedObjects(ProcedureInfo pq) { DateTime start = DateTime.Now; @@ -499,14 +498,14 @@ namespace VEPROMS txtResults.AppendText(Environment.NewLine); } } - private TransitionInfoList transitionsToDisconnected; - private TransitionInfoList transitionsToNonEditable; + //private TransitionInfoList transitionsToDisconnected; + //private TransitionInfoList transitionsToNonEditable; private void RefreshProcedureTransitions(ProcedureInfo pq) { DateTime start = DateTime.Now; myFixes = new StringBuilder(); ProcedureInfo.ResetTranCounters(); - ProcedureInfo.RefreshTransitions(pq, transitionsToDisconnected, transitionsToNonEditable); + ProcedureInfo.RefreshTransitions(pq);//, transitionsToDisconnected, transitionsToNonEditable); TimeSpan ts = DateTime.Now - start; txtProcess.AppendText(string.Format("Procedure: {1}{0}Checked {2} Transitions{0}Fixed {3} Transitions{0}Elapsed Seconds:{4}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ts.TotalSeconds)); if (myFixes.Length > 0) @@ -534,7 +533,7 @@ namespace VEPROMS txtProcess.AppendText(Environment.NewLine); Application.DoEvents(); //transitionsToDisconnected = TransitionInfoList.GetTransitionsToDisconnected(sb.ToString()); - transitionsToNonEditable = TransitionInfoList.GetTransitionsToNonEditable(sb.ToString()); + //transitionsToNonEditable = TransitionInfoList.GetTransitionsToNonEditable(sb.ToString()); } private void ProgressBarShowText() { @@ -556,9 +555,14 @@ namespace VEPROMS StringBuilder myFixes; void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) { - if(args.Type == "TX") - myFixes.AppendLine(string.Format("Fixed Transition for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue)); - else if(args.Type == "RO") + if (args.Type == "TX") + { + if(args.NewValue.StartsWith("Reason for Change:")) + myFixes.AppendLine(string.Format("Fixed Transition for {1}{0}Old Text: {2}{0}{3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue)); + else + myFixes.AppendLine(string.Format("Fixed Transition for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue)); + } + else if (args.Type == "RO") myFixes.AppendLine(string.Format("Fixed Referenced Object for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue)); } private void btnClear_Click(object sender, EventArgs e) @@ -581,18 +585,6 @@ namespace VEPROMS sw.Close(); } } - private void Options_Changed(object sender, EventArgs e) - { - RadioButton rb = sender as RadioButton; - if (rb.Checked) - { - btnRefresh.Text = (sender as RadioButton).Text; - if (rb == rbUpdate) - ResetTV(true); - else - ResetTV(); - } - } private void myTV_AfterCheck(object sender, TreeViewEventArgs e) { if (e.Action != TreeViewAction.Unknown) @@ -608,12 +600,6 @@ namespace VEPROMS CheckChildNodes(tn, ischecked); } } - - private void schedule_Click(object sender, EventArgs e) - { - pnlLater.Enabled = rbLater.Checked; - } - private ProgressBarItem _ProgressBar = null; public ProgressBarItem ProgressBar { @@ -660,26 +646,129 @@ namespace VEPROMS Application.DoEvents(); } } - private void btBatch_BalloonDisplaying(object sender, EventArgs e) + private void cbxAdminTools_SelectedIndexChanged(object sender, EventArgs e) { - Point p = Control.MousePosition; - p.Offset(-btBatch.BalloonControl.TipOffset, btBatch.BalloonControl.TipLength + 4); - btBatch.BalloonControl.Location = p; - if (btBatch.BalloonTriggerControl == rbTransition) + selectedAdminTool = cbxAdminTools.SelectedItem as AdminTool; + if (selectedAdminTool == null) { + lblCaption.Text = string.Empty; + lblDescription.Text = string.Empty; + lblWarning.Text = string.Empty; + myTV.Nodes.Clear(); + btnRefresh.Text = "NO OPTION SELECTED"; } - else if (btBatch.BalloonTriggerControl == rbRefObj) - { - } - else if (btBatch.BalloonTriggerControl == rbBoth) - { - } - else if (btBatch.BalloonTriggerControl == rbNow) - { - } - else if (btBatch.BalloonTriggerControl == rbLater) + else { + lblCaption.Text = selectedAdminTool.Caption; + lblDescription.Text = selectedAdminTool.Description; + lblWarning.Text = selectedAdminTool.WarningPrefix + " " + selectedAdminTool.Warning; + lblWarning.Visible = selectedAdminTool.Warning.Length > 0; + ResetTV(selectedAdminTool.NoProcedures); + btnRefresh.Text = selectedAdminTool.Title; } } + private void chkLater_CheckedChanged(object sender, EventArgs e) + { + pnlLater.Enabled = chkLater.Checked; + } } + public class AdminTool + { + private string _Title; + public string Title + { + get { return _Title; } + set { _Title = value; } + } + private string _Caption; + public string Caption + { + get { return _Caption; } + set { _Caption = value; } + } + private string _Description; + public string Description + { + get { return _Description; } + set { _Description = value; } + } + private string _Warning; + public string Warning + { + get { return _Warning; } + set { _Warning = value; } + } + private string _WarningPrefix; + public string WarningPrefix + { + get { return _WarningPrefix; } + set { _WarningPrefix = value; } + } + private bool _NoProcedures; + public bool NoProcedures + { + get { return _NoProcedures; } + set { _NoProcedures = value; } + } + private bool _NoTreeView; + public bool NoTreeView + { + get { return _NoTreeView; } + set { _NoTreeView = value; } + } + private AdminToolExecute _MyExecute; + public AdminToolExecute MyExecute + { + get { return _MyExecute; } + set { _MyExecute = value; } + } + private string _StoredProcedure; + public string StoredProcedure + { + get { return _StoredProcedure; } + set { _StoredProcedure = value; } + } + public void Execute() + { + if (MyExecute != null) MyExecute(); + } + public AdminTool() + { + } + public AdminTool(string title, string caption, string description, string warning, string warningPrefix, bool noProcedures, bool noTreeView, AdminToolExecute myExecute) + { + _Title = title; + _Caption = caption; + _Description = description; + _Warning = warning; + _WarningPrefix = warningPrefix; + _NoProcedures = noProcedures; + _NoTreeView = noTreeView; + _MyExecute = myExecute; + } + public AdminTool(string title, string caption, string description, string warning, string warningPrefix, bool noProcedures, bool noTreeView, string storedProcedure, AdminToolExecute myExecute) + { + _Title = title; + _Caption = caption; + _Description = description; + _Warning = warning; + _WarningPrefix = warningPrefix; + _NoProcedures = noProcedures; + _NoTreeView = noTreeView; + _StoredProcedure = storedProcedure; + _MyExecute = myExecute; + } + } + public class AdminTools : List + { + public void Add(string title, string caption, string description, string warning, string warningPrefix, bool noProcedures, bool noTreeView, AdminToolExecute myExecute) + { + base.Add(new AdminTool(title, caption, description, warning, warningPrefix, noProcedures, noTreeView, myExecute)); + } + public void Add(string title, string caption, string description, string warning, string warningPrefix, bool noProcedures, bool noTreeView, string storedProcedure, AdminToolExecute myExecute) + { + base.Add(new AdminTool(title, caption, description, warning, warningPrefix, noProcedures, noTreeView, storedProcedure, myExecute)); + } + } + public delegate void AdminToolExecute(); } \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.resx b/PROMS/VEPROMS User Interface/frmBatchRefresh.resx index 7ee46167..527d7b26 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.resx +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - 38 diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 24ca2ebd..d92b5832 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -881,7 +881,7 @@ namespace VEPROMS btnResetSecurity.Click += new EventHandler(btnResetSecurity_Click); //end added by jcb //batch refresh transitions - btnBatchRefresh = new ButtonItem("btnBatchRefresh", "Batch Refresh"); + btnBatchRefresh = new ButtonItem("btnBatchRefresh", "Administrative Tools"); btnBatchRefresh.Click += new EventHandler(btnBatchRefresh_Click); btnAdmin.SubItems.Add(btnBatchRefresh); //end batch refresh transitions @@ -1039,7 +1039,7 @@ namespace VEPROMS frmBatchRefresh frm = new frmBatchRefresh(); frm.ProgressBar = bottomProgBar; frm.MySessionInfo = MySessionInfo; - frm.Show(this); + frm.ShowDialog(this); } void tmrCloseTabItems_Tick(object sender, EventArgs e) @@ -1438,7 +1438,7 @@ namespace VEPROMS } private void SaveMRU() { - Properties.Settings.Default.MRIList = _MyMRIList.ToSettings(); + if(_MyMRIList != null) Properties.Settings.Default.MRIList = _MyMRIList.ToSettings(); Properties.Settings.Default.TreeviewExpanded = epProcedures.Expanded; Properties.Settings.Default.Save(); }