diff --git a/PROMS/VEPROMS User Interface/Properties/AssemblyInfo.cs b/PROMS/VEPROMS User Interface/Properties/AssemblyInfo.cs index 06f03d4c..e3695856 100644 --- a/PROMS/VEPROMS User Interface/Properties/AssemblyInfo.cs +++ b/PROMS/VEPROMS User Interface/Properties/AssemblyInfo.cs @@ -44,8 +44,9 @@ using System.Runtime.InteropServices; // Revision DHH (day - no leading zero, two digit hour - military time // // ********* REMEMBER TO CHECK THE AssemblyConfiguration SETTING (ABOVE) ******** -[assembly: AssemblyVersion("2.1.2508.1807")] -[assembly: AssemblyFileVersion("2.1.2508.1807")] +[assembly: AssemblyVersion("2.2.2508.2100")] +[assembly: AssemblyFileVersion("2.2.2508.2100")] + diff --git a/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj b/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj index 593c1005..184da061 100644 --- a/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj +++ b/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj @@ -298,12 +298,6 @@ frmSI.cs - - Form - - - frmUCF.cs - Form @@ -395,9 +389,6 @@ frmSI.cs - - frmUCF.cs - Designer frmVEPROMS.cs diff --git a/PROMS/VEPROMS User Interface/frmUCF.cs b/PROMS/VEPROMS User Interface/frmUCF.cs deleted file mode 100644 index 18327290..00000000 --- a/PROMS/VEPROMS User Interface/frmUCF.cs +++ /dev/null @@ -1,1015 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Xml; -using System.IO; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; -using System.Xml.Xsl; - - -namespace VEPROMS -{ - // frmUCF is the main form for User Control of Format. It is accessible by Administrator & Set Administrator from the V button Administration - // menu. It uses the FormatConfig structure whose data is stored in the Config field of the Formats table. It uses XmlSerialization to - // store/retrieve the data from the database field and uses a Windows Property Grid to present the data, the data is tied to the - // Property Grid by setting the SelectedObject of the Property Grid to the FormatConfig. FormatConfig objects use TypeConverter(typeof(ExpandableObjectConverter)) on the - // fields to allow for accessing the data structures below the FormatConfig level (by default, fields are shown in the grid, Browsable(false) does - // not show the fields. NOTE that collection data uses the PropGridCollEditor, see that file for further information (in Volian.Base.Library) - // - public partial class frmUCF : Form - { - private bool _UcfForRepWords = false; - public bool UcfForRepWords // flags that UCF has changes to replace words - use for Reset button enabling - { - get { return _UcfForRepWords; } - set { _UcfForRepWords = value; } - } - private FormatConfig MyFormatConfig = new FormatConfig(); - private PlantFormat OriginalPlantFormat; - private FormatInfo OriginalFormatInfo; - public frmUCF() - { - InitializeComponent(); - } - private bool _Initializing = false; - private void frmUCF_Load(object sender, EventArgs e) - { - _Initializing = true; - PlantFormat.DoingUCFCheckOffs = true; - PlantFormat.DoingUCFCheckOffsUse = MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF ?? false; - cbxFormatList.DataSource = null; - cbxFormatList.DisplayMember = "FullName"; - cbxFormatList.ValueMember = "FullName"; - cbxFormatList.DataSource = FormatInfoList.GetFormatInfoListUsed(); - cbxFormatList.SelectedIndex = -1; - MyFormatConfig = new FormatConfig(); - PG.SelectedObject = MyFormatConfig; - PG.Enabled = false; - PG.SelectedGridItemChanged += PG_SelectedGridItemChanged; - PG.PropertyValueChanged += PG_PropertyValueChanged; - btnSaveAs.Enabled = false; - btnSaveClose.Enabled = false; - btnSave.Enabled = false; - btnReset.Enabled = false; - btnDelete.Enabled = false; - _Initializing = false; - } - void PG_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) - { - if (SelectedGridField.EndsWith("Flags:UCF CheckOffs")) - { - // when changing whether the UCF format has the UCF checkoffs (there is a list of checkoffs/headers in the base format, when this - // flag is true, they get added to the list from the starting format), refresh the checkoff header & checkoff lists - if ((bool)e.OldValue != MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF) - { - // refresh the checkoff data in myformatconfig. Need to clear the checkoff header list & checkoff list before - // getting new data. - PlantFormat.DoingUCFCheckOffsUse = (bool)MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF; - GetUCFCheckOffDataForUCFGrid((bool)MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF); - PG.Refresh(); - } - } - else if (SelectedGridField.EndsWith(" Name")) // B2019-012: don't allow removal of '_UCF' from name. - { - if ((string)e.OldValue != MyFormatConfig.Name) - { - if (((string)e.OldValue).EndsWith("_UCF") && !MyFormatConfig.Name.EndsWith("_UCF")) - { - MessageBox.Show(this, "Cannot remove '_UCF' from User Controlled Format name", "UCF Name", MessageBoxButtons.OK); - MyFormatConfig.Name = MyFormatConfig.Name + ("_UCF"); - PG.Refresh(); - } - } - } - } - private string SelectedGridField = "Identification: Name"; // first field sectioned upon creation of form - void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e) - { - if (_Initializing || _formatListIndexChanging) return; - - // refresh the summary data textbox data to show summary of what is in this UCF. This occurs when move off of a field which - // actually 'stores' the change. - FormatConfig tmpfc = GetChangesUCFForSave(); - string scf = tmpfc.ConvertToString(); - scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); - SetUCFSummary(scf); - - // see if data has changed, and if so, enable the Reset button. - // Upon selection of a grid item, see if the grid item has data associated with it & if so, see if there has been - // a change. Code needs added here for any value listed on the main property grid, i.e. not part of a collection, or - // if the collection is reset in its entirety (replace words is an example of this). - bool enabled = false; - btnReset.Text = "Reset"; - string previousSelectedGridField = SelectedGridField; - SelectedGridField = LabelPath(PG.SelectedGridItem); - // remove the following line before release: - lblPGItem.Text = SelectedGridField; - - if (previousSelectedGridField.EndsWith("Identification: Name") && !SelectedGridField.EndsWith("Identification: Name")) SetButtonSaveAsEnabled(); - if (previousSelectedGridField.EndsWith("Data:Plant Format:Step Settings:Replace Words List")) - { - // if moving off of the replace words, see if any changes exist so that Reset List button is enabled: - FormatConfig.ReplaceStrData rps = GetChangedReplaceListForSave(); - UcfForRepWords = (rps != null && rps.Count > 0); - } - if (SelectedGridField.EndsWith("Identification: Name")) enabled = false; - else if (SelectedGridField.EndsWith("Data:Plant Format")) enabled = false; - else if (SelectedGridField.EndsWith("Data:Plant Format:Section Type Settings")) enabled = false; - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings")) enabled = false; - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags")) enabled = false; - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags:Compress Steps")) - { - if (MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps != null && MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps != OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CompressSteps) - { - btnReset.Text = "Reset to " + OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CompressSteps; - enabled = true; - } - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags:Partial Step Compression")) - { - if (MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression != null && MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression != OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PartialStepCompression) - { - btnReset.Text = "Reset to " + OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PartialStepCompression; - enabled = true; - } - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags:UCF CheckOffs")) - { - if (MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF != null && MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF != OriginalPlantFormat.FormatData.ProcData.CheckOffUCF) - { - btnReset.Text = "Reset to " + OriginalPlantFormat.FormatData.ProcData.CheckOffUCF; - enabled = true; - } - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Replace Words List")) - { - if (UcfForRepWords) // flags that ucf data exists for replace words. - { - btnReset.Text = "Reset List"; - enabled = true; - } - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:CheckOff XOffset")) - { - if (MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj != null && MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj != 0) // flags that ucf data exists for replace words. - { - btnReset.Text = "Reset to 0"; - enabled = true; - } - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Step List")) enabled = false; - else enabled = false; - - btnReset.Enabled = enabled; - } - // remove the following method for release: - private string LabelPath(GridItem gi) - { - return (gi.Parent == null ? "" : LabelPath(gi.Parent) + ":" + gi.Label); - } - private void btnSaveClose_Click(object sender, EventArgs e) - { - // get a FormatConfig structure that only has differences from the original format. This is what gets saved. - FormatConfig tmpForSave = GetChangesUCFForSave(); - string scf = tmpForSave.ConvertToString(); - scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); - int fmtid = OriginalPlantFormat.MyFormat is Format ? (OriginalPlantFormat.MyFormat as Format).FormatID : (OriginalPlantFormat.MyFormat as FormatInfo).FormatID; - // for now, tell the user that changes don't take affect until reentry. This was done since the 'refresh' of FormatConfig was not - // working. - using (Format fmt = Format.Get(fmtid)) - { - FormatInfo fi = FormatInfo.GetFormatNoUCFByFormatID(OriginalFormatInfo.FormatID); - if (fi.Data == "") - { - fmt.Data = ""; - fmt.GenMac = ""; - } - fmt.Config = scf; - fmt.Name = MyFormatConfig.Name; - fmt.Description = MyFormatConfig.Description; - fmt.Save(true); - MessageBox.Show(this, "Restart PROMS to have format changes take effect.", "", MessageBoxButtons.OK); - } - OriginalPlantFormat.FormatData.ProcData.CheckOffData.ClearCheckOffAndHeaderLists(); - PlantFormat.IgnoreUCF = false; - PlantFormat.DoingUCFCheckOffs = false; - } - private void btnCancel_Click(object sender, EventArgs e) - { - if (OriginalPlantFormat != null) OriginalPlantFormat.FormatData.ProcData.CheckOffData.ClearCheckOffAndHeaderLists(); - PlantFormat.IgnoreUCF = false; - PlantFormat.DoingUCFCheckOffs = false; - } - private bool _formatListIndexChanging = false; // don't change other selections when changing this index - private void cbxFormatList_SelectedIndexChanged(object sender, EventArgs e) - { - if (_Initializing) return; - if (cbxFormatList.SelectedIndex > -1) - { - _formatListIndexChanging = true; - FormatInfoList fl = FormatInfoList.GetFormatInfoListUsed(); - // Get the format data, the query in GetFormatInfoListUsed may have null for data/genmac which causes a - // problem when reading the 'parent' data for UCF saved as formats. - int i = -1; - FormatInfo finfo = cbxFormatList.SelectedItem as FormatInfo; - if (finfo == null) finfo = fl[cbxFormatList.SelectedIndex]; - OriginalFormatInfo = FormatInfo.Get(finfo.FormatID); - OriginalPlantFormat = OriginalFormatInfo.PlantFormat; - - // get original data when accessing the plant format data (not UCF because it UCF data is being modified): - PlantFormat.IgnoreUCF = true; - int formatid = OriginalPlantFormat.MyFormat is Format ? (OriginalPlantFormat.MyFormat as Format).FormatID : (OriginalPlantFormat.MyFormat as FormatInfo).FormatID; - FormatInfo fi = FormatInfo.Get(formatid); - // if this has config data it is a UCF format, the MyFormatConfig has the config data & see if doing additional checkoffs. - // Also, put out the summary of the changes if it is a 'UCF' and if no differences just state that. - btnDetails.Visible = true; - lblSummary.Visible = true; - tbUCFSummary.Visible = true; - if (fi.Config != null && fi.Config != "") - { - MyFormatConfig = FormatConfig.Get(fi.Config); - PlantFormat.DoingUCFCheckOffsUse = MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF ?? false; - btnSaveClose.Enabled = true; // UCF formats can be modified and saved. - btnSave.Enabled = true; - SetUCFSummary(fi.Config); - } - else - { - MyFormatConfig = new FormatConfig(); - btnSaveClose.Enabled = false; - btnSave.Enabled = false; - tbUCFSummary.Text = "No differences from original"; - } - // initialize the data based on the selected format with any changes from the FormatConfig. - GetUCFDataForUCFGrid(); - PG.Enabled = true; - PG.SelectedObject = MyFormatConfig; - btnSaveAs.Enabled = false; - SetDeleteOrResetAllButton(); - - // set derived from if there is a parent: - if (OriginalFormatInfo.MyParent.FormatID == 1) - { - lblDerFrom.Visible = false; - lblDerivedFrom.Visible = false; - } - else - { - // get to top parent format: - FormatInfo p = OriginalFormatInfo; - while (p.MyParent.FormatID != 1) p = p.MyParent; - lblDerFrom.Visible = true; - lblDerivedFrom.Visible = true; - lblDerivedFrom.Text = p.Name.Replace("_UCF", "") + "->" + OriginalFormatInfo.MyParent.Name.Replace("_UCF", "") + ":" + OriginalFormatInfo.MyParent.Description; - } - _formatListIndexChanging = false; - } - - } - - private void SetUCFSummary(string formatConfig) - { - try - { - string sXSLSummary = System.IO.File.ReadAllText(Application.StartupPath + "\\" + "UCFSummary.xsl"); - StringWriter sw = new StringWriter(); - using (XmlReader xrt = XmlReader.Create(new StringReader(sXSLSummary))) - { - using (XmlReader xri = XmlReader.Create(new StringReader(formatConfig))) - { - using (XmlWriter xwo = XmlWriter.Create(sw)) - { - XslCompiledTransform xsl = new XslCompiledTransform(); - xsl.Load(xrt); - xsl.Transform(xri, null, sw); - } - if (sw == null || sw.ToString() == "") - tbUCFSummary.Text = "No differences from original"; - else - tbUCFSummary.Text = sw.ToString(); - } - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Error getting summary for UCF differences", MessageBoxButtons.OK); - } - } - // The SaveAs Button should only be enabled if the user has given this format change a unique 'Name'. - private void SetButtonSaveAsEnabled() - { - btnSaveAs.Enabled = false; - if (MyFormatConfig.Name == null || MyFormatConfig.Name == "") return; - // See if Name has been changed: - if (MyFormatConfig.Name == OriginalFormatInfo.Name) return; - - // See if the Name is unique - foreach (FormatInfo fi in FormatInfoList.SortedFormatInfoList) - { - if (MyFormatConfig.Name == fi.Name && MyFormatConfig.Name != savDBFormatConfig.Name) - { - MessageBox.Show("A format with Name " + MyFormatConfig.Name + " already exists. Name must be unique. Change the name before a Save As can be done."); - } - } - btnSaveAs.Enabled = true; - return; - } - // If the selected format is a UCF 'Save As', then possibly allow delete (if not used). Otherwise, if selected format - // has Config data, i.e. UCF data, then change button text to 'Revert to Original'. In both cases, enable button, otherwise it is disabled. - private void SetDeleteOrResetAllButton() - { - btnDelete.Enabled = false; - // See if UCF Save As, i.e. Data/Genmac are null and that the format is not used. - FormatInfo fi = FormatInfo.GetFormatNoUCFByFormatID(OriginalFormatInfo.FormatID); - if (fi.Data == "") - { - if (OriginalFormatInfo.ChildFormatCount == 0 && OriginalFormatInfo.FormatContentCount == 0 && OriginalFormatInfo.FormatDocVersionCount == 0 && OriginalFormatInfo.FormatFolderCount == 0) - { - btnDelete.Enabled = true; - btnDelete.Text = "Delete"; - } - } - else - { - if (OriginalFormatInfo.Config != null && OriginalFormatInfo.Config != "") - { - btnDelete.Enabled = true; - btnDelete.Text = "Revert to Original"; - } - } - } - // GetChangeUCFForSave compares UCF data in FormatConfig to the original PlantFormat data to see if there - // are changes that need to be saved to the database. - private FormatConfig savDBFormatConfig; - private FormatConfig GetChangesUCFForSave() - { - FormatConfig changesOnly = new FormatConfig(); - - // Flags - if (MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps != null && MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps != OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CompressSteps) - changesOnly.PlantFormat.FormatData.Flags.CompressSteps = MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps; - if (MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression != null && MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression != OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PartialStepCompression) - changesOnly.PlantFormat.FormatData.Flags.PartialStepCompression = MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression; - if (MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF != null && MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF == true) // save if true (original format is always false) - changesOnly.PlantFormat.FormatData.Flags.CheckOffUCF = MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF; - - // CheckOff Headers - if (MyFormatConfig.PlantFormat.FormatData.CheckOffHeaderList != null) changesOnly.PlantFormat.FormatData.CheckOffHeaderList = GetChangeCheckOffHeaderListForSave(); - - // CheckOffs - if (MyFormatConfig.PlantFormat.FormatData.CheckOffList != null) changesOnly.PlantFormat.FormatData.CheckOffList = GetChangeCheckOffListForSave(); - - // Checkoff xoffset adjustment - if (MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj != null && MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj != 0) // save if not zero (original format is always zero) - changesOnly.PlantFormat.FormatData.CheckOffXOffAdj = MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj; - - // steps - if (MyFormatConfig.PlantFormat.FormatData.StepData != null) changesOnly.PlantFormat.FormatData.StepData = GetChangeStepListForSave(); - - // replace words - just store them all, if there are differences... can't handle deleted unless doing this. - if (MyFormatConfig.PlantFormat.FormatData.ReplaceStrData != null) changesOnly.PlantFormat.FormatData.ReplaceStrData = GetChangedReplaceListForSave(); - - // docstyles - FormatConfig.DocStyles retds = new FormatConfig.DocStyles(); - foreach (DocStyle dsorig in OriginalPlantFormat.DocStyles.DocStyleList) - { - if (!dsorig.Inactive && dsorig.IsStepSection) - { - FormatConfig.DocStyle ds = new FormatConfig.DocStyle(); - ds.Index = dsorig.Index.ToString(); - ds.Name = dsorig.Name; - if (ds.Layout == null) ds.Layout = new FormatConfig.Layout(); - // See if in the FormatConfig, use it - FormatConfig.DocStyle found = null; - if (MyFormatConfig.PlantFormat.DocStyles != null) - { - foreach (FormatConfig.DocStyle fcds in MyFormatConfig.PlantFormat.DocStyles) - { - float? difl = Math.Abs((float)((fcds.Layout.LeftMargin * 72) - dsorig.Layout.LeftMargin)); - float? difp = Math.Abs((float)((fcds.Layout.PageLength * 72) - dsorig.Layout.PageLength)); - if (fcds.Index == dsorig.Index.ToString() && (difl > 1 || difp > 1)) - { - found = fcds; - break; - } - } - } - if (found != null) // save it values are different. - { - if ((found.Layout.LeftMargin * 72) != dsorig.Layout.LeftMargin) ds.Layout.LeftMargin = found.Layout.LeftMargin * 72; - else ds.Layout.LeftMargin = null; - if ((found.Layout.PageLength * 72) != dsorig.Layout.PageLength) ds.Layout.PageLength = found.Layout.PageLength * 72; - else ds.Layout.PageLength = null; - retds.Add(ds); - } - } - } - if (retds.Count > 0) changesOnly.PlantFormat.DocStyles = retds; - return changesOnly; - } - // Check for differences in the checkoffheaderlist & checkofflist. Only Active flag is used: - private FormatConfig.CheckOffHeaderList GetChangeCheckOffHeaderListForSave() - { - FormatConfig.CheckOffHeaderList cohlist = new FormatConfig.CheckOffHeaderList(); - foreach (FormatConfig.CheckOffHeader coh in MyFormatConfig.PlantFormat.FormatData.CheckOffHeaderList) - { - if (!(bool)coh.Active) cohlist.Add(coh); - } - return cohlist; - } - private FormatConfig.CheckOffList GetChangeCheckOffListForSave() - { - FormatConfig.CheckOffList colist = new FormatConfig.CheckOffList(); - foreach (FormatConfig.CheckOff co in MyFormatConfig.PlantFormat.FormatData.CheckOffList) - { - if (!(bool)co.Active) colist.Add(co); - } - return colist; - } - // Check for differences in the StepDataList between UCF and original data for saving of data to database: - private FormatConfig.StepData GetChangeStepListForSave() - { - FormatConfig.StepData sdlist = new FormatConfig.StepData(); - foreach (StepData sdorig in OriginalPlantFormat.FormatData.StepDataList) - { - if (!sdorig.Inactive) - { - // find this step in the config data: - foreach (FormatConfig.Step fcstp in MyFormatConfig.PlantFormat.FormatData.StepData) - { - if (fcstp.Index == sdorig.Index.ToString()) - { - // see if data is different and if so, add it to the return list: - System.Drawing.FontConverter cvt = new System.Drawing.FontConverter(); - string origFont = cvt.ConvertToString(sdorig.Font.WindowsFont); - string newFont = cvt.ConvertToString(fcstp.FontDesc.WindowsFont); - if (origFont != newFont) - { - FormatConfig.Step stp = fcstp; - sdlist.Add(stp); - } - break; - } - } - } - } - return sdlist; - } - // Check for differences in the ReplaceWords between UCF and original data for saving of data to database: - private FormatConfig.ReplaceStrData GetChangedReplaceListForSave() - { - // only saving the differences - // need to compare the original format list with the list as it is stored for UCF, i.e.working with property grid and save differences. - // Note that check for 'bad' data such as no flags, or null/empty replace with/word strings - don't use those. - // States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified - FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // list of changes - foreach (FormatConfig.ReplaceStr ucfrepstr in MyFormatConfig.PlantFormat.FormatData.ReplaceStrData) - { - // Modified - foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList) - { - // B2019-113: consider replace word AND flags to determine if there was a modification - if (origrepstr.ReplaceWord.Replace("{Backspace}", "") == ucfrepstr.ReplaceWord.Replace("{Backspace}", "") && (E_ReplaceFlags)ucfrepstr.Flag == origrepstr.Flag) - { - if ((ucfrepstr.ReplaceWith != origrepstr.ReplaceWith) && ucfrepstr.Flag != 0 && ucfrepstr.ReplaceWith != "") - { - ucfrepstr.State = 2; - retlist.Add(ucfrepstr); - break; - } - } - } - } - // Added: - List origstrList = new List(); // used to find added, (see later in this method) - foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList) origstrList.Add(origrepstr.ReplaceWord); - foreach (FormatConfig.ReplaceStr ucfrepstr in MyFormatConfig.PlantFormat.FormatData.ReplaceStrData) - { - if (!origstrList.Contains(ucfrepstr.ReplaceWord)) - { - // check for valid data, i.e. flag set & both replaceword & with not blank - if (ucfrepstr.Flag != 0 && ucfrepstr.ReplaceWith != null && ucfrepstr.ReplaceWith != "" && ucfrepstr.ReplaceWord != null && ucfrepstr.ReplaceWord != "") - { - ucfrepstr.State = 1; - retlist.Add(ucfrepstr); - } - } - else // B2019-113: replace word is in the original list, see if this word was added with different flags - { - if (!RepWrdSameWordSameFlags(OriginalPlantFormat.FormatData.SectData.ReplaceStrList, ucfrepstr)) - { - ucfrepstr.State = 1; - retlist.Add(ucfrepstr); - } - } - } - //Deleted: - List ucfList = new List(); // used to find deleted - foreach (FormatConfig.ReplaceStr ucfrepstr in MyFormatConfig.PlantFormat.FormatData.ReplaceStrData) ucfList.Add(ucfrepstr.ReplaceWord); - foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList) - { - bool addtodeletelist = false; - if (!ucfList.Contains(origrepstr.ReplaceWord) ) - { - if (!((origrepstr.ReplaceWith.Contains("$1") && origrepstr.ReplaceWord.Contains("w*")) || origrepstr.ReplaceWith.Contains("{Backspace}"))) - { - addtodeletelist = true; - } - } - else // // B2019-113: for this ucf replaceword, see if its flag is in the original list - { - foreach (FormatConfig.ReplaceStr ucfrepstruct in MyFormatConfig.PlantFormat.FormatData.ReplaceStrData) - { - if (origrepstr.ReplaceWord.Replace("{Backspace}", "") == ucfrepstruct.ReplaceWord.Replace("{Backspace}", "")) - { - // only deleted if replace word AND flags match: - if (!RepWrdSameWordSameFlags(OriginalPlantFormat.FormatData.SectData.ReplaceStrList, ucfrepstruct)) - { - addtodeletelist = true; - break; - } - } - } - } - if (addtodeletelist) - { - // make a deleted replacestr to save - FormatConfig.ReplaceStr del = new FormatConfig.ReplaceStr(); - del.State = -1; - del.Flag = (FormatConfig.E_ReplaceFlagsUCF)origrepstr.Flag; - del.ReplaceWord = origrepstr.ReplaceWord; - del.ReplaceWith = origrepstr.ReplaceWith; - retlist.Add(del); - } - } - return retlist; - } - - private bool RepWrdSameWordSameFlags(ReplaceStrList replaceStrList, FormatConfig.ReplaceStr ucfrepstr) - { - // B2019-133: if the replace word is the same, see if the UCF flag is different. The Replace Word & the flags need to be the same for it to be a match. - List flags = new List(); - foreach (ReplaceStr origrepstr in replaceStrList) - { - if (origrepstr.ReplaceWord.Replace("{Backspace}", "") == ucfrepstr.ReplaceWord.Replace("{Backspace}", "")) flags.Add(ucfrepstr.Flag); - } - return (flags.Contains(ucfrepstr.Flag)); - } - // The following uses the original format's ReplaceWords list and applies any changes made from the UCF ReplaceWords list. - private FormatConfig.ReplaceStrData GetMergedReplaceList() - { - // need to compare the original format list with the list as it is stored for working with property grid. - FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // merged list - List inoriglist = new List(); // use this list to find new items in formatconfig (see below) - foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList) - { - // In the format config list (UCF), find the 'ReplaceWord'. This is the 'key' for defining whether the - // replace word has been overwridden by UCF data. If it exists, use it: - FormatConfig.ReplaceStr usethisone = null; - bool deleted = false; - // States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified - foreach (FormatConfig.ReplaceStr ucfrepstr in MyFormatConfig.PlantFormat.FormatData.ReplaceStrData) - { - if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord && (E_ReplaceFlags)ucfrepstr.Flag == origrepstr.Flag) - { - if (ucfrepstr.State == -1) deleted = true; - else usethisone = ucfrepstr; - ucfrepstr.State = 2; - inoriglist.Add(origrepstr.ReplaceWord); - UcfForRepWords = true; - break; - } - } - // don't add in the replacewords that use 'Backspace' and regular expressions: - bool supported = true; - if (!deleted && usethisone == null) - { - if ((origrepstr.ReplaceWith.Contains("$1") || origrepstr.ReplaceWord.Contains("w*")) || origrepstr.ReplaceWith.Contains("{Backspace}")) - supported = false; - else - { - usethisone = new FormatConfig.ReplaceStr(); - usethisone.Flag = (FormatConfig.E_ReplaceFlagsUCF)origrepstr.Flag; - usethisone.State = 0; // no change - usethisone.ReplaceWith = origrepstr.ReplaceWith; - usethisone.ReplaceWord = origrepstr.ReplaceWord; - } - } - if (!deleted && supported) retlist.Add(usethisone); - } - // now add in any ucf only replacements, any that are not in the inoriglist - foreach (FormatConfig.ReplaceStr ucfrepstr in MyFormatConfig.PlantFormat.FormatData.ReplaceStrData) - { - if (!inoriglist.Contains(ucfrepstr.ReplaceWord)) - { - FormatConfig.ReplaceStr newone = new FormatConfig.ReplaceStr(); - newone.Flag = (FormatConfig.E_ReplaceFlagsUCF)ucfrepstr.Flag; - newone.State = 1; - //newone.ReplaceWith = ucfrepstr.ReplaceWith; - newone.ReplaceWith = ucfrepstr.ReplaceWith; - newone.ReplaceWord = ucfrepstr.ReplaceWord; - retlist.Add(newone); - UcfForRepWords = true; - } - } - return (retlist); - } - // This method reads in the format items, merging any changes from UCF into original format. It sets MyFormatConfig, which - // is the structure that gets used by the PropertyGrid - private void GetUCFDataForUCFGrid() - { - // name/description is only stored as format record fields. There are attributes in formatconfig xml that are used for defining these - // when new UCFs are defined or allowing for updates. - MyFormatConfig.Name = OriginalFormatInfo.Name; - MyFormatConfig.Description = OriginalFormatInfo.Description; - - // Store original (currently saved FormatConfig) to be used for comparison when saving. - savDBFormatConfig = MyFormatConfig; - - // Flags - if (MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps == null) MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps = OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CompressSteps; - if (MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression == null) MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression = OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PartialStepCompression; - if (MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF == null) MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF = OriginalPlantFormat.FormatData.ProcData.CheckOffUCF; - - // checkoff xoffset adjustment - if (MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj == null) MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj = 0; - - GetUCFCheckOffDataForUCFGrid((bool)MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF); - - // StepData: If there is no UCF data for steps, copy over from selected format - FormatConfig.StepData sdlMerged = new FormatConfig.StepData(); - if (MyFormatConfig.PlantFormat.FormatData.StepData == null || MyFormatConfig.PlantFormat.FormatData.StepData.Count == 0) - { - foreach (StepData sdorig in OriginalPlantFormat.FormatData.StepDataList) - { - if (!sdorig.Inactive && sdorig.Index != 0) - { - FormatConfig.Step stp = new FormatConfig.Step(); - stp.Index = sdorig.Index.ToString(); - stp.Type = sdorig.Type; - stp.FontDesc = new FormatConfig.FontDesc(); - stp.FontDesc.OrigWindowsFont = sdorig.Font.WindowsFont; - stp.FontDesc.WindowsFont = sdorig.Font.WindowsFont; - if (MyFormatConfig.PlantFormat.FormatData.StepData == null) MyFormatConfig.PlantFormat.FormatData.StepData = new FormatConfig.StepData(); - sdlMerged.Add(stp); - } - } - } - else - { - foreach (StepData sdorig in OriginalPlantFormat.FormatData.StepDataList) - { - if (!sdorig.Inactive && sdorig.Index != 0) - { - FormatConfig.Step stp = new FormatConfig.Step(); - stp.Index = sdorig.Index.ToString(); - stp.Type = sdorig.Type; - stp.FontDesc = new FormatConfig.FontDesc(); - // See if in the FormatConfig, use it - FormatConfig.Step foundinFC = null; - foreach (FormatConfig.Step fcstp in MyFormatConfig.PlantFormat.FormatData.StepData) - { - if (fcstp.Index == sdorig.Index.ToString()) - { - foundinFC = fcstp; - break; - } - } - stp.FontDesc.OrigWindowsFont = new System.Drawing.Font(sdorig.Font.Family, (float)sdorig.Font.Size, sdorig.Font.WindowsFont.Style); - if (foundinFC != null) - stp.FontDesc.WindowsFont = new System.Drawing.Font(foundinFC.FontDesc.WindowsFont.Name, foundinFC.FontDesc.WindowsFont.Size, foundinFC.FontDesc.WindowsFont.Style); - else - stp.FontDesc.WindowsFont = new System.Drawing.Font(sdorig.Font.Family, (float)sdorig.Font.Size, sdorig.Font.WindowsFont.Style); - sdlMerged.Add(stp); - } - } - } - MyFormatConfig.PlantFormat.FormatData.StepData = sdlMerged; - - // ReplacWords - // if there are no replace str entries in sc, add from the selected format: - if (MyFormatConfig.PlantFormat.FormatData.ReplaceStrData == null || MyFormatConfig.PlantFormat.FormatData.ReplaceStrData.Count == 0) - { - foreach (ReplaceStr repstrorig in OriginalPlantFormat.FormatData.SectData.ReplaceStrList) - { - if (!((repstrorig.ReplaceWith.Contains("$1") && repstrorig.ReplaceWord.Contains("w*")) || repstrorig.ReplaceWith.Contains("{Backspace}"))) - { - FormatConfig.ReplaceStr rsfc = new FormatConfig.ReplaceStr(); - rsfc.Flag = (FormatConfig.E_ReplaceFlagsUCF)repstrorig.Flag; - rsfc.State = 0; - rsfc.ReplaceWith = repstrorig.ReplaceWith; - rsfc.ReplaceWord = repstrorig.ReplaceWord; - MyFormatConfig.PlantFormat.FormatData.ReplaceStrData.Add(rsfc); - } - } - } - else - { - MyFormatConfig.PlantFormat.FormatData.ReplaceStrData = GetMergedReplaceList(); - } - // Document Style (section) Data (docstyles). Get step editor type only - if (MyFormatConfig.PlantFormat.DocStyles == null || MyFormatConfig.PlantFormat.DocStyles.Count == 0) - { - foreach (DocStyle dsorig in OriginalPlantFormat.DocStyles.DocStyleList) - { - if (!dsorig.Inactive && dsorig.IsStepSection) - { - FormatConfig.DocStyle ds = new FormatConfig.DocStyle(); - ds.Index = dsorig.Index.ToString(); - ds.Name = dsorig.Name; - if (ds.Layout == null) ds.Layout = new FormatConfig.Layout(); - ds.Layout.PageLength = (float)Math.Round((float)dsorig.Layout.PageLength / 72, 2); - ds.Layout.OrigPageLength = ds.Layout.PageLength; - ds.Layout.LeftMargin = (float)Math.Round((float)dsorig.Layout.LeftMargin / 72, 2); - ds.Layout.OrigLeftMargin = ds.Layout.LeftMargin; - if (MyFormatConfig.PlantFormat.DocStyles == null) MyFormatConfig.PlantFormat.DocStyles = new FormatConfig.DocStyles(); - MyFormatConfig.PlantFormat.DocStyles.Add(ds); - } - } - } - else - { - foreach (DocStyle dsorig in OriginalPlantFormat.DocStyles.DocStyleList) - { - if (!dsorig.Inactive && dsorig.IsStepSection) - { - FormatConfig.DocStyle ds = new FormatConfig.DocStyle(); - ds.Index = dsorig.Index.ToString(); - ds.Name = dsorig.Name; - if (ds.Layout == null) ds.Layout = new FormatConfig.Layout(); - // See if in the FormatConfig, use it - FormatConfig.DocStyle foundinFC = null; - foreach (FormatConfig.DocStyle fcds in MyFormatConfig.PlantFormat.DocStyles) - { - if (fcds.Index == dsorig.Index.ToString()) - { - foundinFC = fcds; - break; - } - } - if (foundinFC != null) - { - if (foundinFC.Layout.LeftMargin == null) foundinFC.Layout.LeftMargin = (float)Math.Round((float)dsorig.Layout.LeftMargin / 72, 2); - else foundinFC.Layout.LeftMargin = (float)Math.Round((float)foundinFC.Layout.LeftMargin / 72, 2); - foundinFC.Layout.OrigLeftMargin = (float)Math.Round((float)dsorig.Layout.LeftMargin / 72, 2); - if (foundinFC.Layout.PageLength == null) foundinFC.Layout.PageLength = (float)Math.Round((float)dsorig.Layout.PageLength / 72, 2); - else foundinFC.Layout.PageLength = (float)Math.Round((float)foundinFC.Layout.PageLength / 72, 2); - foundinFC.Layout.OrigPageLength = (float)Math.Round((float)dsorig.Layout.PageLength / 72, 2); - } - else - { - ds.Layout.OrigLeftMargin = (float)Math.Round((float)dsorig.Layout.LeftMargin / 72, 2); - ds.Layout.OrigPageLength = (float)Math.Round((float)dsorig.Layout.PageLength / 72, 2); - ds.Layout.LeftMargin = (float)Math.Round((float)dsorig.Layout.LeftMargin / 72, 2); - ds.Layout.PageLength = (float)Math.Round((float)dsorig.Layout.PageLength / 72, 2); - MyFormatConfig.PlantFormat.DocStyles.Add(ds); - } - } - } - } - } - - private void GetUCFCheckOffDataForUCFGrid(bool ucfcheckof) - { - OriginalPlantFormat.FormatData.ProcData.CheckOffData.ClearCheckOffAndHeaderLists(); - // CheckOffHeaders: If there is no UCF data, use from the selected format, otherwise merge: - FormatConfig.CheckOffHeaderList cohdrsMerged = new FormatConfig.CheckOffHeaderList(); - if (MyFormatConfig.PlantFormat.FormatData.CheckOffHeaderList == null || MyFormatConfig.PlantFormat.FormatData.CheckOffHeaderList.Count == 0) - { - foreach (CheckOffHeader cohorig in OriginalPlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList) - { - // do inactive:: - FormatConfig.CheckOffHeader coh = new FormatConfig.CheckOffHeader(); - coh.Index = cohorig.Index.ToString(); - coh.CheckOffHeading = cohorig.CheckOffHeading; - coh.Active = true; - coh.OrigActive = true; - cohdrsMerged.Add(coh); - } - } - else - { - foreach (CheckOffHeader cohorig in OriginalPlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList) - { - FormatConfig.CheckOffHeader coh = new FormatConfig.CheckOffHeader(); - coh.Index = cohorig.Index.ToString(); - coh.CheckOffHeading = cohorig.CheckOffHeading; - coh.Active = true; - coh.OrigActive = true; - // See if in the FormatConfig, to check its inactive flag: - foreach (FormatConfig.CheckOffHeader fccoh in MyFormatConfig.PlantFormat.FormatData.CheckOffHeaderList) - { - if (fccoh.Index == cohorig.Index.ToString()) - { - coh.Active = fccoh.Active; - coh.OrigActive = true; - break; - } - } - cohdrsMerged.Add(coh); - } - } - MyFormatConfig.PlantFormat.FormatData.CheckOffHeaderList = cohdrsMerged; - - // CheckOffs: If there is no UCF data, use from the selected format, otherwise merge: - FormatConfig.CheckOffList cosMerged = new FormatConfig.CheckOffList(); - // clear the lists so that correct lists will be initialized - foreach (CheckOff coorig in OriginalPlantFormat.FormatData.ProcData.CheckOffData.CheckOffList) - { - FormatConfig.CheckOff co = new FormatConfig.CheckOff(); - co.Index = coorig.Index.ToString(); - co.MenuItem = coorig.MenuItem; - co.Active = true; - co.OrigActive = true; - // See if in the FormatConfig, to check its inactive flag: - if (MyFormatConfig.PlantFormat.FormatData.CheckOffList != null) - { - foreach (FormatConfig.CheckOff fcco in MyFormatConfig.PlantFormat.FormatData.CheckOffList) - { - if (fcco.Index == coorig.Index.ToString()) - { - co.Active = fcco.Active; - co.OrigActive = true; - break; - } - } - } - cosMerged.Add(co); - } - MyFormatConfig.PlantFormat.FormatData.CheckOffList = cosMerged; - } - // The Reset button is used to reset a UCF change from the original data. If a field is added to UCF, code needs - // added here for the field: - private void btnReset_Click(object sender, EventArgs e) - { - // The code that enables the Reset button checks if a change (UCF) exists. So no need to check here. - if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags:Compress Steps")) - { - MyFormatConfig.PlantFormat.FormatData.Flags.CompressSteps = OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CompressSteps; - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags:Partial Step Compression")) - { - MyFormatConfig.PlantFormat.FormatData.Flags.PartialStepCompression = OriginalPlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PartialStepCompression; - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Flags:UCF CheckOffs")) - { - MyFormatConfig.PlantFormat.FormatData.Flags.CheckOffUCF = OriginalPlantFormat.FormatData.ProcData.CheckOffUCF; - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:CheckOff XOffset")) - { - MyFormatConfig.PlantFormat.FormatData.CheckOffXOffAdj = 0; - } - else if (SelectedGridField.EndsWith("Data:Plant Format:Step Settings:Replace Words List")) - { - MyFormatConfig.PlantFormat.FormatData.ReplaceStrData.Clear(); - foreach (ReplaceStr repstrorig in OriginalPlantFormat.FormatData.SectData.ReplaceStrList) - { - if (!((repstrorig.ReplaceWith.Contains("$1") && repstrorig.ReplaceWord.Contains("w*")) || repstrorig.ReplaceWith.Contains("{Backspace}"))) - { - FormatConfig.ReplaceStr rsfc = new FormatConfig.ReplaceStr(); - rsfc.Flag = (FormatConfig.E_ReplaceFlagsUCF)repstrorig.Flag; - rsfc.State = 0; - rsfc.ReplaceWith = repstrorig.ReplaceWith; - rsfc.ReplaceWord = repstrorig.ReplaceWord; - MyFormatConfig.PlantFormat.FormatData.ReplaceStrData.Add(rsfc); - UcfForRepWords = false; - } - } - } - btnReset.Enabled = false; - btnReset.Text = "Reset"; - } - - private void btnSaveAs_Click(object sender, EventArgs e) - { - // Name must be unique - description can be null. - // Append a '_UCF' at end of all user control of format formats. - // add a format record for this: - // FormatID - next ID, db creates on new format - // ParentID - format id of the format that was used as a base for this user control of format - // Name - user defined - // Description - user defined - if none specified by user, use the original's description - // Data - null: flags that a UCF was saved as and use the parent and config from this. - // - - // check for unique name. - foreach (FormatInfo fi in FormatInfoList.SortedFormatInfoList) - { - if (MyFormatConfig.Name == fi.Name || MyFormatConfig.Name + "_UCF" == fi.Name) - { - MessageBox.Show("A format with Name " + MyFormatConfig.Name + " already exists. Name must be unique. Save As cannot be done."); - return; - } - } - using (Format tmp = Format.Get(OriginalFormatInfo.FormatID)) - { - string fname = MyFormatConfig.Name + (MyFormatConfig.Name.EndsWith("_UCF") ? "" : "_UCF"); - Format fmt = Format.MakeFormat(tmp, fname, MyFormatConfig.Description == OriginalFormatInfo.Description || MyFormatConfig.Description == "" || MyFormatConfig.Description == null ? OriginalFormatInfo.Description : MyFormatConfig.Description, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID); - FormatConfig tmpForSave = GetChangesUCFForSave(); - string scf = tmpForSave.ConvertToString(); - scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); - // for now, tell the user that changes don't take affect until reentry. This was done since the 'refresh' of FormatConfig was not - // working. - fmt.Config = scf; - fmt.Description = MyFormatConfig.Description; - fmt.Save(true); - MessageBox.Show(this, "Restart PROMS to have format changes take effect.", "", MessageBoxButtons.OK); - btnSaveAs.Enabled = false; - } - } - - private void btnDelete_Click(object sender, EventArgs e) - { - // delete this format OR (the button text is set to 'delete...' if no item or version uses it) - // revert to the original - string msg = btnDelete.Text == "Revert to Original" ? "revert to the original?" : "delete this format?"; - if (MessageBox.Show(this, "Are you sure you want to " + msg, "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - PlantFormat.IgnoreUCF = true; - // the button is either 'Revert to Original' for a format that is the original and has config data, or 'Delete' for a UCF that - // was created by a 'Save As'. - // so do either a clear of the config data, or delete the format record depending on button's text - if (btnDelete.Text == "Revert to Original") - { - using (Format fmt = Format.Get(OriginalFormatInfo.FormatID)) - { - fmt.Config = ""; - fmt.Save(true); - MessageBox.Show(this, "The changes that have been made to the format will take affect after reentry to PROMS", "", MessageBoxButtons.OK); - MyFormatConfig = new FormatConfig(); - PG.SelectedObject = MyFormatConfig; - PG.Enabled = false; - btnSaveAs.Enabled = false; - btnDelete.Enabled = false; - btnSaveClose.Enabled = false; - btnSave.Enabled = false; - btnReset.Enabled = false; - } - } - else - { - try - { - Format.Delete(OriginalFormatInfo.FormatID); - } - catch (Exception ex) - { - MessageBox.Show("Could not delete the format"); - return; - } - cbxFormatList.DataSource = FormatInfoList.GetFormatInfoListUsed(); - cbxFormatList.SelectedIndex = -1; - MyFormatConfig = new FormatConfig(); - PG.SelectedObject = MyFormatConfig; - PG.Enabled = false; - btnSaveAs.Enabled = false; - btnDelete.Enabled = false; - btnSaveClose.Enabled = false; - btnSave.Enabled = false; - btnReset.Enabled = false; - } - PlantFormat.IgnoreUCF = false; - PlantFormat.DoingUCFCheckOffs = false; - } - } - - private void btnDetails_Click(object sender, EventArgs e) - { - FormatConfig tmpfc = GetChangesUCFForSave(); - string scf = tmpfc.ConvertToString(); - scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); - dlgUCFDetail dtl = new dlgUCFDetail(scf, MyFormatConfig.Name, MyFormatConfig.Description); - dtl.ShowDialog(); - } - - private void btnSave_Click(object sender, EventArgs e) - { - // get a FormatConfig structure that only has differences from the original format. This is what gets saved. - FormatConfig tmpForSave = GetChangesUCFForSave(); - string scf = tmpForSave.ConvertToString(); - scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); - int fmtid = OriginalPlantFormat.MyFormat is Format ? (OriginalPlantFormat.MyFormat as Format).FormatID : (OriginalPlantFormat.MyFormat as FormatInfo).FormatID; - // for now, tell the user that changes don't take affect until reentry. This was done since the 'refresh' of FormatConfig was not - // working. - using (Format fmt = Format.Get(fmtid)) - { - FormatInfo fi = FormatInfo.GetFormatNoUCFByFormatID(OriginalFormatInfo.FormatID); - if (fi.Data == "") - { - fmt.Data = ""; - fmt.GenMac = ""; - } - fmt.Config = scf; - fmt.Name = MyFormatConfig.Name; - fmt.Description = MyFormatConfig.Description; - fmt.Save(true); - } - } - } -} diff --git a/PROMS/VEPROMS User Interface/frmUCF.designer.cs b/PROMS/VEPROMS User Interface/frmUCF.designer.cs deleted file mode 100644 index 4c257fb0..00000000 --- a/PROMS/VEPROMS User Interface/frmUCF.designer.cs +++ /dev/null @@ -1,287 +0,0 @@ -namespace VEPROMS -{ - partial class frmUCF - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - //protected override void Dispose(bool disposing) - //{ - // if (disposing && (components != null)) - // { - // components.Dispose(); - // } - // base.Dispose(disposing); - //} - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.PGpanelBtm = new System.Windows.Forms.Panel(); - this.btnSave = new System.Windows.Forms.Button(); - this.btnDelete = new System.Windows.Forms.Button(); - this.btnReset = new System.Windows.Forms.Button(); - this.btnSaveAs = new System.Windows.Forms.Button(); - this.lblPGItem = new System.Windows.Forms.Label(); - this.btnSaveClose = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.PG = new System.Windows.Forms.PropertyGrid(); - this.pnlFormatList = new System.Windows.Forms.Panel(); - this.tbUCFSummary = new System.Windows.Forms.TextBox(); - this.btnDetails = new System.Windows.Forms.Button(); - this.lblSummary = new System.Windows.Forms.Label(); - this.lblDerivedFrom = new System.Windows.Forms.Label(); - this.lblDerFrom = new System.Windows.Forms.Label(); - this.cbxFormatList = new System.Windows.Forms.ComboBox(); - this.lblFormatList = new System.Windows.Forms.Label(); - this.PGpanelBtm.SuspendLayout(); - this.pnlFormatList.SuspendLayout(); - this.SuspendLayout(); - // - // PGpanelBtm - // - this.PGpanelBtm.Controls.Add(this.btnSave); - this.PGpanelBtm.Controls.Add(this.btnDelete); - this.PGpanelBtm.Controls.Add(this.btnReset); - this.PGpanelBtm.Controls.Add(this.btnSaveAs); - this.PGpanelBtm.Controls.Add(this.lblPGItem); - this.PGpanelBtm.Controls.Add(this.btnSaveClose); - this.PGpanelBtm.Controls.Add(this.btnCancel); - this.PGpanelBtm.Dock = System.Windows.Forms.DockStyle.Bottom; - this.PGpanelBtm.Location = new System.Drawing.Point(0, 560); - this.PGpanelBtm.Name = "PGpanelBtm"; - this.PGpanelBtm.Size = new System.Drawing.Size(614, 68); - this.PGpanelBtm.TabIndex = 0; - // - // btnSave - // - this.btnSave.Dock = System.Windows.Forms.DockStyle.Right; - this.btnSave.Enabled = false; - this.btnSave.Location = new System.Drawing.Point(164, 0); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(75, 68); - this.btnSave.TabIndex = 6; - this.btnSave.Text = "Save"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Visible = false; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // btnDelete - // - this.btnDelete.Dock = System.Windows.Forms.DockStyle.Right; - this.btnDelete.Enabled = false; - this.btnDelete.Location = new System.Drawing.Point(239, 0); - this.btnDelete.Name = "btnDelete"; - this.btnDelete.Size = new System.Drawing.Size(75, 68); - this.btnDelete.TabIndex = 5; - this.btnDelete.Text = "Delete"; - this.btnDelete.UseVisualStyleBackColor = true; - this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); - // - // btnReset - // - this.btnReset.Dock = System.Windows.Forms.DockStyle.Right; - this.btnReset.Enabled = false; - this.btnReset.Location = new System.Drawing.Point(314, 0); - this.btnReset.Name = "btnReset"; - this.btnReset.Size = new System.Drawing.Size(75, 68); - this.btnReset.TabIndex = 4; - this.btnReset.Text = "Reset"; - this.btnReset.UseVisualStyleBackColor = true; - this.btnReset.Click += new System.EventHandler(this.btnReset_Click); - // - // btnSaveAs - // - this.btnSaveAs.Dock = System.Windows.Forms.DockStyle.Right; - this.btnSaveAs.Enabled = false; - this.btnSaveAs.Location = new System.Drawing.Point(389, 0); - this.btnSaveAs.Name = "btnSaveAs"; - this.btnSaveAs.Size = new System.Drawing.Size(75, 68); - this.btnSaveAs.TabIndex = 3; - this.btnSaveAs.Text = "Save As"; - this.btnSaveAs.UseVisualStyleBackColor = true; - this.btnSaveAs.Click += new System.EventHandler(this.btnSaveAs_Click); - // - // lblPGItem - // - this.lblPGItem.AutoSize = true; - this.lblPGItem.Location = new System.Drawing.Point(39, 20); - this.lblPGItem.Name = "lblPGItem"; - this.lblPGItem.Size = new System.Drawing.Size(46, 17); - this.lblPGItem.TabIndex = 2; - this.lblPGItem.Text = "label1"; - this.lblPGItem.Visible = false; - // - // btnSaveClose - // - this.btnSaveClose.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnSaveClose.Dock = System.Windows.Forms.DockStyle.Right; - this.btnSaveClose.Enabled = false; - this.btnSaveClose.Location = new System.Drawing.Point(464, 0); - this.btnSaveClose.Name = "btnSaveClose"; - this.btnSaveClose.Size = new System.Drawing.Size(75, 68); - this.btnSaveClose.TabIndex = 1; - this.btnSaveClose.Text = "Save and Close"; - this.btnSaveClose.UseVisualStyleBackColor = true; - this.btnSaveClose.Click += new System.EventHandler(this.btnSaveClose_Click); - // - // btnCancel - // - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Dock = System.Windows.Forms.DockStyle.Right; - this.btnCancel.Location = new System.Drawing.Point(539, 0); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 68); - this.btnCancel.TabIndex = 0; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // PG - // - this.PG.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.PG.Font = new System.Drawing.Font("Arial Rounded MT Bold", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.PG.LineColor = System.Drawing.SystemColors.ControlDark; - this.PG.Location = new System.Drawing.Point(0, 155); - this.PG.Name = "PG"; - this.PG.Size = new System.Drawing.Size(614, 405); - this.PG.TabIndex = 1; - // - // pnlFormatList - // - this.pnlFormatList.Controls.Add(this.tbUCFSummary); - this.pnlFormatList.Controls.Add(this.btnDetails); - this.pnlFormatList.Controls.Add(this.lblSummary); - this.pnlFormatList.Controls.Add(this.lblDerivedFrom); - this.pnlFormatList.Controls.Add(this.lblDerFrom); - this.pnlFormatList.Controls.Add(this.cbxFormatList); - this.pnlFormatList.Controls.Add(this.lblFormatList); - this.pnlFormatList.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlFormatList.Location = new System.Drawing.Point(0, 0); - this.pnlFormatList.Name = "pnlFormatList"; - this.pnlFormatList.Size = new System.Drawing.Size(614, 149); - this.pnlFormatList.TabIndex = 3; - // - // tbUCFSummary - // - this.tbUCFSummary.BackColor = System.Drawing.SystemColors.Control; - this.tbUCFSummary.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.tbUCFSummary.Location = new System.Drawing.Point(33, 120); - this.tbUCFSummary.Name = "tbUCFSummary"; - this.tbUCFSummary.Size = new System.Drawing.Size(485, 15); - this.tbUCFSummary.TabIndex = 7; - // - // btnDetails - // - this.btnDetails.Location = new System.Drawing.Point(539, 112); - this.btnDetails.Name = "btnDetails"; - this.btnDetails.Size = new System.Drawing.Size(63, 33); - this.btnDetails.TabIndex = 6; - this.btnDetails.Text = "Details"; - this.btnDetails.UseVisualStyleBackColor = true; - this.btnDetails.Visible = false; - this.btnDetails.Click += new System.EventHandler(this.btnDetails_Click); - // - // lblSummary - // - this.lblSummary.AutoSize = true; - this.lblSummary.Location = new System.Drawing.Point(5, 96); - this.lblSummary.Name = "lblSummary"; - this.lblSummary.Size = new System.Drawing.Size(71, 17); - this.lblSummary.TabIndex = 4; - this.lblSummary.Text = "Summary:"; - this.lblSummary.Visible = false; - // - // lblDerivedFrom - // - this.lblDerivedFrom.AutoSize = true; - this.lblDerivedFrom.Location = new System.Drawing.Point(33, 75); - this.lblDerivedFrom.Name = "lblDerivedFrom"; - this.lblDerivedFrom.Size = new System.Drawing.Size(0, 17); - this.lblDerivedFrom.TabIndex = 3; - this.lblDerivedFrom.Visible = false; - // - // lblDerFrom - // - this.lblDerFrom.AutoSize = true; - this.lblDerFrom.Location = new System.Drawing.Point(3, 52); - this.lblDerFrom.Name = "lblDerFrom"; - this.lblDerFrom.Size = new System.Drawing.Size(97, 17); - this.lblDerFrom.TabIndex = 2; - this.lblDerFrom.Text = "Derived From:"; - this.lblDerFrom.Visible = false; - // - // cbxFormatList - // - this.cbxFormatList.FormattingEnabled = true; - this.cbxFormatList.Location = new System.Drawing.Point(23, 25); - this.cbxFormatList.Name = "cbxFormatList"; - this.cbxFormatList.Size = new System.Drawing.Size(550, 24); - this.cbxFormatList.Sorted = true; - this.cbxFormatList.TabIndex = 1; - this.cbxFormatList.SelectedIndexChanged += new System.EventHandler(this.cbxFormatList_SelectedIndexChanged); - // - // lblFormatList - // - this.lblFormatList.AutoSize = true; - this.lblFormatList.Location = new System.Drawing.Point(5, 4); - this.lblFormatList.Name = "lblFormatList"; - this.lblFormatList.Size = new System.Drawing.Size(115, 17); - this.lblFormatList.TabIndex = 0; - this.lblFormatList.Text = "Selected Format:"; - // - // frmUCF - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(614, 628); - this.Controls.Add(this.pnlFormatList); - this.Controls.Add(this.PG); - this.Controls.Add(this.PGpanelBtm); - this.Name = "frmUCF"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "User Control of Format"; - this.Load += new System.EventHandler(this.frmUCF_Load); - this.PGpanelBtm.ResumeLayout(false); - this.PGpanelBtm.PerformLayout(); - this.pnlFormatList.ResumeLayout(false); - this.pnlFormatList.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel PGpanelBtm; - private System.Windows.Forms.Button btnSaveClose; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.PropertyGrid PG; - private System.Windows.Forms.Panel pnlFormatList; - private System.Windows.Forms.Label lblFormatList; - private System.Windows.Forms.ComboBox cbxFormatList; - private System.Windows.Forms.Label lblPGItem; - private System.Windows.Forms.Button btnSaveAs; - private System.Windows.Forms.Button btnReset; - private System.Windows.Forms.Button btnDelete; - private System.Windows.Forms.Label lblDerivedFrom; - private System.Windows.Forms.Label lblDerFrom; - private System.Windows.Forms.Button btnDetails; - private System.Windows.Forms.Label lblSummary; - private System.Windows.Forms.TextBox tbUCFSummary; - private System.Windows.Forms.Button btnSave; - - } -} - diff --git a/PROMS/VEPROMS User Interface/frmUCF.resx b/PROMS/VEPROMS User Interface/frmUCF.resx deleted file mode 100644 index 7080a7d1..00000000 --- a/PROMS/VEPROMS User Interface/frmUCF.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 74e4ae41..28fbb8df 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -2010,9 +2010,6 @@ namespace VEPROMS private DevComponents.DotNetBar.ButtonItem btnAdministrativeTools; private DevComponents.DotNetBar.ButtonItem btnSecurity; private DevComponents.DotNetBar.ButtonItem btnFormats; - private DevComponents.DotNetBar.ButtonItem btnUserControlOfFormats; - private DevComponents.DotNetBar.ButtonItem btnUserControlOfFormatsExport; - private DevComponents.DotNetBar.ButtonItem btnUserControlOfFormatsImport; private TabItemsToClose _MyCloseTabList = new TabItemsToClose(); public TabItemsToClose MyCloseTabList @@ -2206,16 +2203,8 @@ namespace VEPROMS //btnFormats = new ButtonItem("btnFormats", "Formats"); //btnAdmin.SubItems.Add(btnSecurity); //btnAdmin.SubItems.Add(btnFormats); - //btnUserControlOfFormats = new ButtonItem("btnUserControlOfFormats", "User Control of Formats"); //btnFormats.SubItems.Add(btnUpdateFormats); - //btnFormats.SubItems.Add(btnUserControlOfFormats); - //btnUserControlOfFormats.Click += new EventHandler(btnUserControlOfFormats_Click); - //btnUserControlOfFormatsExport = new ButtonItem("btnUserControlOfFormatsExport", "Export User Control of Formats"); - //btnFormats.SubItems.Add(btnUserControlOfFormatsExport); - //btnUserControlOfFormatsExport.Click += new EventHandler(btnUserControlOfFormatsExport_Click); - //btnUserControlOfFormatsImport = new ButtonItem("btnUserControlOfFormatsImport", "Import User Control of Formats"); - //btnFormats.SubItems.Add(btnUserControlOfFormatsImport); - //btnUserControlOfFormatsImport.Click += new EventHandler(btnUserControlOfFormatsImport_Click); + //btnManageSecurity = new ButtonItem("btnManageSecurity", "Manage Security"); //btnSecurity.SubItems.Add(btnManageSecurity); //btnManageSecurity.Click += new EventHandler(btnManageSecurity_Click); @@ -2226,21 +2215,10 @@ namespace VEPROMS btnAdmin.SubItems.Add(btnSecurity); // btnAdmin.SubItems.Add(btnFormats); // C2024 - 041 remove from Admin(V button) menu btnAdmin.SubItems.Add(btnUpdateFormats); // C2024 - 041 remove from Admin(V button) menu - btnUserControlOfFormats = new ButtonItem("btnUserControlOfFormats", "User Control of Formats"); - //btnFormats.SubItems.Add(btnUpdateFormats); - //btnFormats.SubItems.Add(btnUserControlOfFormats); // C2024-041 remove from Admin (V button) menu - btnUserControlOfFormats.Click += new EventHandler(btnUserControlOfFormats_Click); - btnUserControlOfFormatsExport = new ButtonItem("btnUserControlOfFormatsExport", "Export User Control of Formats"); - //btnFormats.SubItems.Add(btnUserControlOfFormatsExport); // C2024-041 remove from Admin (V button) menu - btnUserControlOfFormatsExport.Click += new EventHandler(btnUserControlOfFormatsExport_Click); - btnUserControlOfFormatsImport = new ButtonItem("btnUserControlOfFormatsImport", "Import User Control of Formats"); - //btnFormats.SubItems.Add(btnUserControlOfFormatsImport); // C2024-041 remove from Admin (V button) menu - btnUserControlOfFormatsImport.Click += new EventHandler(btnUserControlOfFormatsImport_Click); btnManageSecurity = new ButtonItem("btnManageSecurity", "Manage Security"); btnSecurity.SubItems.Add(btnManageSecurity); btnManageSecurity.Click += new EventHandler(btnManageSecurity_Click); - //added by jcb: menu item to reset security requires password to implement btnResetSecurity = new ButtonItem("btnResetSecurity", "Reset Security"); btnSecurity.SubItems.Add(btnResetSecurity); @@ -2254,7 +2232,6 @@ namespace VEPROMS // C2025-031 added tool tip messages this.superTooltip1.SetSuperTooltip(btnManageSecurity, new SuperTooltipInfo("Manage Security", "", "Add, Modify, and Delete PROMS User Access", null, null, eTooltipColor.Gray)); // remove commented out line below when User Control of Formats code is deleted - //this.superTooltip1.SetSuperTooltip(btnUserControlOfFormats, new SuperTooltipInfo("User Control Of Formats", null, null, null, null, eTooltipColor.Gray)); this.superTooltip1.SetSuperTooltip(btnResetSecurity, new SuperTooltipInfo("Reset Security", "", "WARNING this will \nREMOVE ALL PROMS USERS and Reset to the\nOriginal Volian Defaults", null, null, eTooltipColor.Gray)); this.superTooltip1.SetSuperTooltip(btnAdministrativeTools, new SuperTooltipInfo("Administrative Tools", "", "Open the PROMS Adminstration Tools Window", null, null, eTooltipColor.Gray)); this.superTooltip1.SetSuperTooltip(btnUpdateFormats, new SuperTooltipInfo("Update Formats", "", "Install New Formats \n or Re-Install Formats", null, null, eTooltipColor.Gray)); @@ -2295,9 +2272,6 @@ namespace VEPROMS bool isVisible = MyUserInfo.IsAdministrator(); - btnUserControlOfFormats.Visible = isVisible; - btnUserControlOfFormatsExport.Visible = isVisible; - btnUserControlOfFormatsImport.Visible = isVisible; btnManageSecurity.Visible = isVisible; btnUpdateFormats.Visible = isVisible; btnResetSecurity.Visible = isVisible; @@ -3135,32 +3109,6 @@ namespace VEPROMS } } - void btnUserControlOfFormats_Click(object sender, EventArgs e) - { - frmUCF frmucf = new frmUCF(); - DialogResult dr = frmucf.ShowDialog(this); - } - - void btnUserControlOfFormatsExport_Click(object sender, EventArgs e) - { - DocVersionInfo dvi = null; - - dlgExportImport dlg = new dlgExportImport("Export Formats", dvi, this, (E_UCFImportOptions)0); - dlg.MyNewProcedure = null; - dlg.ExternalTransitionItem = null; - dlg.ShowDialog(this); - } - - void btnUserControlOfFormatsImport_Click(object sender, EventArgs e) - { - DocVersionInfo dvi = null; - - dlgExportImport dlg = new dlgExportImport("Import Formats", dvi, this, (E_UCFImportOptions)0); - dlg.MyNewProcedure = null; - dlg.ExternalTransitionItem = null; - dlg.ShowDialog(this); - } - void btnManageSecurity_Click(object sender, EventArgs e) { dlgManageSecurity dlg = new dlgManageSecurity();