commit ba556e7339be7b4b7860d75ea977530228366078 Author: Garritt McCune Date: Sat Apr 10 20:22:54 2021 -0500 Created a form to manage categories and sub-categories along with their properties. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..149ff35 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +InventoryTest/obj +InventoryTest/bin \ No newline at end of file diff --git a/.vs/InventoryTest/DesignTimeBuild/.dtbcache.v2 b/.vs/InventoryTest/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..1aaf4e1 Binary files /dev/null and b/.vs/InventoryTest/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/InventoryTest/v16/.suo b/.vs/InventoryTest/v16/.suo new file mode 100644 index 0000000..d224bc0 Binary files /dev/null and b/.vs/InventoryTest/v16/.suo differ diff --git a/InventoryTest.sln b/InventoryTest.sln new file mode 100644 index 0000000..072489c --- /dev/null +++ b/InventoryTest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31105.61 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InventoryTest", "InventoryTest\InventoryTest.csproj", "{7FE675C0-8B37-40E6-B92E-BCB3509B76C3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7FE675C0-8B37-40E6-B92E-BCB3509B76C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FE675C0-8B37-40E6-B92E-BCB3509B76C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FE675C0-8B37-40E6-B92E-BCB3509B76C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FE675C0-8B37-40E6-B92E-BCB3509B76C3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CFC7AB1F-DCCC-4259-A9E0-908089DBC008} + EndGlobalSection +EndGlobal diff --git a/InventoryTest/CategoryManager.Designer.cs b/InventoryTest/CategoryManager.Designer.cs new file mode 100644 index 0000000..f73cd7c --- /dev/null +++ b/InventoryTest/CategoryManager.Designer.cs @@ -0,0 +1,475 @@ + +namespace InventoryTest +{ + partial class CategoryManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.MainLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.SubCategoryComboBox = new System.Windows.Forms.ComboBox(); + this.CategoryComboBox = new System.Windows.Forms.ComboBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.CreateNewSubCategoryButton = new System.Windows.Forms.Button(); + this.CreateNewCategoryButton = new System.Windows.Forms.Button(); + this.NewCategoryNameTextBox = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.CreateSubCategoryButton = new System.Windows.Forms.Button(); + this.SubCategoryPropertyNameTextBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.SubCategoryPropertiesListBox = new System.Windows.Forms.ListBox(); + this.menuStrip2 = new System.Windows.Forms.MenuStrip(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.DeleteSubCategoryButton = new System.Windows.Forms.Button(); + this.DeleteCategoryButton = new System.Windows.Forms.Button(); + this.SubCategoryComboBoxManager = new System.Windows.Forms.ComboBox(); + this.CategoryComboBoxManager = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.CategoryPropertiesListBox = new System.Windows.Forms.ListBox(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.CategoryPropertyNameTextBox = new System.Windows.Forms.TextBox(); + this.CreateCategoryPropertyButton = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox8 = new System.Windows.Forms.GroupBox(); + this.MainLayoutPanel.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.groupBox7.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.SuspendLayout(); + // + // MainLayoutPanel + // + this.MainLayoutPanel.ColumnCount = 3; + this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34F)); + this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.MainLayoutPanel.Controls.Add(this.menuStrip1, 0, 0); + this.MainLayoutPanel.Location = new System.Drawing.Point(0, 0); + this.MainLayoutPanel.Name = "MainLayoutPanel"; + this.MainLayoutPanel.RowCount = 1; + this.MainLayoutPanel.Size = new System.Drawing.Size(200, 100); + this.MainLayoutPanel.TabIndex = 0; + // + // menuStrip1 + // + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(66, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.SubCategoryComboBox); + this.groupBox1.Controls.Add(this.CategoryComboBox); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.Location = new System.Drawing.Point(267, 28); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(266, 134); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Category Selection"; + // + // SubCategoryComboBox + // + this.SubCategoryComboBox.Location = new System.Drawing.Point(0, 0); + this.SubCategoryComboBox.Name = "SubCategoryComboBox"; + this.SubCategoryComboBox.Size = new System.Drawing.Size(121, 23); + this.SubCategoryComboBox.TabIndex = 0; + // + // CategoryComboBox + // + this.CategoryComboBox.Location = new System.Drawing.Point(0, 0); + this.CategoryComboBox.Name = "CategoryComboBox"; + this.CategoryComboBox.Size = new System.Drawing.Size(121, 23); + this.CategoryComboBox.TabIndex = 1; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel1.Controls.Add(this.groupBox7, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.groupBox6, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.groupBox4, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.menuStrip2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.groupBox2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.groupBox3, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.groupBox5, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.groupBox8, 0, 3); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); + this.tableLayoutPanel1.TabIndex = 1; + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.CreateNewSubCategoryButton); + this.groupBox7.Controls.Add(this.CreateNewCategoryButton); + this.groupBox7.Controls.Add(this.NewCategoryNameTextBox); + this.groupBox7.Controls.Add(this.label5); + this.groupBox7.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox7.Location = new System.Drawing.Point(3, 168); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(258, 138); + this.groupBox7.TabIndex = 6; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "Category / Sub-Category Management"; + // + // CreateNewSubCategoryButton + // + this.CreateNewSubCategoryButton.Enabled = false; + this.CreateNewSubCategoryButton.Location = new System.Drawing.Point(121, 109); + this.CreateNewSubCategoryButton.Name = "CreateNewSubCategoryButton"; + this.CreateNewSubCategoryButton.Size = new System.Drawing.Size(131, 23); + this.CreateNewSubCategoryButton.TabIndex = 3; + this.CreateNewSubCategoryButton.Text = "Add as Sub-category"; + this.CreateNewSubCategoryButton.UseVisualStyleBackColor = true; + this.CreateNewSubCategoryButton.Click += new System.EventHandler(this.CreateNewSubCategoryButton_Click); + // + // CreateNewCategoryButton + // + this.CreateNewCategoryButton.Enabled = false; + this.CreateNewCategoryButton.Location = new System.Drawing.Point(9, 109); + this.CreateNewCategoryButton.Name = "CreateNewCategoryButton"; + this.CreateNewCategoryButton.Size = new System.Drawing.Size(106, 23); + this.CreateNewCategoryButton.TabIndex = 2; + this.CreateNewCategoryButton.Text = "Add as Category"; + this.CreateNewCategoryButton.UseVisualStyleBackColor = true; + this.CreateNewCategoryButton.Click += new System.EventHandler(this.CreateNewCategoryButton_Click); + // + // NewCategoryNameTextBox + // + this.NewCategoryNameTextBox.Location = new System.Drawing.Point(9, 37); + this.NewCategoryNameTextBox.Name = "NewCategoryNameTextBox"; + this.NewCategoryNameTextBox.Size = new System.Drawing.Size(243, 23); + this.NewCategoryNameTextBox.TabIndex = 1; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(9, 19); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(124, 15); + this.label5.TabIndex = 0; + this.label5.Text = "(Sub) Category Name:"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.CreateSubCategoryButton); + this.groupBox6.Controls.Add(this.SubCategoryPropertyNameTextBox); + this.groupBox6.Controls.Add(this.label4); + this.groupBox6.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox6.Location = new System.Drawing.Point(267, 168); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(266, 138); + this.groupBox6.TabIndex = 5; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Sub-Category Property"; + // + // CreateSubCategoryButton + // + this.CreateSubCategoryButton.Enabled = false; + this.CreateSubCategoryButton.Location = new System.Drawing.Point(185, 109); + this.CreateSubCategoryButton.Name = "CreateSubCategoryButton"; + this.CreateSubCategoryButton.Size = new System.Drawing.Size(75, 23); + this.CreateSubCategoryButton.TabIndex = 2; + this.CreateSubCategoryButton.Text = "Add"; + this.CreateSubCategoryButton.UseVisualStyleBackColor = true; + this.CreateSubCategoryButton.Click += new System.EventHandler(this.CreateSubCategoryButton_Click); + // + // SubCategoryPropertyNameTextBox + // + this.SubCategoryPropertyNameTextBox.Location = new System.Drawing.Point(6, 37); + this.SubCategoryPropertyNameTextBox.Name = "SubCategoryPropertyNameTextBox"; + this.SubCategoryPropertyNameTextBox.Size = new System.Drawing.Size(254, 23); + this.SubCategoryPropertyNameTextBox.TabIndex = 1; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 19); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(90, 15); + this.label4.TabIndex = 0; + this.label4.Text = "Property Name:"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.SubCategoryPropertiesListBox); + this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox4.Location = new System.Drawing.Point(539, 168); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(258, 138); + this.groupBox4.TabIndex = 3; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Sub-Category Properties"; + // + // SubCategoryPropertiesListBox + // + this.SubCategoryPropertiesListBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.SubCategoryPropertiesListBox.FormattingEnabled = true; + this.SubCategoryPropertiesListBox.HorizontalScrollbar = true; + this.SubCategoryPropertiesListBox.ItemHeight = 15; + this.SubCategoryPropertiesListBox.Location = new System.Drawing.Point(3, 19); + this.SubCategoryPropertiesListBox.Name = "SubCategoryPropertiesListBox"; + this.SubCategoryPropertiesListBox.Size = new System.Drawing.Size(252, 116); + this.SubCategoryPropertiesListBox.TabIndex = 1; + // + // menuStrip2 + // + this.menuStrip2.Location = new System.Drawing.Point(0, 0); + this.menuStrip2.Name = "menuStrip2"; + this.menuStrip2.Size = new System.Drawing.Size(264, 24); + this.menuStrip2.TabIndex = 0; + this.menuStrip2.Text = "menuStrip2"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.DeleteSubCategoryButton); + this.groupBox2.Controls.Add(this.DeleteCategoryButton); + this.groupBox2.Controls.Add(this.SubCategoryComboBoxManager); + this.groupBox2.Controls.Add(this.CategoryComboBoxManager); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox2.Location = new System.Drawing.Point(3, 28); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(258, 134); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Category Selection"; + // + // DeleteSubCategoryButton + // + this.DeleteSubCategoryButton.Location = new System.Drawing.Point(121, 105); + this.DeleteSubCategoryButton.Name = "DeleteSubCategoryButton"; + this.DeleteSubCategoryButton.Size = new System.Drawing.Size(131, 23); + this.DeleteSubCategoryButton.TabIndex = 3; + this.DeleteSubCategoryButton.Text = "Delete Sub-Category"; + this.DeleteSubCategoryButton.UseVisualStyleBackColor = true; + this.DeleteSubCategoryButton.Click += new System.EventHandler(this.DeleteSubCategoryButton_Click); + // + // DeleteCategoryButton + // + this.DeleteCategoryButton.Location = new System.Drawing.Point(9, 105); + this.DeleteCategoryButton.Name = "DeleteCategoryButton"; + this.DeleteCategoryButton.Size = new System.Drawing.Size(106, 23); + this.DeleteCategoryButton.TabIndex = 0; + this.DeleteCategoryButton.Text = "Delete Category"; + this.DeleteCategoryButton.UseVisualStyleBackColor = true; + this.DeleteCategoryButton.Click += new System.EventHandler(this.DeleteCategoryButton_Click); + // + // SubCategoryComboBoxManager + // + this.SubCategoryComboBoxManager.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.SubCategoryComboBoxManager.FormattingEnabled = true; + this.SubCategoryComboBoxManager.Location = new System.Drawing.Point(91, 54); + this.SubCategoryComboBoxManager.Name = "SubCategoryComboBoxManager"; + this.SubCategoryComboBoxManager.Size = new System.Drawing.Size(161, 23); + this.SubCategoryComboBoxManager.TabIndex = 2; + // + // CategoryComboBoxManager + // + this.CategoryComboBoxManager.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CategoryComboBoxManager.FormattingEnabled = true; + this.CategoryComboBoxManager.Location = new System.Drawing.Point(91, 20); + this.CategoryComboBoxManager.Name = "CategoryComboBoxManager"; + this.CategoryComboBoxManager.Size = new System.Drawing.Size(161, 23); + this.CategoryComboBoxManager.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 57); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(83, 15); + this.label2.TabIndex = 1; + this.label2.Text = "Sub-Category:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(7, 23); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 15); + this.label1.TabIndex = 0; + this.label1.Text = "Category:"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.CategoryPropertiesListBox); + this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox3.Location = new System.Drawing.Point(539, 28); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(258, 134); + this.groupBox3.TabIndex = 2; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Category Properties"; + // + // CategoryPropertiesListBox + // + this.CategoryPropertiesListBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.CategoryPropertiesListBox.FormattingEnabled = true; + this.CategoryPropertiesListBox.HorizontalScrollbar = true; + this.CategoryPropertiesListBox.ItemHeight = 15; + this.CategoryPropertiesListBox.Location = new System.Drawing.Point(3, 19); + this.CategoryPropertiesListBox.Name = "CategoryPropertiesListBox"; + this.CategoryPropertiesListBox.Size = new System.Drawing.Size(252, 112); + this.CategoryPropertiesListBox.TabIndex = 0; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.CategoryPropertyNameTextBox); + this.groupBox5.Controls.Add(this.CreateCategoryPropertyButton); + this.groupBox5.Controls.Add(this.label3); + this.groupBox5.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox5.Location = new System.Drawing.Point(267, 28); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(266, 134); + this.groupBox5.TabIndex = 4; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Category Property"; + // + // CategoryPropertyNameTextBox + // + this.CategoryPropertyNameTextBox.Location = new System.Drawing.Point(6, 41); + this.CategoryPropertyNameTextBox.Name = "CategoryPropertyNameTextBox"; + this.CategoryPropertyNameTextBox.Size = new System.Drawing.Size(254, 23); + this.CategoryPropertyNameTextBox.TabIndex = 4; + // + // CreateCategoryPropertyButton + // + this.CreateCategoryPropertyButton.Enabled = false; + this.CreateCategoryPropertyButton.Location = new System.Drawing.Point(185, 105); + this.CreateCategoryPropertyButton.Name = "CreateCategoryPropertyButton"; + this.CreateCategoryPropertyButton.Size = new System.Drawing.Size(75, 23); + this.CreateCategoryPropertyButton.TabIndex = 5; + this.CreateCategoryPropertyButton.Text = "Add"; + this.CreateCategoryPropertyButton.UseVisualStyleBackColor = true; + this.CreateCategoryPropertyButton.Click += new System.EventHandler(this.CreateCategoryPropertyButton_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 23); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(90, 15); + this.label3.TabIndex = 0; + this.label3.Text = "Property Name:"; + // + // groupBox8 + // + this.groupBox8.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox8.Location = new System.Drawing.Point(3, 312); + this.groupBox8.Name = "groupBox8"; + this.groupBox8.Size = new System.Drawing.Size(258, 135); + this.groupBox8.TabIndex = 7; + this.groupBox8.TabStop = false; + this.groupBox8.Text = "Delete"; + // + // CategoryManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "CategoryManager"; + this.Text = "CategoryManager"; + this.MainLayoutPanel.ResumeLayout(false); + this.MainLayoutPanel.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel MainLayoutPanel; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ComboBox SubCategoryComboBox; + private System.Windows.Forms.ComboBox CategoryComboBox; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.MenuStrip menuStrip2; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.ComboBox CategoryComboBoxManager; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox SubCategoryComboBoxManager; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.ListBox CategoryPropertiesListBox; + private System.Windows.Forms.ListBox SubCategoryPropertiesListBox; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox CategoryPropertyNameTextBox; + private System.Windows.Forms.Button CreateCategoryPropertyButton; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button CreateSubCategoryButton; + private System.Windows.Forms.TextBox SubCategoryPropertyNameTextBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button CreateNewSubCategoryButton; + private System.Windows.Forms.Button CreateNewCategoryButton; + private System.Windows.Forms.TextBox NewCategoryNameTextBox; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button DeleteSubCategoryButton; + private System.Windows.Forms.Button DeleteCategoryButton; + private System.Windows.Forms.GroupBox groupBox8; + } +} \ No newline at end of file diff --git a/InventoryTest/CategoryManager.cs b/InventoryTest/CategoryManager.cs new file mode 100644 index 0000000..338b1cb --- /dev/null +++ b/InventoryTest/CategoryManager.cs @@ -0,0 +1,269 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace InventoryTest +{ + public partial class CategoryManager : Form + { + private static string ConnectionString { get; set; } + private static Dictionary CategoryIds { get; } = new(); + private static Dictionary SubCategoryIds { get; } = new(); + + public CategoryManager(string connectionString) + { + ConnectionString = connectionString; + + InitializeComponent(); + + CategoryComboBoxManager.SelectedIndexChanged += CategoryComboBoxManager_SelectedIndexChanged; + SubCategoryComboBoxManager.SelectedIndexChanged += SubCategoryComboBoxManager_SelectedIndexChanged; + CategoryPropertyNameTextBox.TextChanged += CategoryPropertyNameTextBox_TextChanged; + SubCategoryPropertyNameTextBox.TextChanged += SubCategoryNameTextBox_TextChanged; + NewCategoryNameTextBox.TextChanged += NewCategoryNameTextBox_TextChanged; + + LoadCategories(); + } + + private void NewCategoryNameTextBox_TextChanged(object sender, EventArgs e) + { + CreateNewCategoryButton.Enabled = !string.IsNullOrEmpty(NewCategoryNameTextBox.Text); + CreateNewSubCategoryButton.Enabled = !string.IsNullOrEmpty(NewCategoryNameTextBox.Text); + } + + private void SubCategoryNameTextBox_TextChanged(object sender, EventArgs e) + { + CreateSubCategoryButton.Enabled = !string.IsNullOrEmpty(SubCategoryPropertyNameTextBox.Text); + } + + private void CategoryPropertyNameTextBox_TextChanged(object sender, EventArgs e) + { + CreateCategoryPropertyButton.Enabled = !string.IsNullOrEmpty(CategoryPropertyNameTextBox.Text); + } + + private void SubCategoryComboBoxManager_SelectedIndexChanged(object sender, EventArgs e) + { + LoadSubCategoryProperties(); + } + + private void CategoryComboBoxManager_SelectedIndexChanged(object sender, EventArgs e) + { + SubCategoryComboBoxManager.Items.Clear(); + CategoryPropertiesListBox.Items.Clear(); + SubCategoryPropertiesListBox.Items.Clear(); + var id = CategoryIds[CategoryComboBoxManager.Text]; + SubCategoryIds.Clear(); + + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("SELECT * FROM dbo.GetCategorySubCategories(@ID)", connection); + command.Parameters.AddWithValue("ID", id); + + connection.Open(); + + var reader = command.ExecuteReader(); + + while (reader.Read()) + { + SubCategoryComboBoxManager.Items.Add(reader["Name"]); + SubCategoryIds.Add(reader["Name"].ToString(), Convert.ToInt32(reader["ID"])); + } + + reader.Close(); + + if (SubCategoryComboBoxManager.Items.Count > 0) + { + SubCategoryComboBoxManager.Enabled = true; + SubCategoryComboBoxManager.SelectedIndex = 0; + ToggleSubCategoryProperty(true); + } + else + { + ToggleSubCategoryProperty(false); + SubCategoryComboBoxManager.Enabled = false; + } + + LoadCategoryProperties(); + } + + private void LoadCategories() + { + CategoryComboBoxManager.Items.Clear(); + SubCategoryComboBoxManager.Items.Clear(); + CategoryIds.Clear(); + + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("SELECT [Category ID], [Category Name] FROM Category", connection); + + connection.Open(); + + var reader = command.ExecuteReader(); + + while (reader.Read()) + { + CategoryIds.Add(reader["Category Name"].ToString(), Convert.ToInt32(reader["Category ID"])); + CategoryComboBoxManager.Items.Add(reader["Category Name"]); + } + + reader.Close(); + + if (CategoryComboBoxManager.Items.Count > 0) + { + ToggleCategoryProperty(true); + CategoryComboBoxManager.SelectedIndex = 0; + } + else ToggleCategoryProperty(false); + } + + private void LoadCategoryProperties() + { + CategoryPropertiesListBox.Items.Clear(); + + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("SELECT * FROM GetCategoryProperties(@CategoryID)", connection); + command.Parameters.AddWithValue("CategoryID", CategoryIds[CategoryComboBoxManager.Text]); + + connection.Open(); + + var reader = command.ExecuteReader(); + + while (reader.Read()) + CategoryPropertiesListBox.Items.Add(reader["Name"]); + } + + private void LoadSubCategoryProperties() + { + SubCategoryPropertiesListBox.Items.Clear(); + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("SELECT * FROM GetSubCategoryProperties(@ID)", connection); + command.Parameters.AddWithValue("ID", SubCategoryIds[SubCategoryComboBoxManager.Text]); + + connection.Open(); + + var reader = command.ExecuteReader(); + + while (reader.Read()) + SubCategoryPropertiesListBox.Items.Add(reader["Name"]); + } + + private void ToggleSubCategoryProperty(bool enabled) + { + SubCategoryPropertyNameTextBox.Enabled = enabled; + CreateSubCategoryButton.Enabled = enabled; + DeleteSubCategoryButton.Enabled = enabled; + } + + private void ToggleCategoryProperty(bool enabled) + { + CategoryPropertyNameTextBox.Enabled = enabled; + CreateCategoryPropertyButton.Enabled = enabled; + DeleteCategoryButton.Enabled = enabled; + } + + private void CreateCategoryPropertyButton_Click(object sender, EventArgs e) + { + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("CreateCategoryPropertyByName", connection) { CommandType = CommandType.StoredProcedure }; + command.Parameters.AddWithValue("PropertyName", CategoryPropertyNameTextBox.Text); + command.Parameters.AddWithValue("CategoryID", CategoryIds[CategoryComboBoxManager.Text]); + + connection.Open(); + + command.ExecuteNonQuery(); + + LoadCategoryProperties(); + + CategoryPropertyNameTextBox.Text = string.Empty; + CategoryPropertyNameTextBox.Focus(); + } + + private void CreateSubCategoryButton_Click(object sender, EventArgs e) + { + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("CreateSubCategoryPropertyByName", connection) { CommandType = CommandType.StoredProcedure }; + command.Parameters.AddWithValue("PropertyName", SubCategoryPropertyNameTextBox.Text); + command.Parameters.AddWithValue("SubCategoryID", SubCategoryIds[SubCategoryComboBoxManager.Text]); + + connection.Open(); + + command.ExecuteNonQuery(); + + LoadSubCategoryProperties(); + + SubCategoryPropertyNameTextBox.Text = string.Empty; + SubCategoryPropertyNameTextBox.Focus(); + } + + private void CreateNewCategoryButton_Click(object sender, EventArgs e) + { + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("CreateCategory", connection) { CommandType = CommandType.StoredProcedure }; + command.Parameters.AddWithValue("Category", NewCategoryNameTextBox.Text); + + connection.Open(); + + CategoryIds.Add(NewCategoryNameTextBox.Text, Convert.ToInt32(command.ExecuteScalar())); + + CategoryComboBoxManager.Items.Add(NewCategoryNameTextBox); + + NewCategoryNameTextBox.Text = string.Empty; + NewCategoryNameTextBox.Focus(); + + if (CategoryComboBoxManager.SelectedIndex == -1) CategoryComboBoxManager.SelectedIndex = 0; + } + + private void CreateNewSubCategoryButton_Click(object sender, EventArgs e) + { + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("CreateSubCategory", connection) { CommandType = CommandType.StoredProcedure }; + command.Parameters.AddWithValue("SubCategory", NewCategoryNameTextBox.Text); + command.Parameters.AddWithValue("CategoryID", CategoryIds[CategoryComboBoxManager.Text]); + + connection.Open(); + + SubCategoryIds.Add(NewCategoryNameTextBox.Text, Convert.ToInt32(command.ExecuteScalar())); + + SubCategoryComboBoxManager.Items.Add(NewCategoryNameTextBox.Text); + + NewCategoryNameTextBox.Text = string.Empty; + NewCategoryNameTextBox.Focus(); + + SubCategoryComboBoxManager.Enabled = true; + + if (SubCategoryComboBoxManager.SelectedIndex == -1) SubCategoryComboBoxManager.SelectedIndex = 0; + } + + private void DeleteCategoryButton_Click(object sender, EventArgs e) + { + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("DeleteCategory", connection) { CommandType = CommandType.StoredProcedure }; + command.Parameters.AddWithValue("CategoryID", CategoryIds[CategoryComboBoxManager.Text]); + + connection.Open(); + + command.ExecuteNonQuery(); + + LoadCategories(); + } + + private void DeleteSubCategoryButton_Click(object sender, EventArgs e) + { + using var connection = new SqlConnection(ConnectionString); + using var command = new SqlCommand("DeleteSubCategory", connection) { CommandType = CommandType.StoredProcedure }; + command.Parameters.AddWithValue("SubCategoryID", SubCategoryIds[SubCategoryComboBoxManager.Text]); + + connection.Open(); + + command.ExecuteNonQuery(); + + SubCategoryIds.Remove(SubCategoryComboBoxManager.Text); + SubCategoryComboBoxManager.Items.RemoveAt(SubCategoryComboBoxManager.SelectedIndex); + } + } +} diff --git a/InventoryTest/CategoryManager.resx b/InventoryTest/CategoryManager.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/InventoryTest/CategoryManager.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/InventoryTest/Form1.Designer.cs b/InventoryTest/Form1.Designer.cs new file mode 100644 index 0000000..0d3fbee --- /dev/null +++ b/InventoryTest/Form1.Designer.cs @@ -0,0 +1,374 @@ + +namespace InventoryTest +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + this.MainLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ManageCategoriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.MainLayoutPanel.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // MainLayoutPanel + // + this.MainLayoutPanel.ColumnCount = 3; + this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34F)); + this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.MainLayoutPanel.Controls.Add(this.menuStrip1, 0, 0); + this.MainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.MainLayoutPanel.Location = new System.Drawing.Point(0, 0); + this.MainLayoutPanel.Name = "MainLayoutPanel"; + this.MainLayoutPanel.RowCount = 4; + this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34F)); + this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.MainLayoutPanel.Size = new System.Drawing.Size(800, 450); + this.MainLayoutPanel.TabIndex = 0; + // + // menuStrip1 + // + this.MainLayoutPanel.SetColumnSpan(this.menuStrip1, 3); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem, + this.toolsToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(800, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.openToolStripMenuItem, + this.toolStripSeparator, + this.saveToolStripMenuItem, + this.saveAsToolStripMenuItem, + this.toolStripSeparator1, + this.printToolStripMenuItem, + this.printPreviewToolStripMenuItem, + this.toolStripSeparator2, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); + this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.newToolStripMenuItem.Text = "&New"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); + this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.openToolStripMenuItem.Text = "&Open"; + // + // toolStripSeparator + // + this.toolStripSeparator.Name = "toolStripSeparator"; + this.toolStripSeparator.Size = new System.Drawing.Size(143, 6); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); + this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.saveToolStripMenuItem.Text = "&Save"; + // + // saveAsToolStripMenuItem + // + this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.saveAsToolStripMenuItem.Text = "Save &As"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(143, 6); + // + // printToolStripMenuItem + // + this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image"))); + this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.printToolStripMenuItem.Name = "printToolStripMenuItem"; + this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); + this.printToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.printToolStripMenuItem.Text = "&Print"; + // + // printPreviewToolStripMenuItem + // + this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image"))); + this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; + this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.printPreviewToolStripMenuItem.Text = "Print Pre&view"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(143, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.undoToolStripMenuItem, + this.redoToolStripMenuItem, + this.toolStripSeparator3, + this.cutToolStripMenuItem, + this.copyToolStripMenuItem, + this.pasteToolStripMenuItem, + this.toolStripSeparator4, + this.selectAllToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // undoToolStripMenuItem + // + this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; + this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); + this.undoToolStripMenuItem.Size = new System.Drawing.Size(144, 22); + this.undoToolStripMenuItem.Text = "&Undo"; + // + // redoToolStripMenuItem + // + this.redoToolStripMenuItem.Name = "redoToolStripMenuItem"; + this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); + this.redoToolStripMenuItem.Size = new System.Drawing.Size(144, 22); + this.redoToolStripMenuItem.Text = "&Redo"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(141, 6); + // + // cutToolStripMenuItem + // + this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image"))); + this.cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; + this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X))); + this.cutToolStripMenuItem.Size = new System.Drawing.Size(144, 22); + this.cutToolStripMenuItem.Text = "Cu&t"; + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image"))); + this.copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22); + this.copyToolStripMenuItem.Text = "&Copy"; + // + // pasteToolStripMenuItem + // + this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image"))); + this.pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; + this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); + this.pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22); + this.pasteToolStripMenuItem.Text = "&Paste"; + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6); + // + // selectAllToolStripMenuItem + // + this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(144, 22); + this.selectAllToolStripMenuItem.Text = "Select &All"; + // + // toolsToolStripMenuItem + // + this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ManageCategoriesToolStripMenuItem, + this.optionsToolStripMenuItem}); + this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20); + this.toolsToolStripMenuItem.Text = "&Tools"; + // + // ManageCategoriesToolStripMenuItem + // + this.ManageCategoriesToolStripMenuItem.Name = "ManageCategoriesToolStripMenuItem"; + this.ManageCategoriesToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.ManageCategoriesToolStripMenuItem.Text = "Manage &Categories"; + // + // optionsToolStripMenuItem + // + this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.optionsToolStripMenuItem.Text = "&Options"; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.contentsToolStripMenuItem, + this.indexToolStripMenuItem, + this.searchToolStripMenuItem, + this.toolStripSeparator5, + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "&Help"; + // + // contentsToolStripMenuItem + // + this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; + this.contentsToolStripMenuItem.Size = new System.Drawing.Size(122, 22); + this.contentsToolStripMenuItem.Text = "&Contents"; + // + // indexToolStripMenuItem + // + this.indexToolStripMenuItem.Name = "indexToolStripMenuItem"; + this.indexToolStripMenuItem.Size = new System.Drawing.Size(122, 22); + this.indexToolStripMenuItem.Text = "&Index"; + // + // searchToolStripMenuItem + // + this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; + this.searchToolStripMenuItem.Size = new System.Drawing.Size(122, 22); + this.searchToolStripMenuItem.Text = "&Search"; + // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(119, 6); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(122, 22); + this.aboutToolStripMenuItem.Text = "&About..."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.MainLayoutPanel); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form1"; + this.Text = "Form1"; + this.MainLayoutPanel.ResumeLayout(false); + this.MainLayoutPanel.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel MainLayoutPanel; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem ManageCategoriesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + } +} + diff --git a/InventoryTest/Form1.cs b/InventoryTest/Form1.cs new file mode 100644 index 0000000..53fd6a0 --- /dev/null +++ b/InventoryTest/Form1.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace InventoryTest +{ + public partial class Form1 : Form + { + private static string ConnectionString { get; } = "Server=DESKTOP-HJES64T;Database=main;Integrated Security=true;"; + + public Form1() + { + InitializeComponent(); + + ManageCategoriesToolStripMenuItem.Click += ShowCategoryManagerForm; + } + + private void ShowCategoryManagerForm(object sender, EventArgs e) + { + var form = new CategoryManager(ConnectionString); + form.Show(); + } + } +} diff --git a/InventoryTest/Form1.resx b/InventoryTest/Form1.resx new file mode 100644 index 0000000..8fcf441 --- /dev/null +++ b/InventoryTest/Form1.resx @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABiSURBVDhP7czBCoAwCIBhn80nifnq1cVDddHjQtogtjbb + NRJ+BuI+yCMi0UtVp3Rejx0gYjMiiszcRjKwb0eV7UOgPuIBy7z2EQ+w947Yffp6jQeUDQFlP/B94G2P + wGgAACcYuZjJw4fhNwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFTSURBVDhPlZK9SgNBFIXnCcQnkLyA4CPkHayFdBY22ppG + S0vLiEUEQS0EK4kWIkaiFgYJwYUgWQ24wSRkV/evHOfczMQxsyPrwIGd4dxvzr2zbHZFUbSUJMlTmqYl + eZR/yeJgba/O7513nhsijAWhYhzH6wLAFzdO+dzKQT6IKKqiCKo9uqSTeocACiI8W9JuLhRWLtpkZsv7 + hhZWjwiOdEgpVZDlE4B+G/b9UTBt47bZ4h/PNe57zlTR1xjAKgGc3pBuKh8+UDGkz2DUveMv55u/9Haz + Sz5KohIAgt6xV6+ggLqQABB8UwLEabRdgugpbNIBmAfDgXu1QweAqT5tGnauCYBv1BBAEbP6tal7uW0C + MJxZo0391tnkJRTgc+Aapr8Ujr2fGeDAax4bJpt6jQoPw/CVXkFED1CMnrLMWcKs8GcSQMQoAYIZ/Ee+ + 788zxtg3DfyyePrZw2oAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABzSURBVDhPY/j69WvDt2/f/pODQXoZQIyYCfv+MwTPIQmD + 9ID0gg3ApoAYjGHAh/cficLD2QBS8SA1AJufkTGyWtoagM5HFwdhmAEfkPMCukJkzcjiIAw24MuXLwbI + hqArRNaMLA7CYANAAGYISIA0/O0/AID67ECmnhNDAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACHSURBVDhP3ZJRCoAgEEQ9Wngsj+UJOkF1kwpEP6sxFdNt + 098GHgk7+yxI5LHWHi2Eeh0MpZQsTYJt3Un+KnDODcaYEYNWAcAOdgUOSik/7EFr7SXptedpIW+lQBc7 + 2H18d3y2QAp6eBXgzPEqoEolZS8Jcr4EZT/8DXeigKNaypObOUL9ihAnoWKSj1JdahUAAAAASUVORK5C + YII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADXSURBVDhPnZExDoIwFIY5gWfxDFzBVRMTRu4iriYuXqGT + BmO8gFudmQ2DaJsyPvlrawilFGzy5fFK/68tRO2hlKIQdV2vzXJ3YEEcx16SJKGyLP0SK6ieLwfM5/l5 + WBISoA5KxgiAlWC9iX5HSNBlkqCLV8AYIyEkibfoDVocAT7I8VbQbHWgaLHXFX1fGDgCKeUVIbA7cV2B + 7ySOQDfNzgjjGRX9vXiEBc3uczR/ncCEq+X28rv7pG/QDqNyzqmRjv8LVgAwgRdpmlK2yQZxrmDQk+NR + 9AE47sSEPD2a+wAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE6SURBVDhPhZI9boNAEIU5Qo6QI+QM9Egp6anDAaho3NiN + z0LrCKU0nQt6UodIOOKvJPstM2gJFnnSiN15b+bNrO256LruZRiGO9E0zZOkPc6aRyPpLQz5EcfxlGXZ + 1Pd9KmmPMzk4NJLewjhMvu9PYRhOOoW6k4NDI/It2rb9jKLICnUKdScHh0bkWyDO83w1heteFMVqtYfA + gV11CnUnt+uuMA6vZVkuU6g7OTiR7cOMfTscDraQSJKEdW5C/w9empGv18JGEAT7rw+M4IxIg6LL5d02 + YAqXM3GWshkk2JEixPp1w+XQrprQFSJ+i6f669v+3ojrurbB2eXQUiPlcwNbYAT35sd+uVdVZYWPOBqP + 4/i8NKDr8XiygjRNF5c9zhYDc9m8ge65x0n5DBEvru5f9i/HfWY87xeZHuplYWIClgAAAABJRU5ErkJg + gg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhPtc9RCoAgDMbxzuZJAo9pN/KhetkejQWD/HLq + oAZ/ItIfbZEhomLFzOt9qDdyMITwKsZYcs5jRIFjP6tS2uYQC0DEXKkF6BrPzL+xAHw3V5oF5NlEPICk + iNxzAZgLwP4BsNZFTb5XAOYCcD4DRnWBuahc6R2LWkqXAfkAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACaSURBVDhPvZFBCsMgEEU9Qs/k2TyGe6/RrWdxYRPEbcof + /MTaZGpa6MDDcfQ/AzFj5ZxvpZR7rXUD6DFrx58LAe/9Zq0V0GPWjo+Lr4GUkgSdcwL6/hy02F4Y8kXy + yIswzlUBAwz3Eq5TgiOmBRr/EazLKn8ixqjyIhoFuIC9xpTg7EumBVx7LgtGQgjnAsJLGm+Cb2jxX8qY + J5nBJhUlLbsqAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/InventoryTest/InventoryTest.csproj b/InventoryTest/InventoryTest.csproj new file mode 100644 index 0000000..95000d5 --- /dev/null +++ b/InventoryTest/InventoryTest.csproj @@ -0,0 +1,13 @@ + + + + WinExe + net5.0-windows + true + + + + + + + \ No newline at end of file diff --git a/InventoryTest/InventoryTest.csproj.user b/InventoryTest/InventoryTest.csproj.user new file mode 100644 index 0000000..29da961 --- /dev/null +++ b/InventoryTest/InventoryTest.csproj.user @@ -0,0 +1,11 @@ + + + + + Form + + + Form + + + \ No newline at end of file diff --git a/InventoryTest/Program.cs b/InventoryTest/Program.cs new file mode 100644 index 0000000..5a497ed --- /dev/null +++ b/InventoryTest/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace InventoryTest +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +}