diff --git a/GarmentFactory/GarmentFactoryDatabaseImplement/GarmentFactoryDatabase.cs b/GarmentFactory/GarmentFactoryDatabaseImplement/GarmentFactoryDatabase.cs index 28e6c9a..33b5409 100644 --- a/GarmentFactory/GarmentFactoryDatabaseImplement/GarmentFactoryDatabase.cs +++ b/GarmentFactory/GarmentFactoryDatabaseImplement/GarmentFactoryDatabase.cs @@ -14,7 +14,7 @@ namespace GarmentFactoryDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS01;Initial Catalog=GarmentFactoryDatabaseFulll;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS01;Initial Catalog=GarmentFactoryDatabaseFulll5Laba;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } @@ -23,9 +23,9 @@ namespace GarmentFactoryDatabaseImplement public virtual DbSet TextileComponents { set; get; } public virtual DbSet Orders { set; get; } public virtual DbSet Clients { set; get; } - } - public virtual DbSet Shops { set; get; } + public virtual DbSet Shops { set; get; } - public virtual DbSet ShopTextiles { set; get; } - } + public virtual DbSet ShopTextiles { set; get; } + } + } diff --git a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240407190354_ClientAddition.Designer.cs b/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240407190354_ClientAddition.Designer.cs deleted file mode 100644 index 817baf3..0000000 --- a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240407190354_ClientAddition.Designer.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -using System; -using GarmentFactoryDatabaseImplement; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace GarmentFactoryDatabaseImplement.Migrations -{ - [DbContext(typeof(GarmentFactoryDatabase))] - [Migration("20240407190354_ClientAddition")] - partial class ClientAddition - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Client", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClientFIO") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Password") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Clients"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Component", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ComponentName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cost") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Components"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClientId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("DateCreate") - .HasColumnType("datetime2"); - - b.Property("DateImplement") - .HasColumnType("datetime2"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Sum") - .HasColumnType("float"); - - b.Property("TextileId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("TextileId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Price") - .HasColumnType("float"); - - b.Property("TextileName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Textiles"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ComponentId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("TextileId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ComponentId"); - - b.HasIndex("TextileId"); - - b.ToTable("TextileComponents"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Order", b => - { - b.HasOne("GarmentFactoryDatabaseImplement.Models.Client", "Client") - .WithMany("Orders") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile") - .WithMany("Orders") - .HasForeignKey("TextileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Client"); - - b.Navigation("Textile"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b => - { - b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component") - .WithMany("TextileComponents") - .HasForeignKey("ComponentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile") - .WithMany("Components") - .HasForeignKey("TextileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Component"); - - b.Navigation("Textile"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Client", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Component", b => - { - b.Navigation("TextileComponents"); - }); - - modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b => - { - b.Navigation("Components"); - - b.Navigation("Orders"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240407190354_ClientAddition.cs b/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240407190354_ClientAddition.cs deleted file mode 100644 index 9931a8a..0000000 --- a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240407190354_ClientAddition.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace GarmentFactoryDatabaseImplement.Migrations -{ - /// - public partial class ClientAddition : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ClientId", - table: "Orders", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateTable( - name: "Clients", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Password = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Clients", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_Orders_ClientId", - table: "Orders", - column: "ClientId"); - - migrationBuilder.AddForeignKey( - name: "FK_Orders_Clients_ClientId", - table: "Orders", - column: "ClientId", - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Orders_Clients_ClientId", - table: "Orders"); - - migrationBuilder.DropTable( - name: "Clients"); - - migrationBuilder.DropIndex( - name: "IX_Orders_ClientId", - table: "Orders"); - - migrationBuilder.DropColumn( - name: "ClientId", - table: "Orders"); - } - } -} diff --git a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240419160846_ImplementerAddition.Designer.cs b/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240616112027_InitialMigration.Designer.cs similarity index 84% rename from GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240419160846_ImplementerAddition.Designer.cs rename to GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240616112027_InitialMigration.Designer.cs index 43b0609..8858b89 100644 --- a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240419160846_ImplementerAddition.Designer.cs +++ b/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240616112027_InitialMigration.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace GarmentFactoryDatabaseImplement.Migrations { [DbContext(typeof(GarmentFactoryDatabase))] - [Migration("20240419160846_ImplementerAddition")] - partial class ImplementerAddition + [Migration("20240616112027_InitialMigration")] + partial class InitialMigration { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,6 +25,31 @@ namespace GarmentFactoryDatabaseImplement.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Component", b => { b.Property("Id") @@ -53,6 +78,9 @@ namespace GarmentFactoryDatabaseImplement.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + b.Property("ClientId") + .HasColumnType("int"); + b.Property("Count") .HasColumnType("int"); @@ -73,6 +101,8 @@ namespace GarmentFactoryDatabaseImplement.Migrations b.HasKey("Id"); + b.HasIndex("ClientId"); + b.HasIndex("TextileId"); b.ToTable("Orders"); @@ -179,12 +209,20 @@ namespace GarmentFactoryDatabaseImplement.Migrations modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Order", b => { + b.HasOne("GarmentFactoryDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile") .WithMany("Orders") .HasForeignKey("TextileId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("Client"); + b.Navigation("Textile"); }); @@ -226,6 +264,11 @@ namespace GarmentFactoryDatabaseImplement.Migrations b.Navigation("Textile"); }); + modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Component", b => { b.Navigation("TextileComponents"); diff --git a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240419160846_ImplementerAddition.cs b/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240616112027_InitialMigration.cs similarity index 84% rename from GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240419160846_ImplementerAddition.cs rename to GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240616112027_InitialMigration.cs index a18a2ae..1a7a893 100644 --- a/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240419160846_ImplementerAddition.cs +++ b/GarmentFactory/GarmentFactoryDatabaseImplement/Migrations/20240616112027_InitialMigration.cs @@ -6,12 +6,26 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace GarmentFactoryDatabaseImplement.Migrations { /// - public partial class ImplementerAddition : Migration + public partial class InitialMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { - + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Components", columns: table => new @@ -63,6 +77,7 @@ namespace GarmentFactoryDatabaseImplement.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TextileId = table.Column(type: "int", nullable: false), + ClientId = table.Column(type: "int", nullable: false), Count = table.Column(type: "int", nullable: false), Sum = table.Column(type: "float", nullable: false), Status = table.Column(type: "int", nullable: false), @@ -72,6 +87,12 @@ namespace GarmentFactoryDatabaseImplement.Migrations constraints: table => { table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Orders_Textiles_TextileId", column: x => x.TextileId, @@ -134,6 +155,11 @@ namespace GarmentFactoryDatabaseImplement.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + migrationBuilder.CreateIndex( name: "IX_Orders_TextileId", table: "Orders", @@ -163,7 +189,6 @@ namespace GarmentFactoryDatabaseImplement.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.DropTable( name: "Orders"); @@ -173,6 +198,9 @@ namespace GarmentFactoryDatabaseImplement.Migrations migrationBuilder.DropTable( name: "TextileComponents"); + migrationBuilder.DropTable( + name: "Clients"); + migrationBuilder.DropTable( name: "Shops"); diff --git a/GarmentFactory/GarmentFactoryFileImplement/DataFileSingleton.cs b/GarmentFactory/GarmentFactoryFileImplement/DataFileSingleton.cs index 903c096..30f74bb 100644 --- a/GarmentFactory/GarmentFactoryFileImplement/DataFileSingleton.cs +++ b/GarmentFactory/GarmentFactoryFileImplement/DataFileSingleton.cs @@ -11,20 +11,28 @@ namespace GarmentFactoryFileImplement internal class DataFileSingleton { private static DataFileSingleton? instance; + private readonly string ComponentFileName = "Component.xml"; + private readonly string OrderFileName = "Order.xml"; + private readonly string TextileFileName = "Textile.xml"; + private readonly string ClientFileName = "Client.xml"; + + private readonly string ShopFileName = "Shop.xml"; + public List Components { get; private set; } - private readonly string ShopFileName = "Shop.xml"; - public List Components { get; private set; } + public List Orders { get; private set; } - public List Textils { get; private set; } - public List Clients { get; private set; } - public static DataFileSingleton GetInstance() + public List Textiles { get; private set; } - public List Shops { get; private set; } - public static DataFileSingleton GetInstance() + + public List Clients { get; private set; } + + public List Shops { get; private set; } + + public static DataFileSingleton GetInstance() { if (instance == null) { @@ -32,33 +40,36 @@ namespace GarmentFactoryFileImplement } return instance; } + public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement); + public void SaveTextiles() => SaveData(Textiles, TextileFileName, "Textiles", x => x.GetXElement); + public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); + public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement); + + public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement); + private DataFileSingleton() - public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement); - private DataFileSingleton() { Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Textiles = LoadData(TextileFileName, "Textile", x => Textile.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!; + Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!; } - Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!; - } - private static List? LoadData(string filename, string xmlNodeName, - Func selectFunction) + + private static List? LoadData(string filename, string xmlNodeName, Func selectFunction) { if (File.Exists(filename)) { - return - XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList(); + return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList(); } return new List(); } - private static void SaveData(List data, string filename, string - xmlNodeName, Func selectFunction) + + private static void SaveData(List data, string filename, string xmlNodeName, Func selectFunction) { if (data != null) { diff --git a/GarmentFactory/GarmentFactoryFileImplement/Implements/OrderStorage.cs b/GarmentFactory/GarmentFactoryFileImplement/Implements/OrderStorage.cs index 59bfb9a..d71ff01 100644 --- a/GarmentFactory/GarmentFactoryFileImplement/Implements/OrderStorage.cs +++ b/GarmentFactory/GarmentFactoryFileImplement/Implements/OrderStorage.cs @@ -105,7 +105,7 @@ namespace GarmentFactoryFileImplement.Implements private OrderViewModel AddIntelligence(OrderViewModel model) { - var selectedTextile = source.Textils.FirstOrDefault(x => x.Id == model.TextileId); + var selectedTextile = source.Textiles.FirstOrDefault(x => x.Id == model.TextileId); model.TextileName = selectedTextile?.TextileName ?? string.Empty; var selectedClient = source.Clients.FirstOrDefault(x => x.Id == model.ClientId); model.ClientFIO = selectedClient?.ClientFIO ?? string.Empty; diff --git a/GarmentFactory/GarmentFactoryListImplement/Implements/OrderStorage.cs b/GarmentFactory/GarmentFactoryListImplement/Implements/OrderStorage.cs index 444493a..6285696 100644 --- a/GarmentFactory/GarmentFactoryListImplement/Implements/OrderStorage.cs +++ b/GarmentFactory/GarmentFactoryListImplement/Implements/OrderStorage.cs @@ -43,12 +43,12 @@ namespace GarmentFactoryListImplement.Implements } } } - else if(model.DateFrom.HasValue && model.DateTo.HasValue) + else if (model.DateFrom.HasValue && model.DateTo.HasValue) { foreach (var order in _source.Orders) { if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo) - { + { result.Add(AddIntelligence(order.GetViewModel)); } } diff --git a/GarmentFactory/GarmentFactoryView/FormMain.Designer.cs b/GarmentFactory/GarmentFactoryView/FormMain.Designer.cs index 95cf9a2..bc20f6b 100644 --- a/GarmentFactory/GarmentFactoryView/FormMain.Designer.cs +++ b/GarmentFactory/GarmentFactoryView/FormMain.Designer.cs @@ -32,17 +32,23 @@ справочникиToolStripMenuItem = new ToolStripMenuItem(); компонентыToolStripMenuItem = new ToolStripMenuItem(); изделиеToolStripMenuItem = new ToolStripMenuItem(); + клиентыToolStripMenuItem = new ToolStripMenuItem(); + магазиныToolStripMenuItem = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem(); списокПродуктаToolStripMenuItem = new ToolStripMenuItem(); компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); + списокМагазиновToolStripMenuItem = new ToolStripMenuItem(); + загруженностьМагазиновToolStripMenuItem = new ToolStripMenuItem(); + заказыПоДатамToolStripMenuItem = new ToolStripMenuItem(); + пополнениеМагазинаToolStripMenuItem = new ToolStripMenuItem(); + продажаМагазинаToolStripMenuItem = new ToolStripMenuItem(); dataGridView = new DataGridView(); buttonCreateOrder = new Button(); buttonTakeOrderInWork = new Button(); buttonOrderReady = new Button(); buttonIssuedOrder = new Button(); buttonUpd = new Button(); - клиентыToolStripMenuItem = new ToolStripMenuItem(); menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); @@ -50,16 +56,16 @@ // menuStrip // menuStrip.ImageScalingSize = new Size(20, 20); - menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, пополнениеМагазинаToolStripMenuItem, продажаМагазинаToolStripMenuItem }); menuStrip.Location = new Point(0, 0); menuStrip.Name = "menuStrip"; - menuStrip.Size = new Size(1178, 28); + menuStrip.Size = new Size(1430, 28); menuStrip.TabIndex = 0; menuStrip.Text = "menuStrip1"; // // справочникиToolStripMenuItem // - справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделиеToolStripMenuItem, клиентыToolStripMenuItem }); + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделиеToolStripMenuItem, клиентыToolStripMenuItem, магазиныToolStripMenuItem }); справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Size = new Size(117, 24); справочникиToolStripMenuItem.Text = "Справочники"; @@ -67,20 +73,34 @@ // компонентыToolStripMenuItem // компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; - компонентыToolStripMenuItem.Size = new Size(224, 26); + компонентыToolStripMenuItem.Size = new Size(182, 26); компонентыToolStripMenuItem.Text = "Компоненты"; компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; // // изделиеToolStripMenuItem // изделиеToolStripMenuItem.Name = "изделиеToolStripMenuItem"; - изделиеToolStripMenuItem.Size = new Size(224, 26); + изделиеToolStripMenuItem.Size = new Size(182, 26); изделиеToolStripMenuItem.Text = "Изделие"; изделиеToolStripMenuItem.Click += ИзделиеToolStripMenuItem_Click; // + // клиентыToolStripMenuItem + // + клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; + клиентыToolStripMenuItem.Size = new Size(182, 26); + клиентыToolStripMenuItem.Text = "Клиенты"; + клиентыToolStripMenuItem.Click += КлиентыToolStripMenuItem_Click; + // + // магазиныToolStripMenuItem + // + магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; + магазиныToolStripMenuItem.Size = new Size(182, 26); + магазиныToolStripMenuItem.Text = "Магазины"; + магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click; + // // отчетыToolStripMenuItem // - отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокПродуктаToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem }); + отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокПродуктаToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem, списокМагазиновToolStripMenuItem, загруженностьМагазиновToolStripMenuItem, заказыПоДатамToolStripMenuItem }); отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; отчетыToolStripMenuItem.Size = new Size(73, 24); отчетыToolStripMenuItem.Text = "Отчеты"; @@ -106,6 +126,41 @@ списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Click += СписокЗаказовToolStripMenuItem_Click; // + // списокМагазиновToolStripMenuItem + // + списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem"; + списокМагазиновToolStripMenuItem.Size = new Size(276, 26); + списокМагазиновToolStripMenuItem.Text = "Список магазинов"; + списокМагазиновToolStripMenuItem.Click += СписокМагазиновToolStripMenuItem_Click; + // + // загруженностьМагазиновToolStripMenuItem + // + загруженностьМагазиновToolStripMenuItem.Name = "загруженностьМагазиновToolStripMenuItem"; + загруженностьМагазиновToolStripMenuItem.Size = new Size(276, 26); + загруженностьМагазиновToolStripMenuItem.Text = "Загруженность магазинов"; + загруженностьМагазиновToolStripMenuItem.Click += ЗагруженностьМагазиновToolStripMenuItem_Click; + // + // заказыПоДатамToolStripMenuItem + // + заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem"; + заказыПоДатамToolStripMenuItem.Size = new Size(276, 26); + заказыПоДатамToolStripMenuItem.Text = "Заказы по датам"; + заказыПоДатамToolStripMenuItem.Click += ЗаказыПоДатамToolStripMenuItem_Click; + // + // пополнениеМагазинаToolStripMenuItem + // + пополнениеМагазинаToolStripMenuItem.Name = "пополнениеМагазинаToolStripMenuItem"; + пополнениеМагазинаToolStripMenuItem.Size = new Size(182, 24); + пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина"; + пополнениеМагазинаToolStripMenuItem.Click += ПополнениеМагазинаToolStripMenuItem_Click; + // + // продажаМагазинаToolStripMenuItem + // + продажаМагазинаToolStripMenuItem.Name = "продажаМагазинаToolStripMenuItem"; + продажаМагазинаToolStripMenuItem.Size = new Size(157, 24); + продажаМагазинаToolStripMenuItem.Text = "Продажа магазина"; + продажаМагазинаToolStripMenuItem.Click += ПродажаИзделияToolStripMenuItem_Click; + // // dataGridView // dataGridView.AllowUserToAddRows = false; @@ -120,12 +175,12 @@ dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(944, 427); + dataGridView.Size = new Size(1196, 427); dataGridView.TabIndex = 1; // // buttonCreateOrder // - buttonCreateOrder.Location = new Point(965, 77); + buttonCreateOrder.Location = new Point(1219, 65); buttonCreateOrder.Name = "buttonCreateOrder"; buttonCreateOrder.Size = new Size(199, 36); buttonCreateOrder.TabIndex = 2; @@ -135,7 +190,7 @@ // // buttonTakeOrderInWork // - buttonTakeOrderInWork.Location = new Point(965, 149); + buttonTakeOrderInWork.Location = new Point(1219, 137); buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Size = new Size(199, 36); buttonTakeOrderInWork.TabIndex = 3; @@ -145,7 +200,7 @@ // // buttonOrderReady // - buttonOrderReady.Location = new Point(963, 222); + buttonOrderReady.Location = new Point(1217, 210); buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Size = new Size(199, 36); buttonOrderReady.TabIndex = 4; @@ -155,7 +210,7 @@ // // buttonIssuedOrder // - buttonIssuedOrder.Location = new Point(965, 305); + buttonIssuedOrder.Location = new Point(1219, 293); buttonIssuedOrder.Name = "buttonIssuedOrder"; buttonIssuedOrder.Size = new Size(199, 36); buttonIssuedOrder.TabIndex = 5; @@ -165,7 +220,7 @@ // // buttonUpd // - buttonUpd.Location = new Point(965, 384); + buttonUpd.Location = new Point(1219, 372); buttonUpd.Name = "buttonUpd"; buttonUpd.Size = new Size(197, 36); buttonUpd.TabIndex = 6; @@ -173,18 +228,11 @@ buttonUpd.UseVisualStyleBackColor = true; buttonUpd.Click += ButtonUpd_Click; // - // клиентыToolStripMenuItem - // - клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; - клиентыToolStripMenuItem.Size = new Size(224, 26); - клиентыToolStripMenuItem.Text = "Клиенты"; - клиентыToolStripMenuItem.Click += КлиентыToolStripMenuItem_Click; - // // FormMain // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1178, 463); + ClientSize = new Size(1430, 463); Controls.Add(buttonUpd); Controls.Add(buttonIssuedOrder); Controls.Add(buttonOrderReady); @@ -221,5 +269,11 @@ private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem клиентыToolStripMenuItem; + private ToolStripMenuItem магазиныToolStripMenuItem; + private ToolStripMenuItem пополнениеМагазинаToolStripMenuItem; + private ToolStripMenuItem продажаМагазинаToolStripMenuItem; + private ToolStripMenuItem списокМагазиновToolStripMenuItem; + private ToolStripMenuItem загруженностьМагазиновToolStripMenuItem; + private ToolStripMenuItem заказыПоДатамToolStripMenuItem; } } \ No newline at end of file diff --git a/GarmentFactory/GarmentFactoryView/FormMain.cs b/GarmentFactory/GarmentFactoryView/FormMain.cs index 1081366..63d39ba 100644 --- a/GarmentFactory/GarmentFactoryView/FormMain.cs +++ b/GarmentFactory/GarmentFactoryView/FormMain.cs @@ -240,5 +240,14 @@ namespace GarmentFactoryView form.ShowDialog(); } } + + private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormClients)); + if (service is FormClients form) + { + form.ShowDialog(); + } + } } } diff --git a/GarmentFactory/GarmentFactoryView/Program.cs b/GarmentFactory/GarmentFactoryView/Program.cs index e1db9c2..f20a997 100644 --- a/GarmentFactory/GarmentFactoryView/Program.cs +++ b/GarmentFactory/GarmentFactoryView/Program.cs @@ -34,21 +34,15 @@ namespace GarmentFactoryView services.AddTransient(); services.AddTransient(); services.AddTransient(); -<<<<<<< HEAD services.AddTransient(); -======= services.AddTransient(); ->>>>>>> laba4_hard services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); -<<<<<<< HEAD services.AddTransient(); -======= ->>>>>>> laba4_hard services.AddTransient(); services.AddTransient(); @@ -67,12 +61,9 @@ namespace GarmentFactoryView services.AddTransient(); services.AddTransient(); services.AddTransient(); -<<<<<<< HEAD services.AddTransient(); -======= services.AddTransient(); services.AddTransient(); ->>>>>>> laba4_hard } }