B2024-079 Consistency of adding_editing_removing fields in RO Editor - Referenced Object Definition Form
This commit is contained in:
parent
caec6adf8d
commit
7d408df904
@ -504,7 +504,7 @@ namespace ROEditor
|
||||
ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
|
||||
AvailList.Add(copyrof);
|
||||
|
||||
lboxAvail.Items.Add(copyrof.GetFieldname);
|
||||
lboxAvail.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
|
||||
InUseList.RemoveAt(indx);
|
||||
if (InUseApplcList.Contains(rof)) // C2021-026 remove from the field applicability list
|
||||
InUseApplcList.Remove(rof);
|
||||
@ -527,7 +527,7 @@ namespace ROEditor
|
||||
ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
|
||||
AvailList.Add(copyrof);
|
||||
|
||||
lboxAvail.Items.Add(copyrof.GetFieldname);
|
||||
lboxAvail.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
|
||||
InUseList.RemoveAt(indx);
|
||||
if (InUseApplcList.Contains(rof)) // C2021-026 remove from the field applicability list
|
||||
InUseApplcList.Remove(rof);
|
||||
@ -555,7 +555,7 @@ namespace ROEditor
|
||||
ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
|
||||
InUseList.Add(copyrof);
|
||||
|
||||
lboxInUseCB.Items.Add(copyrof.GetFieldname);
|
||||
lboxInUseCB.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
|
||||
AvailList.RemoveAt(indx);
|
||||
lboxAvail.Refresh();
|
||||
lboxInUseCB.Refresh();
|
||||
@ -577,7 +577,7 @@ namespace ROEditor
|
||||
ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
|
||||
InUseList.Add(copyrof);
|
||||
|
||||
lboxInUse.Items.Add(copyrof.GetFieldname);
|
||||
lboxInUse.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
|
||||
AvailList.RemoveAt(indx);
|
||||
lboxAvail.Refresh();
|
||||
lboxInUse.Refresh();
|
||||
@ -740,7 +740,7 @@ namespace ROEditor
|
||||
{
|
||||
ROField rof = (ROField) InUseList[i];
|
||||
rofname = rof.GetFieldname;
|
||||
if (inusename == rofname)
|
||||
if (inusename == rofname || inusename == CvtFldToUserFld(rofname))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
@ -845,7 +845,7 @@ namespace ROEditor
|
||||
{
|
||||
ROField rof = (ROField) InUseList[i];
|
||||
rofname = rof.GetFieldname;
|
||||
if (inusename == rofname)
|
||||
if (inusename == rofname || inusename == CvtFldToUserFld(rofname))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
@ -1197,6 +1197,7 @@ namespace ROEditor
|
||||
}
|
||||
}
|
||||
|
||||
string origname = CvtFldToUserFld(rof.GetFieldname);
|
||||
uint ftype = rof.GetFieldType;
|
||||
if (ftype == (uint)FieldTypes.FrmtSingleTxt || ftype == (uint)FieldTypes.VariableTxt ||
|
||||
ftype == (uint)FieldTypes.SingleTxt || ftype == (uint)FieldTypes.Table ||
|
||||
@ -1212,6 +1213,10 @@ namespace ROEditor
|
||||
nwcomb.ShowDialog();
|
||||
}
|
||||
|
||||
//need to refresh pull from table for fields in use.
|
||||
_ = myrodb.RODB_GetFields(elem, 0, true);
|
||||
string newname = CvtFldToUserFld(rof.GetFieldname);
|
||||
|
||||
// Update Lists & Text boxes to represent any modified text.
|
||||
if (isInSelList)
|
||||
{
|
||||
@ -1225,20 +1230,28 @@ namespace ROEditor
|
||||
rof = (ROField) InUseList[i];
|
||||
if (rof.GetFieldname != null)
|
||||
{
|
||||
string fieldname = CvtFldToUserFld(rof.GetFieldname);
|
||||
|
||||
// C2021-026 if doing Parent/Child enabled RO Editor, put the In Use fields in the Check Box List instead of the normal list
|
||||
if (PCApplicabilityEnabled)
|
||||
{
|
||||
this.lboxInUseCB.Items.Add(rof.GetFieldname);
|
||||
this.lboxInUseCB.Items.Add(fieldname);
|
||||
if (rof.FieldTypeCanDoApplicability())
|
||||
{
|
||||
if (ContainedInUseApplicList(rof))
|
||||
this.lboxInUseCB.SetItemCheckState(lboxInUseCB.Items.IndexOf(rof.GetFieldname), CheckState.Checked);
|
||||
this.lboxInUseCB.SetItemCheckState(lboxInUseCB.Items.IndexOf(fieldname), CheckState.Checked);
|
||||
}
|
||||
}
|
||||
else
|
||||
this.lboxInUse.Items.Add(rof.GetFieldname);
|
||||
this.lboxInUse.Items.Add(fieldname);
|
||||
}
|
||||
}
|
||||
|
||||
if (origname != newname)
|
||||
{
|
||||
tbMenuVal.Text = tbMenuVal.Text.Replace($"<{origname}>", $"<{newname}>");
|
||||
tbRetVal.Text = tbRetVal.Text.Replace($"<{origname}>", $"<{newname}>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1248,7 +1261,7 @@ namespace ROEditor
|
||||
{
|
||||
rof = (ROField) AvailList[i];
|
||||
if (rof.GetFieldname != null)
|
||||
this.lboxAvail.Items.Add(rof.GetFieldname);
|
||||
this.lboxAvail.Items.Add(CvtFldToUserFld(rof.GetFieldname));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1262,8 +1275,11 @@ namespace ROEditor
|
||||
if (rof.GetFieldname != null)
|
||||
{
|
||||
AvailList.Add(rof);
|
||||
lboxAvail.Items.Add(rof.GetFieldname);
|
||||
lboxAvail.Items.Add(CvtFldToUserFld(rof.GetFieldname));
|
||||
}
|
||||
|
||||
//need to refresh pull from table for fields in use.
|
||||
_ = myrodb.RODB_GetFields(elem, 0, true);
|
||||
}
|
||||
// C2021-026 Check/un-check field for Parent/Child values
|
||||
private void lboxInUseCB_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||
@ -1497,6 +1513,7 @@ namespace ROEditor
|
||||
this.btnCancel.Size = new System.Drawing.Size(80, 24);
|
||||
this.btnCancel.TabIndex = 10;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
|
||||
//
|
||||
// RODefFrm
|
||||
//
|
||||
@ -1518,6 +1535,28 @@ namespace ROEditor
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
//if User clicked save (DialogResult.OK) close the form
|
||||
//if use did not click save, ask if they are sure they want to close the form
|
||||
//only close if they say "Yes, they want to"
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
if (this.DialogResult != System.Windows.Forms.DialogResult.OK && !CloseCancel())
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CloseCancel()
|
||||
{
|
||||
const string message = "Are you sure that you would like to cancel? Information may not be saved.";
|
||||
const string caption = "Cancel";
|
||||
var result = MessageBox.Show(message, caption,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question);
|
||||
|
||||
return result == DialogResult.Yes;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ namespace RODBInterface
|
||||
public abstract bool RODB_WriteRO(VlnXmlElement ro);
|
||||
public abstract bool RODB_InsertRO(VlnXmlElement ro);
|
||||
public abstract ushort RODB_GetFieldType(VlnXmlElement elem, string TableName, string Fld);
|
||||
public abstract ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype);
|
||||
public abstract ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype, bool refresh = false);
|
||||
public abstract string RODB_GetSchemaPiece(string Recid, string table);
|
||||
public abstract bool RODB_NewSchemaPiece(string recid, string parentid, string table, string schpiece, uint rtype);
|
||||
public abstract bool RODB_WriteSchemaPiece(string Recid, string table, string schpiece);
|
||||
@ -2294,11 +2294,16 @@ namespace RODBInterface
|
||||
}
|
||||
|
||||
// For the given element's table, get all of the RO fields defined in this table.
|
||||
public override ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype)
|
||||
public override ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype, bool refresh = false)
|
||||
{
|
||||
string table = elem.GetAttribute("Table");
|
||||
if (!FieldDefinitions.ContainsKey(table))
|
||||
FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
|
||||
else if (refresh)
|
||||
{
|
||||
FieldDefinitions.Remove(table);
|
||||
FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
|
||||
}
|
||||
return FieldDefinitions[table];
|
||||
}
|
||||
private Dictionary<string, ArrayList> _FieldDefinitions = null;
|
||||
|
@ -1744,13 +1744,18 @@ namespace RODBInterface
|
||||
return ftype;
|
||||
}
|
||||
// For the given element's table, get all of the RO fields defined in this table.
|
||||
public override ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype)
|
||||
public override ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype, bool refresh = false)
|
||||
{
|
||||
string table = elem.GetAttribute("Table");
|
||||
if (!FieldDefinitions.ContainsKey(table))
|
||||
{
|
||||
FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
|
||||
}
|
||||
else if (refresh)
|
||||
{
|
||||
FieldDefinitions.Remove(table);
|
||||
FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
|
||||
}
|
||||
return FieldDefinitions[table];
|
||||
}
|
||||
private Dictionary<string, ArrayList> _FieldDefinitions = null;
|
||||
|
@ -85,7 +85,7 @@ namespace VlnStatus
|
||||
this.lblStatMsg.Name = "lblStatMsg";
|
||||
this.lblStatMsg.Size = new System.Drawing.Size(420, 81);
|
||||
this.lblStatMsg.TabIndex = 0;
|
||||
this.lblStatMsg.Text = "Put Satus Message Here";
|
||||
this.lblStatMsg.Text = "Put Status Message Here";
|
||||
this.lblStatMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// StatusMessageFrm
|
||||
|
Loading…
x
Reference in New Issue
Block a user