From 0d1d896232a47615b660746dd2e2d2ca04417eca Mon Sep 17 00:00:00 2001 From: testuser Date: Thu, 14 May 2026 15:26:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D1=8C=D1=82?= =?UTF-8?q?=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BA=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dem41.sln | 25 +++ Dem41/App.config | 6 + Dem41/Autorization.Designer.cs | 111 ++++++++++++ Dem41/Autorization.cs | 57 ++++++ Dem41/Autorization.resx | 120 +++++++++++++ Dem41/Dem41.csproj | 101 +++++++++++ Dem41/EditForm.Designer.cs | 237 +++++++++++++++++++++++++ Dem41/EditForm.cs | 25 +++ Dem41/EditForm.resx | 120 +++++++++++++ Dem41/MainForm.Designer.cs | 145 +++++++++++++++ Dem41/MainForm.cs | 115 ++++++++++++ Dem41/MainForm.resx | 120 +++++++++++++ Dem41/Program.cs | 22 +++ Dem41/Properties/AssemblyInfo.cs | 33 ++++ Dem41/Properties/Resources.Designer.cs | 71 ++++++++ Dem41/Properties/Resources.resx | 117 ++++++++++++ Dem41/Properties/Settings.Designer.cs | 30 ++++ Dem41/Properties/Settings.settings | 7 + 18 files changed, 1462 insertions(+) create mode 100644 Dem41.sln create mode 100644 Dem41/App.config create mode 100644 Dem41/Autorization.Designer.cs create mode 100644 Dem41/Autorization.cs create mode 100644 Dem41/Autorization.resx create mode 100644 Dem41/Dem41.csproj create mode 100644 Dem41/EditForm.Designer.cs create mode 100644 Dem41/EditForm.cs create mode 100644 Dem41/EditForm.resx create mode 100644 Dem41/MainForm.Designer.cs create mode 100644 Dem41/MainForm.cs create mode 100644 Dem41/MainForm.resx create mode 100644 Dem41/Program.cs create mode 100644 Dem41/Properties/AssemblyInfo.cs create mode 100644 Dem41/Properties/Resources.Designer.cs create mode 100644 Dem41/Properties/Resources.resx create mode 100644 Dem41/Properties/Settings.Designer.cs create mode 100644 Dem41/Properties/Settings.settings diff --git a/Dem41.sln b/Dem41.sln new file mode 100644 index 0000000..919c337 --- /dev/null +++ b/Dem41.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}") = "Dem41", "Dem41\Dem41.csproj", "{A0B2EAF6-3C0E-42DA-84F8-A1F70AF38663}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A0B2EAF6-3C0E-42DA-84F8-A1F70AF38663}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0B2EAF6-3C0E-42DA-84F8-A1F70AF38663}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0B2EAF6-3C0E-42DA-84F8-A1F70AF38663}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0B2EAF6-3C0E-42DA-84F8-A1F70AF38663}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B2D57F0D-3FDC-4C64-B889-8A6BB5A7CC81} + EndGlobalSection +EndGlobal diff --git a/Dem41/App.config b/Dem41/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Dem41/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Dem41/Autorization.Designer.cs b/Dem41/Autorization.Designer.cs new file mode 100644 index 0000000..0040639 --- /dev/null +++ b/Dem41/Autorization.Designer.cs @@ -0,0 +1,111 @@ +namespace Dem41 +{ + partial class Autorization + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором форм Windows + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label1.Location = new System.Drawing.Point(63, 54); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(40, 15); + this.label1.TabIndex = 0; + this.label1.Text = "Логин"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label2.Location = new System.Drawing.Point(63, 114); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(48, 15); + this.label2.TabIndex = 1; + this.label2.Text = "Пароль"; + // + // button1 + // + this.button1.BackColor = System.Drawing.Color.Red; + this.button1.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.button1.Location = new System.Drawing.Point(79, 195); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 2; + this.button1.Text = "Войти"; + this.button1.UseVisualStyleBackColor = false; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(66, 70); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 3; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(66, 130); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 20); + this.textBox2.TabIndex = 4; + // + // Autorization + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(237)))), ((int)(((byte)(215))))); + this.ClientSize = new System.Drawing.Size(241, 299); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "Autorization"; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Autorization_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + } +} + diff --git a/Dem41/Autorization.cs b/Dem41/Autorization.cs new file mode 100644 index 0000000..be7fd29 --- /dev/null +++ b/Dem41/Autorization.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Runtime.Remoting.Contexts; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Dem41 +{ + public partial class Autorization : Form + { + public Autorization() + { + InitializeComponent(); + } + + private void Autorization_Load(object sender, EventArgs e) + { + var user = context.Clients.Local.Where(x => x.Login == login && x.Password == password).FirstOrDefault(); + if (user != null) + { + Hide(); + new MainForm().Show(); + } + + else + { + MessageBox.Show("Неправильный логин или пароль"); + } + } + + private void button1_Click(object sender, EventArgs e) + { + Login(logintextBox.Text, passwordTextBox.Text); + } + + private void label3_Click(object sender, EventArgs e) + { + + } + + private void AutorizationForm_Load(object sender, EventArgs e) + { + context = new(); + context.Database.EnsureCreated(); + context.Clients.Load(); + + clientBindingSource.DataSource = context.Clients.Local.ToBindingList(); + } + } +} + + \ No newline at end of file diff --git a/Dem41/Autorization.resx b/Dem41/Autorization.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Dem41/Autorization.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/Dem41/Dem41.csproj b/Dem41/Dem41.csproj new file mode 100644 index 0000000..dad8452 --- /dev/null +++ b/Dem41/Dem41.csproj @@ -0,0 +1,101 @@ + + + + + Debug + AnyCPU + {A0B2EAF6-3C0E-42DA-84F8-A1F70AF38663} + WinExe + Dem41 + Dem41 + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Autorization.cs + + + Form + + + EditForm.cs + + + Form + + + MainForm.cs + + + + + Autorization.cs + + + EditForm.cs + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Dem41/EditForm.Designer.cs b/Dem41/EditForm.Designer.cs new file mode 100644 index 0000000..a39c992 --- /dev/null +++ b/Dem41/EditForm.Designer.cs @@ -0,0 +1,237 @@ +namespace Dem41 +{ + partial class EditForm + { + /// + /// 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.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.comboBox3 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label1.Location = new System.Drawing.Point(24, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(77, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Артикуль"; + this.label1.Click += new System.EventHandler(this.label1_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label2.Location = new System.Drawing.Point(24, 92); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(39, 20); + this.label2.TabIndex = 1; + this.label2.Text = "Имя"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label3.Location = new System.Drawing.Point(24, 155); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(83, 20); + this.label3.TabIndex = 2; + this.label3.Text = "Описание"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label4.Location = new System.Drawing.Point(24, 237); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(125, 20); + this.label4.TabIndex = 3; + this.label4.Text = "Производитель"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label5.Location = new System.Drawing.Point(218, 237); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(92, 20); + this.label5.TabIndex = 4; + this.label5.Text = "Поставщик"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label6.Location = new System.Drawing.Point(24, 303); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(45, 20); + this.label6.TabIndex = 5; + this.label6.Text = "Цена"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label7.Location = new System.Drawing.Point(218, 303); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(141, 20); + this.label7.TabIndex = 6; + this.label7.Text = "Остаток на складе"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label8.Location = new System.Drawing.Point(24, 375); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(154, 20); + this.label8.TabIndex = 7; + this.label8.Text = "Единица измерения"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(28, 55); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 8; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(28, 115); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 20); + this.textBox2.TabIndex = 9; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(28, 179); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(100, 20); + this.textBox3.TabIndex = 10; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(28, 326); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(100, 20); + this.textBox4.TabIndex = 11; + // + // textBox5 + // + this.textBox5.Location = new System.Drawing.Point(222, 326); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(100, 20); + this.textBox5.TabIndex = 12; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(28, 260); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 21); + this.comboBox1.TabIndex = 13; + // + // comboBox2 + // + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Location = new System.Drawing.Point(222, 259); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(121, 21); + this.comboBox2.TabIndex = 14; + // + // comboBox3 + // + this.comboBox3.FormattingEnabled = true; + this.comboBox3.Location = new System.Drawing.Point(28, 399); + this.comboBox3.Name = "comboBox3"; + this.comboBox3.Size = new System.Drawing.Size(121, 21); + this.comboBox3.TabIndex = 15; + // + // EditForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(237)))), ((int)(((byte)(215))))); + this.ClientSize = new System.Drawing.Size(371, 480); + this.Controls.Add(this.comboBox3); + this.Controls.Add(this.comboBox2); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "EditForm"; + this.Text = "EditForm"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.ComboBox comboBox3; + } +} \ No newline at end of file diff --git a/Dem41/EditForm.cs b/Dem41/EditForm.cs new file mode 100644 index 0000000..ee8002d --- /dev/null +++ b/Dem41/EditForm.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 Dem41 +{ + public partial class EditForm : Form + { + public EditForm() + { + InitializeComponent(); + } + + private void label1_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Dem41/EditForm.resx b/Dem41/EditForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Dem41/EditForm.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/Dem41/MainForm.Designer.cs b/Dem41/MainForm.Designer.cs new file mode 100644 index 0000000..fbaa303 --- /dev/null +++ b/Dem41/MainForm.Designer.cs @@ -0,0 +1,145 @@ +namespace Dem41 +{ + partial class MainForm + { + /// + /// 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.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(12, 77); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.Size = new System.Drawing.Size(657, 259); + this.dataGridView1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label1.Location = new System.Drawing.Point(12, 19); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(57, 20); + this.label1.TabIndex = 1; + this.label1.Text = "Поиск"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 42); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(657, 20); + this.textBox1.TabIndex = 2; + // + // button1 + // + this.button1.BackColor = System.Drawing.Color.Red; + this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.button1.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.button1.Location = new System.Drawing.Point(12, 354); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(100, 30); + this.button1.TabIndex = 3; + this.button1.Text = "Сохранить"; + this.button1.UseVisualStyleBackColor = false; + // + // button2 + // + this.button2.BackColor = System.Drawing.Color.Red; + this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.button2.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.button2.Location = new System.Drawing.Point(118, 354); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(100, 30); + this.button2.TabIndex = 4; + this.button2.Text = "Добавить"; + this.button2.UseVisualStyleBackColor = false; + // + // button3 + // + this.button3.BackColor = System.Drawing.Color.Red; + this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.button3.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.button3.Location = new System.Drawing.Point(224, 354); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(100, 30); + this.button3.TabIndex = 5; + this.button3.Text = "Изменить"; + this.button3.UseVisualStyleBackColor = false; + // + // button4 + // + this.button4.BackColor = System.Drawing.Color.Red; + this.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.button4.Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.button4.Location = new System.Drawing.Point(330, 354); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(100, 30); + this.button4.TabIndex = 6; + this.button4.Text = "Удалить"; + this.button4.UseVisualStyleBackColor = false; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(237)))), ((int)(((byte)(215))))); + this.ClientSize = new System.Drawing.Size(681, 464); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.dataGridView1); + this.Name = "MainForm"; + this.Text = " "; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + } +} \ No newline at end of file diff --git a/Dem41/MainForm.cs b/Dem41/MainForm.cs new file mode 100644 index 0000000..4cb4ba9 --- /dev/null +++ b/Dem41/MainForm.cs @@ -0,0 +1,115 @@ +using System.Windows.Forms; +using System; + +namespace Dem41 + + public partial class MainForm : Form + { + + + public MainForm() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + + public void Save() + { + context.SaveChanges(); + dataGridView1.Refresh(); + } + + private void MainForm_Load(object sender, EventArgs e) + { + context = new(); + context.Database.EnsureCreated(); + + context.Tovars.Include(x => x.Categoria) + .Include(x => x.Proizvoditel). + Include(x => x.Postavshick). + Include(x => x.EdIzm).Load(); + + context.Categories.Load(); + context.Proizvoditels.Load(); + context.Postovshiks.Load(); + context.EdenitsaIzmerenia.Load(); + + tovarBindingSource.DataSource = context.Tovars.Local.ToBindingList(); + categoriaBindingSource.DataSource = context.Categories.Local.ToBindingList(); + postovshickBindingSource.DataSource = context.Postovshiks.Local.ToBindingList(); + proizvoditelBindingSource.DataSource = context.Proizvoditels.Local.ToBindingList(); + edenitsa_izmereniaBindingSource.DataSource = context.EdenitsaIzmerenia.Local.ToBindingList(); + + Populate(); + } + + private void saveButton_Click(object sender, EventArgs e) => Save(); + + private void addButton_Click(object sender, EventArgs e) + { + EditForm addForm = new EditForm(); + addForm.tovarBindingSource.DataSource = tovarBindingSource.AddNew(); + ((Tovar)addForm.tovarBindingSource.DataSource).CategoriaId = 0; + ((Tovar)addForm.tovarBindingSource.DataSource).ProizvoditelId = 0; + ((Tovar)addForm.tovarBindingSource.DataSource).EdIzmId = 0; + + addForm.proizvoditelBindingSource.DataSource = proizvoditelBindingSource.DataSource; + addForm.postovshikBindingSource.DataSource = postovshickBindingSource.DataSource; + addForm.edenitsaIzmereniumBindingSource.DataSource = edenitsa_izmereniaBindingSource.DataSource; + + addForm.onSave += () => + { + Save(); + }; + + addForm.ShowDialog(); + } + + private void editButton_Click(object sender, EventArgs e) + { + if (tovarBindingSource.Current == null) + { + MessageBox.Show("Выберите столбец"); return; + } + + EditForm editForm = new EditForm(); + editForm.tovarBindingSource.DataSource = tovarBindingSource.Current; + editForm.proizvoditelBindingSource.DataSource = proizvoditelBindingSource.DataSource; + editForm.postovshikBindingSource.DataSource = postovshickBindingSource.DataSource; + editForm.edenitsaIzmereniumBindingSource.DataSource = edenitsa_izmereniaBindingSource.DataSource; + + editForm.onSave += () => + { + Save(); + }; + + editForm.ShowDialog(); + } + + private void backButton_Click(object sender, EventArgs e) + { + new AutorizationForm().Show(); + Hide(); + } + + private void Populate() + { + foreach (var item in tovarBindingSource) + { + TovarCard tovarCard = new(); + tovarCard.tovarBindingSource.DataSource = item; + flowLayoutPanel1.Controls.Add(tovarCard); + } + } + + private void nameFilterBox_TextChanged(object sender, EventArgs e) + { + tovarBindingSource.Filter = nameFilterBox.Text; + dataGridView1.Refresh(); + } + } +} diff --git a/Dem41/MainForm.resx b/Dem41/MainForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Dem41/MainForm.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/Dem41/Program.cs b/Dem41/Program.cs new file mode 100644 index 0000000..f347060 --- /dev/null +++ b/Dem41/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Dem41 +{ + internal static class Program + { + /// + /// Главная точка входа для приложения. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Autorization()); + } + } +} diff --git a/Dem41/Properties/AssemblyInfo.cs b/Dem41/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b9f2ecd --- /dev/null +++ b/Dem41/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанных со сборкой. +[assembly: AssemblyTitle("Dem41")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Dem41")] +[assembly: AssemblyCopyright("Copyright © 2026")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, следует установить атрибут ComVisible в TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("a0b2eaf6-3c0e-42da-84f8-a1f70af38663")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dem41/Properties/Resources.Designer.cs b/Dem41/Properties/Resources.Designer.cs new file mode 100644 index 0000000..74a0e57 --- /dev/null +++ b/Dem41/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + +namespace Dem41.Properties +{ + + + /// + /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// + // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder + // класс с помощью таких средств, как ResGen или Visual Studio. + // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen + // с параметром /str или заново постройте свой VS-проект. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Dem41.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Переопределяет свойство CurrentUICulture текущего потока для всех + /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Dem41/Properties/Resources.resx b/Dem41/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Dem41/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Dem41/Properties/Settings.Designer.cs b/Dem41/Properties/Settings.Designer.cs new file mode 100644 index 0000000..5634c1b --- /dev/null +++ b/Dem41/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Dem41.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Dem41/Properties/Settings.settings b/Dem41/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Dem41/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +