C2025-022-Remove-UCF-2
This commit is contained in:
@@ -723,25 +723,7 @@ namespace VEPROMS
|
||||
//if (isImported && UCFImportCase == E_UCFImportOptions.LoadForSetOnly) UpdateFormatForUCFInSet();
|
||||
return true;// Import Suceeded
|
||||
}
|
||||
//private void UpdateFormatForUCFInSet()
|
||||
//{
|
||||
// // this gets called if the UCFImportCase == LoadForSetOnly, i.e. only items in this PROCEDURE Set whose formats point to a
|
||||
// // UCF format should point to the updated (copied) UCF format.
|
||||
// if (renamedUCFFormatId == null) return;
|
||||
// foreach (int key in renamedUCFFormatId.Keys)
|
||||
// {
|
||||
// using (ContentInfoList cil = ContentInfoList.FixFormatIDAfterImport(MyDocVersion.VersionID.ToString(), renamedUCFFormatId[key], key))
|
||||
// {
|
||||
// foreach (ContentInfo ci in cil)
|
||||
// {
|
||||
// using (Content c = ci.Get())
|
||||
// {
|
||||
// ContentInfo.Refresh(c);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
// Added Error Handling to assure that Change Manager is turned-on regardless of success or failure of the import
|
||||
// B2019-046: improved error handling (added return value & error message)
|
||||
private bool TryToLoadImportDataDocument()
|
||||
@@ -1021,8 +1003,6 @@ namespace VEPROMS
|
||||
c.Save();
|
||||
}
|
||||
}
|
||||
//private E_UCFImportOptions UCFImportDefaultFromSettings;
|
||||
//private E_UCFImportOptions UCFImportCase = E_UCFImportOptions.LoadOnlyImported;
|
||||
Dictionary<string, string> existingCopyFCName = new Dictionary<string, string>();
|
||||
// note that this is used when importing a folder or a procedure (procedure was added for UCF changes)
|
||||
private bool LoadFormats(XmlDocument xd, string xmlpath)
|
||||
@@ -1123,102 +1103,12 @@ namespace VEPROMS
|
||||
// various cases listed above:
|
||||
if (existingFormat.ContainsKey(name))
|
||||
{
|
||||
//// if case 0 and this ucf already exists, ignore it:
|
||||
//if (UCFImportCase == E_UCFImportOptions.Ignore) continue;
|
||||
|
||||
//// if case 1, 2, 4 and the name exists, make a 'copy' of the newly imported format:
|
||||
//// need to add this format - name must be unique so add 'COPY(x) of 'original name'' where x is unique number:
|
||||
//if (UCFImportCase == E_UCFImportOptions.LoadNotUsed || UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly)
|
||||
//{
|
||||
// int count = (fil.Where(fi => fi.Name.EndsWith(name))).Count();
|
||||
// if (count > 0)
|
||||
// {
|
||||
// string origname = name;
|
||||
// name = string.Format("Copy {0} of {1}", count.ToString(), name);
|
||||
// if (UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly)
|
||||
// {
|
||||
// if (renamedUCFFormatName == null) renamedUCFFormatName = new Dictionary<string, string>();
|
||||
// renamedUCFFormatName.Add(origname, name);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// if case 3, take the existing config data and create in a record whose name is Old(x) of 'original name' (the record
|
||||
// creation gets done below). Then modify the existing record to have the config data. The result is that any
|
||||
// sections that used this UCF throughout the database will have the new config data.
|
||||
//if (UCFImportCase == E_UCFImportOptions.LoadUseAll)
|
||||
//{
|
||||
// string savname = name;
|
||||
// int count = (fil.Where(fi => fi.Name.EndsWith(name))).Count();
|
||||
// if (count > 0)
|
||||
// {
|
||||
// name = string.Format("Old {0} of {1}", count.ToString(), name);
|
||||
// }
|
||||
// // update the 'old' record by getting the original config data.
|
||||
// string savdesc = null;
|
||||
// DateTime savdts = DateTime.Now;
|
||||
// string savuid = null;
|
||||
// int savpar = 0;
|
||||
// string savconfig = null;
|
||||
// using (Format origRecord = Format.Get(existingFormat[savname]))
|
||||
// {
|
||||
// savdesc = origRecord.Description;
|
||||
// savdts = origRecord.DTS;
|
||||
// savuid = origRecord.UserID;
|
||||
// savpar = origRecord.ParentID;
|
||||
// savconfig = origRecord.Config;
|
||||
// origRecord.Name = savname;
|
||||
// origRecord.Description = description;
|
||||
// origRecord.DTS = dts;
|
||||
// origRecord.UserID = userid;
|
||||
// origRecord.MyParent = pformat;
|
||||
// origRecord.Config = config;
|
||||
// origRecord.Save();
|
||||
// description = savdesc;
|
||||
// dts = savdts;
|
||||
// userid = savuid;
|
||||
// pformat = Format.Get(savpar);
|
||||
// config = savconfig;
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
//if (UCFImportCase == 0) // ignore it
|
||||
//{
|
||||
importedFormat.Add(formatid, name);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Format rec = Format.MakeFormat(pformat, name, description, null, null, dts, userid);
|
||||
// rec.Config = config;
|
||||
// rec.Save();
|
||||
// if (UCFImportCase == E_UCFImportOptions.LoadNotUsed || UCFImportCase == E_UCFImportOptions.LoadUseAll) // don't reset format id (case 1 don't use it, case 3 copies new data into original record
|
||||
// importedFormat.Add(formatid, name);
|
||||
// else if (UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly) // case 2 uses it for any items imported, case 4 uses it for any sections within current set
|
||||
// {
|
||||
// existingFormat.Add(name, rec.FormatID); // change to original name?
|
||||
// importedFormat.Add(rec.FormatID, name);
|
||||
|
||||
// // get format id for the original named format
|
||||
// if (UCFImportCase == E_UCFImportOptions.LoadForSetOnly && renamedUCFFormatName != null)
|
||||
// {
|
||||
// int origformatid = -1;
|
||||
// foreach (var kvp in renamedUCFFormatName)
|
||||
// {
|
||||
// if (kvp.Value == name)
|
||||
// {
|
||||
// origformatid = existingFormat[kvp.Key];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (origformatid != -1)
|
||||
// {
|
||||
// if (renamedUCFFormatId == null) renamedUCFFormatId = new Dictionary<int, int>();
|
||||
// renamedUCFFormatId.Add(rec.FormatID, origformatid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
importedFormat.Add(formatid, name);
|
||||
|
||||
}
|
||||
FormatInfoList.Reset();
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user