Правки

This commit is contained in:
nikbel2004@outlook.com 2024-05-03 20:40:52 +04:00
parent 7df35a7c63
commit 208ca6b9a2
8 changed files with 26 additions and 18 deletions

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
namespace FurnitureAssemblyContracts.BindingModels
{
// Реализация сущности "Отчёт"
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;

View File

@ -12,6 +12,7 @@ namespace FurnitureAssemblyContracts.SearchModels
// для поиска по идентификатору
public int? Id { get; set; }
// Два поля для возможности производить выборку
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }

View File

@ -31,8 +31,7 @@ namespace FurnitureAssemblyFileImplement.Implements
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
{
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => GetViewModel(x))
.ToList();
.Select(x => GetViewModel(x)).ToList();
}
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();

View File

@ -35,7 +35,7 @@ namespace FurnitureAssemblyView
Dock = DockStyle.Fill
};
reportViewer.LocalReport.LoadReportDefinition(new FileStream("E:\\TP\\Hard\\Lab4\\FurnitureAssembly\\FurnitureAssemblyView\\ReportOrders.rdlc", FileMode.Open));
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
Controls.Clear();
Controls.Add(reportViewer);

View File

@ -31,7 +31,7 @@
buttonAdd = new Button();
buttonUpdate = new Button();
buttonDelete = new Button();
buttonRef = new Button();
buttonRefresh = new Button();
dataGridView = new DataGridView();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@ -69,16 +69,16 @@
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonRef
// buttonRefresh
//
buttonRef.Location = new Point(561, 197);
buttonRef.Margin = new Padding(3, 2, 3, 2);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(100, 34);
buttonRef.TabIndex = 3;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
buttonRefresh.Location = new Point(561, 197);
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
buttonRefresh.Name = "buttonRef";
buttonRefresh.Size = new Size(100, 34);
buttonRefresh.TabIndex = 3;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// dataGridView
//
@ -97,7 +97,7 @@
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(683, 338);
Controls.Add(dataGridView);
Controls.Add(buttonRef);
Controls.Add(buttonRefresh);
Controls.Add(buttonDelete);
Controls.Add(buttonUpdate);
Controls.Add(buttonAdd);
@ -114,7 +114,7 @@
private Button buttonAdd;
private Button buttonUpdate;
private Button buttonDelete;
private Button buttonRef;
private Button buttonRefresh;
private DataGridView dataGridView;
}
}

View File

@ -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();
}

View File

@ -27,4 +27,10 @@
<ProjectReference Include="..\FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="FormReportOrders.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
</ItemGroup>
</Project>

View File

@ -31,6 +31,7 @@ namespace FurnitureAssemblyView
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>