Готовая лабораторная работа 5 (усложнёнка)
This commit is contained in:
parent
d203230644
commit
7e7bfa54b0
@ -30,13 +30,13 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
using var context = new FurnitureAssemblyDatabase();
|
||||
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
using var context = new FurnitureAssemblyDatabase();
|
||||
|
||||
return context.Orders
|
||||
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo || x.ClientId == model.ClientId)
|
||||
.Include(x => x.Furniture)
|
||||
|
@ -34,6 +34,7 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Client()
|
||||
{
|
||||
Id = model.Id,
|
||||
@ -49,6 +50,7 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ClientFIO = model.ClientFIO;
|
||||
Email = model.Email;
|
||||
Password = model.Password;
|
||||
|
@ -21,10 +21,10 @@ namespace FurnitureAssemblyListImplement
|
||||
// Список для хранения заказов
|
||||
public List<Order> Orders { get; set; }
|
||||
|
||||
//список для хранения Магазинов
|
||||
// Список для хранения Магазинов
|
||||
public List<Shop> Shops { get; set; }
|
||||
|
||||
//список для хранения Клиентов
|
||||
// Список для хранения Клиентов
|
||||
public List<Client> Clients { get; set; }
|
||||
|
||||
public DataListSingleton()
|
||||
|
@ -25,14 +25,14 @@ namespace FurnitureAssemblyView
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_list == null)
|
||||
if (_list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach(var elem in _list)
|
||||
foreach (var elem in _list)
|
||||
{
|
||||
if(elem.Id == Id)
|
||||
if (elem.Id == Id)
|
||||
{
|
||||
return elem;
|
||||
}
|
||||
@ -51,7 +51,7 @@ namespace FurnitureAssemblyView
|
||||
|
||||
_list = logic.ReadList(null);
|
||||
|
||||
if(_list != null)
|
||||
if (_list != null)
|
||||
{
|
||||
comboBoxWorkPiece.DisplayMember = "WorkPieceName";
|
||||
comboBoxWorkPiece.ValueMember = "Id";
|
||||
|
@ -74,7 +74,7 @@
|
||||
buttonRef.TabIndex = 3;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
buttonRef.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
|
@ -118,7 +118,7 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ namespace FurnitureAssemblyView
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["FurnitureId"].Visible = false;
|
||||
dataGridView.Columns["ClientId"].Visible = false;
|
||||
dataGridView.Columns["FurnitureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
|
@ -35,7 +35,7 @@ namespace FurnitureAssemblyView
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
|
||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:\\Users\\NikBe\\source\\repos\\TP\\Hard\\Lab4\\FurnitureAssembly\\FurnitureAssemblyView\\ReportOrders.rdlc", FileMode.Open));
|
||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
||||
|
||||
Controls.Clear();
|
||||
Controls.Add(reportViewer);
|
||||
|
@ -78,7 +78,7 @@
|
||||
buttonRef.TabIndex = 3;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
buttonRef.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
|
@ -40,7 +40,7 @@ namespace FurnitureAssemblyView
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
// Растягиваем колонку Название на всю ширину, колонку Id скрываем
|
||||
if(list != null)
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
@ -49,7 +49,7 @@ namespace FurnitureAssemblyView
|
||||
|
||||
_logger.LogInformation("Загрузка заготовок");
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки заготовок");
|
||||
|
||||
@ -120,7 +120,7 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
@ -30,4 +30,10 @@
|
||||
<ProjectReference Include="..\FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ReportOrders.rdlc">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -31,6 +31,7 @@ namespace FurnitureAssemblyView
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
|
Loading…
Reference in New Issue
Block a user