Added getRoUsagesForDocVersion and modified vesp_ListTables3 stored procedures
Updated how RO values are updated as a result of issues identified by Calvert data Modified code to handle non-standard characters in StepType variable. Chnaged how transitions are updated to utilize methods of Content and ContentInfo classes
This commit is contained in:
parent
249ddafe54
commit
dd7f3a4148
@ -8458,3 +8458,96 @@ GO
|
|||||||
IF (@@Error = 0) PRINT 'Procedure Creation: getRevisionsByItemID Succeeded'
|
IF (@@Error = 0) PRINT 'Procedure Creation: getRevisionsByItemID Succeeded'
|
||||||
ELSE PRINT 'Procedure Creation: getRevisionsByItemID Error on Creation'
|
ELSE PRINT 'Procedure Creation: getRevisionsByItemID Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
/****** Object: StoredProcedure [getRoUsagesForDocVersion] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getRoUsagesForDocVersion]') AND OBJECTPROPERTY
|
||||||
|
|
||||||
|
(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getRoUsagesForDocVersion];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getRoUsagesForDocVersion]
|
||||||
|
(
|
||||||
|
@VersionID int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
[ROUsageID],
|
||||||
|
rr.[ContentID],
|
||||||
|
[ROID],
|
||||||
|
[Config],
|
||||||
|
[DTS],
|
||||||
|
[UserID],
|
||||||
|
[LastChanged],
|
||||||
|
[RODbID]
|
||||||
|
FROM [RoUsages] rr
|
||||||
|
INNER JOIN vefn_getversionitems(@VersionID) vi on rr.contentid = vi.contentid
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getRoUsagesForDocVersion Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getRoUsagesForDocVersion Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [vesp_ListTables3] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListTables3]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [vesp_ListTables3];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE procedure [dbo].[vesp_ListTables3]
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
begin
|
||||||
|
select o.name TableName,c.name ColumnName,
|
||||||
|
case c.system_type_id
|
||||||
|
when 56 then 'int'
|
||||||
|
when 231 then 'nvarchar'
|
||||||
|
when 165 then 'varbinary'
|
||||||
|
when 167 then 'varchar'
|
||||||
|
when 239 then 'nchar'
|
||||||
|
when 175 then 'char'
|
||||||
|
when 61 then 'datetime'
|
||||||
|
when 104 then 'bit'
|
||||||
|
when 48 then 'TinyInt'
|
||||||
|
when 127 then 'BigInt'
|
||||||
|
when 241 then 'Xml'
|
||||||
|
when 62 then 'float'
|
||||||
|
when 189 then 'timestamp'
|
||||||
|
else '???' + cast(c.system_type_id as varchar(10)) end ItemType,
|
||||||
|
case c.system_type_id
|
||||||
|
when 56 then '0'
|
||||||
|
when 231 then case c.max_length when -1 then 'Max' else cast(c.max_length/2 as varchar(10)) end
|
||||||
|
when 165 then case c.max_length when -1 then 'Max' else cast(c.max_length as varchar(10)) end
|
||||||
|
when 167 then case c.max_length when -1 then 'Max' else cast(c.max_length as varchar(10)) end
|
||||||
|
when 239 then case c.max_length when -1 then 'Max' else cast(c.max_length/2 as varchar(10)) end
|
||||||
|
when 175 then case c.max_length when -1 then 'Max' else cast(c.max_length as varchar(10)) end
|
||||||
|
when 61 then '0'
|
||||||
|
when 104 then '0'
|
||||||
|
when 48 then '0'
|
||||||
|
when 189 then '0'
|
||||||
|
else '0' end ItemSize,
|
||||||
|
|
||||||
|
case when c.is_nullable=1 then 'Yes' else '' end AllowNulls,
|
||||||
|
case when c.is_identity=1 then 'Identity' else dc.definition end DefaultValue,
|
||||||
|
x.value Description
|
||||||
|
from sys.objects o
|
||||||
|
join sys.columns c on o.object_id=c.object_id
|
||||||
|
left join sysconstraints cn on o.object_id=cn.id and c.column_id=cn.colid
|
||||||
|
left join sys.default_constraints dc on dc.object_id = cn.constid
|
||||||
|
left join sys.extended_properties x on x.major_id = o.OBJECT_ID AND x.minor_id=c.column_id AND x.Name='MS_Description'
|
||||||
|
where o.type='U'
|
||||||
|
order by o.name,c.column_id
|
||||||
|
end
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ListTables3 Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: vesp_ListTables3 Error on Creation'
|
||||||
|
GO
|
||||||
|
@ -61,14 +61,67 @@ namespace DataLoader
|
|||||||
ProcessROs();
|
ProcessROs();
|
||||||
return DateTime.Now - tstart;
|
return DateTime.Now - tstart;
|
||||||
}
|
}
|
||||||
|
public TimeSpan Process(DocVersionInfo dvi)
|
||||||
|
{
|
||||||
|
DateTime tstart = DateTime.Now;
|
||||||
|
ProcessROs(dvi);
|
||||||
|
return DateTime.Now - tstart;
|
||||||
|
}
|
||||||
|
public TimeSpan Process(ProcedureInfo pi)
|
||||||
|
{
|
||||||
|
DateTime tstart = DateTime.Now;
|
||||||
|
ProcessROs(pi);
|
||||||
|
return DateTime.Now - tstart;
|
||||||
|
}
|
||||||
private void ProcessROs()
|
private void ProcessROs()
|
||||||
{
|
{
|
||||||
int changeCount = 0;
|
|
||||||
Status = "Getting List...";
|
Status = "Getting List...";
|
||||||
|
RoUsageInfoList myRoUsages = RoUsageInfoList.Get();
|
||||||
|
DoProcessROs(myRoUsages);
|
||||||
|
}
|
||||||
|
//private void ProcessROs(FolderInfo fi)
|
||||||
|
//{
|
||||||
|
// Status = "Getting List...";
|
||||||
|
// RoUsageInfoList myRoUsages = RoUsageInfoList.GetByFolder(fi);
|
||||||
|
// DoProcessROs(myRoUsages);
|
||||||
|
//}
|
||||||
|
private void ProcessROs(DocVersionInfo dvi)
|
||||||
|
{
|
||||||
|
Status = "Getting List...";
|
||||||
|
RoUsageInfoList myRoUsages = RoUsageInfoList.GetByDocVersion(dvi);
|
||||||
|
DoProcessROs(myRoUsages);
|
||||||
|
}
|
||||||
|
private void ProcessROs(ProcedureInfo pi)
|
||||||
|
{
|
||||||
|
Status = "Getting List...";
|
||||||
|
RoUsageInfoList myRoUsages = RoUsageInfoList.GetByProcedure(pi);
|
||||||
|
DoProcessROs(myRoUsages);
|
||||||
|
}
|
||||||
|
private AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood
|
||||||
|
public AnnotationType VolianCommentType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_VolianCommentType == null)
|
||||||
|
_VolianCommentType = AnnotationType.GetByName("Volian Comment");
|
||||||
|
if (_VolianCommentType == null)
|
||||||
|
_VolianCommentType = AnnotationType.MakeAnnotationType("Volian Comment",null);
|
||||||
|
return _VolianCommentType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DoProcessROs(RoUsageInfoList myRoUsages)
|
||||||
|
{
|
||||||
|
int changeCount = 0;
|
||||||
// get list of content records
|
// get list of content records
|
||||||
List<int> myContentList = new List<int>();
|
List<int> myContentList = new List<int>();
|
||||||
RoUsageInfoList myRoUsages = RoUsageInfoList.Get();
|
|
||||||
Dictionary<int, ROFSTLookup> roFstLookups = new Dictionary<int,ROFSTLookup>();
|
Dictionary<int, ROFSTLookup> roFstLookups = new Dictionary<int,ROFSTLookup>();
|
||||||
|
Dictionary<int, ROFSTLookup> oldRoFstLookups = null;
|
||||||
|
ROFstInfo oldRoFst = null;
|
||||||
|
if (frmMain.MySettings.SelectedROFst > 0)
|
||||||
|
{
|
||||||
|
oldRoFst = ROFstInfo.Get(frmMain.MySettings.SelectedROFst);
|
||||||
|
oldRoFstLookups = new Dictionary<int, ROFSTLookup>();
|
||||||
|
}
|
||||||
foreach (RoUsageInfo rou in myRoUsages)
|
foreach (RoUsageInfo rou in myRoUsages)
|
||||||
{
|
{
|
||||||
if (!myContentList.Contains(rou.ContentID))
|
if (!myContentList.Contains(rou.ContentID))
|
||||||
@ -89,28 +142,78 @@ namespace DataLoader
|
|||||||
roFstLookups.Add(versionId, myRoFst.GetROFSTLookup(dvi));
|
roFstLookups.Add(versionId, myRoFst.GetROFSTLookup(dvi));
|
||||||
}
|
}
|
||||||
ROFSTLookup myLookup = roFstLookups[versionId];
|
ROFSTLookup myLookup = roFstLookups[versionId];
|
||||||
|
if (oldRoFstLookups != null && !oldRoFstLookups.ContainsKey(versionId))
|
||||||
|
{
|
||||||
|
oldRoFstLookups.Add(versionId, oldRoFst.GetROFSTLookup(dvi));
|
||||||
|
}
|
||||||
|
ROFSTLookup oldLookup = null;
|
||||||
|
if(oldRoFstLookups != null)
|
||||||
|
oldLookup = oldRoFstLookups[versionId];
|
||||||
using (Content ctmp = myContentInfo.Get())
|
using (Content ctmp = myContentInfo.Get())
|
||||||
{
|
{
|
||||||
ItemInfo ii = myContentInfo.ContentItems[0];
|
ItemInfo ii = myContentInfo.ContentItems[0];
|
||||||
foreach (RoUsageInfo ru in myContentInfo.ContentRoUsages)
|
foreach (RoUsageInfo ru in myContentInfo.ContentRoUsages)
|
||||||
{
|
{
|
||||||
|
string sameMsg = string.Empty;
|
||||||
|
bool theSame = false;
|
||||||
|
if (oldLookup != null)
|
||||||
|
theSame = CheckIfTheSame(ii, ru.ROID, myLookup, oldLookup, dvi, ref sameMsg);
|
||||||
ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID);
|
ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID);
|
||||||
if (rocc.value == null)
|
if (rocc.value == null)
|
||||||
rocc = myLookup.GetRoChild(ru.ROID);
|
rocc = myLookup.GetRoChild(ru.ROID);
|
||||||
int myType = rocc.type;
|
int myType = rocc.type;
|
||||||
string myValue = myLookup.GetTranslatedRoValue(ru.ROID, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
string myValue = myLookup.GetTranslatedRoValue(ru.ROID, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||||
myValue = myValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen
|
myValue = myValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen
|
||||||
|
string fileNameOnly = null;
|
||||||
if (myType == 8 && myValue.Contains("\n"))
|
if (myType == 8 && myValue.Contains("\n"))
|
||||||
|
{
|
||||||
|
fileNameOnly = myValue.Split("\n".ToCharArray())[0];
|
||||||
myValue = myValue.Replace("\n", "");// Remove newlines in Figure data
|
myValue = myValue.Replace("\n", "");// Remove newlines in Figure data
|
||||||
|
}
|
||||||
|
string textB4 = ctmp.Text;
|
||||||
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
|
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
|
||||||
string oldval = ctmp.FixContentText(ru, myValue, myType, myRoFst);
|
string oldval;
|
||||||
|
switch (frmMain.MySettings.WhatROsToConvert)
|
||||||
|
{
|
||||||
|
case ROUpdateMode.None:
|
||||||
|
oldval = ctmp.FixContentText(ru, myValue, myType, myRoFst, fileNameOnly);
|
||||||
|
if(myValue == "?" && frmMain.MySettings.AnnotateWhenShowingMissingRO)
|
||||||
|
Annotation.MakeAnnotation(ctmp.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) missing", ItemInfo.ConvertToDisplayText(oldval)), null);
|
||||||
|
else if (ctmp.Text != textB4 && frmMain.MySettings.AnnotateWhenShowingDifferentRO)
|
||||||
|
Annotation.MakeAnnotation(ctmp.ContentItems[0].MyItem, VolianCommentType, "", string.Format("Old RO value ({0}) different than new RO value({1})", ItemInfo.ConvertToDisplayText(oldval), ItemInfo.ConvertToDisplayText(myValue)), null);
|
||||||
|
break;
|
||||||
|
case ROUpdateMode.All:
|
||||||
|
oldval = ctmp.ConvertROToText(ru, myValue, myType, myRoFst);
|
||||||
|
if (frmMain.MySettings.AnnotateWhenConvertingToText)
|
||||||
|
Annotation.MakeAnnotation(ctmp.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldval)), null);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (myValue == "?")
|
||||||
|
{
|
||||||
|
oldval = ctmp.ConvertROToText(ru, myValue, myType, myRoFst);
|
||||||
|
if (frmMain.MySettings.AnnotateWhenConvertingToText)
|
||||||
|
Annotation.MakeAnnotation(ctmp.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text" + sameMsg, ItemInfo.ConvertToDisplayText(oldval)), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldval = ctmp.FixContentText(ru, myValue, myType, myRoFst, fileNameOnly);
|
||||||
|
if (ctmp.Text != textB4 && frmMain.MySettings.AnnotateWhenShowingDifferentRO)
|
||||||
|
Annotation.MakeAnnotation(ctmp.ContentItems[0].MyItem, VolianCommentType, "", string.Format("Old RO value ({0}) different than new RO value({1})" + sameMsg, ItemInfo.ConvertToDisplayText(oldval), ItemInfo.ConvertToDisplayText(myValue)), null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
|
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
|
||||||
if (ctmp.IsDirty)
|
if (ctmp.Text != textB4)
|
||||||
{
|
{
|
||||||
changeCount++;
|
changeCount++;
|
||||||
//Console.WriteLine("'{0}', '{1}', '{2}', '{3}'", replace(oldval, @"\u8209?", "-"), replace(myValue, @"\u8209?", "-"), ru.ROID, rocc.appid);
|
//Console.WriteLine("'{0}', '{1}', '{2}', '{3}'", replace(oldval, @"\u8209?", "-"), replace(myValue, @"\u8209?", "-"), ru.ROID, rocc.appid);
|
||||||
frmMain.AddInfo("'{0}','{1}','{2}','{3}','R{4}','{5}'", ii.MyDocVersion.MyFolder.Name, ii.ShortPath,
|
frmMain.AddInfo("'{0}','{1}','{2}','{3}','R{4}','{5}','{6}'", ii.MyDocVersion.MyFolder.Name, ii.ShortPath,
|
||||||
(oldval ?? "").Replace(@"\u8209?", "-"), myValue.Replace(@"\u8209?", "-"), ru.ROID, myLookup.GetAccPageID(ru.ROID));
|
(oldval ?? "").Replace(@"\u8209?", "-").Replace("'", "''"), myValue.Replace(@"\u8209?", "-").Replace("'", "''"), ru.ROID, myLookup.GetAccPageID(ru.ROID), sameMsg);
|
||||||
|
}
|
||||||
|
else if (sameMsg != string.Empty && sameMsg != ", Exact Match")
|
||||||
|
{
|
||||||
|
frmMain.AddInfo("'{0}','{1}','{2}','{3}','R{4}','{5}','{6}'", ii.MyDocVersion.MyFolder.Name, ii.ShortPath,
|
||||||
|
(oldval ?? "").Replace(@"\u8209?", "-").Replace("'", "''"), myValue.Replace(@"\u8209?", "-").Replace("'", "''"), ru.ROID, myLookup.GetAccPageID(ru.ROID), sameMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ctmp.IsDirty)
|
if (ctmp.IsDirty)
|
||||||
@ -124,6 +227,61 @@ namespace DataLoader
|
|||||||
frmMain.AddInfo("{0} RO Values Updated", changeCount);
|
frmMain.AddInfo("{0} RO Values Updated", changeCount);
|
||||||
MessageBox.Show(String.Format("{0} RO Values Updated", changeCount), "RO Value Update Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(String.Format("{0} RO Values Updated", changeCount), "RO Value Update Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckIfTheSame(ItemInfo ii, string roid, ROFSTLookup myLookup, ROFSTLookup oldLookup, DocVersionInfo dvi, ref string sameMsg)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID);
|
||||||
|
if (rocc.value == null)
|
||||||
|
rocc = myLookup.GetRoChild(ru.ROID);
|
||||||
|
int myType = rocc.type;
|
||||||
|
*/
|
||||||
|
ROFSTLookup.rochild roc = myLookup.GetRoChild12(roid);
|
||||||
|
if (roc.value == null) roc = myLookup.GetRoChild(roid);
|
||||||
|
ROFSTLookup.rochild oroc = oldLookup.GetRoChild12(roid);
|
||||||
|
if (oroc.value == null) oroc = oldLookup.GetRoChild(roid);
|
||||||
|
string myValue = myLookup.GetTranslatedRoValue(roid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||||
|
myValue = myValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen
|
||||||
|
string oldValue = oldLookup.GetTranslatedRoValue(roid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||||
|
oldValue = oldValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen
|
||||||
|
string myAccPageID = myLookup.GetAccPageID(roid);
|
||||||
|
string oldAccPageID = oldLookup.GetAccPageID(roid);
|
||||||
|
if (myValue == oldValue && roc.type == oroc.type && ((myAccPageID ?? "null") == (oldAccPageID ?? "null")))
|
||||||
|
{
|
||||||
|
sameMsg = ", Exact Match";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (myValue != oldValue && roc.type == oroc.type && ((myAccPageID ?? "null") == (oldAccPageID ?? "null")))
|
||||||
|
{
|
||||||
|
sameMsg = ", Different Value, Same RO";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((myAccPageID ?? "null") != (oldAccPageID ?? "null"))
|
||||||
|
{
|
||||||
|
ROFSTLookup.rochild? myroc = myLookup.GetROChildByAccPageID(oldAccPageID, dvi.DocVersionConfig.RODefaults_setpointprefix, dvi.DocVersionConfig.RODefaults_graphicsprefix);
|
||||||
|
if (myroc != null)
|
||||||
|
{
|
||||||
|
string myValueNew = myLookup.GetTranslatedRoValue(((ROFSTLookup.rochild)myroc).roid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||||
|
if(myValueNew == oldValue)
|
||||||
|
sameMsg = ", Same Value, Different RO";
|
||||||
|
else
|
||||||
|
sameMsg = ", Different Value, Different RO";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sameMsg = ", Missing RO";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sameMsg = ", Unknown";
|
||||||
|
|
||||||
|
//if (myLookup.GetAccPageID(roid) == oldLookup.GetAccPageID(roid))
|
||||||
|
//{
|
||||||
|
// sameMsg = string.Format("ROID: {0}, AccPageID: {1}, OldAccPageID: {2}", roid, myLookup.GetAccPageID(roid), oldLookup.GetAccPageID(roid));
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
//sameMsg = "Values and AccPageIDs are different for ROID: " + roid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private List<string> myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
|
private List<string> myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
|
||||||
{
|
{
|
||||||
return Volian.Controls.Library.VlnFlexGrid.ROTableUpdate(sender,args);
|
return Volian.Controls.Library.VlnFlexGrid.ROTableUpdate(sender,args);
|
||||||
|
@ -57,7 +57,21 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
// get step type, and check its format for bold. BGE had data that was high5 (bolded step)
|
// get step type, and check its format for bold. BGE had data that was high5 (bolded step)
|
||||||
// with the bold of the next word character, but it was redundant
|
// with the bold of the next word character, but it was redundant
|
||||||
int stptype = Convert.ToInt32(StepType) + 1;
|
if (StepType[0] == '\u2591')
|
||||||
|
StepType = "0" + StepType.Substring(1, StepType.Length - 1);
|
||||||
|
if (StepType[0] == '\u2592')
|
||||||
|
StepType = "1" + StepType.Substring(1, StepType.Length - 1);
|
||||||
|
if (StepType[0] == '\u2524')
|
||||||
|
StepType = "4" + StepType.Substring(1, StepType.Length - 1);
|
||||||
|
int stptype = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stptype = Convert.ToInt32(StepType) + 1;
|
||||||
|
}
|
||||||
|
catch (Exception myex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(myex.Message);
|
||||||
|
}
|
||||||
bool isbold = (stptype == 41); // This is hardcoded for BGE only
|
bool isbold = (stptype == 41); // This is hardcoded for BGE only
|
||||||
if (isbold && Textm.Contains("\x13")) Textm = Textm.Replace("\x13", "");
|
if (isbold && Textm.Contains("\x13")) Textm = Textm.Replace("\x13", "");
|
||||||
|
|
||||||
@ -651,6 +665,7 @@ namespace DataLoader
|
|||||||
string sParent = GetParent(drvs["CSequence"].ToString());
|
string sParent = GetParent(drvs["CSequence"].ToString());
|
||||||
if (dicStep.ContainsKey(sParent))
|
if (dicStep.ContainsKey(sParent))
|
||||||
{
|
{
|
||||||
|
if (dicStep[sParent] == null) Console.WriteLine("jcb");
|
||||||
Item itemp = dicStep[sParent];
|
Item itemp = dicStep[sParent];
|
||||||
sType = GetStructType(drvs["CSequence"].ToString());
|
sType = GetStructType(drvs["CSequence"].ToString());
|
||||||
Dictionary<string,Item> dicStr = dicStruct[sParent];
|
Dictionary<string,Item> dicStr = dicStruct[sParent];
|
||||||
|
@ -60,10 +60,12 @@ namespace DataLoader
|
|||||||
get { return _MyStepRTB; }
|
get { return _MyStepRTB; }
|
||||||
}
|
}
|
||||||
private string _LogPath;
|
private string _LogPath;
|
||||||
public TransitionFixer(StepRTB myStepRTB,string logpath)
|
private frmLoader _MyLoader;
|
||||||
|
public TransitionFixer(StepRTB myStepRTB,string logpath, frmLoader myLoader)
|
||||||
{
|
{
|
||||||
_MyStepRTB = myStepRTB;
|
_MyStepRTB = myStepRTB;
|
||||||
_LogPath = logpath;
|
_LogPath = logpath;
|
||||||
|
_MyLoader = myLoader;
|
||||||
}
|
}
|
||||||
public TimeSpan Process(bool checkRTF)
|
public TimeSpan Process(bool checkRTF)
|
||||||
{
|
{
|
||||||
@ -75,8 +77,8 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
Status = "Getting List...";
|
Status = "Getting List...";
|
||||||
// Loop through all Items and check before and after text
|
// Loop through all Items and check before and after text
|
||||||
ItemInfoList myListFrom = ItemInfoList.GetListTranFrom();
|
ItemInfoList myListFrom = ItemInfoList.GetListTranFrom(); //ItemInfoList.GetByContentID(99732);//
|
||||||
ItemInfoList myListTo = ItemInfoList.GetListTranTo();
|
ItemInfoList myListTo = ItemInfoList.GetListTranTo(); //ItemInfoList.GetByContentID(99732); //
|
||||||
ConversionRTBProblems myProblems = new ConversionRTBProblems();
|
ConversionRTBProblems myProblems = new ConversionRTBProblems();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (ItemInfo item in myListFrom)
|
foreach (ItemInfo item in myListFrom)
|
||||||
@ -100,10 +102,28 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (item.MyContent.MyGrid != null)
|
using (Content c = item.MyContent.Get())
|
||||||
updatedText = FixTableTransitionText(updatedText, tran, item.MyContent.Get());
|
{
|
||||||
else
|
c.FixTransitionText(tran);
|
||||||
updatedText = FixTransitionText(updatedText, tran);
|
c.Save();
|
||||||
|
}
|
||||||
|
if (item.NewTransToUnNumberedItem)
|
||||||
|
{
|
||||||
|
using (Item itm = item.Get())
|
||||||
|
{
|
||||||
|
ItemAnnotation ia = itm.ItemAnnotations.Add(VerificationRequiredType);
|
||||||
|
ia.SearchText = "Transition to un-numbered step";
|
||||||
|
ia.UserID = "Migration";
|
||||||
|
itm.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//_MyLoader.AddInfo("{0}", item.MyContent.MyContentMessage);
|
||||||
|
//if (item.MyContent.MyGridMessage != string.Empty)
|
||||||
|
// _MyLoader.AddInfo("{0}", item.MyContent.MyGridMessage);
|
||||||
|
// updatedText = FixTransitionText(originalText, tran, item.MyContent.ContentID);
|
||||||
|
//if (item.MyContent.MyGrid != null)
|
||||||
|
// updatedText = FixTableTransitionText(originalText, tran, item.MyContent.Get());
|
||||||
|
//else
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -111,45 +131,45 @@ namespace DataLoader
|
|||||||
_MyLog.WarnFormat("Transition Conversion Error: {0}", ex.Message);
|
_MyLog.WarnFormat("Transition Conversion Error: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
// Added for transitions to un-numbered steps
|
// Added for transitions to un-numbered steps
|
||||||
if (tran.NewTransToUnNumberedItem) item.NewTransToUnNumberedItem = true;
|
//if (tran.NewTransToUnNumberedItem) item.NewTransToUnNumberedItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updatedText.EndsWith(" ")) updatedText = updatedText.Substring(0, updatedText.Length - 1);
|
//if (updatedText.EndsWith(" ")) updatedText = updatedText.Substring(0, updatedText.Length - 1);
|
||||||
if (item.MyContent.MyGrid != null)
|
//if (item.MyContent.MyGrid != null)
|
||||||
{
|
//{
|
||||||
using (Item itm = item.Get())
|
// using (Item itm = item.Get())
|
||||||
{
|
// {
|
||||||
updatedText = (updatedText.Replace("<START]", "<START]")).Replace("[END>", "[END>");
|
// updatedText = (updatedText.Replace("<START]", "<START]")).Replace("[END>", "[END>");
|
||||||
string sstring = AdjustSizeAndGetSearchString(updatedText, itm);
|
// string sstring = AdjustSizeAndGetSearchString(updatedText, itm);
|
||||||
itm.MyContent.Text = sstring;
|
// itm.MyContent.Text = sstring;
|
||||||
if (item.NewTransToUnNumberedItem)
|
// if (item.NewTransToUnNumberedItem)
|
||||||
{
|
// {
|
||||||
ItemAnnotation ia = itm.ItemAnnotations.Add(VerificationRequiredType);
|
// ItemAnnotation ia = itm.ItemAnnotations.Add(VerificationRequiredType);
|
||||||
ia.SearchText = "Transition to un-numbered step";
|
// ia.SearchText = "Transition to un-numbered step";
|
||||||
ia.UserID = "Migration";
|
// ia.UserID = "Migration";
|
||||||
}
|
// }
|
||||||
itm.Save();
|
// itm.Save();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
if (item.NewTransToUnNumberedItem)
|
// if (item.NewTransToUnNumberedItem)
|
||||||
{
|
// {
|
||||||
using (Item itm = item.Get())
|
// using (Item itm = item.Get())
|
||||||
{
|
// {
|
||||||
ItemAnnotation ia = itm.ItemAnnotations.Add(VerificationRequiredType);
|
// ItemAnnotation ia = itm.ItemAnnotations.Add(VerificationRequiredType);
|
||||||
ia.SearchText = "Transition to un-numbered step";
|
// ia.SearchText = "Transition to un-numbered step";
|
||||||
ia.UserID = "Migration";
|
// ia.UserID = "Migration";
|
||||||
itm.Save();
|
// itm.Save();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
using (Content c = item.MyContent.Get())
|
// using (Content c = item.MyContent.Get())
|
||||||
{
|
// {
|
||||||
c.Text = updatedText;
|
// c.Text = updatedText;
|
||||||
c.Save();
|
// c.Save();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
// Added for transitions to un-numbered steps
|
//// Added for transitions to un-numbered steps
|
||||||
if (checkRTF)
|
if (checkRTF)
|
||||||
{
|
{
|
||||||
MyStepRTB.MyItemInfo = item;
|
MyStepRTB.MyItemInfo = item;
|
||||||
@ -190,7 +210,7 @@ namespace DataLoader
|
|||||||
return _VerificationRequiredType;
|
return _VerificationRequiredType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string FixTransitionText(string Text, TransitionInfo tran)
|
public string FixTransitionText(string Text, TransitionInfo tran, int contentID)
|
||||||
{
|
{
|
||||||
string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1}( [0-9]*){2}\[END>", tran.TranType, tran.TransitionID, "{1,2}");
|
string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1}( [0-9]*){2}\[END>", tran.TranType, tran.TransitionID, "{1,2}");
|
||||||
string transText = tran.ResolvePathTo();
|
string transText = tran.ResolvePathTo();
|
||||||
@ -202,7 +222,9 @@ namespace DataLoader
|
|||||||
if (m != null && m.Groups.Count > 1)
|
if (m != null && m.Groups.Count > 1)
|
||||||
{
|
{
|
||||||
System.Text.RegularExpressions.Group g = m.Groups[1];
|
System.Text.RegularExpressions.Group g = m.Groups[1];
|
||||||
if (g.ToString() != transText)
|
_MyLoader.AddInfo("DataLoader.TransitionFixer:Content:{0}, {1}, {2}", contentID, tran.TransitionID, g.ToString());
|
||||||
|
//Console.WriteLine("DataLoader.TransitionFixer:Content:{0}, {1}", tran.TransitionID, g.ToString());
|
||||||
|
if (g.ToString() != transText)
|
||||||
Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
|
Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -221,7 +243,9 @@ namespace DataLoader
|
|||||||
if (m != null && m.Groups.Count > 1)
|
if (m != null && m.Groups.Count > 1)
|
||||||
{
|
{
|
||||||
System.Text.RegularExpressions.Group g = m.Groups[1];
|
System.Text.RegularExpressions.Group g = m.Groups[1];
|
||||||
if (g.ToString() != transText)
|
_MyLoader.AddInfo("DataLoader.TransitionFixer:Grid:{0}, {1}, {2}", content.ContentID, tran.TransitionID, g.ToString());
|
||||||
|
// Console.WriteLine("DataLoader.TransitionFixer:Grid:{0}, {1}", tran.TransitionID, g.ToString());
|
||||||
|
if (g.ToString() != transText)
|
||||||
Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
|
Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user