A crude way for the main form to display the properties a category and sub category have has been implemented.

This commit is contained in:
2021-04-20 19:06:49 -05:00
parent dd0594211f
commit 262dfb8735
4 changed files with 63 additions and 26 deletions
+26
View File
@@ -46,12 +46,25 @@ namespace InventoryTest
private void SubCategorySelectionComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
//throw new NotImplementedException();
using var connection = new SqlConnection(ConnectionString);
using var command = new SqlCommand("SELECT [Name], [Property ID], [Sub Category Property ID], [Property Type ID], [Property Type] FROM dbo.GetSubCategoryProperties(@ID)", connection);
command.Parameters.AddWithValue("ID", SubCategoryIds[SubCategorySelectionComboBox.Text]);
connection.Open();
var reader = command.ExecuteReader();
while (reader.Read())
{
PropertiesFlowLayoutPanel.Controls.Add(new Label() { Text = reader["Name"].ToString() + ":" });
PropertiesFlowLayoutPanel.Controls.Add(new TextBox() { Name = reader["Property ID"].ToString() });
}
}
private void CategorySelectionComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SubCategoryIds.Clear();
SubCategorySelectionComboBox.Items.Clear();
ItemTreeView.Nodes.Clear();
PropertiesFlowLayoutPanel.Controls.Clear();
using var connection = new SqlConnection(ConnectionString);
using var command = new SqlCommand("SELECT ID, Name FROM dbo.GetCategorySubCategories(@ID)", connection);
@@ -73,6 +86,19 @@ namespace InventoryTest
SubCategorySelectionComboBox.SelectedIndex = 0;
}
else SubCategorySelectionComboBox.Enabled = false;
reader.Close();
command.CommandText = "SELECT [Name], [Property ID], [Category Property ID], [Property Type ID], [Property Type] FROM dbo.GetCategoryProperties(@ID)";
command.CommandType = CommandType.Text;
reader = command.ExecuteReader();
while (reader.Read())
{
PropertiesFlowLayoutPanel.Controls.Add(new Label() { Text = reader["Name"].ToString() + ":"});
PropertiesFlowLayoutPanel.Controls.Add(new TextBox() { Name = reader["Property ID"].ToString() });
}
}
private void LoadCategories()