привязка статей затрат к заявкам
This commit is contained in:
parent
40faac2b71
commit
95e2b5f94f
@ -9,6 +9,9 @@ namespace CarServiceContracts.ViewModels
|
|||||||
[DisplayName("Количество")]
|
[DisplayName("Количество")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public int ItemId { get; set; }
|
public int ItemId { get; set; }
|
||||||
|
[DisplayName("Номер заявки")]
|
||||||
public int RepairRequestId { get; set; }
|
public int RepairRequestId { get; set; }
|
||||||
|
[DisplayName("Статья затрат")]
|
||||||
|
public string ItemName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
using CarServiceContracts.BindingModels;
|
||||||
|
using CarServiceContracts.SearchModels;
|
||||||
|
using CarServiceContracts.StorageContracts;
|
||||||
|
using CarServiceContracts.ViewModels;
|
||||||
|
using CarServiceDatabase.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace CarServiceDatabase.Implements
|
||||||
|
{
|
||||||
|
public class ItemForRepairStorage : IItemForRepairStorage
|
||||||
|
{
|
||||||
|
public List<ItemForRepairViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
return context.ItemsForRepair
|
||||||
|
.Include(x => x.Item)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
public List<ItemForRepairViewModel> GetFilteredList(ItemForRepairSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
return context.ItemsForRepair
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
|
.Include(x => x.Item)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
public ItemForRepairViewModel? GetElement(ItemForRepairSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
if (model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return context.ItemsForRepair
|
||||||
|
.Include(x => x.Item)
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public ItemForRepairViewModel? Insert(ItemForRepairBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
var newItemForRepair = ItemForRepair.Create(context, model);
|
||||||
|
if (newItemForRepair != null)
|
||||||
|
{
|
||||||
|
context.ItemsForRepair.Add(newItemForRepair);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newItemForRepair.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public ItemForRepairViewModel? Update(ItemForRepairBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
var itemForRepair = context.ItemsForRepair.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (itemForRepair == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
itemForRepair.Update(context, model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return itemForRepair.GetViewModel;
|
||||||
|
}
|
||||||
|
public ItemForRepairViewModel? Delete(ItemForRepairBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
var itemForRepair = context.ItemsForRepair.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (itemForRepair == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.ItemsForRepair.Remove(itemForRepair);
|
||||||
|
context.SaveChanges();
|
||||||
|
return itemForRepair.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
using CarServiceContracts.BindingModels;
|
||||||
|
using CarServiceContracts.SearchModels;
|
||||||
|
using CarServiceContracts.StorageContracts;
|
||||||
|
using CarServiceContracts.ViewModels;
|
||||||
|
using CarServiceDatabase.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace CarServiceDatabase.Implements
|
||||||
|
{
|
||||||
|
public class RepairRequestStorage : IRepairRequestStorage
|
||||||
|
{
|
||||||
|
public List<RepairRequestViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
return context.RepairRequests
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
public List<RepairRequestViewModel> GetFilteredList(RepairRequestSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
return context.RepairRequests
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
public RepairRequestViewModel? GetElement(RepairRequestSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
if (model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return context.RepairRequests
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public RepairRequestViewModel? Insert(RepairRequestBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
var newRepairRequest = RepairRequest.Create(model);
|
||||||
|
if (newRepairRequest != null)
|
||||||
|
{
|
||||||
|
context.RepairRequests.Add(newRepairRequest);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newRepairRequest.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public RepairRequestViewModel? Update(RepairRequestBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
var repairRequest = context.RepairRequests.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (repairRequest == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
repairRequest.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return repairRequest.GetViewModel;
|
||||||
|
}
|
||||||
|
public RepairRequestViewModel? Delete(RepairRequestBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new CarServiceDbContext();
|
||||||
|
var repairRequest = context.RepairRequests.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (repairRequest == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.RepairRequests.Remove(repairRequest);
|
||||||
|
context.SaveChanges();
|
||||||
|
return repairRequest.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
404
CarService/CarServiceDatabase/Migrations/20230405185109_DateFixMigration.Designer.cs
generated
Normal file
404
CarService/CarServiceDatabase/Migrations/20230405185109_DateFixMigration.Designer.cs
generated
Normal file
@ -0,0 +1,404 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using CarServiceDatabase;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CarServiceDatabase.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(CarServiceDbContext))]
|
||||||
|
[Migration("20230405185109_DateFixMigration")]
|
||||||
|
partial class DateFixMigration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Customers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal (10,2)");
|
||||||
|
|
||||||
|
b.Property<int>("WorkerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("WorkerId");
|
||||||
|
|
||||||
|
b.ToTable("Items");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ItemId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RepairRequestId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ItemId");
|
||||||
|
|
||||||
|
b.HasIndex("RepairRequestId");
|
||||||
|
|
||||||
|
b.ToTable("ItemsForRepair");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreated")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<int>("VehicleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VehicleId");
|
||||||
|
|
||||||
|
b.ToTable("RepairRequests");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CustomerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Plate")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("VIN")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CustomerId");
|
||||||
|
|
||||||
|
b.ToTable("Vehicles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<decimal>("Duration")
|
||||||
|
.HasColumnType("decimal (3,1)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal (10,2)");
|
||||||
|
|
||||||
|
b.Property<int>("WorkerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("WorkerId");
|
||||||
|
|
||||||
|
b.ToTable("Works");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<decimal>("Cost")
|
||||||
|
.HasColumnType("decimal (10,2)");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RepairRequestId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RepairRequestId");
|
||||||
|
|
||||||
|
b.HasIndex("WorkId");
|
||||||
|
|
||||||
|
b.ToTable("WorksInRequest");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("DatePayment")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<decimal>("Sum")
|
||||||
|
.HasColumnType("decimal (10,2)");
|
||||||
|
|
||||||
|
b.Property<int>("WorkInRequestId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("WorkInRequestId");
|
||||||
|
|
||||||
|
b.ToTable("WorkPayments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Workers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.Worker", "Worker")
|
||||||
|
.WithMany("Items")
|
||||||
|
.HasForeignKey("WorkerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Worker");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.Item", "Item")
|
||||||
|
.WithMany("ItemsForRepair")
|
||||||
|
.HasForeignKey("ItemId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("CarServiceDatabase.Models.RepairRequest", "RepairRequest")
|
||||||
|
.WithMany("ItemsForRepair")
|
||||||
|
.HasForeignKey("RepairRequestId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Item");
|
||||||
|
|
||||||
|
b.Navigation("RepairRequest");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.Vehicle", "Vehicle")
|
||||||
|
.WithMany("RepairRequests")
|
||||||
|
.HasForeignKey("VehicleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Vehicle");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.Customer", "Customer")
|
||||||
|
.WithMany("Vehicles")
|
||||||
|
.HasForeignKey("CustomerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Customer");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.Worker", "Worker")
|
||||||
|
.WithMany("Works")
|
||||||
|
.HasForeignKey("WorkerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Worker");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.RepairRequest", "RepairRequest")
|
||||||
|
.WithMany("WorksInRequest")
|
||||||
|
.HasForeignKey("RepairRequestId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("CarServiceDatabase.Models.Work", "Work")
|
||||||
|
.WithMany("WorksInRequest")
|
||||||
|
.HasForeignKey("WorkId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("RepairRequest");
|
||||||
|
|
||||||
|
b.Navigation("Work");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("CarServiceDatabase.Models.WorkInRequest", "WorkInRequest")
|
||||||
|
.WithMany("WorkPayments")
|
||||||
|
.HasForeignKey("WorkInRequestId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("WorkInRequest");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Vehicles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ItemsForRepair");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ItemsForRepair");
|
||||||
|
|
||||||
|
b.Navigation("WorksInRequest");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RepairRequests");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("WorksInRequest");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("WorkPayments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Items");
|
||||||
|
|
||||||
|
b.Navigation("Works");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CarServiceDatabase.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class DateFixMigration : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "DatePayment",
|
||||||
|
table: "WorkPayments",
|
||||||
|
type: "date",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime2");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "DateCreated",
|
||||||
|
table: "RepairRequests",
|
||||||
|
type: "date",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime2");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "DatePayment",
|
||||||
|
table: "WorkPayments",
|
||||||
|
type: "datetime2",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "date");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "DateCreated",
|
||||||
|
table: "RepairRequests",
|
||||||
|
type: "datetime2",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "date");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -114,7 +114,7 @@ namespace CarServiceDatabase.Migrations
|
|||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
b.Property<DateTime>("DateCreated")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<int>("VehicleId")
|
b.Property<int>("VehicleId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
@ -220,7 +220,7 @@ namespace CarServiceDatabase.Migrations
|
|||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<DateTime>("DatePayment")
|
b.Property<DateTime>("DatePayment")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<decimal>("Sum")
|
b.Property<decimal>("Sum")
|
||||||
.HasColumnType("decimal (10,2)");
|
.HasColumnType("decimal (10,2)");
|
||||||
|
@ -16,7 +16,7 @@ namespace CarServiceDatabase.Models
|
|||||||
public int RepairRequestId { get; private set; }
|
public int RepairRequestId { get; private set; }
|
||||||
public virtual Item Item { get; set; } = new();
|
public virtual Item Item { get; set; } = new();
|
||||||
public virtual RepairRequest RepairRequest { get; set; } = new();
|
public virtual RepairRequest RepairRequest { get; set; } = new();
|
||||||
public static ItemForRepair? Create(ItemForRepairBindingModel? model)
|
public static ItemForRepair? Create(CarServiceDbContext context, ItemForRepairBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -26,21 +26,21 @@ namespace CarServiceDatabase.Models
|
|||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
ItemId = model.ItemId,
|
Item = context.Items.First(x => x.Id == model.ItemId),
|
||||||
RepairRequestId = model.RepairRequestId
|
RepairRequest = context.RepairRequests.First(x => x.Id == model.RepairRequestId)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static ItemForRepair Create(ItemForRepairViewModel model)
|
public static ItemForRepair Create(CarServiceDbContext context, ItemForRepairViewModel model)
|
||||||
{
|
{
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
ItemId = model.ItemId,
|
Item = context.Items.First(x => x.Id == model.ItemId),
|
||||||
RepairRequestId = model.RepairRequestId
|
RepairRequest = context.RepairRequests.First(x => x.Id == model.RepairRequestId)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(ItemForRepairBindingModel? model)
|
public void Update(CarServiceDbContext context, ItemForRepairBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -56,7 +56,8 @@ namespace CarServiceDatabase.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
ItemId = ItemId,
|
ItemId = ItemId,
|
||||||
RepairRequestId = RepairRequestId
|
RepairRequestId = RepairRequestId,
|
||||||
|
ItemName = Item.Name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace CarServiceDatabase.Models
|
|||||||
public class RepairRequest : IRepairRequestModel
|
public class RepairRequest : IRepairRequestModel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[Required]
|
[Required, Column(TypeName = "date")]
|
||||||
public DateTime DateCreated { get; private set; } = DateTime.Now;
|
public DateTime DateCreated { get; private set; } = DateTime.Now;
|
||||||
[Required]
|
[Required]
|
||||||
public int VehicleId { get; private set; }
|
public int VehicleId { get; private set; }
|
||||||
|
@ -10,7 +10,7 @@ namespace CarServiceDatabase.Models
|
|||||||
public class WorkPayment : IWorkPaymentModel
|
public class WorkPayment : IWorkPaymentModel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[Required]
|
[Required, Column(TypeName = "date")]
|
||||||
public DateTime DatePayment { get; private set; } = DateTime.Now;
|
public DateTime DatePayment { get; private set; } = DateTime.Now;
|
||||||
[Required, Column(TypeName = "decimal (10,2)")]
|
[Required, Column(TypeName = "decimal (10,2)")]
|
||||||
public decimal Sum { get; private set; }
|
public decimal Sum { get; private set; }
|
||||||
|
132
CarService/CarServiceView/FormAddItemForRepairTest.Designer.cs
generated
Normal file
132
CarService/CarServiceView/FormAddItemForRepairTest.Designer.cs
generated
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
namespace CarServiceView
|
||||||
|
{
|
||||||
|
partial class FormAddItemForRepairTest
|
||||||
|
{
|
||||||
|
/// <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.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||||
|
this.comboBoxRepairRequest = new System.Windows.Forms.ComboBox();
|
||||||
|
this.comboBoxItem = new System.Windows.Forms.ComboBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(36, 125);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.buttonAdd.TabIndex = 9;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(12, 67);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(72, 15);
|
||||||
|
this.label3.TabIndex = 6;
|
||||||
|
this.label3.Text = "Количество";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(12, 38);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(80, 15);
|
||||||
|
this.label2.TabIndex = 7;
|
||||||
|
this.label2.Text = "Статья затрат";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(44, 15);
|
||||||
|
this.label1.TabIndex = 8;
|
||||||
|
this.label1.Text = "Заявка";
|
||||||
|
//
|
||||||
|
// textBoxCount
|
||||||
|
//
|
||||||
|
this.textBoxCount.Location = new System.Drawing.Point(110, 64);
|
||||||
|
this.textBoxCount.Name = "textBoxCount";
|
||||||
|
this.textBoxCount.Size = new System.Drawing.Size(100, 23);
|
||||||
|
this.textBoxCount.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// comboBoxRepairRequest
|
||||||
|
//
|
||||||
|
this.comboBoxRepairRequest.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxRepairRequest.FormattingEnabled = true;
|
||||||
|
this.comboBoxRepairRequest.Location = new System.Drawing.Point(110, 12);
|
||||||
|
this.comboBoxRepairRequest.Name = "comboBoxRepairRequest";
|
||||||
|
this.comboBoxRepairRequest.Size = new System.Drawing.Size(121, 23);
|
||||||
|
this.comboBoxRepairRequest.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// comboBoxItem
|
||||||
|
//
|
||||||
|
this.comboBoxItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxItem.FormattingEnabled = true;
|
||||||
|
this.comboBoxItem.Location = new System.Drawing.Point(110, 38);
|
||||||
|
this.comboBoxItem.Name = "comboBoxItem";
|
||||||
|
this.comboBoxItem.Size = new System.Drawing.Size(121, 23);
|
||||||
|
this.comboBoxItem.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// FormAddItemForRepairTest
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.comboBoxItem);
|
||||||
|
this.Controls.Add(this.comboBoxRepairRequest);
|
||||||
|
this.Controls.Add(this.buttonAdd);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.textBoxCount);
|
||||||
|
this.Name = "FormAddItemForRepairTest";
|
||||||
|
this.Text = "FormAddItemForRepairTest";
|
||||||
|
this.Load += new System.EventHandler(this.FormAddItemForRepairTest_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Label label3;
|
||||||
|
private Label label2;
|
||||||
|
private Label label1;
|
||||||
|
private TextBox textBoxCount;
|
||||||
|
private ComboBox comboBoxRepairRequest;
|
||||||
|
private ComboBox comboBoxItem;
|
||||||
|
}
|
||||||
|
}
|
54
CarService/CarServiceView/FormAddItemForRepairTest.cs
Normal file
54
CarService/CarServiceView/FormAddItemForRepairTest.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using CarServiceContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
|
namespace CarServiceView
|
||||||
|
{
|
||||||
|
public partial class FormAddItemForRepairTest : Form
|
||||||
|
{
|
||||||
|
IItemLogic _itemLogic;
|
||||||
|
IRepairRequestLogic _repairRequestLogic;
|
||||||
|
IItemForRepairLogic _itemForRepairLogic;
|
||||||
|
public FormAddItemForRepairTest(IItemLogic itemLogic, IRepairRequestLogic repairRequestLogic, IItemForRepairLogic itemForRepairLogic)
|
||||||
|
{
|
||||||
|
_itemLogic = itemLogic;
|
||||||
|
_repairRequestLogic = repairRequestLogic;
|
||||||
|
_itemForRepairLogic = itemForRepairLogic;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormAddItemForRepairTest_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
//загружаем заказы
|
||||||
|
var listRR = _repairRequestLogic.ReadList(null);
|
||||||
|
if (listRR != null)
|
||||||
|
{
|
||||||
|
comboBoxRepairRequest.DisplayMember = "Id";
|
||||||
|
comboBoxRepairRequest.ValueMember = "Id";
|
||||||
|
comboBoxRepairRequest.DataSource = listRR;
|
||||||
|
comboBoxRepairRequest.SelectedItem = null;
|
||||||
|
}
|
||||||
|
//загружаем статьи затрат
|
||||||
|
var listI = _itemLogic.ReadList(null);
|
||||||
|
if (listI != null)
|
||||||
|
{
|
||||||
|
comboBoxItem.DisplayMember = "Name";
|
||||||
|
comboBoxItem.ValueMember = "Id";
|
||||||
|
comboBoxItem.DataSource = listI;
|
||||||
|
comboBoxItem.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_itemForRepairLogic.Create(new()
|
||||||
|
{
|
||||||
|
Count = Convert.ToInt32(textBoxCount.Text),
|
||||||
|
ItemId = Convert.ToInt32(comboBoxItem.SelectedValue),
|
||||||
|
RepairRequestId = Convert.ToInt32(comboBoxRepairRequest.SelectedValue)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
CarService/CarServiceView/FormAddItemForRepairTest.resx
Normal file
60
CarService/CarServiceView/FormAddItemForRepairTest.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<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>
|
107
CarService/CarServiceView/FormItemForRepairTest.Designer.cs
generated
Normal file
107
CarService/CarServiceView/FormItemForRepairTest.Designer.cs
generated
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
namespace CarServiceView
|
||||||
|
{
|
||||||
|
partial class FormItemForRepairTest
|
||||||
|
{
|
||||||
|
/// <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.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.updateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.menuStrip.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.addToolStripMenuItem,
|
||||||
|
this.updateToolStripMenuItem,
|
||||||
|
this.deleteToolStripMenuItem});
|
||||||
|
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip.Name = "menuStrip";
|
||||||
|
this.menuStrip.Size = new System.Drawing.Size(800, 24);
|
||||||
|
this.menuStrip.TabIndex = 6;
|
||||||
|
this.menuStrip.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// addToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.addToolStripMenuItem.Name = "addToolStripMenuItem";
|
||||||
|
this.addToolStripMenuItem.Size = new System.Drawing.Size(71, 20);
|
||||||
|
this.addToolStripMenuItem.Text = "Добавить";
|
||||||
|
this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// updateToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.updateToolStripMenuItem.Name = "updateToolStripMenuItem";
|
||||||
|
this.updateToolStripMenuItem.Size = new System.Drawing.Size(73, 20);
|
||||||
|
this.updateToolStripMenuItem.Text = "Изменить";
|
||||||
|
//
|
||||||
|
// deleteToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||||
|
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(63, 20);
|
||||||
|
this.deleteToolStripMenuItem.Text = "Удалить";
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView.Location = new System.Drawing.Point(0, 28);
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.RowTemplate.Height = 25;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(798, 421);
|
||||||
|
this.dataGridView.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// FormItemForRepairTest
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.menuStrip);
|
||||||
|
this.Controls.Add(this.dataGridView);
|
||||||
|
this.Name = "FormItemForRepairTest";
|
||||||
|
this.Text = "FormItemForRepairTest";
|
||||||
|
this.Load += new System.EventHandler(this.FormWorkInRequestTest_Load);
|
||||||
|
this.menuStrip.ResumeLayout(false);
|
||||||
|
this.menuStrip.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem addToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem updateToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem deleteToolStripMenuItem;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
37
CarService/CarServiceView/FormItemForRepairTest.cs
Normal file
37
CarService/CarServiceView/FormItemForRepairTest.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using CarServiceBusinessLogic.BusinessLogics;
|
||||||
|
using CarServiceContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
|
namespace CarServiceView
|
||||||
|
{
|
||||||
|
public partial class FormItemForRepairTest : Form
|
||||||
|
{
|
||||||
|
IItemForRepairLogic _itemForRepairLogic;
|
||||||
|
public FormItemForRepairTest(IItemForRepairLogic itemForRepairLogic)
|
||||||
|
{
|
||||||
|
_itemForRepairLogic = itemForRepairLogic;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormWorkInRequestTest_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
var list = _itemForRepairLogic.ReadList(null);
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ItemId"].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormAddItemForRepairTest));
|
||||||
|
if (service is FormAddItemForRepairTest form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
CarService/CarServiceView/FormItemForRepairTest.resx
Normal file
63
CarService/CarServiceView/FormItemForRepairTest.resx
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<root>
|
||||||
|
<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>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
@ -19,7 +19,7 @@ namespace CarServiceView
|
|||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
ConfigureServices(services);
|
ConfigureServices(services);
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormItemTest>());
|
Application.Run(_serviceProvider.GetRequiredService<FormItemForRepairTest>());
|
||||||
}
|
}
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
@ -41,12 +41,16 @@ namespace CarServiceView
|
|||||||
services.AddTransient<IWorkerStorage, WorkerStorage>();
|
services.AddTransient<IWorkerStorage, WorkerStorage>();
|
||||||
services.AddTransient<IWorkStorage, WorkStorage>();
|
services.AddTransient<IWorkStorage, WorkStorage>();
|
||||||
services.AddTransient<IItemStorage, ItemStorage>();
|
services.AddTransient<IItemStorage, ItemStorage>();
|
||||||
|
services.AddTransient<IItemForRepairStorage, ItemForRepairStorage>();
|
||||||
|
services.AddTransient<IRepairRequestStorage, RepairRequestStorage>();
|
||||||
|
|
||||||
services.AddTransient<FormRegistrationWorker>();
|
services.AddTransient<FormRegistrationWorker>();
|
||||||
services.AddTransient<FormWorkTest>();
|
services.AddTransient<FormWorkTest>();
|
||||||
services.AddTransient<FormAddWorkTest>();
|
services.AddTransient<FormAddWorkTest>();
|
||||||
services.AddTransient<FormItemTest>();
|
services.AddTransient<FormItemTest>();
|
||||||
services.AddTransient<FormAddItemTest>();
|
services.AddTransient<FormAddItemTest>();
|
||||||
|
services.AddTransient<FormItemForRepairTest>();
|
||||||
|
services.AddTransient<FormAddItemForRepairTest>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user