LabWork 4.1.0 (Исправление)
This commit is contained in:
parent
c178331965
commit
00135ac791
@ -42,11 +42,11 @@
|
|||||||
//
|
//
|
||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
label1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||||
label1.Location = new Point(26, 9);
|
label1.Location = new Point(50, 11);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new Size(98, 21);
|
label1.Size = new Size(71, 21);
|
||||||
label1.TabIndex = 0;
|
label1.TabIndex = 0;
|
||||||
label1.Text = "ID Автобуса:";
|
label1.Text = "Автобус:";
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
|
@ -11,7 +11,7 @@ public partial class FormBusRepair : Form
|
|||||||
_busRepairRepository = busRepairRepository ??
|
_busRepairRepository = busRepairRepository ??
|
||||||
throw new ArgumentNullException(nameof(busRepairRepository));
|
throw new ArgumentNullException(nameof(busRepairRepository));
|
||||||
comboBoxBus.DataSource = busRepository.ReadBuses();
|
comboBoxBus.DataSource = busRepository.ReadBuses();
|
||||||
comboBoxBus.DisplayMember = "BusBrand";
|
comboBoxBus.DisplayMember = "Brand";
|
||||||
comboBoxBus.ValueMember = "Id";
|
comboBoxBus.ValueMember = "Id";
|
||||||
}
|
}
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
@ -65,7 +65,6 @@ public partial class FormItineraries : Form
|
|||||||
{
|
{
|
||||||
dataGridViewData.DataSource = _itineraryRepository.ReadItinerary();
|
dataGridViewData.DataSource = _itineraryRepository.ReadItinerary();
|
||||||
dataGridViewData.Columns["Id"].Visible = false;
|
dataGridViewData.Columns["Id"].Visible = false;
|
||||||
dataGridViewData.Columns["RoutePoints"].Visible = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
@ -125,11 +125,11 @@
|
|||||||
//
|
//
|
||||||
label5.AutoSize = true;
|
label5.AutoSize = true;
|
||||||
label5.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
label5.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||||
label5.Location = new Point(32, 45);
|
label5.Location = new Point(51, 47);
|
||||||
label5.Name = "label5";
|
label5.Name = "label5";
|
||||||
label5.Size = new Size(96, 21);
|
label5.Size = new Size(71, 21);
|
||||||
label5.TabIndex = 10;
|
label5.TabIndex = 10;
|
||||||
label5.Text = "ID автобуса:";
|
label5.Text = "Aвтобус:";
|
||||||
//
|
//
|
||||||
// FormRouteReport
|
// FormRouteReport
|
||||||
//
|
//
|
||||||
|
@ -13,7 +13,7 @@ public partial class FormRouteReport : Form
|
|||||||
_container = container ??
|
_container = container ??
|
||||||
throw new ArgumentNullException(nameof(container));
|
throw new ArgumentNullException(nameof(container));
|
||||||
comboBoxBus.DataSource = busRepository.ReadBuses();
|
comboBoxBus.DataSource = busRepository.ReadBuses();
|
||||||
comboBoxBus.DisplayMember = "Id";
|
comboBoxBus.DisplayMember = "Brand";
|
||||||
comboBoxBus.ValueMember = "Id";
|
comboBoxBus.ValueMember = "Id";
|
||||||
}
|
}
|
||||||
private void ButtonSelectFilePath_Click(object sender, EventArgs e)
|
private void ButtonSelectFilePath_Click(object sender, EventArgs e)
|
||||||
|
@ -85,6 +85,7 @@ public partial class FormRoutes : Form
|
|||||||
{
|
{
|
||||||
dataGridViewData.DataSource = _routeRepository.ReadRoutes();
|
dataGridViewData.DataSource = _routeRepository.ReadRoutes();
|
||||||
dataGridViewData.Columns["Id"].Visible = false;
|
dataGridViewData.Columns["Id"].Visible = false;
|
||||||
|
dataGridViewData.Columns["RoutePoints"].Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
@ -179,7 +179,7 @@ internal class ExcelBuilder
|
|||||||
{
|
{
|
||||||
Horizontal = HorizontalAlignmentValues.Left,
|
Horizontal = HorizontalAlignmentValues.Left,
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
WrapText = true
|
WrapText = false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cellFormats.Append(new CellFormat
|
cellFormats.Append(new CellFormat
|
||||||
@ -193,7 +193,7 @@ internal class ExcelBuilder
|
|||||||
{
|
{
|
||||||
Horizontal = HorizontalAlignmentValues.Center,
|
Horizontal = HorizontalAlignmentValues.Center,
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
WrapText = true
|
WrapText = false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ internal class ExcelBuilder
|
|||||||
{
|
{
|
||||||
Horizontal = HorizontalAlignmentValues.Center,
|
Horizontal = HorizontalAlignmentValues.Center,
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
WrapText = true
|
WrapText = false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cellFormats.Append(new CellFormat
|
cellFormats.Append(new CellFormat
|
||||||
@ -222,7 +222,7 @@ internal class ExcelBuilder
|
|||||||
{
|
{
|
||||||
Horizontal = HorizontalAlignmentValues.Center,
|
Horizontal = HorizontalAlignmentValues.Center,
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
WrapText = true
|
WrapText = false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||||
|
@ -9,7 +9,7 @@ internal class TableReport
|
|||||||
{
|
{
|
||||||
private readonly IItineraryRepository _itineraryRepository;
|
private readonly IItineraryRepository _itineraryRepository;
|
||||||
private readonly ILogger<TableReport> _logger;
|
private readonly ILogger<TableReport> _logger;
|
||||||
internal static readonly string[] item = ["Дата", "Id Автобуса", "Id Водителя", "Id Кондуктора", "Кол-во маршрутов"];
|
internal static readonly string[] item = ["Дата", "Автобус", "Водитель", "Кондуктор", "Кол-во маршрутов"];
|
||||||
public TableReport(IItineraryRepository itineraryRepository,
|
public TableReport(IItineraryRepository itineraryRepository,
|
||||||
IBusRepository busRepository, ILogger<TableReport> logger)
|
IBusRepository busRepository, ILogger<TableReport> logger)
|
||||||
{
|
{
|
||||||
@ -26,7 +26,7 @@ internal class TableReport
|
|||||||
new ExcelBuilder(filePath)
|
new ExcelBuilder(filePath)
|
||||||
.AddHeader("Сводка по поездкам автобуса", 0, 5)
|
.AddHeader("Сводка по поездкам автобуса", 0, 5)
|
||||||
.AddParagraph($"за период c {startDate:dd.MM.yyyy} по { endDate: dd.MM.yyyy}", 0)
|
.AddParagraph($"за период c {startDate:dd.MM.yyyy} по { endDate: dd.MM.yyyy}", 0)
|
||||||
.AddTable([10, 10, 10, 10, 10], GetData(busId, startDate, endDate))
|
.AddTable([10, 15, 15, 15, 10], GetData(busId, startDate, endDate))
|
||||||
.Build();
|
.Build();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -44,9 +44,9 @@ internal class TableReport
|
|||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Date = x.ItineraryDate,
|
Date = x.ItineraryDate,
|
||||||
BusId = x.BusId,
|
BusBrand = x.BusBrand,
|
||||||
DriverId = x.DriverId,
|
DriverFullName = x.DriverFullName,
|
||||||
ConductorId = x.ConductorId,
|
ConductorFullName = x.ConductorFullName,
|
||||||
CountRoutes = (int?)x.ItineraryRoutes.Count()
|
CountRoutes = (int?)x.ItineraryRoutes.Count()
|
||||||
})
|
})
|
||||||
.OrderBy(x => x.Date);
|
.OrderBy(x => x.Date);
|
||||||
@ -54,7 +54,7 @@ internal class TableReport
|
|||||||
new List<string[]>() { item }
|
new List<string[]>() { item }
|
||||||
.Union(
|
.Union(
|
||||||
data
|
data
|
||||||
.Select(x => new string[] { x.Date.ToString("dd.MM.yyyy"), x.BusId.ToString(), x.DriverId.ToString(), x.ConductorId.ToString(), x.CountRoutes.ToString()}))
|
.Select(x => new string[] { x.Date.ToString("dd.MM.yyyy"), x.BusBrand.ToString(), x.DriverFullName.ToString(), x.ConductorFullName.ToString(), x.CountRoutes.ToString()}))
|
||||||
.Union(
|
.Union(
|
||||||
[["Всего", "", "", "", data.Sum(x => x.CountRoutes ?? 0).ToString()]])
|
[["Всего", "", "", "", data.Sum(x => x.CountRoutes ?? 0).ToString()]])
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -126,7 +126,7 @@ LEFT JOIN Routes r ON r.Id = ir.RouteId
|
|||||||
return itinerary;
|
return itinerary;
|
||||||
},
|
},
|
||||||
splitOn: "RouteId",
|
splitOn: "RouteId",
|
||||||
param: new { dateForm, dateTo, driverId, conductorId, routeId });
|
param: new { dateForm, dateTo, busId, driverId, conductorId, routeId });
|
||||||
|
|
||||||
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(itineraries));
|
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(itineraries));
|
||||||
return itineraryDict.Select(x =>
|
return itineraryDict.Select(x =>
|
||||||
@ -141,17 +141,5 @@ LEFT JOIN Routes r ON r.Id = ir.RouteId
|
|||||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
var itineraries = connection.Query<TempItineraryRoute>(querySelect);
|
|
||||||
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(itineraries));
|
|
||||||
|
|
||||||
return itineraries.GroupBy(x => x.Id, y => y, (key, value) => Itinerary.CreateOpeartion(
|
|
||||||
value.First(), value.Select(z => ItineraryRoute.CreateElement(0, z.RouteId)) ) ).ToList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
|
||||||
throw;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user