M
Markus Freitag
Guest
Hello,
I have to read a file into my own structure. I have to edit the next free Position.
<PANEL no="3" state="0" finished="0">
<INDEX no="2" state="0" ref1="0003" />
modify it to
<INDEX no="2" state="0" ref1=""new ref 1 for test" />
Problems:
How do I make sure that I ask for the first free position?
Is it sufficient with sorting / order by?
var qry = ListIndexPanels.Where(x => x.Finished == 0).OrderBy(o => o.No).FirstOrDefault();
if (qry != null)
{
var qry2 = qry.ListIndexProperties.Where(x => x.No == 2).FirstOrDefault();
if (qry2 != null)
{
qry2.ref1 = "new ref 1 for test";
}
}
<WORKS_ORDER id="0601">
<QUANTITY>3</QUANTITY>
<PRODUCT >
<PANELS>
<PANEL no="1" state="0" finished="1">
<INDEX no="1" state="0" ref1="0001" />
<INDEX no="2" state="0" ref1="0001" />
</PANEL>
<PANEL no="2" state="0" finished="1">
<INDEX no="1" state="0" ref1="0002" />
<INDEX no="2" state="0" ref1="0002" />
<INDEX no="3" state="0" ref1="0002" />
<INDEX no="4" state="0" ref1="0002" />
<INDEX no="5" state="0" ref1="0002" />
<INDEX no="6" state="0" ref1="0002" />
<INDEX no="7" state="0" ref1="0002" />
</PANEL>
<PANEL no="3" state="0" finished="0">
<INDEX no="1" state="0" ref1="0003" />
<INDEX no="2" state="0" ref1="0003" />
<INDEX no="3" state="0" ref1="0003" />
</PANEL>
<PANEL no="4" state="0" finished="0">
<INDEX no="1" state="0" ref1="0004" />
<INDEX no="2" state="0" ref1="0004" />
<INDEX no="3" state="0" ref1="0004" />
</PANEL>
</PANELS>
</PRODUCT>
</WORKS_ORDER>
Continue reading...
I have to read a file into my own structure. I have to edit the next free Position.
<PANEL no="3" state="0" finished="0">
<INDEX no="2" state="0" ref1="0003" />
modify it to
<INDEX no="2" state="0" ref1=""new ref 1 for test" />
Problems:
How do I make sure that I ask for the first free position?
Is it sufficient with sorting / order by?
var qry = ListIndexPanels.Where(x => x.Finished == 0).OrderBy(o => o.No).FirstOrDefault();
if (qry != null)
{
var qry2 = qry.ListIndexProperties.Where(x => x.No == 2).FirstOrDefault();
if (qry2 != null)
{
qry2.ref1 = "new ref 1 for test";
}
}
<WORKS_ORDER id="0601">
<QUANTITY>3</QUANTITY>
<PRODUCT >
<PANELS>
<PANEL no="1" state="0" finished="1">
<INDEX no="1" state="0" ref1="0001" />
<INDEX no="2" state="0" ref1="0001" />
</PANEL>
<PANEL no="2" state="0" finished="1">
<INDEX no="1" state="0" ref1="0002" />
<INDEX no="2" state="0" ref1="0002" />
<INDEX no="3" state="0" ref1="0002" />
<INDEX no="4" state="0" ref1="0002" />
<INDEX no="5" state="0" ref1="0002" />
<INDEX no="6" state="0" ref1="0002" />
<INDEX no="7" state="0" ref1="0002" />
</PANEL>
<PANEL no="3" state="0" finished="0">
<INDEX no="1" state="0" ref1="0003" />
<INDEX no="2" state="0" ref1="0003" />
<INDEX no="3" state="0" ref1="0003" />
</PANEL>
<PANEL no="4" state="0" finished="0">
<INDEX no="1" state="0" ref1="0004" />
<INDEX no="2" state="0" ref1="0004" />
<INDEX no="3" state="0" ref1="0004" />
</PANEL>
</PANELS>
</PRODUCT>
</WORKS_ORDER>
Continue reading...