Fixed logic for Change Bar portion of Step Properties Panel, Tags Tab

This commit is contained in:
Rich 2014-06-20 14:08:19 +00:00
parent fc0b4424ae
commit 9419fc36a6

View File

@ -217,28 +217,31 @@ namespace Volian.Controls.Library
// There is also an override flag in the config for the step, used to override the change bar to 'off' // There is also an override flag in the config for the step, used to override the change bar to 'off'
// if the date show it as having one, or allow a change bar to be 'on' if there the dates are // if the date show it as having one, or allow a change bar to be 'on' if there the dates are
// not different. Note also that a user may edit data after the change bar is set to 'on'. // not different. Note also that a user may edit data after the change bar is set to 'on'.
DateTime curDts; //DateTime curDts;
using (Item itm = Item.Get(CurItemInfo.ItemID)) //using (Item itm = Item.Get(CurItemInfo.ItemID))
{ //{
curDts = itm.DTS; // curDts = itm.DTS;
} //}
// set change bar radio buttons for the default that there is no change // set change bar radio buttons for the default that there is no change
// bar & override sets it to On. // bar & override sets it to On.
rbChgBarOff.Checked = true; if (CurItemInfo.HasChanges)
rbChgBarOn.Text = "ON (Override)"; {
rbChgBarOff.Text = "OFF"; rbChgBarOff.Text = "OFF (Override)";
rbChgBarOn.Text = "ON";
}
else
{
rbChgBarOn.Text = "ON (Override)";
rbChgBarOff.Text = "OFF";
}
// if there is no override & a change occurred to the text, there is a // if there is no override & a change occurred to the text, there is a
// change bar & override sets it to Off. // change bar & override sets it to Off.
if (sc.Step_CBOverride == null) if (sc.Step_CBOverride == null)
{ {
if (curDts > CurItemInfo.MyProcedure.DTS) rbChgBarOn.Checked = CurItemInfo.HasChanges;
{ rbChgBarOff.Checked = ! rbChgBarOn.Checked;
rbChgBarOn.Checked = true;
rbChgBarOff.Text = "OFF (Override)";
rbChgBarOn.Text = "ON";
}
} }
else else
{ {
@ -249,17 +252,17 @@ namespace Volian.Controls.Library
// If the date of this is greater than the procedure, a change bar should be displayed - // If the date of this is greater than the procedure, a change bar should be displayed -
// see what the override says. The override states whether change bar is on/off (not // see what the override says. The override states whether change bar is on/off (not
// whether override is on/off) // whether override is on/off)
if (curDts > CurItemInfo.MyProcedure.DTS) //if (curDts > CurItemInfo.MyProcedure.DTS)
{ //{
rbChgBarOff.Text = "OFF (Override)"; // rbChgBarOff.Text = "OFF (Override)";
rbChgBarOn.Text = "ON"; // rbChgBarOn.Text = "ON";
} //}
else //else
{ //{
// date time stamp says no change bar should be displayed: // // date time stamp says no change bar should be displayed:
rbChgBarOff.Text = "OFF"; // rbChgBarOff.Text = "OFF";
rbChgBarOn.Text = "ON (Override)"; // rbChgBarOn.Text = "ON (Override)";
} //}
} }
// see if the change id label & text box are visible, i.e. plant has multiple change ids. // see if the change id label & text box are visible, i.e. plant has multiple change ids.
@ -434,7 +437,7 @@ namespace Volian.Controls.Library
if (rbChgBarOn.Checked) if (rbChgBarOn.Checked)
{ {
StepConfig sc = CurItemInfo.MyConfig as StepConfig; StepConfig sc = CurItemInfo.MyConfig as StepConfig;
sc.Step_CBOverride = "On"; sc.Step_CBOverride = CurItemInfo.HasChanges ? null : "On";
//using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID)) //using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID))
//{ //{
// cnt.DTS = DateTime.Now; // cnt.DTS = DateTime.Now;
@ -453,7 +456,7 @@ namespace Volian.Controls.Library
if (rbChgBarOff.Checked) if (rbChgBarOff.Checked)
{ {
StepConfig sc = CurItemInfo.MyConfig as StepConfig; StepConfig sc = CurItemInfo.MyConfig as StepConfig;
sc.Step_CBOverride = "Off"; sc.Step_CBOverride = CurItemInfo.HasChanges ? "Off" :null;
//using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID)) //using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID))
//{ //{
// cnt.DTS = CurItemInfo.MyProcedure.DTS; // cnt.DTS = CurItemInfo.MyProcedure.DTS;