fix: change current culture to russian for import

This commit is contained in:
Polianin Nikita 2024-10-31 04:06:58 +03:00
parent 5bc729eb66
commit 3279ef594b

View File

@ -79,6 +79,8 @@ public class ImportController(IMediator mediator, IOptionsSnapshot<GeneralConfig
var pairsDictionary = config.Value.ScheduleSettings!.PairPeriod; var pairsDictionary = config.Value.ScheduleSettings!.PairPeriod;
var ruCulture = new CultureInfo("ru-RU");
foreach (var dto in result.GroupBy(s => new foreach (var dto in result.GroupBy(s => new
{ {
s.DayOfWeek, s.DayOfWeek,
@ -100,7 +102,7 @@ public class ImportController(IMediator mediator, IOptionsSnapshot<GeneralConfig
g.First().Campus, g.First().Campus,
g.First().Professors, g.First().Professors,
Groups = string.Join('\n', g.Select(x => x.Group)), Groups = string.Join('\n', g.Select(x => x.Group)),
IsExclude = g.First().IsExcludedWeeks, IsExclude = g.First().IsExcludedWeeks,
g.First().TypeOfOccupations, g.First().TypeOfOccupations,
g.First().Weeks g.First().Weeks
@ -109,7 +111,7 @@ public class ImportController(IMediator mediator, IOptionsSnapshot<GeneralConfig
{ {
// День // День
worksheet.Cells[row, col++].Value = worksheet.Cells[row, col++].Value =
$"{(int)dto.DayOfWeek} [{CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedDayName(dto.DayOfWeek).ToUpper()}]"; $"{(int)dto.DayOfWeek} [{ruCulture.DateTimeFormat.GetAbbreviatedDayName(dto.DayOfWeek).ToUpper()}]";
// Пара // Пара
worksheet.Cells[row, col++].Value = dto.PairNumber + " п"; worksheet.Cells[row, col++].Value = dto.PairNumber + " п";
@ -118,7 +120,7 @@ public class ImportController(IMediator mediator, IOptionsSnapshot<GeneralConfig
worksheet.Cells[row, col++].Value = $"[{(dto.IsEven ? 2 : 1)}] {(dto.IsEven ? "Четная" : "Нечетная")}"; worksheet.Cells[row, col++].Value = $"[{(dto.IsEven ? 2 : 1)}] {(dto.IsEven ? "Четная" : "Нечетная")}";
// Время // Время
worksheet.Cells[row, col++].Value = pairsDictionary[dto.PairNumber].Start.ToString(CultureInfo.CurrentCulture); worksheet.Cells[row, col++].Value = pairsDictionary[dto.PairNumber].Start.ToString(ruCulture);
// Группа // Группа
worksheet.Cells[row, col].Style.WrapText = true; worksheet.Cells[row, col].Style.WrapText = true;