Merge pull request 'B2024-079 Consistency of adding_editing_removing fields in RO Editor - Referenced Object Definition Form' (#430) from B2024-079 into Development
change are good. Ready for testing phase.
This commit is contained in:
		@@ -504,7 +504,7 @@ namespace ROEditor
 | 
				
			|||||||
					ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
										ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
				
			||||||
					AvailList.Add(copyrof);
 | 
										AvailList.Add(copyrof);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					lboxAvail.Items.Add(copyrof.GetFieldname);
 | 
										lboxAvail.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
 | 
				
			||||||
					InUseList.RemoveAt(indx);
 | 
										InUseList.RemoveAt(indx);
 | 
				
			||||||
					if (InUseApplcList.Contains(rof)) // C2021-026 remove from the field applicability list
 | 
										if (InUseApplcList.Contains(rof)) // C2021-026 remove from the field applicability list
 | 
				
			||||||
						InUseApplcList.Remove(rof);
 | 
											InUseApplcList.Remove(rof);
 | 
				
			||||||
@@ -527,7 +527,7 @@ namespace ROEditor
 | 
				
			|||||||
					ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
										ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
				
			||||||
					AvailList.Add(copyrof);
 | 
										AvailList.Add(copyrof);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					lboxAvail.Items.Add(copyrof.GetFieldname);
 | 
										lboxAvail.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
 | 
				
			||||||
					InUseList.RemoveAt(indx);
 | 
										InUseList.RemoveAt(indx);
 | 
				
			||||||
					if (InUseApplcList.Contains(rof)) // C2021-026 remove from the field applicability list
 | 
										if (InUseApplcList.Contains(rof)) // C2021-026 remove from the field applicability list
 | 
				
			||||||
						InUseApplcList.Remove(rof);
 | 
											InUseApplcList.Remove(rof);
 | 
				
			||||||
@@ -555,7 +555,7 @@ namespace ROEditor
 | 
				
			|||||||
					ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
										ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
				
			||||||
					InUseList.Add(copyrof);
 | 
										InUseList.Add(copyrof);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					lboxInUseCB.Items.Add(copyrof.GetFieldname);
 | 
										lboxInUseCB.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
 | 
				
			||||||
					AvailList.RemoveAt(indx);
 | 
										AvailList.RemoveAt(indx);
 | 
				
			||||||
					lboxAvail.Refresh();
 | 
										lboxAvail.Refresh();
 | 
				
			||||||
					lboxInUseCB.Refresh();
 | 
										lboxInUseCB.Refresh();
 | 
				
			||||||
@@ -577,7 +577,7 @@ namespace ROEditor
 | 
				
			|||||||
					ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
										ROField copyrof = new ROField(rof.GetFieldname, rof.GetRecID, rof.GetMasterRecID, rof.GetFieldType);
 | 
				
			||||||
					InUseList.Add(copyrof);
 | 
										InUseList.Add(copyrof);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					lboxInUse.Items.Add(copyrof.GetFieldname);
 | 
										lboxInUse.Items.Add(CvtFldToUserFld(copyrof.GetFieldname));
 | 
				
			||||||
					AvailList.RemoveAt(indx);
 | 
										AvailList.RemoveAt(indx);
 | 
				
			||||||
					lboxAvail.Refresh();
 | 
										lboxAvail.Refresh();
 | 
				
			||||||
					lboxInUse.Refresh();
 | 
										lboxInUse.Refresh();
 | 
				
			||||||
@@ -740,7 +740,7 @@ namespace ROEditor
 | 
				
			|||||||
							{
 | 
												{
 | 
				
			||||||
								ROField rof = (ROField) InUseList[i];
 | 
													ROField rof = (ROField) InUseList[i];
 | 
				
			||||||
								rofname = rof.GetFieldname;
 | 
													rofname = rof.GetFieldname;
 | 
				
			||||||
								if (inusename == rofname)
 | 
													if (inusename == rofname || inusename == CvtFldToUserFld(rofname))
 | 
				
			||||||
								{
 | 
													{
 | 
				
			||||||
									found = true;
 | 
														found = true;
 | 
				
			||||||
									break;
 | 
														break;
 | 
				
			||||||
@@ -845,7 +845,7 @@ namespace ROEditor
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
					ROField rof = (ROField) InUseList[i];
 | 
										ROField rof = (ROField) InUseList[i];
 | 
				
			||||||
					rofname = rof.GetFieldname;
 | 
										rofname = rof.GetFieldname;
 | 
				
			||||||
					if (inusename == rofname)
 | 
										if (inusename == rofname || inusename == CvtFldToUserFld(rofname))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						found = true;
 | 
											found = true;
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
@@ -1197,6 +1197,7 @@ namespace ROEditor
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								string origname = CvtFldToUserFld(rof.GetFieldname);
 | 
				
			||||||
			uint ftype = rof.GetFieldType;
 | 
								uint ftype = rof.GetFieldType;
 | 
				
			||||||
			if (ftype == (uint)FieldTypes.FrmtSingleTxt || ftype == (uint)FieldTypes.VariableTxt ||
 | 
								if (ftype == (uint)FieldTypes.FrmtSingleTxt || ftype == (uint)FieldTypes.VariableTxt ||
 | 
				
			||||||
				ftype == (uint)FieldTypes.SingleTxt || ftype == (uint)FieldTypes.Table || 
 | 
									ftype == (uint)FieldTypes.SingleTxt || ftype == (uint)FieldTypes.Table || 
 | 
				
			||||||
@@ -1212,6 +1213,10 @@ namespace ROEditor
 | 
				
			|||||||
				nwcomb.ShowDialog();
 | 
									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.
 | 
								// Update Lists & Text boxes to represent any modified text.
 | 
				
			||||||
			if (isInSelList)
 | 
								if (isInSelList)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -1225,20 +1230,28 @@ namespace ROEditor
 | 
				
			|||||||
					rof = (ROField) InUseList[i];
 | 
										rof = (ROField) InUseList[i];
 | 
				
			||||||
					if (rof.GetFieldname != null)
 | 
										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
 | 
											// 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)
 | 
											if (PCApplicabilityEnabled)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							this.lboxInUseCB.Items.Add(rof.GetFieldname);
 | 
												this.lboxInUseCB.Items.Add(fieldname);
 | 
				
			||||||
							if (rof.FieldTypeCanDoApplicability())
 | 
												if (rof.FieldTypeCanDoApplicability())
 | 
				
			||||||
							{
 | 
												{
 | 
				
			||||||
								if (ContainedInUseApplicList(rof))
 | 
													if (ContainedInUseApplicList(rof))
 | 
				
			||||||
									this.lboxInUseCB.SetItemCheckState(lboxInUseCB.Items.IndexOf(rof.GetFieldname), CheckState.Checked);
 | 
														this.lboxInUseCB.SetItemCheckState(lboxInUseCB.Items.IndexOf(fieldname), CheckState.Checked);
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						else
 | 
											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 
 | 
								else 
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -1248,7 +1261,7 @@ namespace ROEditor
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
					rof = (ROField) AvailList[i];
 | 
										rof = (ROField) AvailList[i];
 | 
				
			||||||
					if (rof.GetFieldname != null)
 | 
										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)
 | 
								if (rof.GetFieldname != null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				AvailList.Add(rof);
 | 
									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
 | 
							// C2021-026 Check/un-check field for Parent/Child values
 | 
				
			||||||
		private void lboxInUseCB_ItemCheck(object sender, ItemCheckEventArgs e)
 | 
							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.Size = new System.Drawing.Size(80, 24);
 | 
				
			||||||
			this.btnCancel.TabIndex = 10;
 | 
								this.btnCancel.TabIndex = 10;
 | 
				
			||||||
			this.btnCancel.Text = "Cancel";
 | 
								this.btnCancel.Text = "Cancel";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// 
 | 
								// 
 | 
				
			||||||
			// RODefFrm
 | 
								// RODefFrm
 | 
				
			||||||
			// 
 | 
								// 
 | 
				
			||||||
@@ -1519,6 +1536,28 @@ namespace ROEditor
 | 
				
			|||||||
			this.PerformLayout();
 | 
								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
 | 
							#endregion
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -339,7 +339,7 @@ namespace RODBInterface
 | 
				
			|||||||
		public abstract bool RODB_WriteRO(VlnXmlElement ro);
 | 
							public abstract bool RODB_WriteRO(VlnXmlElement ro);
 | 
				
			||||||
		public abstract bool RODB_InsertRO(VlnXmlElement ro);
 | 
							public abstract bool RODB_InsertRO(VlnXmlElement ro);
 | 
				
			||||||
		public abstract ushort RODB_GetFieldType(VlnXmlElement elem, string TableName, string Fld);
 | 
							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 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_NewSchemaPiece(string recid, string parentid, string table, string schpiece, uint rtype);
 | 
				
			||||||
		public abstract bool RODB_WriteSchemaPiece(string Recid, string table, string schpiece);
 | 
							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.
 | 
							// 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");
 | 
								string table = elem.GetAttribute("Table");
 | 
				
			||||||
			if (!FieldDefinitions.ContainsKey(table))
 | 
								if (!FieldDefinitions.ContainsKey(table))
 | 
				
			||||||
				FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
 | 
									FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
 | 
				
			||||||
 | 
								else if (refresh)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									FieldDefinitions.Remove(table);
 | 
				
			||||||
 | 
									FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			return FieldDefinitions[table];
 | 
								return FieldDefinitions[table];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		private Dictionary<string, ArrayList> _FieldDefinitions = null;
 | 
							private Dictionary<string, ArrayList> _FieldDefinitions = null;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1744,13 +1744,18 @@ namespace RODBInterface
 | 
				
			|||||||
			return ftype;
 | 
								return ftype;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// For the given element's table, get all of the RO fields defined in this table.
 | 
							// 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");
 | 
								string table = elem.GetAttribute("Table");
 | 
				
			||||||
			if (!FieldDefinitions.ContainsKey(table))
 | 
								if (!FieldDefinitions.ContainsKey(table))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
 | 
									FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								else if (refresh)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									FieldDefinitions.Remove(table);
 | 
				
			||||||
 | 
									FieldDefinitions.Add(table, RODB_GetFieldsFromDB(elem));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			return FieldDefinitions[table];
 | 
								return FieldDefinitions[table];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		private Dictionary<string, ArrayList> _FieldDefinitions = null;
 | 
							private Dictionary<string, ArrayList> _FieldDefinitions = null;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,7 @@ namespace VlnStatus
 | 
				
			|||||||
			this.lblStatMsg.Name = "lblStatMsg";
 | 
								this.lblStatMsg.Name = "lblStatMsg";
 | 
				
			||||||
			this.lblStatMsg.Size = new System.Drawing.Size(420, 81);
 | 
								this.lblStatMsg.Size = new System.Drawing.Size(420, 81);
 | 
				
			||||||
			this.lblStatMsg.TabIndex = 0;
 | 
								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;
 | 
								this.lblStatMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
 | 
				
			||||||
			// 
 | 
								// 
 | 
				
			||||||
			// StatusMessageFrm
 | 
								// StatusMessageFrm
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user