доработка
This commit is contained in:
parent
090d50e663
commit
90186bb7a9
@ -16,6 +16,7 @@ namespace BusinessBL.BusinessBL
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly ICarStorage _carStorage;
|
private readonly ICarStorage _carStorage;
|
||||||
|
|
||||||
public CarBL(ILogger<CarBL> logger, ICarStorage carStorage)
|
public CarBL(ILogger<CarBL> logger, ICarStorage carStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
@ -16,10 +16,14 @@ namespace BusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IVoyageStorage _voyageStorage;
|
private readonly IVoyageStorage _voyageStorage;
|
||||||
public VoyageBL(ILogger<VoyageBL> logger, IVoyageStorage voyageStorage)
|
private readonly IRouteStorage _routeStorage;
|
||||||
|
private readonly ICompanyStorage _companyStorage;
|
||||||
|
public VoyageBL(ILogger<VoyageBL> logger, IVoyageStorage voyageStorage,IRouteStorage routeStorage,ICompanyStorage companyStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_voyageStorage = voyageStorage;
|
_voyageStorage = voyageStorage;
|
||||||
|
_routeStorage = routeStorage;
|
||||||
|
_companyStorage = companyStorage;
|
||||||
}
|
}
|
||||||
public List<VoyageVM>? ReadList(VoyageSM? model)
|
public List<VoyageVM>? ReadList(VoyageSM? model)
|
||||||
{
|
{
|
||||||
@ -108,5 +112,59 @@ namespace BusinessLogic.BusinessLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public List<ReportHuman> GetTopDrivers()
|
||||||
|
{
|
||||||
|
|
||||||
|
var list = _voyageStorage.GetFilteredList(new VoyageSM
|
||||||
|
{
|
||||||
|
|
||||||
|
DateStart = DateTime.SpecifyKind(DateTime.Now.AddYears(-1), DateTimeKind.Utc),
|
||||||
|
DateEnd = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
List<ReportHuman> reportList = new List<ReportHuman>();
|
||||||
|
Dictionary<int? ,(string? , int? )> humans = new Dictionary<int?, (string?, int?)>();
|
||||||
|
foreach(var item in list)
|
||||||
|
{
|
||||||
|
if(!humans.ContainsKey(item.HumanId))
|
||||||
|
{
|
||||||
|
humans.Add(item.HumanId, (item.HumanName, item.Km));
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
humans[item.HumanId] = (item.HumanName, humans[item.HumanId].Item2 + item.Km);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var human in humans)
|
||||||
|
reportList.Add(new ReportHuman { Name = human.Value.Item1, Length = human.Value.Item2 });
|
||||||
|
return reportList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportCompany>? GetCompanysPath()
|
||||||
|
{
|
||||||
|
var list = _voyageStorage.GetFullList();
|
||||||
|
List<ReportCompany> reportList = new List<ReportCompany>();
|
||||||
|
Dictionary< (int? , int ?),int? > companies = new Dictionary<(int?, int?), int?>();
|
||||||
|
foreach(var company in list)
|
||||||
|
{
|
||||||
|
if (!companies.ContainsKey((company.CompanyId,company.RouteId)))
|
||||||
|
{
|
||||||
|
companies.Add((company.CompanyId, company.RouteId),1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
companies[(company.CompanyId, company.RouteId)] = (companies[(company.CompanyId, company.RouteId)].Value + 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach(var compan in companies)
|
||||||
|
{
|
||||||
|
|
||||||
|
reportList.Add(new ReportCompany { Title = _companyStorage.GetElement(new CompanySM { Id = compan.Key.Item1 }).Title, Details = _routeStorage.GetElement(new RouteSM { Id = compan.Key.Item2 }).Title, Count = compan.Value});
|
||||||
|
}
|
||||||
|
|
||||||
|
return reportList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace Contracts.BindingModels
|
|||||||
|
|
||||||
public int? StatusId { get; set; }
|
public int? StatusId { get; set; }
|
||||||
|
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace Contracts.BindingModels
|
|||||||
|
|
||||||
public int? StatusId {get; set; }
|
public int? StatusId {get; set; }
|
||||||
|
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace Contracts.BindingModels
|
|||||||
|
|
||||||
public int? StatusId { get; set; }
|
public int? StatusId { get; set; }
|
||||||
|
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,17 @@ namespace Contracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int? CarId { get; set; }
|
public int? CarId { get; set; }
|
||||||
|
|
||||||
public string CarName { get; set; } = string.Empty;
|
public string? CarName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int? HumanId { get; set; }
|
public int? HumanId { get; set; }
|
||||||
|
|
||||||
public string HumanName { get; set; } = string.Empty;
|
public string? HumanName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int? CompanyId { get; set; }
|
public int? CompanyId { get; set; }
|
||||||
|
|
||||||
public string CompanyName { get; set; } = string.Empty;
|
public string? CompanyName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string? RouteName { get; set; } = string.Empty;
|
||||||
public int? RouteId { get; set; }
|
public int? RouteId { get; set; }
|
||||||
|
|
||||||
public DateOnly? DateStart { get; set; }
|
public DateOnly? DateStart { get; set; }
|
||||||
|
@ -13,8 +13,9 @@ namespace Contracts.BusinessLogic
|
|||||||
{
|
{
|
||||||
List<VoyageVM>? ReadList(VoyageSM model);
|
List<VoyageVM>? ReadList(VoyageSM model);
|
||||||
VoyageVM? ReadElement(VoyageSM model);
|
VoyageVM? ReadElement(VoyageSM model);
|
||||||
|
List<ReportHuman>? GetTopDrivers();
|
||||||
bool Create(VoyageBM model);
|
bool Create(VoyageBM model);
|
||||||
|
public List<ReportCompany>? GetCompanysPath();
|
||||||
bool Delete(VoyageBM model);
|
bool Delete(VoyageBM model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace Contracts.Storage
|
|||||||
{
|
{
|
||||||
List<VoyageVM> GetFullList();
|
List<VoyageVM> GetFullList();
|
||||||
List<VoyageVM> GetFilteredList(VoyageSM model);
|
List<VoyageVM> GetFilteredList(VoyageSM model);
|
||||||
|
|
||||||
VoyageVM? GetElement(VoyageSM model);
|
VoyageVM? GetElement(VoyageSM model);
|
||||||
VoyageVM? Insert(VoyageBM model);
|
VoyageVM? Insert(VoyageBM model);
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ namespace Contracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class CarVM : ICar
|
public class CarVM : ICar
|
||||||
{
|
{
|
||||||
|
[DisplayName("Номер")]
|
||||||
|
public int Id { get; set; }
|
||||||
[DisplayName("Модель")]
|
[DisplayName("Модель")]
|
||||||
public string Model { get; set; } = string.Empty;
|
public string Model { get; set; } = string.Empty;
|
||||||
[DisplayName("Грузоподъемность")]
|
[DisplayName("Грузоподъемность")]
|
||||||
@ -17,8 +19,7 @@ namespace Contracts.ViewModels
|
|||||||
|
|
||||||
public int? StatusId { get; set; }
|
public int? StatusId { get; set; }
|
||||||
[DisplayName("Статус")]
|
[DisplayName("Статус")]
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
[DisplayName("Номер")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace Contracts.ViewModels
|
|||||||
|
|
||||||
public int? StatusId { get; set; }
|
public int? StatusId { get; set; }
|
||||||
[DisplayName("Статус")]
|
[DisplayName("Статус")]
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
[DisplayName("Номер")]
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace Contracts.ViewModels
|
|||||||
|
|
||||||
public int? StatusId { get; set; }
|
public int? StatusId { get; set; }
|
||||||
[DisplayName("Статус")]
|
[DisplayName("Статус")]
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
[DisplayName("Номер")]
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
19
Subd/Contracts/ViewModels/ReportCompany.cs
Normal file
19
Subd/Contracts/ViewModels/ReportCompany.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Contracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportCompany
|
||||||
|
{
|
||||||
|
[DisplayName("Название")]
|
||||||
|
public string Title { get; set; }
|
||||||
|
[DisplayName("Маршруты")]
|
||||||
|
public string? Details { get; set; }
|
||||||
|
[DisplayName("поездок")]
|
||||||
|
public int? Count { get; set; }
|
||||||
|
}
|
||||||
|
}
|
17
Subd/Contracts/ViewModels/ReportHuman.cs
Normal file
17
Subd/Contracts/ViewModels/ReportHuman.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Contracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportHuman
|
||||||
|
{
|
||||||
|
[DisplayName("ФИО")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
[DisplayName("Расстояние")]
|
||||||
|
public int? Length { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -12,16 +12,18 @@ namespace Contracts.ViewModels
|
|||||||
{
|
{
|
||||||
public int? CarId { get; set; }
|
public int? CarId { get; set; }
|
||||||
[DisplayName("Машина")]
|
[DisplayName("Машина")]
|
||||||
public string CarName { get; set; } = string.Empty;
|
public string? CarName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int? HumanId { get; set; }
|
public int? HumanId { get; set; }
|
||||||
[DisplayName("Водитель")]
|
[DisplayName("Водитель")]
|
||||||
public string HumanName { get; set; } = string.Empty;
|
public string? HumanName { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Расстояние")]
|
||||||
|
public int? Km { get; set; }
|
||||||
public int? CompanyId { get; set; }
|
public int? CompanyId { get; set; }
|
||||||
[DisplayName("Заказчик")]
|
[DisplayName("Заказчик")]
|
||||||
public string CompanyName { get; set; } = string.Empty;
|
public string CompanyName { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Маршрут")]
|
||||||
|
public string? RouteName { get; set; } = string.Empty;
|
||||||
public int? RouteId { get; set; }
|
public int? RouteId { get; set; }
|
||||||
[DisplayName("Дата выезда")]
|
[DisplayName("Дата выезда")]
|
||||||
public DateOnly? DateStart { get; set; }
|
public DateOnly? DateStart { get; set; }
|
||||||
|
@ -3,6 +3,7 @@ using Contracts.ViewModels;
|
|||||||
using DataModels.Models;
|
using DataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace DataBase;
|
namespace DataBase;
|
||||||
@ -35,8 +36,9 @@ public partial class Car : ICar
|
|||||||
public virtual Status? Status { get; set; }
|
public virtual Status? Status { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||||
|
[NotMapped]
|
||||||
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string StatusTitle { get; set; } =string.Empty;
|
|
||||||
|
|
||||||
public static Car Create(LogisticContext context, CarBM model)
|
public static Car Create(LogisticContext context, CarBM model)
|
||||||
{
|
{
|
||||||
@ -46,7 +48,7 @@ public partial class Car : ICar
|
|||||||
Model = model.Model,
|
Model = model.Model,
|
||||||
Tonnage = model.Tonnage,
|
Tonnage = model.Tonnage,
|
||||||
StatusId= model.StatusId,
|
StatusId= model.StatusId,
|
||||||
StatusTitle = model.StatusTitle
|
StatusTitle = model.StatusTitle,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +66,6 @@ public partial class Car : ICar
|
|||||||
Model = Model,
|
Model = Model,
|
||||||
Tonnage = Tonnage,
|
Tonnage = Tonnage,
|
||||||
StatusId = StatusId ,
|
StatusId = StatusId ,
|
||||||
StatusTitle=StatusTitle,
|
StatusTitle = Status?.Title
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using Contracts.ViewModels;
|
|||||||
using DataModels.Models;
|
using DataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DataBase;
|
namespace DataBase;
|
||||||
|
|
||||||
@ -29,8 +30,8 @@ public partial class Company : ICompany
|
|||||||
public virtual Status? Status { get; set; }
|
public virtual Status? Status { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||||
|
[NotMapped]
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
public static Company Create(LogisticContext context, CompanyBM model)
|
public static Company Create(LogisticContext context, CompanyBM model)
|
||||||
{
|
{
|
||||||
return new Company()
|
return new Company()
|
||||||
@ -55,6 +56,6 @@ public partial class Company : ICompany
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
Title = Title,
|
Title = Title,
|
||||||
StatusId = StatusId,
|
StatusId = StatusId,
|
||||||
StatusTitle = StatusTitle
|
StatusTitle = Status?.Title
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using Contracts.ViewModels;
|
|||||||
using DataModels.Models;
|
using DataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DataBase;
|
namespace DataBase;
|
||||||
|
|
||||||
@ -35,8 +36,9 @@ public partial class Human : IHuman
|
|||||||
public virtual Status? Status { get; set; }
|
public virtual Status? Status { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||||
|
[NotMapped]
|
||||||
|
public string? StatusTitle { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string StatusTitle { get; set; } = string.Empty;
|
|
||||||
public static Human Create(LogisticContext context, HumanBM model)
|
public static Human Create(LogisticContext context, HumanBM model)
|
||||||
{
|
{
|
||||||
return new Human()
|
return new Human()
|
||||||
@ -63,6 +65,6 @@ public partial class Human : IHuman
|
|||||||
Name = Name,
|
Name = Name,
|
||||||
Phone = Phone,
|
Phone = Phone,
|
||||||
StatusId = StatusId,
|
StatusId = StatusId,
|
||||||
StatusTitle = StatusTitle
|
StatusTitle = Status?.Title
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,12 @@ namespace DataBase.Implements
|
|||||||
public List<CarVM> GetFullList()
|
public List<CarVM> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Cars.FromSqlRaw("Select * From Car")
|
return context.Cars.FromSqlRaw("Select * from Car")
|
||||||
|
.Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CarVM> GetFilteredList(CarSM model)
|
public List<CarVM> GetFilteredList(CarSM model)
|
||||||
@ -31,13 +33,15 @@ namespace DataBase.Implements
|
|||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
if(model.StatusId.HasValue)
|
if(model.StatusId.HasValue)
|
||||||
return context.Cars
|
return context.Cars
|
||||||
.FromSqlRaw("Select * FROM Car WHERE StatusId = {0}",model.StatusId)
|
.FromSqlRaw("Select * FROM Car WHERE status_id = {0}", model.StatusId)
|
||||||
|
.Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
else
|
else
|
||||||
return context.Cars
|
return context.Cars
|
||||||
.FromSqlRaw("Select * FROM Car WHERE Tonnage >= {0}", model.Tonnage)
|
.FromSqlRaw("Select * FROM Car WHERE Tonnage >= {0}", model.Tonnage)
|
||||||
|
.Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -17,6 +17,7 @@ namespace DataBase.Implements
|
|||||||
{
|
{
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Companies.FromSqlRaw("Select * From Company")
|
return context.Companies.FromSqlRaw("Select * From Company")
|
||||||
|
.Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -30,7 +31,8 @@ namespace DataBase.Implements
|
|||||||
}
|
}
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Companies
|
return context.Companies
|
||||||
.FromSqlRaw("Select * FROM Company WHERE StatusId = {0}", model.StatusId)
|
.FromSqlRaw("Select * FROM Company WHERE status_id = {0}", model.StatusId)
|
||||||
|
.Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -16,7 +16,7 @@ namespace DataBase.Implements
|
|||||||
public List<HumanVM> GetFullList()
|
public List<HumanVM> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Humans.FromSqlRaw("Select * From Human")
|
return context.Humans.FromSqlRaw("Select * From Human").Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -30,7 +30,7 @@ namespace DataBase.Implements
|
|||||||
}
|
}
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Humans
|
return context.Humans
|
||||||
.FromSqlRaw("Select * FROM Human WHERE StatusId = {0}", model.StatusId)
|
.FromSqlRaw("Select * FROM Human WHERE status_id = {0}", model.StatusId).Include(u => u.Status)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -16,7 +16,7 @@ namespace DataBase.Implements
|
|||||||
public List<RouteVM> GetFullList()
|
public List<RouteVM> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Routes.FromSqlRaw("Select * From Route")
|
return context.Routes.FromSqlRaw("Select * From Route").Include(u => u.PlaceStartNavigation).Include(a => a.PlaceEndNavigation)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -31,18 +31,18 @@ namespace DataBase.Implements
|
|||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
if(model.Length.HasValue)
|
if(model.Length.HasValue)
|
||||||
return context.Routes
|
return context.Routes
|
||||||
.FromSqlRaw("Select * FROM Route WHERE Length <= {0}", model.Length)
|
.FromSqlRaw("Select * FROM Route WHERE Length <= {0}", model.Length).Include(u => u.PlaceStartNavigation).Include(a => a.PlaceEndNavigation)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
else if(model.Start.HasValue)
|
else if(model.Start.HasValue)
|
||||||
return context.Routes
|
return context.Routes
|
||||||
.FromSqlRaw("Select * FROM Route WHERE PlaceStart = {0} ", model.Start)
|
.FromSqlRaw("Select * FROM Route WHERE PlaceStart = {0} ", model.Start).Include(u => u.PlaceStartNavigation).Include(a => a.PlaceEndNavigation)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
return context.Routes
|
return context.Routes
|
||||||
.FromSqlRaw("Select * FROM Route WHERE PlaceEnd = {0} ", model.End)
|
.FromSqlRaw("Select * FROM Route WHERE PlaceEnd = {0} ", model.End).Include(u => u.PlaceStartNavigation).Include(a => a.PlaceEndNavigation)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -55,9 +55,12 @@ namespace DataBase.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Routes
|
var mid = context.Routes.FromSqlRaw("Select * from Route r where r.id = {0}", model.Id).Include(u => u.PlaceStartNavigation).Include(a => a.PlaceEndNavigation).ToList();
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) || (model.Start.HasValue && model.End.HasValue && x.PlaceEnd == model.End && x.PlaceStart == model.Start ))
|
|
||||||
?.GetViewModel;
|
if (mid.Count == 0)
|
||||||
|
return null;
|
||||||
|
var res = mid[0]?.GetViewModel;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteVM? Insert(RouteBM model)
|
public RouteVM? Insert(RouteBM model)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Contracts.SearchModel;
|
using Contracts.SearchModel;
|
||||||
using Contracts.Storage;
|
using Contracts.Storage;
|
||||||
using Contracts.ViewModels;
|
using Contracts.ViewModels;
|
||||||
|
using DataModels.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -17,6 +18,9 @@ namespace DataBase.Implements
|
|||||||
{
|
{
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Voyages.FromSqlRaw("Select * From Voyage")
|
return context.Voyages.FromSqlRaw("Select * From Voyage")
|
||||||
|
.Include(u => u.Car).Include(u => u.Company).Include(u => u.Human)
|
||||||
|
.Include(u => u.Route).ThenInclude(u => u.PlaceStartNavigation)
|
||||||
|
.Include(u => u.Route).ThenInclude(u => u.PlaceEndNavigation)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -30,7 +34,10 @@ namespace DataBase.Implements
|
|||||||
}
|
}
|
||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Voyages
|
return context.Voyages
|
||||||
.FromSqlRaw("Select * FROM Voyage WHERE DateStart > {0} AND DateEnd < {1}", model.DateStart,model.DateEnd)
|
.FromSqlRaw("Select * FROM Voyage WHERE date_start > {0} AND date_end < {1}", model.DateStart,model.DateEnd)
|
||||||
|
.Include(u => u.Car).Include(u => u.Company).Include(u => u.Human)
|
||||||
|
.Include(u => u.Route).ThenInclude(u => u.PlaceStartNavigation)
|
||||||
|
.Include(u => u.Route).ThenInclude(u => u.PlaceEndNavigation)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -46,6 +53,7 @@ namespace DataBase.Implements
|
|||||||
using var context = new LogisticContext();
|
using var context = new LogisticContext();
|
||||||
return context.Voyages
|
return context.Voyages
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||||
|
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,5 +85,6 @@ namespace DataBase.Implements
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using Contracts.ViewModels;
|
|||||||
using DataModels.Models;
|
using DataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DataBase;
|
namespace DataBase;
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ public partial class Route : IRoute
|
|||||||
|
|
||||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
public string Title { get; set; }=string.Empty;
|
public string Title { get; set; }=string.Empty;
|
||||||
|
|
||||||
public static Route Create(LogisticContext context, RouteBM model)
|
public static Route Create(LogisticContext context, RouteBM model)
|
||||||
@ -49,22 +51,21 @@ public partial class Route : IRoute
|
|||||||
PlaceStart = model.PlaceStart,
|
PlaceStart = model.PlaceStart,
|
||||||
PlaceEnd = model.PlaceEnd,
|
PlaceEnd = model.PlaceEnd,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(RouteBM model)
|
public void Update(RouteBM model)
|
||||||
{
|
{
|
||||||
Title = model.Title;
|
Title = model.Title;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteVM GetViewModel => new()
|
public RouteVM GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
Title = Title,
|
|
||||||
Length = Length,
|
Length = Length,
|
||||||
PlaceStart = PlaceStart,
|
PlaceStart = PlaceStart,
|
||||||
PlaceEnd = PlaceEnd,
|
PlaceEnd = PlaceEnd,
|
||||||
|
Title = PlaceStartNavigation?.Title + " - " + PlaceEndNavigation?.Title
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Contracts.BindingModels;
|
using Contracts.BindingModels;
|
||||||
using Contracts.ViewModels;
|
using Contracts.ViewModels;
|
||||||
|
using DataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@ -8,7 +9,7 @@ namespace DataBase;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Таблица статусов
|
/// Таблица статусов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Status
|
public partial class Status : IStatus
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Айди статуса
|
/// Айди статуса
|
||||||
|
@ -3,6 +3,7 @@ using Contracts.ViewModels;
|
|||||||
using DataModels.Models;
|
using DataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DataBase;
|
namespace DataBase;
|
||||||
|
|
||||||
@ -53,12 +54,16 @@ public partial class Voyage : IVoyage
|
|||||||
public virtual Human? Human { get; set; }
|
public virtual Human? Human { get; set; }
|
||||||
|
|
||||||
public virtual Route? Route { get; set; }
|
public virtual Route? Route { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string CarName { get; set; } = string.Empty;
|
public string? CarName { get; set; } = string.Empty;
|
||||||
|
[NotMapped]
|
||||||
public string HumanName { get; set; } = string.Empty;
|
public string? HumanName { get; set; } = string.Empty;
|
||||||
|
[NotMapped]
|
||||||
public string CompanyName { get; set; } = string.Empty;
|
public string? CompanyName { get; set; } = string.Empty;
|
||||||
|
[NotMapped]
|
||||||
|
public string? RouteName { get; set; } = string.Empty;
|
||||||
|
[NotMapped]
|
||||||
|
public int? Km { get; set; }
|
||||||
public static Voyage Create(LogisticContext context, VoyageBM model)
|
public static Voyage Create(LogisticContext context, VoyageBM model)
|
||||||
{
|
{
|
||||||
return new Voyage()
|
return new Voyage()
|
||||||
@ -73,7 +78,7 @@ public partial class Voyage : IVoyage
|
|||||||
CarName=model.CarName,
|
CarName=model.CarName,
|
||||||
HumanName=model.HumanName,
|
HumanName=model.HumanName,
|
||||||
CompanyName=model.CompanyName,
|
CompanyName=model.CompanyName,
|
||||||
|
RouteName = model.RouteName
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -90,9 +95,15 @@ public partial class Voyage : IVoyage
|
|||||||
RouteId = RouteId,
|
RouteId = RouteId,
|
||||||
DateStart = DateStart,
|
DateStart = DateStart,
|
||||||
DateEnd = DateEnd,
|
DateEnd = DateEnd,
|
||||||
CarName = CarName,
|
CarName = Car?.Model,
|
||||||
HumanName = HumanName,
|
HumanName = Human?.Name,
|
||||||
CompanyName = CompanyName,
|
CompanyName = Company?.Title,
|
||||||
|
RouteName = Route?.PlaceStartNavigation?.Title + " - " + Route?.PlaceStartNavigation?.Title,
|
||||||
|
Km = Route?.Length
|
||||||
|
};
|
||||||
|
public VoyageVM GetReportVM => new()
|
||||||
|
{
|
||||||
|
HumanName=Human?.Name,
|
||||||
|
Km=Km
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
39
Subd/Forms/Form1.Designer.cs
generated
39
Subd/Forms/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace Forms
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <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.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace Forms
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
197
Subd/Forms/FormCar.Designer.cs
generated
Normal file
197
Subd/Forms/FormCar.Designer.cs
generated
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormCar
|
||||||
|
{
|
||||||
|
/// <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.ModelLabel = new System.Windows.Forms.Label();
|
||||||
|
this.ModelTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.CostLabel = new System.Windows.Forms.Label();
|
||||||
|
this.TonnageTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.Statuslabel = new System.Windows.Forms.Label();
|
||||||
|
this.StatuscomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.TenPlusbutton = new System.Windows.Forms.Button();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ModelLabel
|
||||||
|
//
|
||||||
|
this.ModelLabel.AutoSize = true;
|
||||||
|
this.ModelLabel.Location = new System.Drawing.Point(22, 20);
|
||||||
|
this.ModelLabel.Name = "ModelLabel";
|
||||||
|
this.ModelLabel.Size = new System.Drawing.Size(84, 20);
|
||||||
|
this.ModelLabel.TabIndex = 0;
|
||||||
|
this.ModelLabel.Text = "Название: ";
|
||||||
|
//
|
||||||
|
// ModelTextBox
|
||||||
|
//
|
||||||
|
this.ModelTextBox.Location = new System.Drawing.Point(103, 16);
|
||||||
|
this.ModelTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ModelTextBox.Name = "ModelTextBox";
|
||||||
|
this.ModelTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.ModelTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// CostLabel
|
||||||
|
//
|
||||||
|
this.CostLabel.AutoSize = true;
|
||||||
|
this.CostLabel.Location = new System.Drawing.Point(22, 71);
|
||||||
|
this.CostLabel.Name = "CostLabel";
|
||||||
|
this.CostLabel.Size = new System.Drawing.Size(144, 20);
|
||||||
|
this.CostLabel.TabIndex = 3;
|
||||||
|
this.CostLabel.Text = "Грузоподъемность:";
|
||||||
|
//
|
||||||
|
// TonnageTextBox
|
||||||
|
//
|
||||||
|
this.TonnageTextBox.Location = new System.Drawing.Point(22, 95);
|
||||||
|
this.TonnageTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.TonnageTextBox.Name = "TonnageTextBox";
|
||||||
|
this.TonnageTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.TonnageTextBox.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(165, 218);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(268, 218);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// Statuslabel
|
||||||
|
//
|
||||||
|
this.Statuslabel.AutoSize = true;
|
||||||
|
this.Statuslabel.Location = new System.Drawing.Point(22, 147);
|
||||||
|
this.Statuslabel.Name = "Statuslabel";
|
||||||
|
this.Statuslabel.Size = new System.Drawing.Size(59, 20);
|
||||||
|
this.Statuslabel.TabIndex = 7;
|
||||||
|
this.Statuslabel.Text = "Статус: ";
|
||||||
|
//
|
||||||
|
// StatuscomboBox
|
||||||
|
//
|
||||||
|
this.StatuscomboBox.FormattingEnabled = true;
|
||||||
|
this.StatuscomboBox.Location = new System.Drawing.Point(123, 147);
|
||||||
|
this.StatuscomboBox.Name = "StatuscomboBox";
|
||||||
|
this.StatuscomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.StatuscomboBox.TabIndex = 8;
|
||||||
|
this.StatuscomboBox.SelectedIndexChanged += new System.EventHandler(this.StatuscomboBox_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// TenPlusbutton
|
||||||
|
//
|
||||||
|
this.TenPlusbutton.Location = new System.Drawing.Point(32, 218);
|
||||||
|
this.TenPlusbutton.Name = "TenPlusbutton";
|
||||||
|
this.TenPlusbutton.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.TenPlusbutton.TabIndex = 9;
|
||||||
|
this.TenPlusbutton.Text = "+10";
|
||||||
|
this.TenPlusbutton.UseVisualStyleBackColor = true;
|
||||||
|
this.TenPlusbutton.Click += new System.EventHandler(this.TenPlusbutton_Click);
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(32, 265);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(116, 20);
|
||||||
|
this.label1.TabIndex = 10;
|
||||||
|
this.label1.Text = "Среднее время";
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(154, 265);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(17, 20);
|
||||||
|
this.Timelabel.TabIndex = 11;
|
||||||
|
this.Timelabel.Text = "0";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(177, 265);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(27, 20);
|
||||||
|
this.label2.TabIndex = 12;
|
||||||
|
this.label2.Text = "мс";
|
||||||
|
//
|
||||||
|
// FormCar
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 305);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.TenPlusbutton);
|
||||||
|
this.Controls.Add(this.StatuscomboBox);
|
||||||
|
this.Controls.Add(this.Statuslabel);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.TonnageTextBox);
|
||||||
|
this.Controls.Add(this.CostLabel);
|
||||||
|
this.Controls.Add(this.ModelTextBox);
|
||||||
|
this.Controls.Add(this.ModelLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCar";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ModelLabel;
|
||||||
|
private TextBox ModelTextBox;
|
||||||
|
private Label CostLabel;
|
||||||
|
private TextBox TonnageTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label Statuslabel;
|
||||||
|
private ComboBox StatuscomboBox;
|
||||||
|
private Button TenPlusbutton;
|
||||||
|
private Label label1;
|
||||||
|
private Label Timelabel;
|
||||||
|
private Label label2;
|
||||||
|
}
|
||||||
|
}
|
143
Subd/Forms/FormCar.cs
Normal file
143
Subd/Forms/FormCar.cs
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormCar : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly ICarLogic _logic;
|
||||||
|
private readonly IStatusLogic _statusLogic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
string[] ModelName = { "Ural", "Vaz", "T","Min","IS" };
|
||||||
|
string[] ModelType = { "V", "34", "Ultra", "Patriot", "30" };
|
||||||
|
string[] ModelCat = { "300", "KV", "Cross", "New", "Speed" };
|
||||||
|
Random rndModel = new Random();
|
||||||
|
public FormCar(ILogger<FormCar> logger, ICarLogic logic, IStatusLogic statusLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_statusLogic = statusLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var statuses = _statusLogic.ReadList();
|
||||||
|
if (statuses != null)
|
||||||
|
{
|
||||||
|
StatuscomboBox.DisplayMember = "Title";
|
||||||
|
StatuscomboBox.ValueMember = "Id";
|
||||||
|
StatuscomboBox.DataSource = statuses;
|
||||||
|
StatuscomboBox.SelectedItem = null;
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение car");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new CarSM
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
ModelTextBox.Text = view.Model;
|
||||||
|
TonnageTextBox.Text = view.Tonnage.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения car");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(ModelTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new CarBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Model = ModelTextBox.Text,
|
||||||
|
Tonnage = Convert.ToInt32(TonnageTextBox.Text),
|
||||||
|
StatusId = Convert.ToInt32(StatuscomboBox.SelectedValue),
|
||||||
|
StatusTitle = StatuscomboBox.Text,
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StatuscomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TenPlusbutton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
for(int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var model = new CarBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Model = ModelName[rndModel.Next(0,4)] + ModelType[rndModel.Next(0, 4)] + ModelCat[rndModel.Next(0, 4)],
|
||||||
|
Tonnage = rndModel.Next(30,100),
|
||||||
|
StatusId = rndModel.Next(1,3),
|
||||||
|
StatusTitle = "",
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormCar.resx
Normal file
60
Subd/Forms/FormCar.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>
|
121
Subd/Forms/FormCars.Designer.cs
generated
Normal file
121
Subd/Forms/FormCars.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormCars
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.ChangeButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(642, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(669, 16);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// ChangeButton
|
||||||
|
//
|
||||||
|
this.ChangeButton.Location = new System.Drawing.Point(669, 95);
|
||||||
|
this.ChangeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ChangeButton.Name = "ChangeButton";
|
||||||
|
this.ChangeButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.ChangeButton.TabIndex = 2;
|
||||||
|
this.ChangeButton.Text = "Изменить";
|
||||||
|
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(669, 173);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(669, 255);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormCars
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.ChangeButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCars";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormCars_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button ChangeButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
121
Subd/Forms/FormCars.cs
Normal file
121
Subd/Forms/FormCars.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormCars : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly ICarLogic _logic;
|
||||||
|
|
||||||
|
public FormCars(ILogger<FormCars> logger, ICarLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormCars_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["Model"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
DataGridView.Columns["StatusId"].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCar));
|
||||||
|
|
||||||
|
if (service is FormCar form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCar));
|
||||||
|
|
||||||
|
if (service is FormCar form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new CarBM
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormCars.resx
Normal file
60
Subd/Forms/FormCars.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>
|
122
Subd/Forms/FormCompanies.Designer.cs
generated
Normal file
122
Subd/Forms/FormCompanies.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormCompanies
|
||||||
|
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.ChangeButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(642, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(669, 16);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// ChangeButton
|
||||||
|
//
|
||||||
|
this.ChangeButton.Location = new System.Drawing.Point(669, 95);
|
||||||
|
this.ChangeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ChangeButton.Name = "ChangeButton";
|
||||||
|
this.ChangeButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.ChangeButton.TabIndex = 2;
|
||||||
|
this.ChangeButton.Text = "Изменить";
|
||||||
|
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(669, 173);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(669, 255);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormCars
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.ChangeButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCars";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormCompanys_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button ChangeButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
121
Subd/Forms/FormCompanies.cs
Normal file
121
Subd/Forms/FormCompanies.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormCompanies : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly ICompanyLogic _logic;
|
||||||
|
|
||||||
|
public FormCompanies(ILogger<FormCompanies> logger, ICompanyLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormCompanys_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["Title"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
DataGridView.Columns["StatusId"].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCompany));
|
||||||
|
|
||||||
|
if (service is FormCompany form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCompany));
|
||||||
|
|
||||||
|
if (service is FormCompany form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new CompanyBM
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormCompanies.resx
Normal file
60
Subd/Forms/FormCompanies.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>
|
162
Subd/Forms/FormCompany.Designer.cs
generated
Normal file
162
Subd/Forms/FormCompany.Designer.cs
generated
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormCompany
|
||||||
|
{
|
||||||
|
/// <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.ComponentNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.TitleTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.Statuslabel = new System.Windows.Forms.Label();
|
||||||
|
this.StatuscomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.AddTenbutton = new System.Windows.Forms.Button();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ComponentNameLabel
|
||||||
|
//
|
||||||
|
this.ComponentNameLabel.AutoSize = true;
|
||||||
|
this.ComponentNameLabel.Location = new System.Drawing.Point(22, 20);
|
||||||
|
this.ComponentNameLabel.Name = "ComponentNameLabel";
|
||||||
|
this.ComponentNameLabel.Size = new System.Drawing.Size(84, 20);
|
||||||
|
this.ComponentNameLabel.TabIndex = 0;
|
||||||
|
this.ComponentNameLabel.Text = "Название: ";
|
||||||
|
//
|
||||||
|
// TitleTextBox
|
||||||
|
//
|
||||||
|
this.TitleTextBox.Location = new System.Drawing.Point(103, 16);
|
||||||
|
this.TitleTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.TitleTextBox.Name = "TitleTextBox";
|
||||||
|
this.TitleTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.TitleTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(132, 127);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(255, 127);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// Statuslabel
|
||||||
|
//
|
||||||
|
this.Statuslabel.AutoSize = true;
|
||||||
|
this.Statuslabel.Location = new System.Drawing.Point(22, 79);
|
||||||
|
this.Statuslabel.Name = "Statuslabel";
|
||||||
|
this.Statuslabel.Size = new System.Drawing.Size(59, 20);
|
||||||
|
this.Statuslabel.TabIndex = 7;
|
||||||
|
this.Statuslabel.Text = "Статус: ";
|
||||||
|
//
|
||||||
|
// StatuscomboBox
|
||||||
|
//
|
||||||
|
this.StatuscomboBox.FormattingEnabled = true;
|
||||||
|
this.StatuscomboBox.Location = new System.Drawing.Point(117, 79);
|
||||||
|
this.StatuscomboBox.Name = "StatuscomboBox";
|
||||||
|
this.StatuscomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.StatuscomboBox.TabIndex = 8;
|
||||||
|
this.StatuscomboBox.SelectedIndexChanged += new System.EventHandler(this.StatuscomboBox_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// AddTenbutton
|
||||||
|
//
|
||||||
|
this.AddTenbutton.Location = new System.Drawing.Point(12, 129);
|
||||||
|
this.AddTenbutton.Name = "AddTenbutton";
|
||||||
|
this.AddTenbutton.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.AddTenbutton.TabIndex = 9;
|
||||||
|
this.AddTenbutton.Text = "+10";
|
||||||
|
this.AddTenbutton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddTenbutton.Click += new System.EventHandler(this.AddTenbutton_Click);
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(12, 197);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(17, 20);
|
||||||
|
this.Timelabel.TabIndex = 10;
|
||||||
|
this.Timelabel.Text = "0";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(35, 197);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(29, 20);
|
||||||
|
this.label1.TabIndex = 11;
|
||||||
|
this.label1.Text = "mc";
|
||||||
|
//
|
||||||
|
// FormCompany
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 240);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.AddTenbutton);
|
||||||
|
this.Controls.Add(this.StatuscomboBox);
|
||||||
|
this.Controls.Add(this.Statuslabel);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.TitleTextBox);
|
||||||
|
this.Controls.Add(this.ComponentNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCompany";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ComponentNameLabel;
|
||||||
|
private TextBox TitleTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label Statuslabel;
|
||||||
|
private ComboBox StatuscomboBox;
|
||||||
|
private Button AddTenbutton;
|
||||||
|
private Label Timelabel;
|
||||||
|
private Label label1;
|
||||||
|
}
|
||||||
|
}
|
150
Subd/Forms/FormCompany.cs
Normal file
150
Subd/Forms/FormCompany.cs
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormCompany : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly ICompanyLogic _logic;
|
||||||
|
private readonly IStatusLogic _statusLogic;
|
||||||
|
private int? _id;
|
||||||
|
string[] ModelName = { "Ural1 ", "Vaz2 ", "T3 ", "Mi4 ", "IS5 ", "Mash1 ", "Zavod1 ", "Tech2 ", "Patriot2 ", "Indastris3 " };
|
||||||
|
string[] ModelType = { "Mash1 ", "Zavod1 ", "Tech2 ", "Patriot2 ", "Indastris3 ", "Mash21 ", "Zavod21 ", "Tech22 ", "Patriot22 ", "Indastris23 " };
|
||||||
|
string[] ModelCat = { "Msk", "DD", "Pet", "Uls", "World" };
|
||||||
|
Random rndModel = new Random();
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormCompany(ILogger<FormCompany> logger, ICompanyLogic logic, IStatusLogic statusLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_statusLogic = statusLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var statuses = _statusLogic.ReadList();
|
||||||
|
if (statuses != null)
|
||||||
|
{
|
||||||
|
StatuscomboBox.DisplayMember = "Title";
|
||||||
|
StatuscomboBox.ValueMember = "Id";
|
||||||
|
StatuscomboBox.DataSource = statuses;
|
||||||
|
StatuscomboBox.SelectedItem = null;
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение company");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new CompanySM
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
TitleTextBox.Text = view.Title;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения company");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(TitleTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new CompanyBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Title = TitleTextBox.Text,
|
||||||
|
|
||||||
|
StatusId = Convert.ToInt32(StatuscomboBox.SelectedValue),
|
||||||
|
StatusTitle = StatuscomboBox.Text,
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StatuscomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTenbutton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var model = new CompanyBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Title = ModelName[rndModel.Next(0, 9)] + ModelType[rndModel.Next(0, 9)] + ModelCat[rndModel.Next(0, 4)],
|
||||||
|
StatusId = rndModel.Next(1, 3),
|
||||||
|
StatusTitle = "",
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
}catch(Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormCompany.resx
Normal file
60
Subd/Forms/FormCompany.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>
|
185
Subd/Forms/FormHuman.Designer.cs
generated
Normal file
185
Subd/Forms/FormHuman.Designer.cs
generated
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormHuman
|
||||||
|
{
|
||||||
|
/// <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.ComponentNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.FIOTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.CostLabel = new System.Windows.Forms.Label();
|
||||||
|
this.PhoneTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.Statuslabel = new System.Windows.Forms.Label();
|
||||||
|
this.StatuscomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.AddTenbutton = new System.Windows.Forms.Button();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ComponentNameLabel
|
||||||
|
//
|
||||||
|
this.ComponentNameLabel.AutoSize = true;
|
||||||
|
this.ComponentNameLabel.Location = new System.Drawing.Point(22, 20);
|
||||||
|
this.ComponentNameLabel.Name = "ComponentNameLabel";
|
||||||
|
this.ComponentNameLabel.Size = new System.Drawing.Size(49, 20);
|
||||||
|
this.ComponentNameLabel.TabIndex = 0;
|
||||||
|
this.ComponentNameLabel.Text = "ФИО: ";
|
||||||
|
//
|
||||||
|
// FIOTextBox
|
||||||
|
//
|
||||||
|
this.FIOTextBox.Location = new System.Drawing.Point(103, 16);
|
||||||
|
this.FIOTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.FIOTextBox.Name = "FIOTextBox";
|
||||||
|
this.FIOTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.FIOTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// CostLabel
|
||||||
|
//
|
||||||
|
this.CostLabel.AutoSize = true;
|
||||||
|
this.CostLabel.Location = new System.Drawing.Point(22, 71);
|
||||||
|
this.CostLabel.Name = "CostLabel";
|
||||||
|
this.CostLabel.Size = new System.Drawing.Size(72, 20);
|
||||||
|
this.CostLabel.TabIndex = 3;
|
||||||
|
this.CostLabel.Text = "Телефон:";
|
||||||
|
//
|
||||||
|
// PhoneTextBox
|
||||||
|
//
|
||||||
|
this.PhoneTextBox.Location = new System.Drawing.Point(22, 95);
|
||||||
|
this.PhoneTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.PhoneTextBox.Name = "PhoneTextBox";
|
||||||
|
this.PhoneTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.PhoneTextBox.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(141, 218);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(255, 218);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// Statuslabel
|
||||||
|
//
|
||||||
|
this.Statuslabel.AutoSize = true;
|
||||||
|
this.Statuslabel.Location = new System.Drawing.Point(22, 147);
|
||||||
|
this.Statuslabel.Name = "Statuslabel";
|
||||||
|
this.Statuslabel.Size = new System.Drawing.Size(59, 20);
|
||||||
|
this.Statuslabel.TabIndex = 7;
|
||||||
|
this.Statuslabel.Text = "Статус: ";
|
||||||
|
//
|
||||||
|
// StatuscomboBox
|
||||||
|
//
|
||||||
|
this.StatuscomboBox.FormattingEnabled = true;
|
||||||
|
this.StatuscomboBox.Location = new System.Drawing.Point(123, 147);
|
||||||
|
this.StatuscomboBox.Name = "StatuscomboBox";
|
||||||
|
this.StatuscomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.StatuscomboBox.TabIndex = 8;
|
||||||
|
this.StatuscomboBox.SelectedIndexChanged += new System.EventHandler(this.StatuscomboBox_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// AddTenbutton
|
||||||
|
//
|
||||||
|
this.AddTenbutton.Location = new System.Drawing.Point(12, 218);
|
||||||
|
this.AddTenbutton.Name = "AddTenbutton";
|
||||||
|
this.AddTenbutton.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.AddTenbutton.TabIndex = 9;
|
||||||
|
this.AddTenbutton.Text = "+10";
|
||||||
|
this.AddTenbutton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddTenbutton.Click += new System.EventHandler(this.AddTenbutton_Click);
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(12, 289);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(17, 20);
|
||||||
|
this.Timelabel.TabIndex = 10;
|
||||||
|
this.Timelabel.Text = "0";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(44, 289);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(29, 20);
|
||||||
|
this.label1.TabIndex = 11;
|
||||||
|
this.label1.Text = "mc";
|
||||||
|
//
|
||||||
|
// FormHuman
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 318);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.AddTenbutton);
|
||||||
|
this.Controls.Add(this.StatuscomboBox);
|
||||||
|
this.Controls.Add(this.Statuslabel);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.PhoneTextBox);
|
||||||
|
this.Controls.Add(this.CostLabel);
|
||||||
|
this.Controls.Add(this.FIOTextBox);
|
||||||
|
this.Controls.Add(this.ComponentNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormHuman";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ComponentNameLabel;
|
||||||
|
private TextBox FIOTextBox;
|
||||||
|
private Label CostLabel;
|
||||||
|
private TextBox PhoneTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label Statuslabel;
|
||||||
|
private ComboBox StatuscomboBox;
|
||||||
|
private Button AddTenbutton;
|
||||||
|
private Label Timelabel;
|
||||||
|
private Label label1;
|
||||||
|
}
|
||||||
|
}
|
143
Subd/Forms/FormHuman.cs
Normal file
143
Subd/Forms/FormHuman.cs
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormHuman : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IHumanLogic _logic;
|
||||||
|
private readonly IStatusLogic _statusLogic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
string[] ModelName = { "Vlad", "Dima", "Kyza", "Oleg", "Egor" };
|
||||||
|
string[] ModelType = { "Sergeevich", "Olegovich", "Sanich", "Petrovich", "Vladimirovich" };
|
||||||
|
string[] ModelCat = { "Popov", "Antoniv", "Lazarev", "Petrov", "Vasilevich" };
|
||||||
|
Random rndModel = new Random();
|
||||||
|
public FormHuman(ILogger<FormHuman> logger, IHumanLogic logic, IStatusLogic statusLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_statusLogic = statusLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var statuses = _statusLogic.ReadList();
|
||||||
|
if (statuses != null)
|
||||||
|
{
|
||||||
|
StatuscomboBox.DisplayMember = "Title";
|
||||||
|
StatuscomboBox.ValueMember = "Id";
|
||||||
|
StatuscomboBox.DataSource = statuses;
|
||||||
|
StatuscomboBox.SelectedItem = null;
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение human");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new HumanSM
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
FIOTextBox.Text = view.Name;
|
||||||
|
PhoneTextBox.Text = view.Phone.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения human");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(FIOTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new HumanBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Name = FIOTextBox.Text,
|
||||||
|
Phone = PhoneTextBox.Text,
|
||||||
|
StatusId = Convert.ToInt32(StatuscomboBox.SelectedValue),
|
||||||
|
StatusTitle = StatuscomboBox.Text,
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StatuscomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTenbutton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var model = new HumanBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Name = ModelName[rndModel.Next(0, 4)] + ModelType[rndModel.Next(0, 4)] + ModelCat[rndModel.Next(0, 4)],
|
||||||
|
Phone = "+" + rndModel.Next(30, 100) + rndModel.Next(30, 100)+ rndModel.Next(30, 100)+ rndModel.Next(30, 100) + rndModel.Next(30, 100)+ rndModel.Next(0, 10),
|
||||||
|
StatusId = rndModel.Next(1, 3),
|
||||||
|
StatusTitle = "",
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormHuman.resx
Normal file
60
Subd/Forms/FormHuman.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>
|
121
Subd/Forms/FormHumans.Designer.cs
generated
Normal file
121
Subd/Forms/FormHumans.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormHumans
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.ChangeButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(642, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(669, 16);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// ChangeButton
|
||||||
|
//
|
||||||
|
this.ChangeButton.Location = new System.Drawing.Point(669, 95);
|
||||||
|
this.ChangeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ChangeButton.Name = "ChangeButton";
|
||||||
|
this.ChangeButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.ChangeButton.TabIndex = 2;
|
||||||
|
this.ChangeButton.Text = "Изменить";
|
||||||
|
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(669, 173);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(669, 255);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormCars
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.ChangeButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCars";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormHumans_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button ChangeButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
121
Subd/Forms/FormHumans.cs
Normal file
121
Subd/Forms/FormHumans.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormHumans : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IHumanLogic _logic;
|
||||||
|
|
||||||
|
public FormHumans(ILogger<FormHumans> logger, IHumanLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormHumans_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
DataGridView.Columns["StatusId"].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormHuman));
|
||||||
|
|
||||||
|
if (service is FormHuman form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormHuman));
|
||||||
|
|
||||||
|
if (service is FormHuman form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new HumanBM
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormHumans.resx
Normal file
60
Subd/Forms/FormHumans.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>
|
202
Subd/Forms/FormMain.Designer.cs
generated
Normal file
202
Subd/Forms/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormMain
|
||||||
|
{
|
||||||
|
/// <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.СправочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.ИзделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.КомпонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.компанииToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.маршрутыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.местаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.водителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.компанииToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.CreateOrderButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateListButton = new System.Windows.Forms.Button();
|
||||||
|
this.MenuStrip.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// MenuStrip
|
||||||
|
//
|
||||||
|
this.MenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
|
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.СправочникиToolStripMenuItem,
|
||||||
|
this.отчетыToolStripMenuItem});
|
||||||
|
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.MenuStrip.Name = "MenuStrip";
|
||||||
|
this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
|
||||||
|
this.MenuStrip.Size = new System.Drawing.Size(989, 30);
|
||||||
|
this.MenuStrip.TabIndex = 0;
|
||||||
|
this.MenuStrip.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// СправочникиToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.СправочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.ИзделияToolStripMenuItem,
|
||||||
|
this.КомпонентыToolStripMenuItem,
|
||||||
|
this.компанииToolStripMenuItem,
|
||||||
|
this.маршрутыToolStripMenuItem,
|
||||||
|
this.местаToolStripMenuItem});
|
||||||
|
this.СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem";
|
||||||
|
this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
||||||
|
this.СправочникиToolStripMenuItem.Text = "Cправочники";
|
||||||
|
//
|
||||||
|
// ИзделияToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.ИзделияToolStripMenuItem.Name = "ИзделияToolStripMenuItem";
|
||||||
|
this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||||
|
this.ИзделияToolStripMenuItem.Text = "Машины";
|
||||||
|
this.ИзделияToolStripMenuItem.Click += new System.EventHandler(this.МашиныToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// КомпонентыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
|
||||||
|
this.КомпонентыToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||||
|
this.КомпонентыToolStripMenuItem.Text = "Водители";
|
||||||
|
this.КомпонентыToolStripMenuItem.Click += new System.EventHandler(this.ВодителиToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// компанииToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.компанииToolStripMenuItem.Name = "компанииToolStripMenuItem";
|
||||||
|
this.компанииToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||||
|
this.компанииToolStripMenuItem.Text = "Компании";
|
||||||
|
this.компанииToolStripMenuItem.Click += new System.EventHandler(this.компанииToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// маршрутыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.маршрутыToolStripMenuItem.Name = "маршрутыToolStripMenuItem";
|
||||||
|
this.маршрутыToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||||
|
this.маршрутыToolStripMenuItem.Text = "Маршруты";
|
||||||
|
this.маршрутыToolStripMenuItem.Click += new System.EventHandler(this.маршрутыToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// местаToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.местаToolStripMenuItem.Name = "местаToolStripMenuItem";
|
||||||
|
this.местаToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||||
|
this.местаToolStripMenuItem.Text = "Места";
|
||||||
|
this.местаToolStripMenuItem.Click += new System.EventHandler(this.местаToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// отчетыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.водителиToolStripMenuItem,
|
||||||
|
this.компанииToolStripMenuItem1});
|
||||||
|
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||||
|
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
||||||
|
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
|
//
|
||||||
|
// водителиToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.водителиToolStripMenuItem.Name = "водителиToolStripMenuItem";
|
||||||
|
this.водителиToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
|
this.водителиToolStripMenuItem.Text = "Водители";
|
||||||
|
this.водителиToolStripMenuItem.Click += new System.EventHandler(this.водителиToolStripMenuItem_Click_1);
|
||||||
|
//
|
||||||
|
// компанииToolStripMenuItem1
|
||||||
|
//
|
||||||
|
this.компанииToolStripMenuItem1.Name = "компанииToolStripMenuItem1";
|
||||||
|
this.компанииToolStripMenuItem1.Size = new System.Drawing.Size(224, 26);
|
||||||
|
this.компанииToolStripMenuItem1.Text = "Компании";
|
||||||
|
this.компанииToolStripMenuItem1.Click += new System.EventHandler(this.компанииToolStripMenuItem1_Click);
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(0, 36);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(825, 561);
|
||||||
|
this.DataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// CreateOrderButton
|
||||||
|
//
|
||||||
|
this.CreateOrderButton.Location = new System.Drawing.Point(831, 199);
|
||||||
|
this.CreateOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.CreateOrderButton.Name = "CreateOrderButton";
|
||||||
|
this.CreateOrderButton.Size = new System.Drawing.Size(143, 44);
|
||||||
|
this.CreateOrderButton.TabIndex = 2;
|
||||||
|
this.CreateOrderButton.Text = "Создать заказ";
|
||||||
|
this.CreateOrderButton.UseVisualStyleBackColor = true;
|
||||||
|
this.CreateOrderButton.Click += new System.EventHandler(this.CreateOrderButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateListButton
|
||||||
|
//
|
||||||
|
this.UpdateListButton.Location = new System.Drawing.Point(832, 349);
|
||||||
|
this.UpdateListButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateListButton.Name = "UpdateListButton";
|
||||||
|
this.UpdateListButton.Size = new System.Drawing.Size(143, 44);
|
||||||
|
this.UpdateListButton.TabIndex = 6;
|
||||||
|
this.UpdateListButton.Text = "Обновить список";
|
||||||
|
this.UpdateListButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateListButton.Click += new System.EventHandler(this.UpdateListButton_Click);
|
||||||
|
//
|
||||||
|
// FormMain
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(989, 600);
|
||||||
|
this.Controls.Add(this.UpdateListButton);
|
||||||
|
this.Controls.Add(this.CreateOrderButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Controls.Add(this.MenuStrip);
|
||||||
|
this.MainMenuStrip = this.MenuStrip;
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormMain";
|
||||||
|
this.Text = "Автозавод";
|
||||||
|
this.Load += new System.EventHandler(this.FormMain_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 СправочникиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem ИзделияToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button CreateOrderButton;
|
||||||
|
private Button UpdateListButton;
|
||||||
|
private ToolStripMenuItem компанииToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem маршрутыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem местаToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem водителиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem компанииToolStripMenuItem1;
|
||||||
|
}
|
||||||
|
}
|
152
Subd/Forms/FormMain.cs
Normal file
152
Subd/Forms/FormMain.cs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
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 Forms
|
||||||
|
{
|
||||||
|
public partial class FormMain : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IVoyageLogic _voyageLogic;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FormMain(ILogger<FormMain> logger, IVoyageLogic voyageLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_voyageLogic = voyageLogic;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _voyageLogic.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["HumanId"].Visible = false;
|
||||||
|
DataGridView.Columns["CarId"].Visible = false;
|
||||||
|
DataGridView.Columns["CompanyId"].Visible = false;
|
||||||
|
DataGridView.Columns["RouteId"].Visible = false;
|
||||||
|
DataGridView.Columns["RouteName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка ");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ВодителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormHumans));
|
||||||
|
|
||||||
|
if (service is FormHumans form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void МашиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCars));
|
||||||
|
|
||||||
|
if (service is FormCars form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateOrderButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormVoyage));
|
||||||
|
|
||||||
|
if (service is FormVoyage form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void UpdateListButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void компанииToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCompanies));
|
||||||
|
|
||||||
|
if (service is FormCompanies form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void маршрутыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormRoutes));
|
||||||
|
|
||||||
|
if (service is FormRoutes form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void местаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormPlaces));
|
||||||
|
|
||||||
|
if (service is FormPlaces form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void водителиToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportHumans));
|
||||||
|
|
||||||
|
if (service is FormReportHumans form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void компанииToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportCompanies));
|
||||||
|
|
||||||
|
if (service is FormReportCompanies form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
Subd/Forms/FormMain.resx
Normal file
63
Subd/Forms/FormMain.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>
|
138
Subd/Forms/FormPlace.Designer.cs
generated
Normal file
138
Subd/Forms/FormPlace.Designer.cs
generated
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormPlace
|
||||||
|
{
|
||||||
|
/// <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.ComponentNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.TitleTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.AddTenbutton = new System.Windows.Forms.Button();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ComponentNameLabel
|
||||||
|
//
|
||||||
|
this.ComponentNameLabel.AutoSize = true;
|
||||||
|
this.ComponentNameLabel.Location = new System.Drawing.Point(22, 20);
|
||||||
|
this.ComponentNameLabel.Name = "ComponentNameLabel";
|
||||||
|
this.ComponentNameLabel.Size = new System.Drawing.Size(84, 20);
|
||||||
|
this.ComponentNameLabel.TabIndex = 0;
|
||||||
|
this.ComponentNameLabel.Text = "Название: ";
|
||||||
|
//
|
||||||
|
// TitleTextBox
|
||||||
|
//
|
||||||
|
this.TitleTextBox.Location = new System.Drawing.Point(103, 16);
|
||||||
|
this.TitleTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.TitleTextBox.Name = "TitleTextBox";
|
||||||
|
this.TitleTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.TitleTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(137, 101);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(255, 101);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// AddTenbutton
|
||||||
|
//
|
||||||
|
this.AddTenbutton.Location = new System.Drawing.Point(22, 101);
|
||||||
|
this.AddTenbutton.Name = "AddTenbutton";
|
||||||
|
this.AddTenbutton.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.AddTenbutton.TabIndex = 7;
|
||||||
|
this.AddTenbutton.Text = "+10";
|
||||||
|
this.AddTenbutton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddTenbutton.Click += new System.EventHandler(this.AddTenbutton_Click);
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(22, 172);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(17, 20);
|
||||||
|
this.Timelabel.TabIndex = 8;
|
||||||
|
this.Timelabel.Text = "0";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(45, 172);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(29, 20);
|
||||||
|
this.label2.TabIndex = 9;
|
||||||
|
this.label2.Text = "mc";
|
||||||
|
//
|
||||||
|
// FormPlace
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 201);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.AddTenbutton);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.TitleTextBox);
|
||||||
|
this.Controls.Add(this.ComponentNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormPlace";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ComponentNameLabel;
|
||||||
|
private TextBox TitleTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Button AddTenbutton;
|
||||||
|
private Label Timelabel;
|
||||||
|
private Label label2;
|
||||||
|
}
|
||||||
|
}
|
131
Subd/Forms/FormPlace.cs
Normal file
131
Subd/Forms/FormPlace.cs
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormPlace : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IPlaceLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
string[] ModelName = { "Vlad", "Dimit", "Mos", "Volg", "Peter" };
|
||||||
|
string[] ModelType = { "grad", "sk", "vl", "orod", "burg" };
|
||||||
|
string[] ModelCat = { "-severniy", "-sanct", "", "-kamchatskiy", "Yar" };
|
||||||
|
Random rndModel = new Random();
|
||||||
|
public FormPlace(ILogger<FormCompany> logger, IPlaceLogic placeLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = placeLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение company");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new PlaceSM
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
TitleTextBox.Text = view.Title;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения company");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(TitleTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new PlaceBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Title = TitleTextBox.Text,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlacecomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTenbutton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var model = new PlaceBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Title = ModelName[rndModel.Next(0, 4)] + ModelType[rndModel.Next(0, 4)] + ModelCat[rndModel.Next(0, 4)],
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormPlace.resx
Normal file
60
Subd/Forms/FormPlace.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>
|
122
Subd/Forms/FormPlaces.Designer.cs
generated
Normal file
122
Subd/Forms/FormPlaces.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormPlaces
|
||||||
|
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.ChangeButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(642, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(669, 16);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// ChangeButton
|
||||||
|
//
|
||||||
|
this.ChangeButton.Location = new System.Drawing.Point(669, 95);
|
||||||
|
this.ChangeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ChangeButton.Name = "ChangeButton";
|
||||||
|
this.ChangeButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.ChangeButton.TabIndex = 2;
|
||||||
|
this.ChangeButton.Text = "Изменить";
|
||||||
|
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(669, 173);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(669, 255);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormCars
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.ChangeButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCars";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormPlacees_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button ChangeButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
121
Subd/Forms/FormPlaces.cs
Normal file
121
Subd/Forms/FormPlaces.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormPlaces : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IPlaceLogic _logic;
|
||||||
|
|
||||||
|
public FormPlaces(ILogger<FormCompanies> logger, IPlaceLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormPlacees_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["Title"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormPlace));
|
||||||
|
|
||||||
|
if (service is FormPlace form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormPlace));
|
||||||
|
|
||||||
|
if (service is FormPlace form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new PlaceBM
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormPlaces.resx
Normal file
60
Subd/Forms/FormPlaces.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>
|
78
Subd/Forms/FormReportCompanies.Designer.cs
generated
Normal file
78
Subd/Forms/FormReportCompanies.Designer.cs
generated
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormReportCompanies
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.timelabel = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(696, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// timelabel
|
||||||
|
//
|
||||||
|
this.timelabel.AutoSize = true;
|
||||||
|
this.timelabel.Location = new System.Drawing.Point(742, 436);
|
||||||
|
this.timelabel.Name = "timelabel";
|
||||||
|
this.timelabel.Size = new System.Drawing.Size(50, 20);
|
||||||
|
this.timelabel.TabIndex = 1;
|
||||||
|
this.timelabel.Text = "label1";
|
||||||
|
//
|
||||||
|
// FormReportCompanies
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.timelabel);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormReportCompanies";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormReportHumans_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Label timelabel;
|
||||||
|
}
|
||||||
|
}
|
64
Subd/Forms/FormReportCompanies.cs
Normal file
64
Subd/Forms/FormReportCompanies.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormReportCompanies : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IVoyageLogic _logic;
|
||||||
|
|
||||||
|
public FormReportCompanies(ILogger<FormReportHumans> logger, IVoyageLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormReportHumans_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
var list = _logic.GetCompanysPath();
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
timelabel.Text = time.ToString();
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Title"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormReportCompanies.resx
Normal file
60
Subd/Forms/FormReportCompanies.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>
|
78
Subd/Forms/FormReportHumans.Designer.cs
generated
Normal file
78
Subd/Forms/FormReportHumans.Designer.cs
generated
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormReportHumans
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(696, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(732, 414);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(50, 20);
|
||||||
|
this.Timelabel.TabIndex = 1;
|
||||||
|
this.Timelabel.Text = "label1";
|
||||||
|
//
|
||||||
|
// FormReportHumans
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormReportHumans";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormReportHumans_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Label Timelabel;
|
||||||
|
}
|
||||||
|
}
|
64
Subd/Forms/FormReportHumans.cs
Normal file
64
Subd/Forms/FormReportHumans.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormReportHumans : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IVoyageLogic _logic;
|
||||||
|
|
||||||
|
public FormReportHumans(ILogger<FormReportHumans> logger, IVoyageLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormReportHumans_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
var list = _logic.GetTopDrivers();
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormReportHumans.resx
Normal file
60
Subd/Forms/FormReportHumans.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>
|
184
Subd/Forms/FormRoute.Designer.cs
generated
Normal file
184
Subd/Forms/FormRoute.Designer.cs
generated
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormRoute
|
||||||
|
{
|
||||||
|
/// <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.ComponentNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.LengthTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.Statuslabel = new System.Windows.Forms.Label();
|
||||||
|
this.StartcomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.EndcomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.AddTenbutton = new System.Windows.Forms.Button();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ComponentNameLabel
|
||||||
|
//
|
||||||
|
this.ComponentNameLabel.AutoSize = true;
|
||||||
|
this.ComponentNameLabel.Location = new System.Drawing.Point(13, 145);
|
||||||
|
this.ComponentNameLabel.Name = "ComponentNameLabel";
|
||||||
|
this.ComponentNameLabel.Size = new System.Drawing.Size(91, 20);
|
||||||
|
this.ComponentNameLabel.TabIndex = 0;
|
||||||
|
this.ComponentNameLabel.Text = "Расстояние:";
|
||||||
|
//
|
||||||
|
// LengthTextBox
|
||||||
|
//
|
||||||
|
this.LengthTextBox.Location = new System.Drawing.Point(103, 145);
|
||||||
|
this.LengthTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.LengthTextBox.Name = "LengthTextBox";
|
||||||
|
this.LengthTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.LengthTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(159, 218);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(268, 218);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// Statuslabel
|
||||||
|
//
|
||||||
|
this.Statuslabel.AutoSize = true;
|
||||||
|
this.Statuslabel.Location = new System.Drawing.Point(12, 19);
|
||||||
|
this.Statuslabel.Name = "Statuslabel";
|
||||||
|
this.Statuslabel.Size = new System.Drawing.Size(68, 20);
|
||||||
|
this.Statuslabel.TabIndex = 7;
|
||||||
|
this.Statuslabel.Text = "Точка 1: ";
|
||||||
|
//
|
||||||
|
// StartcomboBox
|
||||||
|
//
|
||||||
|
this.StartcomboBox.FormattingEnabled = true;
|
||||||
|
this.StartcomboBox.Location = new System.Drawing.Point(103, 19);
|
||||||
|
this.StartcomboBox.Name = "StartcomboBox";
|
||||||
|
this.StartcomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.StartcomboBox.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(13, 85);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(68, 20);
|
||||||
|
this.label1.TabIndex = 9;
|
||||||
|
this.label1.Text = "Точка 2: ";
|
||||||
|
//
|
||||||
|
// EndcomboBox
|
||||||
|
//
|
||||||
|
this.EndcomboBox.FormattingEnabled = true;
|
||||||
|
this.EndcomboBox.Location = new System.Drawing.Point(103, 85);
|
||||||
|
this.EndcomboBox.Name = "EndcomboBox";
|
||||||
|
this.EndcomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.EndcomboBox.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// AddTenbutton
|
||||||
|
//
|
||||||
|
this.AddTenbutton.Location = new System.Drawing.Point(33, 218);
|
||||||
|
this.AddTenbutton.Name = "AddTenbutton";
|
||||||
|
this.AddTenbutton.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.AddTenbutton.TabIndex = 11;
|
||||||
|
this.AddTenbutton.Text = "+10";
|
||||||
|
this.AddTenbutton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddTenbutton.Click += new System.EventHandler(this.AddTenbutton_Click);
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(30, 278);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(17, 20);
|
||||||
|
this.Timelabel.TabIndex = 12;
|
||||||
|
this.Timelabel.Text = "0";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(54, 278);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(29, 20);
|
||||||
|
this.label2.TabIndex = 13;
|
||||||
|
this.label2.Text = "mc";
|
||||||
|
//
|
||||||
|
// FormRoute
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 325);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.AddTenbutton);
|
||||||
|
this.Controls.Add(this.EndcomboBox);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.StartcomboBox);
|
||||||
|
this.Controls.Add(this.Statuslabel);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.LengthTextBox);
|
||||||
|
this.Controls.Add(this.ComponentNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormRoute";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ComponentNameLabel;
|
||||||
|
private TextBox LengthTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label Statuslabel;
|
||||||
|
private ComboBox StartcomboBox;
|
||||||
|
private Label label1;
|
||||||
|
private ComboBox EndcomboBox;
|
||||||
|
private Button AddTenbutton;
|
||||||
|
private Label Timelabel;
|
||||||
|
private Label label2;
|
||||||
|
}
|
||||||
|
}
|
142
Subd/Forms/FormRoute.cs
Normal file
142
Subd/Forms/FormRoute.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormRoute : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IRouteLogic _logic;
|
||||||
|
private readonly IPlaceLogic _placeLogic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
Random rndModel = new Random();
|
||||||
|
public FormRoute(ILogger<FormRoute> logger, IRouteLogic logic, IPlaceLogic placeLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_placeLogic = placeLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var places = _placeLogic.ReadList(null);
|
||||||
|
var places2 = _placeLogic.ReadList(null);
|
||||||
|
if (places != null && places2 !=null)
|
||||||
|
{
|
||||||
|
StartcomboBox.DisplayMember = "Title";
|
||||||
|
StartcomboBox.ValueMember = "Id";
|
||||||
|
StartcomboBox.DataSource = places;
|
||||||
|
StartcomboBox.SelectedItem = null;
|
||||||
|
EndcomboBox.DisplayMember = "Title";
|
||||||
|
EndcomboBox.ValueMember = "Id";
|
||||||
|
EndcomboBox.DataSource = places2;
|
||||||
|
EndcomboBox.SelectedItem = null;
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение route");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new RouteSM
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
LengthTextBox.Text = view.Length.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения route");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new RouteBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
|
||||||
|
Length = Convert.ToInt32(LengthTextBox.Text),
|
||||||
|
PlaceStart = Convert.ToInt32(StartcomboBox.SelectedValue),
|
||||||
|
PlaceEnd = Convert.ToInt32(EndcomboBox.SelectedValue),
|
||||||
|
Title = StartcomboBox.Text + " - " + EndcomboBox.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlacecomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTenbutton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var model = new RouteBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Length = rndModel.Next(10,200),
|
||||||
|
PlaceStart = rndModel.Next(1, _placeLogic.ReadList(null).Count),
|
||||||
|
PlaceEnd = rndModel.Next(1, _placeLogic.ReadList(null).Count),
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormRoute.resx
Normal file
60
Subd/Forms/FormRoute.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
Subd/Forms/FormRoutes.Designer.cs
generated
Normal file
107
Subd/Forms/FormRoutes.Designer.cs
generated
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormRoutes
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(642, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(669, 100);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(669, 173);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(669, 255);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormRoutes
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormRoutes";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormRoutes_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
122
Subd/Forms/FormRoutes.cs
Normal file
122
Subd/Forms/FormRoutes.cs
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormRoutes : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IRouteLogic _logic;
|
||||||
|
|
||||||
|
public FormRoutes(ILogger<FormRoutes> logger, IRouteLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormRoutes_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["PlaceStart"].Visible = false;
|
||||||
|
DataGridView.Columns["PlaceEnd"].Visible = false;
|
||||||
|
DataGridView.Columns["Title"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormRoute));
|
||||||
|
|
||||||
|
if (service is FormRoute form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormRoute));
|
||||||
|
|
||||||
|
if (service is FormRoute form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new RouteBM
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormRoutes.resx
Normal file
60
Subd/Forms/FormRoutes.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>
|
101
Subd/Forms/FormStatus.Designer.cs
generated
Normal file
101
Subd/Forms/FormStatus.Designer.cs
generated
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormStatus
|
||||||
|
{
|
||||||
|
/// <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.ComponentNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.TitleTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ComponentNameLabel
|
||||||
|
//
|
||||||
|
this.ComponentNameLabel.AutoSize = true;
|
||||||
|
this.ComponentNameLabel.Location = new System.Drawing.Point(22, 20);
|
||||||
|
this.ComponentNameLabel.Name = "ComponentNameLabel";
|
||||||
|
this.ComponentNameLabel.Size = new System.Drawing.Size(84, 20);
|
||||||
|
this.ComponentNameLabel.TabIndex = 0;
|
||||||
|
this.ComponentNameLabel.Text = "Название: ";
|
||||||
|
//
|
||||||
|
// TitleTextBox
|
||||||
|
//
|
||||||
|
this.TitleTextBox.Location = new System.Drawing.Point(103, 16);
|
||||||
|
this.TitleTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.TitleTextBox.Name = "TitleTextBox";
|
||||||
|
this.TitleTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.TitleTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(22, 125);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(255, 125);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// FormStatus
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 193);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.TitleTextBox);
|
||||||
|
this.Controls.Add(this.ComponentNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormStatus";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ComponentNameLabel;
|
||||||
|
private TextBox TitleTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
}
|
||||||
|
}
|
107
Subd/Forms/FormStatus.cs
Normal file
107
Subd/Forms/FormStatus.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormStatus : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IStatusLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormStatus(ILogger<FormCompany> logger, IStatusLogic statusLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = statusLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение company");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new StatusSM
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
TitleTextBox.Text = view.Title;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения company");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(TitleTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new StatusBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Title = TitleTextBox.Text,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StatuscomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormStatus.resx
Normal file
60
Subd/Forms/FormStatus.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>
|
122
Subd/Forms/FormStatuses.Designer.cs
generated
Normal file
122
Subd/Forms/FormStatuses.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormStatuses
|
||||||
|
|
||||||
|
{
|
||||||
|
/// <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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.ChangeButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(1, 1);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(642, 660);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(669, 16);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// ChangeButton
|
||||||
|
//
|
||||||
|
this.ChangeButton.Location = new System.Drawing.Point(669, 95);
|
||||||
|
this.ChangeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ChangeButton.Name = "ChangeButton";
|
||||||
|
this.ChangeButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.ChangeButton.TabIndex = 2;
|
||||||
|
this.ChangeButton.Text = "Изменить";
|
||||||
|
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(669, 173);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(669, 255);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(137, 55);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormCars
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(819, 669);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.ChangeButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormCars";
|
||||||
|
this.Text = "Машины";
|
||||||
|
this.Load += new System.EventHandler(this.FormStatuses_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button ChangeButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
121
Subd/Forms/FormStatuses.cs
Normal file
121
Subd/Forms/FormStatuses.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
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;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormStatuses : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IStatusLogic _logic;
|
||||||
|
|
||||||
|
public FormStatuses(ILogger<FormCompanies> logger, IStatusLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormStatuses_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList();
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["Title"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка машин");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки машин");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormStatus));
|
||||||
|
|
||||||
|
if (service is FormStatus form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormStatus));
|
||||||
|
|
||||||
|
if (service is FormStatus form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new StatusBM
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormStatuses.resx
Normal file
60
Subd/Forms/FormStatuses.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>
|
250
Subd/Forms/FormVoyage.Designer.cs
generated
Normal file
250
Subd/Forms/FormVoyage.Designer.cs
generated
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
partial class FormVoyage
|
||||||
|
{
|
||||||
|
/// <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.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.Statuslabel = new System.Windows.Forms.Label();
|
||||||
|
this.RoutecomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.HumancomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.CarcomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.CompanycomboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.AddTenbutton = new System.Windows.Forms.Button();
|
||||||
|
this.Timelabel = new System.Windows.Forms.Label();
|
||||||
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(138, 325);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(259, 325);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// Statuslabel
|
||||||
|
//
|
||||||
|
this.Statuslabel.AutoSize = true;
|
||||||
|
this.Statuslabel.Location = new System.Drawing.Point(12, 24);
|
||||||
|
this.Statuslabel.Name = "Statuslabel";
|
||||||
|
this.Statuslabel.Size = new System.Drawing.Size(80, 20);
|
||||||
|
this.Statuslabel.TabIndex = 7;
|
||||||
|
this.Statuslabel.Text = "Маршрут: ";
|
||||||
|
//
|
||||||
|
// RoutecomboBox
|
||||||
|
//
|
||||||
|
this.RoutecomboBox.FormattingEnabled = true;
|
||||||
|
this.RoutecomboBox.Location = new System.Drawing.Point(115, 24);
|
||||||
|
this.RoutecomboBox.Name = "RoutecomboBox";
|
||||||
|
this.RoutecomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.RoutecomboBox.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(12, 65);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(67, 20);
|
||||||
|
this.label1.TabIndex = 9;
|
||||||
|
this.label1.Text = "Водила: ";
|
||||||
|
//
|
||||||
|
// HumancomboBox
|
||||||
|
//
|
||||||
|
this.HumancomboBox.FormattingEnabled = true;
|
||||||
|
this.HumancomboBox.Location = new System.Drawing.Point(115, 65);
|
||||||
|
this.HumancomboBox.Name = "HumancomboBox";
|
||||||
|
this.HumancomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.HumancomboBox.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(12, 115);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(75, 20);
|
||||||
|
this.label2.TabIndex = 11;
|
||||||
|
this.label2.Text = "Машина: ";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(12, 170);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(88, 20);
|
||||||
|
this.label3.TabIndex = 12;
|
||||||
|
this.label3.Text = "Компания: ";
|
||||||
|
//
|
||||||
|
// CarcomboBox
|
||||||
|
//
|
||||||
|
this.CarcomboBox.FormattingEnabled = true;
|
||||||
|
this.CarcomboBox.Location = new System.Drawing.Point(115, 115);
|
||||||
|
this.CarcomboBox.Name = "CarcomboBox";
|
||||||
|
this.CarcomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.CarcomboBox.TabIndex = 13;
|
||||||
|
//
|
||||||
|
// CompanycomboBox
|
||||||
|
//
|
||||||
|
this.CompanycomboBox.FormattingEnabled = true;
|
||||||
|
this.CompanycomboBox.Location = new System.Drawing.Point(112, 170);
|
||||||
|
this.CompanycomboBox.Name = "CompanycomboBox";
|
||||||
|
this.CompanycomboBox.Size = new System.Drawing.Size(151, 28);
|
||||||
|
this.CompanycomboBox.TabIndex = 14;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(12, 238);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(52, 20);
|
||||||
|
this.label4.TabIndex = 15;
|
||||||
|
this.label4.Text = "Выезд";
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(12, 282);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(43, 20);
|
||||||
|
this.label5.TabIndex = 16;
|
||||||
|
this.label5.Text = "Срок";
|
||||||
|
//
|
||||||
|
// dateTimePickerFrom
|
||||||
|
//
|
||||||
|
this.dateTimePickerFrom.Location = new System.Drawing.Point(95, 231);
|
||||||
|
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||||
|
this.dateTimePickerFrom.Size = new System.Drawing.Size(250, 27);
|
||||||
|
this.dateTimePickerFrom.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// dateTimePickerTo
|
||||||
|
//
|
||||||
|
this.dateTimePickerTo.Location = new System.Drawing.Point(95, 277);
|
||||||
|
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
||||||
|
this.dateTimePickerTo.Size = new System.Drawing.Size(250, 27);
|
||||||
|
this.dateTimePickerTo.TabIndex = 18;
|
||||||
|
//
|
||||||
|
// AddTenbutton
|
||||||
|
//
|
||||||
|
this.AddTenbutton.Location = new System.Drawing.Point(26, 327);
|
||||||
|
this.AddTenbutton.Name = "AddTenbutton";
|
||||||
|
this.AddTenbutton.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.AddTenbutton.TabIndex = 19;
|
||||||
|
this.AddTenbutton.Text = "+10";
|
||||||
|
this.AddTenbutton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddTenbutton.Click += new System.EventHandler(this.AddTenbutton_Click);
|
||||||
|
//
|
||||||
|
// Timelabel
|
||||||
|
//
|
||||||
|
this.Timelabel.AutoSize = true;
|
||||||
|
this.Timelabel.Location = new System.Drawing.Point(26, 389);
|
||||||
|
this.Timelabel.Name = "Timelabel";
|
||||||
|
this.Timelabel.Size = new System.Drawing.Size(17, 20);
|
||||||
|
this.Timelabel.TabIndex = 20;
|
||||||
|
this.Timelabel.Text = "0";
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
this.label6.AutoSize = true;
|
||||||
|
this.label6.Location = new System.Drawing.Point(50, 389);
|
||||||
|
this.label6.Name = "label6";
|
||||||
|
this.label6.Size = new System.Drawing.Size(29, 20);
|
||||||
|
this.label6.TabIndex = 21;
|
||||||
|
this.label6.Text = "mc";
|
||||||
|
//
|
||||||
|
// FormVoyage
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(375, 433);
|
||||||
|
this.Controls.Add(this.label6);
|
||||||
|
this.Controls.Add(this.Timelabel);
|
||||||
|
this.Controls.Add(this.AddTenbutton);
|
||||||
|
this.Controls.Add(this.dateTimePickerTo);
|
||||||
|
this.Controls.Add(this.dateTimePickerFrom);
|
||||||
|
this.Controls.Add(this.label5);
|
||||||
|
this.Controls.Add(this.label4);
|
||||||
|
this.Controls.Add(this.CompanycomboBox);
|
||||||
|
this.Controls.Add(this.CarcomboBox);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.HumancomboBox);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.RoutecomboBox);
|
||||||
|
this.Controls.Add(this.Statuslabel);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormVoyage";
|
||||||
|
this.Text = "Компонент";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label Statuslabel;
|
||||||
|
private ComboBox RoutecomboBox;
|
||||||
|
private Label label1;
|
||||||
|
private ComboBox HumancomboBox;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private ComboBox CarcomboBox;
|
||||||
|
private ComboBox CompanycomboBox;
|
||||||
|
private Label label4;
|
||||||
|
private Label label5;
|
||||||
|
private DateTimePicker dateTimePickerFrom;
|
||||||
|
private DateTimePicker dateTimePickerTo;
|
||||||
|
private Button AddTenbutton;
|
||||||
|
private Label Timelabel;
|
||||||
|
private Label label6;
|
||||||
|
}
|
||||||
|
}
|
173
Subd/Forms/FormVoyage.cs
Normal file
173
Subd/Forms/FormVoyage.cs
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.SearchModel;
|
||||||
|
using DataBase;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using NLog.LayoutRenderers;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Forms
|
||||||
|
{
|
||||||
|
public partial class FormVoyage : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IVoyageLogic _logic;
|
||||||
|
private readonly IRouteLogic _routeLogic;
|
||||||
|
private readonly ICarLogic _carLogic;
|
||||||
|
private readonly IHumanLogic _humanLogic;
|
||||||
|
private readonly ICompanyLogic _companyLogic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
Random rndModel = new Random();
|
||||||
|
public FormVoyage(ILogger<FormVoyage> logger, IVoyageLogic logic, IRouteLogic routeLogic, ICarLogic carLogic, IHumanLogic humanLogic, ICompanyLogic companyLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_routeLogic = routeLogic;
|
||||||
|
_carLogic = carLogic;
|
||||||
|
_humanLogic = humanLogic;
|
||||||
|
_companyLogic = companyLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormComponent_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var routes = _routeLogic.ReadList(null);
|
||||||
|
if (routes != null)
|
||||||
|
{
|
||||||
|
RoutecomboBox.DisplayMember = "Title";
|
||||||
|
RoutecomboBox.ValueMember = "Id";
|
||||||
|
RoutecomboBox.DataSource = routes;
|
||||||
|
RoutecomboBox.SelectedItem = null;
|
||||||
|
}
|
||||||
|
var cars = _carLogic.ReadList(new CarSM { StatusId = 1});
|
||||||
|
if (cars != null)
|
||||||
|
{
|
||||||
|
CarcomboBox.DisplayMember = "Model";
|
||||||
|
CarcomboBox.ValueMember = "Id";
|
||||||
|
CarcomboBox.DataSource = cars;
|
||||||
|
CarcomboBox.SelectedItem = null;
|
||||||
|
}
|
||||||
|
var companys = _companyLogic.ReadList(new CompanySM { StatusId =1});
|
||||||
|
if (companys != null)
|
||||||
|
{
|
||||||
|
CompanycomboBox.DisplayMember = "Title";
|
||||||
|
CompanycomboBox.ValueMember = "Id";
|
||||||
|
CompanycomboBox.DataSource = companys;
|
||||||
|
CompanycomboBox.SelectedItem = null;
|
||||||
|
}
|
||||||
|
var humans = _humanLogic.ReadList(new HumanSM { StatusId=1});
|
||||||
|
if (humans != null)
|
||||||
|
{
|
||||||
|
HumancomboBox.DisplayMember = "Name";
|
||||||
|
HumancomboBox.ValueMember = "Id";
|
||||||
|
HumancomboBox.DataSource = humans;
|
||||||
|
HumancomboBox.SelectedItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения voyage");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
_logger.LogInformation("Сохранение компонента");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new VoyageBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
RouteId = Convert.ToInt32(RoutecomboBox.SelectedValue),
|
||||||
|
CarId = Convert.ToInt32(CarcomboBox.SelectedValue),
|
||||||
|
HumanId = Convert.ToInt32(HumancomboBox.SelectedValue),
|
||||||
|
CompanyId = Convert.ToInt32(CompanycomboBox.SelectedValue),
|
||||||
|
DateStart = DateOnly.FromDateTime(DateTime.SpecifyKind(dateTimePickerFrom.Value, DateTimeKind.Utc)),
|
||||||
|
DateEnd = DateOnly.FromDateTime(DateTime.SpecifyKind(dateTimePickerTo.Value, DateTimeKind.Utc)),
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
//MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
//DialogResult = DialogResult.OK;
|
||||||
|
//Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlacecomboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTenbutton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
stopwatch.Start();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var dateNew = new DateOnly(rndModel.Next(2000, 2023), rndModel.Next(1, 13), rndModel.Next(1, 30));
|
||||||
|
var dateEnd = dateNew.AddMonths(rndModel.Next(1, 30));
|
||||||
|
var model = new VoyageBM
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
CarId = rndModel.Next(1, _carLogic.ReadList(null).Count),
|
||||||
|
CompanyId = rndModel.Next(1, _companyLogic.ReadList(null).Count),
|
||||||
|
HumanId = rndModel.Next(1, _humanLogic.ReadList(null).Count),
|
||||||
|
RouteId = rndModel.Next(1, _routeLogic.ReadList(null).Count),
|
||||||
|
DateStart = dateNew,
|
||||||
|
DateEnd = dateEnd
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _logic.Create(model);
|
||||||
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
stopwatch.Stop();
|
||||||
|
var time = stopwatch.ElapsedMilliseconds;
|
||||||
|
Timelabel.Text = time.ToString();
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Subd/Forms/FormVoyage.resx
Normal file
60
Subd/Forms/FormVoyage.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>
|
@ -18,4 +18,51 @@
|
|||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\DataBase\DataBase.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="FormReportCompanies.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormReportHumans.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormVoyage.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormRoute.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormRoutes.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormPlace.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormPlaces.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormStatuses.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormStatus.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormCompany.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormHuman.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormCompanies.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="FormHumans.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,3 +1,9 @@
|
|||||||
|
|
||||||
|
using BusinessBL.BusinessBL;
|
||||||
|
using BusinessLogic.BusinessLogic;
|
||||||
|
using Contracts.BusinessLogic;
|
||||||
|
using Contracts.Storage;
|
||||||
|
using DataBase.Implements;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
@ -21,7 +27,7 @@ namespace Forms
|
|||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
ConfigureServices(services);
|
ConfigureServices(services);
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<Form1>());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
}
|
}
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
@ -30,6 +36,39 @@ namespace Forms
|
|||||||
option.SetMinimumLevel(LogLevel.Information);
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
option.AddNLog("nlog.config");
|
option.AddNLog("nlog.config");
|
||||||
});
|
});
|
||||||
|
services.AddTransient<IStatusStorage, StatusStorage>();
|
||||||
|
services.AddTransient<IHumanStorage, HumanStorage>();
|
||||||
|
services.AddTransient<ICarStorage, CarStorage>();
|
||||||
|
services.AddTransient<ICompanyStorage,CompanyStorage>();
|
||||||
|
services.AddTransient<IVoyageStorage, VoyageStorage>();
|
||||||
|
services.AddTransient<IPlaceStorage, PlaceStorage>();
|
||||||
|
services.AddTransient<IRouteStorage, RouteStorage>();
|
||||||
|
|
||||||
|
|
||||||
|
services.AddTransient<IStatusLogic, StatusBL>();
|
||||||
|
services.AddTransient<IHumanLogic, HumanBL>();
|
||||||
|
services.AddTransient<ICarLogic, CarBL>();
|
||||||
|
services.AddTransient<ICompanyLogic, CompanyBL>();
|
||||||
|
services.AddTransient<IVoyageLogic, VoyageBL>();
|
||||||
|
services.AddTransient<IPlaceLogic, PlaceBL>();
|
||||||
|
services.AddTransient<IRouteLogic, RouteBL>();
|
||||||
|
|
||||||
|
services.AddTransient<FormMain>();
|
||||||
|
services.AddTransient<FormCars>();
|
||||||
|
services.AddTransient<FormCar>();
|
||||||
|
services.AddTransient<FormHumans>();
|
||||||
|
services.AddTransient<FormHuman>();
|
||||||
|
services.AddTransient<FormCompanies>();
|
||||||
|
services.AddTransient<FormCompany>();
|
||||||
|
services.AddTransient<FormStatuses>();
|
||||||
|
services.AddTransient<FormStatus>();
|
||||||
|
services.AddTransient<FormPlaces>();
|
||||||
|
services.AddTransient<FormPlace>();
|
||||||
|
services.AddTransient<FormRoutes>();
|
||||||
|
services.AddTransient<FormRoute>();
|
||||||
|
services.AddTransient<FormVoyage>();
|
||||||
|
services.AddTransient<FormReportHumans>();
|
||||||
|
services.AddTransient<FormReportCompanies>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ namespace DataModels.Models
|
|||||||
string Model { get; }
|
string Model { get; }
|
||||||
int Tonnage { get; }
|
int Tonnage { get; }
|
||||||
int? StatusId { get; }
|
int? StatusId { get; }
|
||||||
string StatusTitle { get; }
|
string? StatusTitle { get; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@ namespace DataModels.Models
|
|||||||
{
|
{
|
||||||
string Title { get; }
|
string Title { get; }
|
||||||
int? StatusId { get; }
|
int? StatusId { get; }
|
||||||
string StatusTitle { get; }
|
string? StatusTitle { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ namespace DataModels.Models
|
|||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Phone { get; }
|
string Phone { get; }
|
||||||
int? StatusId { get; }
|
int? StatusId { get; }
|
||||||
string StatusTitle { get; }
|
string? StatusTitle { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,11 @@ namespace DataModels.Models
|
|||||||
public interface IVoyage : IId
|
public interface IVoyage : IId
|
||||||
{
|
{
|
||||||
int? CarId { get; }
|
int? CarId { get; }
|
||||||
string CarName { get; }
|
string? CarName { get; }
|
||||||
int? HumanId { get; }
|
int? HumanId { get; }
|
||||||
string HumanName { get; }
|
string? HumanName { get; }
|
||||||
int? CompanyId { get; }
|
int? CompanyId { get; }
|
||||||
string CompanyName { get; }
|
string? CompanyName { get; }
|
||||||
int? RouteId { get; }
|
int? RouteId { get; }
|
||||||
DateOnly? DateStart { get; }
|
DateOnly? DateStart { get; }
|
||||||
DateOnly? DateEnd { get; }
|
DateOnly? DateEnd { get; }
|
||||||
|
Loading…
Reference in New Issue
Block a user