52 lines
1.8 KiB
C#
52 lines
1.8 KiB
C#
using ConstructionCompanyContracts.BusinessLogicContracts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace ConstructionCompanyView
|
|
{
|
|
public partial class FormBrigadeReport : Form
|
|
{
|
|
public IPositionLogic _logic;
|
|
public FormBrigadeReport(IPositionLogic logic)
|
|
{
|
|
InitializeComponent();
|
|
_logic = logic;
|
|
}
|
|
|
|
private void buttonShow_Click(object sender, EventArgs e)
|
|
{
|
|
if (dateTimePickerFrom.Value.Date > dateTimePickerTo.Value.Date)
|
|
{
|
|
MessageBox.Show("Неверно выбраны даты!");
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
Stopwatch stopwatch = new Stopwatch();
|
|
stopwatch.Start();
|
|
var list = _logic.ReadPositionsAverage(dateTimePickerFrom.Value.Date, dateTimePickerTo.Value.Date).OrderBy(x => x.PositionId).ToList();
|
|
stopwatch.Stop();
|
|
MessageBox.Show(stopwatch.ElapsedMilliseconds.ToString(), "Результат среднего по должностям. Время:");
|
|
if (list != null)
|
|
{
|
|
dataGridView.DataSource = list;
|
|
dataGridView.Columns["PositionId"].Visible = false;
|
|
dataGridView.Columns["PositionName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|
|
}
|