new button copy including attributes

This commit is contained in:
2015-11-03 14:10:41 +01:00
parent b4e8089efc
commit 3e128794e1
2 changed files with 68 additions and 29 deletions

View File

@ -2197,10 +2197,10 @@ namespace CobXmlSupport
}
private void createXMLMoveCode(savedFile SF, bool justOut = false)
private void createXMLMoveCode(savedFile SF, bool justOut = false, bool inclAttribs = false)
{
bool loopTyp = false;
string SectionNames="",BoolVars="";
string SectionNames = "", BoolVars = "";
qualifieldhlp locTmpQfh = null;
Stack<string> indexStack = new Stack<string>();
@ -2247,7 +2247,9 @@ namespace CobXmlSupport
fromToMoves.CodeShower.Text += "\r\n";
}
if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE))
// inclAttribs)
//if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE))
if (bringAttrs(tmpQfh,inclAttribs))
{
//IndStatus-object takes care of optionally occuring indexes
@ -2257,7 +2259,7 @@ namespace CobXmlSupport
for (int i = 0; i < indSt.Returns; i++)
{
string xtIndex = indexStack.Pop();
string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex ).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
locTmpQfh = qldList.First(x => x.qualCobRow.FieldName == chosenKey); // Find QualifiedHelp-object for right field
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "LAST-in-",
@ -2379,10 +2381,18 @@ namespace CobXmlSupport
}
private bool bringAttrs(qualifieldhlp qfh, bool yes)
{
if (yes)
return (!qfh.qualCobRow.SampleStr.Equals(NOMOVE));
else
return (!qfh.qualCobRow.isAttribute && !qfh.qualCobRow.SampleStr.Equals(NOMOVE));
}
private string createAftReferenceSections(string tagName, string procPrefix, string indexVar, ref string wrkSectStr)
{
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "")+"-x";
if (!wrkSectStr.Contains(tmpProcName+"-x"))
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "") + "-x";
if (!wrkSectStr.Contains(tmpProcName + "-x"))
{
wrkSectStr += "\r\n *>------------------- HANDLE SECTION --------------*" + tmpProcName;
wrkSectStr += "\r\n * Den här sektionen används för att positionera ";
@ -2562,5 +2572,20 @@ namespace CobXmlSupport
cwi.ShowDialog();
}
private void chkAttribs_CheckedChanged(object sender, EventArgs e)
{
}
private void btnXmlKopAttr_Click(object sender, EventArgs e)
{
// kopiera xml inclusive Attribut
savedFile SF = new savedFile();
SF.idConnect = "598A5F20-9A8A-415D-81B2-BBFE04465381";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
createXMLMoveCode(SF, inclAttribs: true);
}
}
}