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