public static async Task <string[]> GenerateLessonMessage(UserInfo user, GoogleSpreadsheetController.SchedulerSheet schedulerSheet, ISchedulerController scheduler, string day, int lesson) { await schedulerSheet.GetSheetDataAsync(); var formattingData = await scheduler.FormatingDataFromGSAsync(scheduler : await schedulerSheet.GetScheduler()); string answer = " Невдалось знайти урок."; string callBackData = default; if (user.TypeUser == TypeUser.Teacher.ToString()) { var teacherInfo = await BalDbController.GetTeacherInformationAsync(user.ChatId); var schedulerDay = await scheduler.GetConcreteDayInformationAsync( scheduler : await scheduler.GetConcreteWeekInformationAsync(teacherInfo.Teachers.First().FullName), dayOfWeek : day); string title = $"{new SendPupilsMessage().Name}{lesson} урок у {ConverteEngMonthToUkr(day, LanguageCases.Rodovyy).Result}:\n"; int pointLesson = lesson * 3; string @class = schedulerDay[pointLesson]; callBackData = @class; string subject = schedulerDay[pointLesson + 1]; string classRoom = schedulerDay[pointLesson + 2]; string timeLesson = timeLessons[lesson]; string body = $"🕐 Час: {timeLesson}\n" + $"📚 Предмет: {subject}\n" + $"💡 Клас: {@class}\n" + $"🏴 Кабінет: {classRoom}\n"; answer = title + body; } if (user.TypeUser == TypeUser.Pupil.ToString()) { var pupilInfo = await BalDbController.GetPupilInformationAsync(user.ChatId); var schedulerDay = await scheduler.GetConcreteDayInformationAsync( scheduler : await scheduler.GetConcreteWeekInformationAsync(pupilInfo.Pupils.First().Class), dayOfWeek : day); string title = $"{new SendTeacherMessage().Name}{lesson} урок у {ConverteEngMonthToUkr(day, LanguageCases.Rodovyy).Result}:\n"; int pointLesson = lesson * 3; string subject = schedulerDay[pointLesson]; string nameTeacher = schedulerDay[pointLesson + 1]; callBackData = nameTeacher; string classRoom = schedulerDay[pointLesson + 2]; string timeLesson = timeLessons[lesson]; string body = $"🕐 Час: {timeLesson}\n" + $"📚 Предмет: {subject}\n" + $"💡 Вчитель: {nameTeacher}\n" + $"🏴 Кабінет: {classRoom}\n"; answer = title + body; } return(new[] { answer, callBackData }); }
GenerateSchedulerMessage(ISchedulerController scheduler, UserInfo userInformation, string day) { GoogleSpreadsheetController.SchedulerSheet schedulerSheet = null; if (userInformation.TypeUser == TypeUser.Teacher.ToString()) { schedulerSheet = new GoogleSpreadsheetController.SchedulerTeacher(); } if (userInformation.TypeUser == TypeUser.Pupil.ToString()) // if Pupil { schedulerSheet = new GoogleSpreadsheetController.SchedulerPupil(); } if (schedulerSheet == null) { return(null); } await schedulerSheet.GetSheetDataAsync(); var schedulerInformation = await schedulerSheet.GetScheduler(); var formattingData = await scheduler.FormatingDataFromGSAsync(schedulerInformation); string answer = default; if (day == "AllWeek") { answer += $"Розклад на весь тиждень.\n"; string body = default; foreach (var dayy in weekDays) { body += await CreateDayScheduler(scheduler, userInformation, dayy); } return(answer + body); } else { return(await CreateDayScheduler(scheduler, userInformation, day)); } }