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
+37 -26
View File
@@ -42,7 +42,7 @@ namespace InventoryTest
this.SubCategorySelectionComboBox = new System.Windows.Forms.ComboBox();
this.CategorySelectionComboBox = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ItemListView = new System.Windows.Forms.ListView();
this.ItemTreeView = new System.Windows.Forms.TreeView();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.CorePropertySoldToTextBox = new System.Windows.Forms.TextBox();
this.CorePropertyDateSoldDateTimePicker = new System.Windows.Forms.DateTimePicker();
@@ -63,6 +63,7 @@ namespace InventoryTest
this.CorePropertyCommentTextBox = new System.Windows.Forms.TextBox();
this.CorePropertyNotesGroupBox = new System.Windows.Forms.GroupBox();
this.CorePropertyNotesTextBox = new System.Windows.Forms.TextBox();
this.PropertiesFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.MainLayoutPanel.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -85,6 +86,7 @@ namespace InventoryTest
this.MainLayoutPanel.Controls.Add(this.groupBox3, 0, 3);
this.MainLayoutPanel.Controls.Add(this.CorePropertyCommentGroupBox, 1, 3);
this.MainLayoutPanel.Controls.Add(this.CorePropertyNotesGroupBox, 1, 4);
this.MainLayoutPanel.Controls.Add(this.PropertiesFlowLayoutPanel, 2, 1);
this.MainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.MainLayoutPanel.Name = "MainLayoutPanel";
@@ -200,7 +202,7 @@ namespace InventoryTest
//
// groupBox2
//
this.groupBox2.Controls.Add(this.ItemListView);
this.groupBox2.Controls.Add(this.ItemTreeView);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(3, 176);
this.groupBox2.Name = "groupBox2";
@@ -209,15 +211,13 @@ namespace InventoryTest
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Items:";
//
// ItemListView
// ItemTreeView
//
this.ItemListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.ItemListView.HideSelection = false;
this.ItemListView.Location = new System.Drawing.Point(3, 19);
this.ItemListView.Name = "ItemListView";
this.ItemListView.Size = new System.Drawing.Size(310, 120);
this.ItemListView.TabIndex = 0;
this.ItemListView.UseCompatibleStateImageBehavior = false;
this.ItemTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.ItemTreeView.Location = new System.Drawing.Point(3, 19);
this.ItemTreeView.Name = "ItemTreeView";
this.ItemTreeView.Size = new System.Drawing.Size(310, 120);
this.ItemTreeView.TabIndex = 0;
//
// groupBox3
//
@@ -247,42 +247,42 @@ namespace InventoryTest
//
// CorePropertySoldToTextBox
//
this.CorePropertySoldToTextBox.Location = new System.Drawing.Point(94, 209);
this.CorePropertySoldToTextBox.Location = new System.Drawing.Point(94, 239);
this.CorePropertySoldToTextBox.Name = "CorePropertySoldToTextBox";
this.CorePropertySoldToTextBox.Size = new System.Drawing.Size(216, 23);
this.CorePropertySoldToTextBox.TabIndex = 14;
//
// CorePropertyDateSoldDateTimePicker
//
this.CorePropertyDateSoldDateTimePicker.Location = new System.Drawing.Point(94, 179);
this.CorePropertyDateSoldDateTimePicker.Location = new System.Drawing.Point(94, 209);
this.CorePropertyDateSoldDateTimePicker.Name = "CorePropertyDateSoldDateTimePicker";
this.CorePropertyDateSoldDateTimePicker.Size = new System.Drawing.Size(216, 23);
this.CorePropertyDateSoldDateTimePicker.TabIndex = 13;
//
// CorePropertySoldForTextBox
//
this.CorePropertySoldForTextBox.Location = new System.Drawing.Point(94, 124);
this.CorePropertySoldForTextBox.Location = new System.Drawing.Point(94, 154);
this.CorePropertySoldForTextBox.Name = "CorePropertySoldForTextBox";
this.CorePropertySoldForTextBox.Size = new System.Drawing.Size(216, 23);
this.CorePropertySoldForTextBox.TabIndex = 12;
//
// CorePropertyDateAquiredDateTimePicker
//
this.CorePropertyDateAquiredDateTimePicker.Location = new System.Drawing.Point(94, 97);
this.CorePropertyDateAquiredDateTimePicker.Location = new System.Drawing.Point(94, 127);
this.CorePropertyDateAquiredDateTimePicker.Name = "CorePropertyDateAquiredDateTimePicker";
this.CorePropertyDateAquiredDateTimePicker.Size = new System.Drawing.Size(216, 23);
this.CorePropertyDateAquiredDateTimePicker.TabIndex = 11;
//
// CorePropertyBoughtForTextBox
//
this.CorePropertyBoughtForTextBox.Location = new System.Drawing.Point(94, 70);
this.CorePropertyBoughtForTextBox.Location = new System.Drawing.Point(94, 100);
this.CorePropertyBoughtForTextBox.Name = "CorePropertyBoughtForTextBox";
this.CorePropertyBoughtForTextBox.Size = new System.Drawing.Size(216, 23);
this.CorePropertyBoughtForTextBox.TabIndex = 10;
//
// CorePropertyValueTextBox
//
this.CorePropertyValueTextBox.Location = new System.Drawing.Point(94, 43);
this.CorePropertyValueTextBox.Location = new System.Drawing.Point(94, 73);
this.CorePropertyValueTextBox.Name = "CorePropertyValueTextBox";
this.CorePropertyValueTextBox.Size = new System.Drawing.Size(216, 23);
this.CorePropertyValueTextBox.TabIndex = 9;
@@ -290,7 +290,7 @@ namespace InventoryTest
// CorePropertyNameTextBox
//
this.CorePropertyNameTextBox.Enabled = false;
this.CorePropertyNameTextBox.Location = new System.Drawing.Point(94, 16);
this.CorePropertyNameTextBox.Location = new System.Drawing.Point(94, 46);
this.CorePropertyNameTextBox.Name = "CorePropertyNameTextBox";
this.CorePropertyNameTextBox.Size = new System.Drawing.Size(216, 23);
this.CorePropertyNameTextBox.TabIndex = 8;
@@ -298,7 +298,7 @@ namespace InventoryTest
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 212);
this.label9.Location = new System.Drawing.Point(6, 242);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(48, 15);
this.label9.TabIndex = 7;
@@ -307,7 +307,7 @@ namespace InventoryTest
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 185);
this.label8.Location = new System.Drawing.Point(6, 215);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(60, 15);
this.label8.TabIndex = 6;
@@ -316,7 +316,7 @@ namespace InventoryTest
// CorePropertySoldCheckBox
//
this.CorePropertySoldCheckBox.AutoSize = true;
this.CorePropertySoldCheckBox.Location = new System.Drawing.Point(6, 154);
this.CorePropertySoldCheckBox.Location = new System.Drawing.Point(6, 184);
this.CorePropertySoldCheckBox.Name = "CorePropertySoldCheckBox";
this.CorePropertySoldCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.CorePropertySoldCheckBox.Size = new System.Drawing.Size(54, 19);
@@ -327,7 +327,7 @@ namespace InventoryTest
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 127);
this.label7.Location = new System.Drawing.Point(6, 157);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(53, 15);
this.label7.TabIndex = 4;
@@ -336,7 +336,7 @@ namespace InventoryTest
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 100);
this.label6.Location = new System.Drawing.Point(6, 130);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(79, 15);
this.label6.TabIndex = 3;
@@ -345,7 +345,7 @@ namespace InventoryTest
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 73);
this.label5.Location = new System.Drawing.Point(6, 103);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(69, 15);
this.label5.TabIndex = 2;
@@ -354,7 +354,7 @@ namespace InventoryTest
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 46);
this.label4.Location = new System.Drawing.Point(6, 76);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(38, 15);
this.label4.TabIndex = 1;
@@ -363,7 +363,7 @@ namespace InventoryTest
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 19);
this.label3.Location = new System.Drawing.Point(3, 49);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(42, 15);
this.label3.TabIndex = 0;
@@ -411,6 +411,16 @@ namespace InventoryTest
this.CorePropertyNotesTextBox.Size = new System.Drawing.Size(310, 121);
this.CorePropertyNotesTextBox.TabIndex = 0;
//
// PropertiesFlowLayoutPanel
//
this.MainLayoutPanel.SetColumnSpan(this.PropertiesFlowLayoutPanel, 2);
this.PropertiesFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.PropertiesFlowLayoutPanel.Location = new System.Drawing.Point(647, 28);
this.PropertiesFlowLayoutPanel.Name = "PropertiesFlowLayoutPanel";
this.MainLayoutPanel.SetRowSpan(this.PropertiesFlowLayoutPanel, 3);
this.PropertiesFlowLayoutPanel.Size = new System.Drawing.Size(639, 438);
this.PropertiesFlowLayoutPanel.TabIndex = 6;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -451,7 +461,6 @@ namespace InventoryTest
private System.Windows.Forms.ComboBox SubCategorySelectionComboBox;
private System.Windows.Forms.ComboBox CategorySelectionComboBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListView ItemListView;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
@@ -473,6 +482,8 @@ namespace InventoryTest
private System.Windows.Forms.TextBox CorePropertyCommentTextBox;
private System.Windows.Forms.TextBox CorePropertyNotesTextBox;
private System.Windows.Forms.Button CreateItemButton;
private System.Windows.Forms.TreeView ItemTreeView;
private System.Windows.Forms.FlowLayoutPanel PropertiesFlowLayoutPanel;
}
}
+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()