Start create izdeliya

This commit is contained in:
Georgy Khatuncev 2021-07-15 16:58:51 +05:00
parent fa58287edf
commit 8f5e200e19
19 changed files with 692 additions and 20 deletions

Binary file not shown.

@ -14,8 +14,13 @@ namespace Diplom_B.DB
{ {
public DbSet<Zakazchik> Zakazchiki { get; set; } public DbSet<Zakazchik> Zakazchiki { get; set; }
public DbSet<User> Users { get; set; } public DbSet<User> Users { get; set; }
public DbSet<Izdelie> Izdeliya { get; set; }
public MainDB() { Database.EnsureCreated(); }
public MainDB() {
//Database.Migrate();
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
@ -32,15 +37,26 @@ namespace Diplom_B.DB
public string Name { get; set; } public string Name { get; set; }
public string Pass { get; set; } public string Pass { get; set; }
} }
public class Zakazchik public class Zakazchik
{ {
[Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Adres { get; set; } public string Adres { get; set; }
public string Phone { get; set; } public string Phone { get; set; }
} }
public class Izdelie
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string DecNum { get; set; }
public string Shifr { get; set; }
public string Litera { get; set; }
public double Cena { get; set; }
public int OtdelRazrab { get; set; }
public string Ved { get; set; }
public string GlavKonstr { get; set; }
}
} }

@ -242,12 +242,21 @@
<Compile Include="FormLogin.Designer.cs"> <Compile Include="FormLogin.Designer.cs">
<DependentUpon>FormLogin.cs</DependentUpon> <DependentUpon>FormLogin.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="IzdForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="IzdForm.Designer.cs">
<DependentUpon>IzdForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="User.cs" /> <Compile Include="User.cs" />
<EmbeddedResource Include="FormLogin.resx"> <EmbeddedResource Include="FormLogin.resx">
<DependentUpon>FormLogin.cs</DependentUpon> <DependentUpon>FormLogin.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="IzdForm.resx">
<DependentUpon>IzdForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>

30
FormLogin.Designer.cs generated

@ -31,10 +31,10 @@ namespace Diplom_B
{ {
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
@ -42,7 +42,7 @@ namespace Diplom_B
this.button1.Location = new System.Drawing.Point(190, 58); this.button1.Location = new System.Drawing.Point(190, 58);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0; this.button1.TabIndex = 3;
this.button1.Text = "Войти"; this.button1.Text = "Войти";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
@ -56,13 +56,6 @@ namespace Diplom_B
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "Пользователь:"; this.label1.Text = "Пользователь:";
// //
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(101, 6);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(164, 20);
this.textBox1.TabIndex = 3;
//
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
@ -77,7 +70,7 @@ namespace Diplom_B
this.textBox2.Location = new System.Drawing.Point(101, 32); this.textBox2.Location = new System.Drawing.Point(101, 32);
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(164, 20); this.textBox2.Size = new System.Drawing.Size(164, 20);
this.textBox2.TabIndex = 5; this.textBox2.TabIndex = 2;
this.textBox2.UseSystemPasswordChar = true; this.textBox2.UseSystemPasswordChar = true;
// //
// label3 // label3
@ -90,15 +83,28 @@ namespace Diplom_B
this.label3.TabIndex = 6; this.label3.TabIndex = 6;
this.label3.Text = "Отображение ошибки"; this.label3.Text = "Отображение ошибки";
// //
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"Разработчик",
"Конструктор",
"Монтажник",
"Упаковщик"});
this.comboBox1.Location = new System.Drawing.Point(101, 6);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(161, 21);
this.comboBox1.TabIndex = 1;
//
// FormLogin // FormLogin
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(274, 92); this.ClientSize = new System.Drawing.Size(274, 92);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
@ -117,10 +123,10 @@ namespace Diplom_B
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboBox1;
} }
} }

