diff --git a/shoe_store.sln b/shoe_store.sln new file mode 100644 index 0000000..bd0e391 --- /dev/null +++ b/shoe_store.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35931.197 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "shoe_store", "shoe_store\shoe_store.csproj", "{60757A2E-4B9E-42B9-8BD2-6AC36B6098F2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {60757A2E-4B9E-42B9-8BD2-6AC36B6098F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60757A2E-4B9E-42B9-8BD2-6AC36B6098F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60757A2E-4B9E-42B9-8BD2-6AC36B6098F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60757A2E-4B9E-42B9-8BD2-6AC36B6098F2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3F52BA18-F4A3-430E-8180-C271B118AE37} + EndGlobalSection +EndGlobal diff --git a/shoe_store/Category.cs b/shoe_store/Category.cs new file mode 100644 index 0000000..b286b88 --- /dev/null +++ b/shoe_store/Category.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace shoe_store +{ + internal class Category + { + } +} diff --git a/shoe_store/Form1.Designer.cs b/shoe_store/Form1.Designer.cs new file mode 100644 index 0000000..0410716 --- /dev/null +++ b/shoe_store/Form1.Designer.cs @@ -0,0 +1,108 @@ +namespace shoe_store +{ + partial class avtorization + { + /// + /// 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() + { + textBox1 = new TextBox(); + textBox2 = new TextBox(); + label1 = new Label(); + label2 = new Label(); + button1 = new Button(); + SuspendLayout(); + // + // textBox1 + // + textBox1.Location = new Point(125, 125); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(100, 27); + textBox1.TabIndex = 0; + // + // textBox2 + // + textBox2.Location = new Point(125, 194); + textBox2.Name = "textBox2"; + textBox2.Size = new Size(100, 27); + textBox2.TabIndex = 1; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(125, 102); + label1.Name = "label1"; + label1.Size = new Size(52, 20); + label1.TabIndex = 2; + label1.Text = "Логин"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(125, 171); + label2.Name = "label2"; + label2.Size = new Size(62, 20); + label2.TabIndex = 3; + label2.Text = "Пароль"; + // + // button1 + // + button1.Location = new Point(125, 246); + button1.Name = "button1"; + button1.Size = new Size(89, 25); + button1.TabIndex = 4; + button1.Text = "вход"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // avtorization + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(336, 397); + Controls.Add(button1); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(textBox2); + Controls.Add(textBox1); + FormBorderStyle = FormBorderStyle.FixedSingle; + MaximizeBox = false; + MinimizeBox = false; + Name = "avtorization"; + StartPosition = FormStartPosition.CenterScreen; + Text = "вход"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TextBox textBox1; + private TextBox textBox2; + private Label label1; + private Label label2; + private Button button1; + } +} diff --git a/shoe_store/Form1.cs b/shoe_store/Form1.cs new file mode 100644 index 0000000..f293c67 --- /dev/null +++ b/shoe_store/Form1.cs @@ -0,0 +1,17 @@ +namespace shoe_store +{ + public partial class avtorization : Form + { + public avtorization() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + this.Hide(); + admin admin = new admin(); + admin.Show(); + } + } +} diff --git a/shoe_store/Form1.resx b/shoe_store/Form1.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/shoe_store/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/shoe_store/Formadd.Designer.cs b/shoe_store/Formadd.Designer.cs new file mode 100644 index 0000000..2c9d087 --- /dev/null +++ b/shoe_store/Formadd.Designer.cs @@ -0,0 +1,247 @@ +namespace shoe_store +{ + partial class Formadd + { + /// + /// 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() + { + components = new System.ComponentModel.Container(); + button1 = new Button(); + productBindingSource = new BindingSource(components); + Save = new Button(); + textBox1 = new TextBox(); + comboBox1 = new ComboBox(); + categoryBindingSourse = new BindingSource(components); + comboBox2 = new ComboBox(); + manufacturerBindingSourse = new BindingSource(components); + comboBox3 = new ComboBox(); + supplierBindingSource = new BindingSource(components); + textBox2 = new TextBox(); + textBox3 = new TextBox(); + textBox4 = new TextBox(); + textBox5 = new TextBox(); + textBox6 = new TextBox(); + textBox7 = new TextBox(); + ((System.ComponentModel.ISupportInitialize)productBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)categoryBindingSourse).BeginInit(); + ((System.ComponentModel.ISupportInitialize)manufacturerBindingSourse).BeginInit(); + ((System.ComponentModel.ISupportInitialize)supplierBindingSource).BeginInit(); + SuspendLayout(); + // + // button1 + // + button1.Location = new Point(346, 297); + button1.Margin = new Padding(3, 2, 3, 2); + button1.Name = "button1"; + button1.Size = new Size(80, 23); + button1.TabIndex = 0; + button1.Text = "Exit"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // productBindingSource + // + productBindingSource.DataSource = typeof(Models.Product); + // + // Save + // + Save.Location = new Point(321, 244); + Save.Margin = new Padding(3, 2, 3, 2); + Save.Name = "Save"; + Save.Size = new Size(97, 35); + Save.TabIndex = 1; + Save.Text = "save"; + Save.UseVisualStyleBackColor = true; + // + // textBox1 + // + textBox1.DataBindings.Add(new Binding("Text", productBindingSource, "ArticleProduct", true)); + textBox1.Location = new Point(46, 9); + textBox1.Margin = new Padding(3, 2, 3, 2); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(128, 23); + textBox1.TabIndex = 2; + textBox1.TextChanged += textBox1_TextChanged; + // + // comboBox1 + // + comboBox1.DataBindings.Add(new Binding("SelectedValue", productBindingSource, "CategoryId", true)); + comboBox1.DataSource = categoryBindingSourse; + comboBox1.DisplayMember = "CategoryName"; + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(46, 164); + comboBox1.Margin = new Padding(3, 2, 3, 2); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(106, 23); + comboBox1.TabIndex = 3; + comboBox1.ValueMember = "IdCategory"; + // + // categoryBindingSourse + // + categoryBindingSourse.DataSource = typeof(Models.Category); + // + // comboBox2 + // + comboBox2.DataBindings.Add(new Binding("SelectedValue", productBindingSource, "ManufacturerId", true)); + comboBox2.DataSource = manufacturerBindingSourse; + comboBox2.DisplayMember = "ManufacturerName"; + comboBox2.FormattingEnabled = true; + comboBox2.Location = new Point(46, 139); + comboBox2.Margin = new Padding(3, 2, 3, 2); + comboBox2.Name = "comboBox2"; + comboBox2.Size = new Size(106, 23); + comboBox2.TabIndex = 4; + comboBox2.ValueMember = "IdManufacturer"; + // + // manufacturerBindingSourse + // + manufacturerBindingSourse.DataSource = typeof(Models.Manufacturer); + // + // comboBox3 + // + comboBox3.DataBindings.Add(new Binding("SelectedValue", productBindingSource, "SupplierId", true)); + comboBox3.DataSource = supplierBindingSource; + comboBox3.DisplayMember = "SupplierName"; + comboBox3.FormattingEnabled = true; + comboBox3.Location = new Point(46, 105); + comboBox3.Margin = new Padding(3, 2, 3, 2); + comboBox3.Name = "comboBox3"; + comboBox3.Size = new Size(128, 23); + comboBox3.TabIndex = 5; + comboBox3.ValueMember = "IdSupplier"; + // + // supplierBindingSource + // + supplierBindingSource.DataSource = typeof(Models.Supplier); + // + // textBox2 + // + textBox2.DataBindings.Add(new Binding("Text", productBindingSource, "ProductName", true)); + textBox2.Location = new Point(46, 41); + textBox2.Margin = new Padding(3, 2, 3, 2); + textBox2.Name = "textBox2"; + textBox2.Size = new Size(128, 23); + textBox2.TabIndex = 7; + textBox2.Text = "v"; + // + // textBox3 + // + textBox3.DataBindings.Add(new Binding("Text", productBindingSource, "SalePercent", true)); + textBox3.Location = new Point(46, 190); + textBox3.Margin = new Padding(3, 2, 3, 2); + textBox3.Name = "textBox3"; + textBox3.Size = new Size(128, 23); + textBox3.TabIndex = 9; + // + // textBox4 + // + textBox4.DataBindings.Add(new Binding("Text", productBindingSource, "Price", true)); + textBox4.Location = new Point(46, 71); + textBox4.Margin = new Padding(3, 2, 3, 2); + textBox4.Name = "textBox4"; + textBox4.Size = new Size(128, 23); + textBox4.TabIndex = 8; + // + // textBox5 + // + textBox5.DataBindings.Add(new Binding("Text", productBindingSource, "Description", true)); + textBox5.Location = new Point(46, 251); + textBox5.Margin = new Padding(3, 2, 3, 2); + textBox5.Name = "textBox5"; + textBox5.Size = new Size(128, 23); + textBox5.TabIndex = 12; + // + // textBox6 + // + textBox6.DataBindings.Add(new Binding("Text", productBindingSource, "UnitType", true)); + textBox6.Location = new Point(46, 219); + textBox6.Margin = new Padding(3, 2, 3, 2); + textBox6.Name = "textBox6"; + textBox6.Size = new Size(128, 23); + textBox6.TabIndex = 11; + // + // textBox7 + // + textBox7.DataBindings.Add(new Binding("Text", productBindingSource, "QuantityInStock", true)); + textBox7.Location = new Point(55, 312); + textBox7.Margin = new Padding(3, 2, 3, 2); + textBox7.Name = "textBox7"; + textBox7.Size = new Size(128, 23); + textBox7.TabIndex = 10; + // + // Formadd + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(441, 341); + Controls.Add(textBox5); + Controls.Add(textBox6); + Controls.Add(textBox7); + Controls.Add(textBox3); + Controls.Add(textBox4); + Controls.Add(textBox2); + Controls.Add(comboBox3); + Controls.Add(comboBox2); + Controls.Add(comboBox1); + Controls.Add(textBox1); + Controls.Add(Save); + Controls.Add(button1); + FormBorderStyle = FormBorderStyle.FixedSingle; + Margin = new Padding(3, 2, 3, 2); + MaximizeBox = false; + MinimizeBox = false; + Name = "Formadd"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Formadd"; + Load += Formadd_Load; + ((System.ComponentModel.ISupportInitialize)productBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)categoryBindingSourse).EndInit(); + ((System.ComponentModel.ISupportInitialize)manufacturerBindingSourse).EndInit(); + ((System.ComponentModel.ISupportInitialize)supplierBindingSource).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button button1; + public BindingSource productBindingSource; + public Button Save; + private TextBox textBox1; + private ComboBox comboBox1; + private ComboBox comboBox2; + private ComboBox comboBox3; + private TextBox textBox2; + private TextBox textBox3; + private TextBox textBox4; + private TextBox textBox5; + private TextBox textBox6; + private TextBox textBox7; + public BindingSource categoryBindingSourse; + public BindingSource manufacturerBindingSourse; + public BindingSource supplierBindingSource; + } +} \ No newline at end of file diff --git a/shoe_store/Formadd.cs b/shoe_store/Formadd.cs new file mode 100644 index 0000000..35a0ea9 --- /dev/null +++ b/shoe_store/Formadd.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace shoe_store +{ + public partial class Formadd : Form + { + public Formadd() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + + } + + private void Formadd_Load(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/shoe_store/Formadd.resx b/shoe_store/Formadd.resx new file mode 100644 index 0000000..cef4f38 --- /dev/null +++ b/shoe_store/Formadd.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 225, 22 + + + 225, 22 + + + 454, 19 + + + 454, 19 + + + 687, 16 + + + 687, 16 + + + 128 + + \ No newline at end of file diff --git a/shoe_store/LayoutControl.Designer.cs b/shoe_store/LayoutControl.Designer.cs new file mode 100644 index 0000000..824246e --- /dev/null +++ b/shoe_store/LayoutControl.Designer.cs @@ -0,0 +1,202 @@ +namespace shoe_store +{ + partial class LayoutControl + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + descri = new TextBox(); + productBindingSource = new BindingSource(components); + unitttttttttte = new TextBox(); + kwanttodm = new TextBox(); + sale = new TextBox(); + articledb = new TextBox(); + Price = new TextBox(); + suppluer = new ComboBox(); + supplierbindingSource = new BindingSource(components); + manufac = new ComboBox(); + manuSource2 = new BindingSource(components); + catgor = new ComboBox(); + CategorSource1 = new BindingSource(components); + name = new TextBox(); + ((System.ComponentModel.ISupportInitialize)productBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)supplierbindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)manuSource2).BeginInit(); + ((System.ComponentModel.ISupportInitialize)CategorSource1).BeginInit(); + SuspendLayout(); + // + // descri + // + descri.DataBindings.Add(new Binding("Text", productBindingSource, "Description", true)); + descri.Location = new Point(194, 109); + descri.Name = "descri"; + descri.Size = new Size(146, 27); + descri.TabIndex = 22; + // + // productBindingSource + // + productBindingSource.DataSource = typeof(Models.Product); + // + // unitttttttttte + // + unitttttttttte.DataBindings.Add(new Binding("Text", productBindingSource, "UnitType", true)); + unitttttttttte.Location = new Point(194, 66); + unitttttttttte.Name = "unitttttttttte"; + unitttttttttte.Size = new Size(146, 27); + unitttttttttte.TabIndex = 21; + // + // kwanttodm + // + kwanttodm.DataBindings.Add(new Binding("Text", productBindingSource, "QuantityInStock", true)); + kwanttodm.Location = new Point(194, 155); + kwanttodm.Name = "kwanttodm"; + kwanttodm.Size = new Size(146, 27); + kwanttodm.TabIndex = 20; + // + // sale + // + sale.DataBindings.Add(new Binding("Text", productBindingSource, "SalePercent", true)); + sale.Location = new Point(194, 18); + sale.Name = "sale"; + sale.Size = new Size(146, 27); + sale.TabIndex = 19; + // + // articledb + // + articledb.DataBindings.Add(new Binding("Text", productBindingSource, "ArticleProduct", true)); + articledb.Location = new Point(42, 17); + articledb.Name = "articledb"; + articledb.Size = new Size(146, 27); + articledb.TabIndex = 18; + // + // Price + // + Price.DataBindings.Add(new Binding("Text", productBindingSource, "Price", true)); + Price.Location = new Point(42, 97); + Price.Name = "Price"; + Price.Size = new Size(146, 27); + Price.TabIndex = 17; + // + // suppluer + // + suppluer.DataBindings.Add(new Binding("SelectedValue", supplierbindingSource, "IdSupplier", true)); + suppluer.DataSource = supplierbindingSource; + suppluer.DisplayMember = "SupplierName"; + suppluer.FormattingEnabled = true; + suppluer.Location = new Point(42, 144); + suppluer.Name = "suppluer"; + suppluer.Size = new Size(146, 28); + suppluer.TabIndex = 16; + suppluer.ValueMember = "IdSupplier"; + // + // supplierbindingSource + // + supplierbindingSource.DataSource = typeof(Models.Supplier); + // + // manufac + // + manufac.DataBindings.Add(new Binding("SelectedValue", manuSource2, "IdManufacturer", true)); + manufac.DataSource = manuSource2; + manufac.DisplayMember = "ManufacturerName"; + manufac.FormattingEnabled = true; + manufac.Location = new Point(42, 189); + manufac.Name = "manufac"; + manufac.Size = new Size(121, 28); + manufac.TabIndex = 15; + manufac.ValueMember = "IdManufacturer"; + // + // manuSource2 + // + manuSource2.DataSource = typeof(Models.Manufacturer); + manuSource2.CurrentChanged += bindingSource2_CurrentChanged; + // + // catgor + // + catgor.DataBindings.Add(new Binding("SelectedValue", CategorSource1, "IdCategory", true)); + catgor.DataSource = CategorSource1; + catgor.DisplayMember = "CategoryName"; + catgor.FormattingEnabled = true; + catgor.Location = new Point(194, 188); + catgor.Name = "catgor"; + catgor.Size = new Size(121, 28); + catgor.TabIndex = 14; + catgor.ValueMember = "IdCategory"; + // + // CategorSource1 + // + CategorSource1.DataSource = typeof(Models.Category); + // + // name + // + name.DataBindings.Add(new Binding("Text", productBindingSource, "ProductName", true)); + name.Location = new Point(42, 50); + name.Name = "name"; + name.Size = new Size(146, 27); + name.TabIndex = 13; + // + // LayoutControl + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(descri); + Controls.Add(unitttttttttte); + Controls.Add(kwanttodm); + Controls.Add(sale); + Controls.Add(articledb); + Controls.Add(Price); + Controls.Add(suppluer); + Controls.Add(manufac); + Controls.Add(catgor); + Controls.Add(name); + Name = "LayoutControl"; + Size = new Size(344, 235); + ((System.ComponentModel.ISupportInitialize)productBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)supplierbindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)manuSource2).EndInit(); + ((System.ComponentModel.ISupportInitialize)CategorSource1).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TextBox descri; + private TextBox unitttttttttte; + private TextBox kwanttodm; + private TextBox sale; + private TextBox articledb; + private TextBox Price; + private ComboBox suppluer; + private ComboBox manufac; + private ComboBox catgor; + private TextBox name; + public BindingSource productBindingSource; + public BindingSource CategorSource1; + public BindingSource supplierbindingSource; + public BindingSource manuSource2; + } +} diff --git a/shoe_store/LayoutControl.cs b/shoe_store/LayoutControl.cs new file mode 100644 index 0000000..a211666 --- /dev/null +++ b/shoe_store/LayoutControl.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace shoe_store +{ + public partial class LayoutControl : UserControl + { + public LayoutControl() + { + InitializeComponent(); + } + + private void bindingSource2_CurrentChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/shoe_store/LayoutControl.resx b/shoe_store/LayoutControl.resx new file mode 100644 index 0000000..703faec --- /dev/null +++ b/shoe_store/LayoutControl.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 425, 8 + + + 739, 18 + + + 221, 17 + + \ No newline at end of file diff --git a/shoe_store/Models/Category.cs b/shoe_store/Models/Category.cs new file mode 100644 index 0000000..95421db --- /dev/null +++ b/shoe_store/Models/Category.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class Category +{ + public int IdCategory { get; set; } + + public string CategoryName { get; set; } = null!; + + public virtual ICollection Products { get; set; } = new List(); +} diff --git a/shoe_store/Models/Ispr2521TimofeevKoShoestoreContext.cs b/shoe_store/Models/Ispr2521TimofeevKoShoestoreContext.cs new file mode 100644 index 0000000..ca8a227 --- /dev/null +++ b/shoe_store/Models/Ispr2521TimofeevKoShoestoreContext.cs @@ -0,0 +1,265 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal; + +namespace shoe_store.Models; + +public partial class Ispr2521TimofeevKoShoestoreContext : DbContext +{ + public Ispr2521TimofeevKoShoestoreContext() + { + } + + public Ispr2521TimofeevKoShoestoreContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Categories { get; set; } + + public virtual DbSet Manufacturers { get; set; } + + public virtual DbSet Orders { get; set; } + + public virtual DbSet OrderItems { get; set; } + + public virtual DbSet OrderStatuses { get; set; } + + public virtual DbSet PickupPoints { get; set; } + + public virtual DbSet Products { get; set; } + + public virtual DbSet Roles { get; set; } + + public virtual DbSet Suppliers { get; set; } + + public virtual DbSet Users { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. + => optionsBuilder.UseMySql("server=cfif31.ru;username=ISPr25-21_TimofeevKO;password=ISPr25-21_TimofeevKO;database=ISPr25-21_TimofeevKO_shoestore", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.45-mysql")); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder + .UseCollation("utf8mb4_0900_ai_ci") + .HasCharSet("utf8mb4"); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdCategory).HasName("PRIMARY"); + + entity.ToTable("Category"); + + entity.Property(e => e.IdCategory).HasColumnName("id_Category"); + entity.Property(e => e.CategoryName) + .HasMaxLength(45) + .HasColumnName("Category_name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdManufacturer).HasName("PRIMARY"); + + entity.ToTable("Manufacturer"); + + entity.Property(e => e.IdManufacturer).HasColumnName("id_Manufacturer"); + entity.Property(e => e.ManufacturerName) + .HasMaxLength(45) + .HasColumnName("Manufacturer_name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdOrders).HasName("PRIMARY"); + + entity.HasIndex(e => e.PickupPointId, "from order to pickup_idx"); + + entity.HasIndex(e => e.OrderstatusId, "from order to status_idx"); + + entity.HasIndex(e => e.UserInitialsId, "from order to user_idx"); + + entity.Property(e => e.IdOrders).HasColumnName("id_Orders"); + entity.Property(e => e.Code).HasColumnName("code"); + entity.Property(e => e.DeliveryDate).HasColumnName("delivery_date"); + entity.Property(e => e.OrderDate).HasColumnName("order_date"); + entity.Property(e => e.OrderstatusId).HasColumnName("orderstatus_id"); + entity.Property(e => e.PickupPointId).HasColumnName("pickup_point_id"); + entity.Property(e => e.UserInitialsId).HasColumnName("user_initials_id"); + + entity.HasOne(d => d.Orderstatus).WithMany(p => p.Orders) + .HasForeignKey(d => d.OrderstatusId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("from order to status"); + + entity.HasOne(d => d.PickupPoint).WithMany(p => p.Orders) + .HasForeignKey(d => d.PickupPointId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("from order to pickup"); + + entity.HasOne(d => d.UserInitials).WithMany(p => p.Orders) + .HasForeignKey(d => d.UserInitialsId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("from order to user"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdOrderItems).HasName("PRIMARY"); + + entity.HasIndex(e => e.OrderId, "from items to order_idx"); + + entity.HasIndex(e => e.ProductArticle, "from items to product_idx"); + + entity.Property(e => e.IdOrderItems).HasColumnName("id_OrderItems"); + entity.Property(e => e.OrderId).HasColumnName("order_id"); + entity.Property(e => e.ProductArticle) + .HasMaxLength(20) + .HasColumnName("product_article"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + + entity.HasOne(d => d.Order).WithMany(p => p.OrderItems) + .HasForeignKey(d => d.OrderId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("from items to order"); + + entity.HasOne(d => d.ProductArticleNavigation).WithMany(p => p.OrderItems) + .HasForeignKey(d => d.ProductArticle) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("from items to product"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdOrderStatus).HasName("PRIMARY"); + + entity.ToTable("OrderStatus"); + + entity.Property(e => e.IdOrderStatus).HasColumnName("id_OrderStatus"); + entity.Property(e => e.StatusName) + .HasMaxLength(75) + .HasColumnName("status_name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdpickupPoints).HasName("PRIMARY"); + + entity.ToTable("pickup_points"); + + entity.Property(e => e.IdpickupPoints).HasColumnName("idpickup_points"); + entity.Property(e => e.City) + .HasMaxLength(75) + .HasColumnName("city"); + entity.Property(e => e.HouseNumber).HasColumnName("house_number"); + entity.Property(e => e.Index).HasColumnName("index"); + entity.Property(e => e.Street) + .HasMaxLength(100) + .HasColumnName("street"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ArticleProduct).HasName("PRIMARY"); + + entity.ToTable("products"); + + entity.HasIndex(e => e.CategoryId, "from prod to category_idx"); + + entity.HasIndex(e => e.ManufacturerId, "from prod to manufacturer_idx"); + + entity.HasIndex(e => e.SupplierId, "from prod to suppleir_idx"); + + entity.Property(e => e.ArticleProduct) + .HasMaxLength(20) + .HasColumnName("article_product"); + entity.Property(e => e.CategoryId).HasColumnName("category_id"); + entity.Property(e => e.Description) + .HasColumnType("text") + .HasColumnName("description"); + entity.Property(e => e.ManufacturerId).HasColumnName("manufacturer_id"); + entity.Property(e => e.Photo) + .HasColumnType("mediumblob") + .HasColumnName("photo"); + entity.Property(e => e.Price) + .HasPrecision(10, 2) + .HasColumnName("price"); + entity.Property(e => e.ProductName) + .HasMaxLength(100) + .HasColumnName("product_name"); + entity.Property(e => e.QuantityInStock).HasColumnName("quantity_in_stock"); + entity.Property(e => e.SalePercent).HasColumnName("sale_percent"); + entity.Property(e => e.SupplierId).HasColumnName("supplier_id"); + entity.Property(e => e.UnitType) + .HasMaxLength(45) + .HasColumnName("unit_type"); + + entity.HasOne(d => d.Category).WithMany(p => p.Products) + .HasForeignKey(d => d.CategoryId) + .HasConstraintName("from prod to category"); + + entity.HasOne(d => d.Manufacturer).WithMany(p => p.Products) + .HasForeignKey(d => d.ManufacturerId) + .HasConstraintName("from prod to manufacturer"); + + entity.HasOne(d => d.Supplier).WithMany(p => p.Products) + .HasForeignKey(d => d.SupplierId) + .HasConstraintName("from prod to suppleir"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdRole).HasName("PRIMARY"); + + entity.ToTable("Role"); + + entity.Property(e => e.IdRole).HasColumnName("idRole"); + entity.Property(e => e.RoleName) + .HasMaxLength(75) + .HasColumnName("Role_name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdSupplier).HasName("PRIMARY"); + + entity.ToTable("Supplier"); + + entity.Property(e => e.IdSupplier).HasColumnName("id_Supplier"); + entity.Property(e => e.SupplierName) + .HasMaxLength(75) + .HasColumnName("supplier_name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdUsers).HasName("PRIMARY"); + + entity.ToTable("users"); + + entity.HasIndex(e => e.RoleId, "from users to role_idx"); + + entity.Property(e => e.IdUsers).HasColumnName("id_users"); + entity.Property(e => e.Login) + .HasMaxLength(45) + .HasColumnName("login"); + entity.Property(e => e.Name).HasMaxLength(45); + entity.Property(e => e.Password) + .HasMaxLength(45) + .HasColumnName("password"); + entity.Property(e => e.Patronymic).HasMaxLength(45); + entity.Property(e => e.RoleId).HasColumnName("RoleID"); + entity.Property(e => e.Surname).HasMaxLength(45); + + entity.HasOne(d => d.Role).WithMany(p => p.Users) + .HasForeignKey(d => d.RoleId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("from users to role"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/shoe_store/Models/Manufacturer.cs b/shoe_store/Models/Manufacturer.cs new file mode 100644 index 0000000..94f469e --- /dev/null +++ b/shoe_store/Models/Manufacturer.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class Manufacturer +{ + public int IdManufacturer { get; set; } + + public string ManufacturerName { get; set; } = null!; + + public virtual ICollection Products { get; set; } = new List(); +} diff --git a/shoe_store/Models/Order.cs b/shoe_store/Models/Order.cs new file mode 100644 index 0000000..99247bd --- /dev/null +++ b/shoe_store/Models/Order.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class Order +{ + public int IdOrders { get; set; } + + public DateOnly OrderDate { get; set; } + + public DateOnly DeliveryDate { get; set; } + + public int PickupPointId { get; set; } + + public int UserInitialsId { get; set; } + + public int Code { get; set; } + + public int OrderstatusId { get; set; } + + public virtual ICollection OrderItems { get; set; } = new List(); + + public virtual OrderStatus Orderstatus { get; set; } = null!; + + public virtual PickupPoint PickupPoint { get; set; } = null!; + + public virtual User UserInitials { get; set; } = null!; +} diff --git a/shoe_store/Models/OrderItem.cs b/shoe_store/Models/OrderItem.cs new file mode 100644 index 0000000..977c665 --- /dev/null +++ b/shoe_store/Models/OrderItem.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class OrderItem +{ + public int IdOrderItems { get; set; } + + public int OrderId { get; set; } + + public string ProductArticle { get; set; } = null!; + + public int Quantity { get; set; } + + public virtual Order Order { get; set; } = null!; + + public virtual Product ProductArticleNavigation { get; set; } = null!; +} diff --git a/shoe_store/Models/OrderStatus.cs b/shoe_store/Models/OrderStatus.cs new file mode 100644 index 0000000..872a9ea --- /dev/null +++ b/shoe_store/Models/OrderStatus.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class OrderStatus +{ + public int IdOrderStatus { get; set; } + + public string StatusName { get; set; } = null!; + + public virtual ICollection Orders { get; set; } = new List(); +} diff --git a/shoe_store/Models/PickupPoint.cs b/shoe_store/Models/PickupPoint.cs new file mode 100644 index 0000000..f6fe03a --- /dev/null +++ b/shoe_store/Models/PickupPoint.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class PickupPoint +{ + public int IdpickupPoints { get; set; } + + public int Index { get; set; } + + public string Street { get; set; } = null!; + + public string City { get; set; } = null!; + + public int HouseNumber { get; set; } + + public virtual ICollection Orders { get; set; } = new List(); +} diff --git a/shoe_store/Models/Product.cs b/shoe_store/Models/Product.cs new file mode 100644 index 0000000..2b91c94 --- /dev/null +++ b/shoe_store/Models/Product.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class Product +{ + public string ArticleProduct { get; set; } = null!; + + public string ProductName { get; set; } = null!; + + public decimal Price { get; set; } + + public int? SupplierId { get; set; } + + public int? ManufacturerId { get; set; } + + public int? CategoryId { get; set; } + + public int SalePercent { get; set; } + + public string UnitType { get; set; } = null!; + + public string Description { get; set; } = null!; + + public byte[]? Photo { get; set; } + + public int QuantityInStock { get; set; } + + public virtual Category? Category { get; set; } + + public virtual Manufacturer? Manufacturer { get; set; } + + public virtual ICollection OrderItems { get; set; } = new List(); + + public virtual Supplier? Supplier { get; set; } +} diff --git a/shoe_store/Models/Role.cs b/shoe_store/Models/Role.cs new file mode 100644 index 0000000..aad8207 --- /dev/null +++ b/shoe_store/Models/Role.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class Role +{ + public int IdRole { get; set; } + + public string RoleName { get; set; } = null!; + + public virtual ICollection Users { get; set; } = new List(); +} diff --git a/shoe_store/Models/Supplier.cs b/shoe_store/Models/Supplier.cs new file mode 100644 index 0000000..af00d41 --- /dev/null +++ b/shoe_store/Models/Supplier.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class Supplier +{ + public int IdSupplier { get; set; } + + public string SupplierName { get; set; } = null!; + + public virtual ICollection Products { get; set; } = new List(); +} diff --git a/shoe_store/Models/Test1.cs b/shoe_store/Models/Test1.cs new file mode 100644 index 0000000..dbb5e4e --- /dev/null +++ b/shoe_store/Models/Test1.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace shoe_store.Models +{ + public class Test1 + { + public string? ManufacturerName { get; set; } + } +} diff --git a/shoe_store/Models/User.cs b/shoe_store/Models/User.cs new file mode 100644 index 0000000..30c1396 --- /dev/null +++ b/shoe_store/Models/User.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace shoe_store.Models; + +public partial class User +{ + public int IdUsers { get; set; } + + public string Login { get; set; } = null!; + + public string Password { get; set; } = null!; + + public int RoleId { get; set; } + + public string Surname { get; set; } = null!; + + public string Name { get; set; } = null!; + + public string? Patronymic { get; set; } + + public virtual ICollection Orders { get; set; } = new List(); + + public virtual Role Role { get; set; } = null!; +} diff --git a/shoe_store/Product.cs b/shoe_store/Product.cs new file mode 100644 index 0000000..87c64c4 --- /dev/null +++ b/shoe_store/Product.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace shoe_store +{ + internal class Product + { + } +} + + + diff --git a/shoe_store/Program.cs b/shoe_store/Program.cs new file mode 100644 index 0000000..91b23ba --- /dev/null +++ b/shoe_store/Program.cs @@ -0,0 +1,17 @@ +namespace shoe_store +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new avtorization()); + } + } +} \ No newline at end of file diff --git a/shoe_store/Properties/DataSources/shoe_store.Models.Manufacturer.datasource b/shoe_store/Properties/DataSources/shoe_store.Models.Manufacturer.datasource new file mode 100644 index 0000000..8d06acc --- /dev/null +++ b/shoe_store/Properties/DataSources/shoe_store.Models.Manufacturer.datasource @@ -0,0 +1,10 @@ + + + + shoe_store.Models.Manufacturer, shoe_store, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/shoe_store/Validation.cs b/shoe_store/Validation.cs new file mode 100644 index 0000000..f3ce86a --- /dev/null +++ b/shoe_store/Validation.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; +using shoe_store.Models; + +namespace shoe_store.Models +{ + internal partial class Product : IEditableObject + { + Ispr2521TimofeevKoShoestoreContext context; + + + public void BeginEdit() + { + context = new(); + context.Update(this); + } + + + public void CancelEdit() + { + var entry = context.Entry(this); + if (entry.State == Microsoft.EntityFrameworkCore.EntityState.Modified) + { + entry.Reload(); + } + } + + + public void EndEdit() + { + + if (string.IsNullOrEmpty(ProductName)) + { + throw new ValidationException("Имя не должно быть пустым"); + } + context.SaveChanges(); + } + } +} + diff --git a/shoe_store/admin.Designer.cs b/shoe_store/admin.Designer.cs new file mode 100644 index 0000000..cefa2de --- /dev/null +++ b/shoe_store/admin.Designer.cs @@ -0,0 +1,341 @@ +namespace shoe_store +{ + partial class admin + { + /// + /// 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() + { + components = new System.ComponentModel.Container(); + dataGridView1 = new DataGridView(); + articleProductDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + Photo = new DataGridViewImageColumn(); + productNameDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + priceDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + supplierIdDataGridViewTextBoxColumn = new DataGridViewComboBoxColumn(); + supplierBindingSource = new BindingSource(components); + Manufacturer = new DataGridViewTextBoxColumn(); + manufacturerIdDataGridViewTextBoxColumn = new DataGridViewComboBoxColumn(); + manufacturerBindingSource = new BindingSource(components); + categoryIdDataGridViewTextBoxColumn = new DataGridViewComboBoxColumn(); + categoryBindingSource = new BindingSource(components); + salePercentDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + unitTypeDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + descriptionDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + quantityInStockDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn(); + productBindingSource = new BindingSource(components); + userBindingSource = new BindingSource(components); + button1 = new Button(); + button2 = new Button(); + ex = new Button(); + button3 = new Button(); + button4 = new Button(); + cancel = new Button(); + flowLayoutPanel1 = new FlowLayoutPanel(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)supplierBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)manufacturerBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)categoryBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)productBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)userBindingSource).BeginInit(); + SuspendLayout(); + // + // dataGridView1 + // + dataGridView1.AllowUserToAddRows = false; + dataGridView1.AllowUserToDeleteRows = false; + dataGridView1.AutoGenerateColumns = false; + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { articleProductDataGridViewTextBoxColumn, Photo, productNameDataGridViewTextBoxColumn, priceDataGridViewTextBoxColumn, supplierIdDataGridViewTextBoxColumn, Manufacturer, manufacturerIdDataGridViewTextBoxColumn, categoryIdDataGridViewTextBoxColumn, salePercentDataGridViewTextBoxColumn, unitTypeDataGridViewTextBoxColumn, descriptionDataGridViewTextBoxColumn, quantityInStockDataGridViewTextBoxColumn }); + dataGridView1.DataSource = productBindingSource; + dataGridView1.Enabled = false; + dataGridView1.Location = new Point(13, 15); + dataGridView1.Margin = new Padding(3, 2, 3, 2); + dataGridView1.Name = "dataGridView1"; + dataGridView1.ReadOnly = true; + dataGridView1.Size = new Size(439, 220); + dataGridView1.TabIndex = 0; + dataGridView1.CellContentClick += dataGridView1_CellContentClick; + // + // articleProductDataGridViewTextBoxColumn + // + articleProductDataGridViewTextBoxColumn.DataPropertyName = "ArticleProduct"; + articleProductDataGridViewTextBoxColumn.HeaderText = "ArticleProduct"; + articleProductDataGridViewTextBoxColumn.Name = "articleProductDataGridViewTextBoxColumn"; + articleProductDataGridViewTextBoxColumn.ReadOnly = true; + // + // Photo + // + Photo.DataPropertyName = "Photo"; + Photo.HeaderText = "Photo"; + Photo.ImageLayout = DataGridViewImageCellLayout.Stretch; + Photo.Name = "Photo"; + Photo.ReadOnly = true; + // + // productNameDataGridViewTextBoxColumn + // + productNameDataGridViewTextBoxColumn.DataPropertyName = "ProductName"; + productNameDataGridViewTextBoxColumn.HeaderText = "ProductName"; + productNameDataGridViewTextBoxColumn.Name = "productNameDataGridViewTextBoxColumn"; + productNameDataGridViewTextBoxColumn.ReadOnly = true; + // + // priceDataGridViewTextBoxColumn + // + priceDataGridViewTextBoxColumn.DataPropertyName = "Price"; + priceDataGridViewTextBoxColumn.HeaderText = "Price"; + priceDataGridViewTextBoxColumn.Name = "priceDataGridViewTextBoxColumn"; + priceDataGridViewTextBoxColumn.ReadOnly = true; + // + // supplierIdDataGridViewTextBoxColumn + // + supplierIdDataGridViewTextBoxColumn.DataPropertyName = "SupplierId"; + supplierIdDataGridViewTextBoxColumn.DataSource = supplierBindingSource; + supplierIdDataGridViewTextBoxColumn.DisplayMember = "SupplierName"; + supplierIdDataGridViewTextBoxColumn.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; + supplierIdDataGridViewTextBoxColumn.HeaderText = "Помставсщике"; + supplierIdDataGridViewTextBoxColumn.Name = "supplierIdDataGridViewTextBoxColumn"; + supplierIdDataGridViewTextBoxColumn.ReadOnly = true; + supplierIdDataGridViewTextBoxColumn.Resizable = DataGridViewTriState.True; + supplierIdDataGridViewTextBoxColumn.SortMode = DataGridViewColumnSortMode.Automatic; + supplierIdDataGridViewTextBoxColumn.ValueMember = "IdSupplier"; + // + // supplierBindingSource + // + supplierBindingSource.DataSource = typeof(Models.Supplier); + // + // Manufacturer + // + Manufacturer.DataPropertyName = "Manufacturer"; + Manufacturer.HeaderText = "Manufacturer"; + Manufacturer.Name = "Manufacturer"; + Manufacturer.ReadOnly = true; + Manufacturer.Visible = false; + // + // manufacturerIdDataGridViewTextBoxColumn + // + manufacturerIdDataGridViewTextBoxColumn.DataPropertyName = "ManufacturerId"; + manufacturerIdDataGridViewTextBoxColumn.DataSource = manufacturerBindingSource; + manufacturerIdDataGridViewTextBoxColumn.DisplayMember = "ManufacturerName"; + manufacturerIdDataGridViewTextBoxColumn.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; + manufacturerIdDataGridViewTextBoxColumn.HeaderText = "Произхводтиелть"; + manufacturerIdDataGridViewTextBoxColumn.Name = "manufacturerIdDataGridViewTextBoxColumn"; + manufacturerIdDataGridViewTextBoxColumn.ReadOnly = true; + manufacturerIdDataGridViewTextBoxColumn.Resizable = DataGridViewTriState.True; + manufacturerIdDataGridViewTextBoxColumn.SortMode = DataGridViewColumnSortMode.Automatic; + manufacturerIdDataGridViewTextBoxColumn.ValueMember = "IdManufacturer"; + // + // manufacturerBindingSource + // + manufacturerBindingSource.DataSource = typeof(Models.Manufacturer); + // + // categoryIdDataGridViewTextBoxColumn + // + categoryIdDataGridViewTextBoxColumn.DataPropertyName = "CategoryId"; + categoryIdDataGridViewTextBoxColumn.DataSource = categoryBindingSource; + categoryIdDataGridViewTextBoxColumn.DisplayMember = "CategoryName"; + categoryIdDataGridViewTextBoxColumn.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; + categoryIdDataGridViewTextBoxColumn.HeaderText = "категория"; + categoryIdDataGridViewTextBoxColumn.Name = "categoryIdDataGridViewTextBoxColumn"; + categoryIdDataGridViewTextBoxColumn.ReadOnly = true; + categoryIdDataGridViewTextBoxColumn.Resizable = DataGridViewTriState.True; + categoryIdDataGridViewTextBoxColumn.SortMode = DataGridViewColumnSortMode.Automatic; + categoryIdDataGridViewTextBoxColumn.ValueMember = "IdCategory"; + // + // categoryBindingSource + // + categoryBindingSource.DataSource = typeof(Models.Category); + // + // salePercentDataGridViewTextBoxColumn + // + salePercentDataGridViewTextBoxColumn.DataPropertyName = "SalePercent"; + salePercentDataGridViewTextBoxColumn.HeaderText = "SalePercent"; + salePercentDataGridViewTextBoxColumn.Name = "salePercentDataGridViewTextBoxColumn"; + salePercentDataGridViewTextBoxColumn.ReadOnly = true; + // + // unitTypeDataGridViewTextBoxColumn + // + unitTypeDataGridViewTextBoxColumn.DataPropertyName = "UnitType"; + unitTypeDataGridViewTextBoxColumn.HeaderText = "UnitType"; + unitTypeDataGridViewTextBoxColumn.Name = "unitTypeDataGridViewTextBoxColumn"; + unitTypeDataGridViewTextBoxColumn.ReadOnly = true; + // + // descriptionDataGridViewTextBoxColumn + // + descriptionDataGridViewTextBoxColumn.DataPropertyName = "Description"; + descriptionDataGridViewTextBoxColumn.HeaderText = "Description"; + descriptionDataGridViewTextBoxColumn.Name = "descriptionDataGridViewTextBoxColumn"; + descriptionDataGridViewTextBoxColumn.ReadOnly = true; + // + // quantityInStockDataGridViewTextBoxColumn + // + quantityInStockDataGridViewTextBoxColumn.DataPropertyName = "QuantityInStock"; + quantityInStockDataGridViewTextBoxColumn.HeaderText = "QuantityInStock"; + quantityInStockDataGridViewTextBoxColumn.Name = "quantityInStockDataGridViewTextBoxColumn"; + quantityInStockDataGridViewTextBoxColumn.ReadOnly = true; + // + // productBindingSource + // + productBindingSource.DataSource = typeof(Models.Product); + // + // userBindingSource + // + userBindingSource.DataSource = typeof(Models.User); + // + // button1 + // + button1.Location = new Point(32, 306); + button1.Margin = new Padding(3, 2, 3, 2); + button1.Name = "button1"; + button1.Size = new Size(66, 22); + button1.TabIndex = 1; + button1.Text = "Exit"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // button2 + // + button2.Location = new Point(527, 252); + button2.Margin = new Padding(3, 2, 3, 2); + button2.Name = "button2"; + button2.Size = new Size(134, 28); + button2.TabIndex = 2; + button2.Text = "Редактирование"; + button2.UseVisualStyleBackColor = true; + button2.Click += button2_Click; + // + // ex + // + ex.Location = new Point(283, 280); + ex.Margin = new Padding(3, 2, 3, 2); + ex.Name = "ex"; + ex.Size = new Size(172, 34); + ex.TabIndex = 3; + ex.Text = "ex"; + ex.UseVisualStyleBackColor = true; + ex.Click += ex_Click; + // + // button3 + // + button3.Location = new Point(32, 252); + button3.Margin = new Padding(3, 2, 3, 2); + button3.Name = "button3"; + button3.Size = new Size(150, 32); + button3.TabIndex = 4; + button3.Text = "Добавление"; + button3.UseVisualStyleBackColor = true; + button3.Click += button3_Click; + // + // button4 + // + button4.Location = new Point(187, 249); + button4.Margin = new Padding(3, 2, 3, 2); + button4.Name = "button4"; + button4.Size = new Size(156, 26); + button4.TabIndex = 5; + button4.Text = "Удаление"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; + // + // cancel + // + cancel.Location = new Point(415, 239); + cancel.Margin = new Padding(3, 2, 3, 2); + cancel.Name = "cancel"; + cancel.Size = new Size(80, 36); + cancel.TabIndex = 6; + cancel.Text = "Отмена"; + cancel.UseVisualStyleBackColor = true; + cancel.Click += cancel_Click; + // + // flowLayoutPanel1 + // + flowLayoutPanel1.AutoScroll = true; + flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; + flowLayoutPanel1.Location = new Point(458, 15); + flowLayoutPanel1.Margin = new Padding(3, 2, 3, 2); + flowLayoutPanel1.Name = "flowLayoutPanel1"; + flowLayoutPanel1.Size = new Size(363, 220); + flowLayoutPanel1.TabIndex = 7; + flowLayoutPanel1.WrapContents = false; + // + // admin + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(833, 322); + Controls.Add(flowLayoutPanel1); + Controls.Add(cancel); + Controls.Add(button4); + Controls.Add(button3); + Controls.Add(ex); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(dataGridView1); + FormBorderStyle = FormBorderStyle.None; + Margin = new Padding(3, 2, 3, 2); + MaximizeBox = false; + MinimizeBox = false; + Name = "admin"; + StartPosition = FormStartPosition.CenterScreen; + Text = "admin"; + Load += admin_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ((System.ComponentModel.ISupportInitialize)supplierBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)manufacturerBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)categoryBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)productBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)userBindingSource).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView1; + private Button button1; + private BindingSource userBindingSource; + private BindingSource productBindingSource; + private BindingSource supplierBindingSource; + private BindingSource manufacturerBindingSource; + private Button button2; + public BindingSource categoryBindingSource; + private Button ex; + private Button button3; + private Button button4; + private DataGridViewTextBoxColumn articleProductDataGridViewTextBoxColumn; + private DataGridViewImageColumn Photo; + private DataGridViewTextBoxColumn productNameDataGridViewTextBoxColumn; + private DataGridViewTextBoxColumn priceDataGridViewTextBoxColumn; + private DataGridViewComboBoxColumn supplierIdDataGridViewTextBoxColumn; + private DataGridViewTextBoxColumn Manufacturer; + private DataGridViewComboBoxColumn manufacturerIdDataGridViewTextBoxColumn; + private DataGridViewComboBoxColumn categoryIdDataGridViewTextBoxColumn; + private DataGridViewTextBoxColumn salePercentDataGridViewTextBoxColumn; + private DataGridViewTextBoxColumn unitTypeDataGridViewTextBoxColumn; + private DataGridViewTextBoxColumn descriptionDataGridViewTextBoxColumn; + private DataGridViewTextBoxColumn quantityInStockDataGridViewTextBoxColumn; + private Button cancel; + private FlowLayoutPanel flowLayoutPanel1; + } +} \ No newline at end of file diff --git a/shoe_store/admin.cs b/shoe_store/admin.cs new file mode 100644 index 0000000..e42661f --- /dev/null +++ b/shoe_store/admin.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.Common; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Microsoft.EntityFrameworkCore; +using shoe_store.Models; + +namespace shoe_store +{ + public partial class admin : Form + { + Ispr2521TimofeevKoShoestoreContext context; + + public admin() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + this.Hide(); + avtorization avtorization = new avtorization(); + avtorization.Show(); + } + + private void admin_Load(object sender, EventArgs e) + { + + } + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + context = new Ispr2521TimofeevKoShoestoreContext(); + context.Products.Include(x => x.Category).Include(x => x.Supplier).Include(x => x.Manufacturer).Load(); + + context.Database.EnsureCreated(); + productBindingSource.DataSource = context.Products.Local.ToBindingList(); + categoryBindingSource.DataSource = context.Categories.Local.ToBindingList(); + supplierBindingSource.DataSource = context.Suppliers.Local.ToBindingList(); + manufacturerBindingSource.DataSource = context.Manufacturers.Local.ToBindingList(); + Populate(); + + + + } + + private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void label1_Click(object sender, EventArgs e) + { + + } + + public void button2_Click(object sender, EventArgs e) + { + var form = new Formadd(); + form.categoryBindingSourse.DataSource = categoryBindingSource.DataSource; + form.manufacturerBindingSourse.DataSource = manufacturerBindingSource.DataSource; + form.supplierBindingSource.DataSource = supplierBindingSource.DataSource; + form.productBindingSource.DataSource = productBindingSource.Current; + form.Save.Click += SaveButton_Click; + form.Show(); + Populate(); + + + } + + private void SaveButton_Click(object sender, EventArgs e) + { + productBindingSource.EndEdit(); + context.SaveChanges(); + dataGridView1.Refresh(); + Populate(); + } + + private void ex_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void button3_Click(object sender, EventArgs e) + { + var form = new Formadd(); + form.categoryBindingSourse.DataSource = categoryBindingSource.DataSource; + form.manufacturerBindingSourse.DataSource = manufacturerBindingSource.DataSource; + form.supplierBindingSource.DataSource = supplierBindingSource.DataSource; + form.productBindingSource.DataSource = productBindingSource.AddNew(); + var ob = form.productBindingSource.DataSource as Product; + form.Save.Click += (o, e) => + { + if (!string.IsNullOrEmpty(ob?.ProductName)) + { + context.SaveChanges(); + } + else + { + MessageBox.Show("Название не должно быть пустым!"); + } + } + ; + form.Show(); + Populate(); + } + + private void button4_Click(object sender, EventArgs e) + { + productBindingSource.RemoveCurrent(); + context.SaveChanges(); + dataGridView1.Refresh(); + Populate(); + } + + private void cancel_Click(object sender, EventArgs e) + { + productBindingSource.CancelEdit(); + } + private void Populate() + { + flowLayoutPanel1.Controls.Clear(); + foreach (var binding in productBindingSource) + { + var control = new LayoutControl(); + control.productBindingSource.DataSource = binding; + control.CategorSource1.DataSource = categoryBindingSource; + control.supplierbindingSource.DataSource = supplierBindingSource; + control.manuSource2.DataSource = manufacturerBindingSource; + + flowLayoutPanel1.Controls.Add(control); + } + } + + + } +} diff --git a/shoe_store/admin.resx b/shoe_store/admin.resx new file mode 100644 index 0000000..64f0d8e --- /dev/null +++ b/shoe_store/admin.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + 850, 17 + + + True + + + 610, 17 + + + 17, 17 + + + 406, 17 + + + 227, 17 + + + 91 + + \ No newline at end of file diff --git a/shoe_store/categoty.cs b/shoe_store/categoty.cs new file mode 100644 index 0000000..3067caa --- /dev/null +++ b/shoe_store/categoty.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace shoe_store +{ + internal class categoty + { + } +} diff --git a/shoe_store/shoe_store.csproj b/shoe_store/shoe_store.csproj new file mode 100644 index 0000000..442fc7e --- /dev/null +++ b/shoe_store/shoe_store.csproj @@ -0,0 +1,23 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + \ No newline at end of file