R
reigh7
Guest
-I'm having trouble I'm following a standard set of instructions to make a list box mover and the ".SelectedItem” keeps causing exception errors because it is saying lab panel name is required as if it's not already selected. Sometimes this will pop up a window to type in a name of row in the table this however seems to only solve that one validation issue.
-Additionally it seems to have created two rows for the one panel I'm working on for saving to this many to many table as there is still only one entry on the full list of the lab panels table but now when selecting a lab panel there are two one with some of the Lab parts already added and one with none saved to it. I will not want there to be possible duplicate Lab Panels in the end only one unique per Lab Panel Name.
-Then the two values I'm trying to associate many to many with the row of the selected table also say the referenced Lab Panel is either not set or no longer exists. That being the one that is selected and starts that way on that screen as the lab panel is selected first.
partial void AddLabPart_Execute()
{
// Write your code here.
//LabPart is a collection shown in the list for this List control values are from the LabPart Table
//Code refers to the item in the list selected using the list control
if (LabPart.SelectedItem != null)
{
//LabPanelAssembledPart is the table entity for the many to many relationship between LabPanel and Labpart tables
//This tests to see if the assembled Panel has been created before to hold associated Lab Parts
LabPanelAssembledPart lpExists = new LabPanelAssembledPart();
//then a loop searches the mapping/linking table for items displayed on the screen named LabPanelAssembledParts(LabPanelAssembledParts1)
//the loop goes through to figure out the Lab Parts Names to include in the current list control for the the assembled Panel
//this property LabPart.LabPanelFullName is the name given to a primary value of Lab Parts in refernt to the full name not abreviation
//the full name is a required field of the Lab Parts table and is also used as the summary property for the Linking many to many table
foreach (LabPanelAssembledPart lpSearch in this.LabPanelAssembledParts1)
{
if (lpSearch.LabPart.LabPartFullName == this.LabPart.SelectedItem.LabPartFullName)
{
lpExists = lpSearch;
}
}
//After the existstance of the parts is determined already and if it does not yet exist it is added to the many to many linking table
//The selected Lap Part on the right will be added and displayed on the list control for that entity on the Left which is set to this Panel Selected above
if (lpExists == null || lpExists.LabPart == null)
{
LabPanelAssembledPart lpap = LabPanelAssembledParts1.AddNew();
lpap.LabPanel = this.LabPanelProperty;
lpap.LabPart = LabPart.SelectedItem;
}
//If the selected Lab Part already exists and the user trys to add it to the entity this message will pop up instead
else
{
ScreenExtensions.ShowMessageBox(this, LabPart.SelectedItem.LabPartFullName + " (" + LabPart.SelectedItem.LabPartAbbreviation + ") Lab Part already added to this Lab Panel.");
}
}
}
partial void RemoveLabPart_Execute()
{
// Write your code here.
if (LabPart.SelectedItem != null)
{
LabPanelAssembledParts1.RemoveSelected();
}
else
{
ScreenExtensions.ShowMessageBox(this, "No Lab Parts left to 'Delete'.");
}
}
Summary Property in another table to show the Lab Part Name once it's been added before it's been saved visually on the List Box Mover Screen.
partial void PanelParts_Compute(ref string result)
{
//Ok we have a table with a table field that is detectign null values Labpart is the Table and LabPartFullName is the field
//if (Order != null && Order.OrderNotes == null)
/*{
do.something...
}*/
//below is the code causing the exception becsause of the null value
//what do.somethng can we do for null values so we are not adding data entry errors into the field?
result = LabPart.LabPartFullName ?? "None Listed";
//code to handle null values but there should be none due to it being a required field or even a primary key
}
Continue reading...
-Additionally it seems to have created two rows for the one panel I'm working on for saving to this many to many table as there is still only one entry on the full list of the lab panels table but now when selecting a lab panel there are two one with some of the Lab parts already added and one with none saved to it. I will not want there to be possible duplicate Lab Panels in the end only one unique per Lab Panel Name.
-Then the two values I'm trying to associate many to many with the row of the selected table also say the referenced Lab Panel is either not set or no longer exists. That being the one that is selected and starts that way on that screen as the lab panel is selected first.
partial void AddLabPart_Execute()
{
// Write your code here.
//LabPart is a collection shown in the list for this List control values are from the LabPart Table
//Code refers to the item in the list selected using the list control
if (LabPart.SelectedItem != null)
{
//LabPanelAssembledPart is the table entity for the many to many relationship between LabPanel and Labpart tables
//This tests to see if the assembled Panel has been created before to hold associated Lab Parts
LabPanelAssembledPart lpExists = new LabPanelAssembledPart();
//then a loop searches the mapping/linking table for items displayed on the screen named LabPanelAssembledParts(LabPanelAssembledParts1)
//the loop goes through to figure out the Lab Parts Names to include in the current list control for the the assembled Panel
//this property LabPart.LabPanelFullName is the name given to a primary value of Lab Parts in refernt to the full name not abreviation
//the full name is a required field of the Lab Parts table and is also used as the summary property for the Linking many to many table
foreach (LabPanelAssembledPart lpSearch in this.LabPanelAssembledParts1)
{
if (lpSearch.LabPart.LabPartFullName == this.LabPart.SelectedItem.LabPartFullName)
{
lpExists = lpSearch;
}
}
//After the existstance of the parts is determined already and if it does not yet exist it is added to the many to many linking table
//The selected Lap Part on the right will be added and displayed on the list control for that entity on the Left which is set to this Panel Selected above
if (lpExists == null || lpExists.LabPart == null)
{
LabPanelAssembledPart lpap = LabPanelAssembledParts1.AddNew();
lpap.LabPanel = this.LabPanelProperty;
lpap.LabPart = LabPart.SelectedItem;
}
//If the selected Lab Part already exists and the user trys to add it to the entity this message will pop up instead
else
{
ScreenExtensions.ShowMessageBox(this, LabPart.SelectedItem.LabPartFullName + " (" + LabPart.SelectedItem.LabPartAbbreviation + ") Lab Part already added to this Lab Panel.");
}
}
}
partial void RemoveLabPart_Execute()
{
// Write your code here.
if (LabPart.SelectedItem != null)
{
LabPanelAssembledParts1.RemoveSelected();
}
else
{
ScreenExtensions.ShowMessageBox(this, "No Lab Parts left to 'Delete'.");
}
}
Summary Property in another table to show the Lab Part Name once it's been added before it's been saved visually on the List Box Mover Screen.
partial void PanelParts_Compute(ref string result)
{
//Ok we have a table with a table field that is detectign null values Labpart is the Table and LabPartFullName is the field
//if (Order != null && Order.OrderNotes == null)
/*{
do.something...
}*/
//below is the code causing the exception becsause of the null value
//what do.somethng can we do for null values so we are not adding data entry errors into the field?
result = LabPart.LabPartFullName ?? "None Listed";
//code to handle null values but there should be none due to it being a required field or even a primary key
}
Continue reading...