@ -22,7 +22,7 @@ namespace Diplom_B
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
label3.Text = ""; label3.Text = "";
var usr = new User(textBox1.Text, textBox2.Text); var usr = new User(comboBox1.Text, comboBox1.Text);
if (!usr.CheckUser()) if (!usr.CheckUser())
{ {
label3.Text = "Пользователя нет"; label3.Text = "Пользователя нет";
@ -34,6 +34,10 @@ namespace Diplom_B
return; return;
} }
this.Hide();
var izdForm = new IzdForm();
izdForm.Closed += (s, args) => this.Close();
izdForm.Show();
} }
} }
} }

385
IzdForm.Designer.cs generated Normal file

@ -0,0 +1,385 @@

namespace Diplom_B
{
partial class IzdForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.searchBox = new System.Windows.Forms.TextBox();
this.resetSearchButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.vedBox = new System.Windows.Forms.TextBox();
this.otdRazBox = new System.Windows.Forms.TextBox();
this.cenaBox = new System.Windows.Forms.TextBox();
this.literaBox = new System.Windows.Forms.TextBox();
this.shifrBox = new System.Windows.Forms.TextBox();
this.decBox = new System.Windows.Forms.TextBox();
this.idBox = new System.Windows.Forms.TextBox();
this.label2 = 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.glavKonstrBox = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.createButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
this.deleteButton = new System.Windows.Forms.Button();
this.selectButton = new System.Windows.Forms.Button();
this.errorLable = new System.Windows.Forms.Label();
this.nameBox = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.ColumnHeadersVisible = false;
this.dataGridView1.Location = new System.Drawing.Point(345, 38);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.Size = new System.Drawing.Size(470, 384);
this.dataGridView1.TabIndex = 0;
//
// searchBox
//
this.searchBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.searchBox.Location = new System.Drawing.Point(387, 12);
this.searchBox.Name = "searchBox";
this.searchBox.Size = new System.Drawing.Size(347, 20);
this.searchBox.TabIndex = 3;
this.searchBox.Tag = "";
//
// resetSearchButton
//
this.resetSearchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.resetSearchButton.Location = new System.Drawing.Point(740, 10);
this.resetSearchButton.Name = "resetSearchButton";
this.resetSearchButton.Size = new System.Drawing.Size(75, 23);
this.resetSearchButton.TabIndex = 4;
this.resetSearchButton.Text = "Сбросить";
this.resetSearchButton.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(342, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Поиск";
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.nameBox);
this.groupBox1.Controls.Add(this.errorLable);
this.groupBox1.Controls.Add(this.selectButton);
this.groupBox1.Controls.Add(this.deleteButton);
this.groupBox1.Controls.Add(this.changeButton);
this.groupBox1.Controls.Add(this.createButton);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.glavKonstrBox);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.vedBox);
this.groupBox1.Controls.Add(this.otdRazBox);
this.groupBox1.Controls.Add(this.cenaBox);
this.groupBox1.Controls.Add(this.literaBox);
this.groupBox1.Controls.Add(this.shifrBox);
this.groupBox1.Controls.Add(this.decBox);
this.groupBox1.Controls.Add(this.idBox);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Location = new System.Drawing.Point(12, 10);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(324, 412);
this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Информационное окно";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(79, 128);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(44, 13);
this.label5.TabIndex = 10;
this.label5.Text = "Литера";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(87, 102);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(36, 13);
this.label4.TabIndex = 9;
this.label4.Text = "Шифр";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(29, 76);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(94, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Децимальный №";
//
// vedBox
//
this.vedBox.Location = new System.Drawing.Point(129, 203);
this.vedBox.Name = "vedBox";
this.vedBox.Size = new System.Drawing.Size(185, 20);
this.vedBox.TabIndex = 7;
//
// otdRazBox
//
this.otdRazBox.Location = new System.Drawing.Point(129, 177);
this.otdRazBox.Name = "otdRazBox";
this.otdRazBox.Size = new System.Drawing.Size(185, 20);
this.otdRazBox.TabIndex = 6;
//
// cenaBox
//
this.cenaBox.Location = new System.Drawing.Point(129, 151);
this.cenaBox.Name = "cenaBox";
this.cenaBox.Size = new System.Drawing.Size(185, 20);
this.cenaBox.TabIndex = 5;
//
// literaBox
//
this.literaBox.Location = new System.Drawing.Point(129, 125);
this.literaBox.Name = "literaBox";
this.literaBox.Size = new System.Drawing.Size(185, 20);
this.literaBox.TabIndex = 4;
//
// shifrBox
//
this.shifrBox.Location = new System.Drawing.Point(129, 99);
this.shifrBox.Name = "shifrBox";
this.shifrBox.Size = new System.Drawing.Size(185, 20);
this.shifrBox.TabIndex = 3;
//
// decBox
//
this.decBox.Location = new System.Drawing.Point(129, 73);
this.decBox.Name = "decBox";
this.decBox.Size = new System.Drawing.Size(185, 20);
this.decBox.TabIndex = 2;
//
// idBox
//
this.idBox.Location = new System.Drawing.Point(129, 21);
this.idBox.Name = "idBox";
this.idBox.Size = new System.Drawing.Size(185, 20);
this.idBox.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(105, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(18, 13);
this.label2.TabIndex = 0;
this.label2.Text = "№";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(90, 154);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(33, 13);
this.label6.TabIndex = 11;
this.label6.Text = "Цена";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(18, 180);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(105, 13);
this.label7.TabIndex = 12;
this.label7.Text = "Отдел-разработчик";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(71, 206);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(52, 13);
this.label8.TabIndex = 13;
this.label8.Text = "Ведущий";
//
// glavKonstrBox
//
this.glavKonstrBox.Location = new System.Drawing.Point(129, 229);
this.glavKonstrBox.Name = "glavKonstrBox";
this.glavKonstrBox.Size = new System.Drawing.Size(185, 20);
this.glavKonstrBox.TabIndex = 14;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 232);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(117, 13);
this.label9.TabIndex = 15;
this.label9.Text = "Главный конструктор";
//
// createButton
//
this.createButton.Location = new System.Drawing.Point(239, 255);
this.createButton.Name = "createButton";
this.createButton.Size = new System.Drawing.Size(75, 23);
this.createButton.TabIndex = 16;
this.createButton.Text = "Создать";
this.createButton.UseVisualStyleBackColor = true;
this.createButton.Click += new System.EventHandler(this.createButton_Click);
//
// changeButton
//
this.changeButton.Location = new System.Drawing.Point(163, 255);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 17;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
//
// deleteButton
//
this.deleteButton.Location = new System.Drawing.Point(87, 255);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(75, 23);
this.deleteButton.TabIndex = 18;
this.deleteButton.Text = "Удалить";
this.deleteButton.UseVisualStyleBackColor = true;
//
// selectButton
//
this.selectButton.Location = new System.Drawing.Point(239, 284);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
this.selectButton.TabIndex = 19;
this.selectButton.Text = "Выбрать";
this.selectButton.UseVisualStyleBackColor = true;
//
// errorLable
//
this.errorLable.AutoSize = true;
this.errorLable.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.errorLable.ForeColor = System.Drawing.Color.Red;
this.errorLable.Location = new System.Drawing.Point(6, 289);
this.errorLable.Name = "errorLable";
this.errorLable.Size = new System.Drawing.Size(149, 13);
this.errorLable.TabIndex = 20;
this.errorLable.Text = "Информация об ошибке";
//
// nameBox
//
this.nameBox.Location = new System.Drawing.Point(129, 47);
this.nameBox.Name = "nameBox";
this.nameBox.Size = new System.Drawing.Size(185, 20);
this.nameBox.TabIndex = 21;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(40, 50);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(83, 13);
this.label10.TabIndex = 22;
this.label10.Text = "Наименование";
//
// IzdForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(827, 434);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.resetSearchButton);
this.Controls.Add(this.searchBox);
this.Controls.Add(this.dataGridView1);
this.Name = "IzdForm";
this.Text = "IzdForm";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.TextBox searchBox;
private System.Windows.Forms.Button resetSearchButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox vedBox;
private System.Windows.Forms.TextBox otdRazBox;
private System.Windows.Forms.TextBox cenaBox;
private System.Windows.Forms.TextBox literaBox;
private System.Windows.Forms.TextBox shifrBox;
private System.Windows.Forms.TextBox decBox;
private System.Windows.Forms.TextBox idBox;
private System.Windows.Forms.Label errorLable;
private System.Windows.Forms.Button selectButton;
private System.Windows.Forms.Button deleteButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button createButton;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox glavKonstrBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox nameBox;
}
}

130
IzdForm.cs Normal file

@ -0,0 +1,130 @@
using Diplom_B.DB;
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 Diplom_B
{
public partial class IzdForm : Form
{
public IzdForm()
{
InitializeComponent();
errorLable.Visible = false;
try
{
using (var db = new MainDB()){
var res = (from a in db.Izdeliya
select a).ToArray();
UpdateTable(res);
}
}
catch
{
ShowError();
}
}
private void createButton_Click(object sender, EventArgs e)
{
try
{
if (!double.TryParse(cenaBox.Text, out double cena))
{
ShowError("Ошибка цены.");
return;
}
if (!int.TryParse(otdRazBox.Text, out int otdRaz))
{
ShowError("Ошибка отдела-разработчика.");
return;
}
using (var db = new MainDB())
{
var r = new Izdelie()
{
Name = nameBox.Text,
DecNum = decBox.Text,
Shifr = shifrBox.Text,
Litera = literaBox.Text,
Cena = cena,
OtdelRazrab = otdRaz,
Ved = vedBox.Text,
GlavKonstr = glavKonstrBox.Text
};
db.Izdeliya.Add(r);
db.SaveChanges();
var izd = (from a in db.Izdeliya
select a).ToArray();
UpdateTable(izd);
}
}
catch (Exception ex)
{
ShowError(ex.Message);
}
}
private void UpdateTable(Izdelie[] arr)
{
{
var r = dataGridView1.Rows;
while (r.Count > 0)
r.Remove(r[0]);
var c = dataGridView1.Columns;
while (c.Count > 0)
c.Remove(c[0]);
}
{
var c = dataGridView1.Columns;
c.Add("Id", "№");
c["Id"].Width = 4;
c.Add("Name", "Наименование");
c.Add("DecNum", "Децимальный №");
c.Add("Shifr", "Шифр");
c.Add("Litera", "Литера");
c.Add("Cena", "Цена");
c.Add("OtdelRazrab", "Отдел");
c.Add("Ved", "Ведущий");
c.Add("GlavKonstr", "Главный конструктор");
}
{
var r = dataGridView1.Rows;
foreach(var izd in arr)
r.Add(new object[] {
izd.Id,
izd.Name,
izd.DecNum,
izd.Shifr,
izd.Litera,
izd.Cena,
izd.OtdelRazrab,
izd.Ved,
izd.GlavKonstr
});
}
}
private void ShowError(string msg = null)
{
errorLable.Text = string.IsNullOrEmpty(msg) ? "Неизвестная ошибка." : msg;
errorLable.Visible = true;
new Task(() => {
Task.Delay(5000).Wait();
if (InvokeRequired) Invoke((Action)(() => { errorLable.Visible = false; }));
else errorLable.Visible = false;
}).Start();
}
}
}

120
IzdForm.resx Normal file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -15,10 +15,11 @@ namespace Diplom_B
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Init();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormLogin()); Init();
//Application.Run(new FormLogin());
Application.Run(new IzdForm());
} }
static void Init() static void Init()
{ {

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
b8adb16d2dcef24b62fcb89078d0decb74aab707 dca0df6c7585e9532b1eb684c0d45286f26b293c

@ -49,3 +49,4 @@ D:\GIT\Diplom B\obj\Debug\Diplom B.csproj.CopyComplete
D:\GIT\Diplom B\obj\Debug\Diplom B.exe D:\GIT\Diplom B\obj\Debug\Diplom B.exe
D:\GIT\Diplom B\obj\Debug\Diplom B.pdb D:\GIT\Diplom B\obj\Debug\Diplom B.pdb
D:\GIT\Diplom B\obj\Debug\Diplom_B.FormLogin.resources D:\GIT\Diplom B\obj\Debug\Diplom_B.FormLogin.resources
D:\GIT\Diplom B\obj\Debug\Diplom_B.IzdForm.resources

Binary file not shown.

Binary file not shown.

Binary file not shown.