public static void ReadXls(string FileName)
        {
            //ScheduleController.CheckFile();

            ScheduleController.Unit();

            ScheduleController.AddUniversity("мисис");
            ScheduleController.AddFaculty("мисис", FileName);

            HSSFWorkbook hssfwb;

            using (FileStream file = new FileStream(@"" + FileName + ".xls", FileMode.Open, FileAccess.Read))
            {
                hssfwb = new HSSFWorkbook(file);
            }

            for (int course = 1; course < 7; course++)
            {
                if (hssfwb.GetSheet(course + " курс") == null)
                {
                    break;
                }

                ScheduleController.AddCourse("мисис", FileName, course.ToString());

                ISheet sheet = hssfwb.GetSheet(course + " курс");

                int group = 4;
                //int myFlag = 0;

                while (sheet.GetRow(1).GetCell(group - 1) != null)
                {
                    if (sheet.GetRow(1).GetCell(group - 1).NumericCellValue.ToString() == "1")
                    {
                        ScheduleController.AddGroup("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue + " 1 подгруппа");
                    }
                    else if (sheet.GetRow(1).GetCell(group - 1).NumericCellValue.ToString() == "2")
                    {
                        if (sheet.GetRow(0).GetCell(group - 1).ToString() == "")
                        {
                            ScheduleController.AddGroup("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 3).StringCellValue + " 2 подгруппа");
                        }
                        else
                        {
                            ScheduleController.AddGroup("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue + " 2 подгруппа");
                        }
                    }
                    else
                    {
                        ScheduleController.AddGroup("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue);
                    }

                    ScheduleWeek week1 = new ScheduleWeek();
                    ScheduleWeek week2 = new ScheduleWeek();

                    week1.Week = 1;
                    week1.Day  = new List <ScheduleDay>();

                    week2.Week = 2;
                    week2.Day  = new List <ScheduleDay>();

                    for (int dayofweek = 3; dayofweek < 100; dayofweek += 14)
                    {
                        ScheduleDay day1 = new ScheduleDay();
                        ScheduleDay day2 = new ScheduleDay();

                        day1.Day    = dayofweek / 14 + 1;
                        day1.Lesson = new List <Lesson>();
                        day2.Day    = dayofweek / 14 + 1;
                        day2.Lesson = new List <Lesson>();

                        for (int para = dayofweek; para < dayofweek + 14; para += 2)
                        {
                            if (sheet.GetRow(para - 1).GetCell(group - 1) != null)
                            {
                                if (sheet.GetRow(para - 1).GetCell(group - 1).StringCellValue != "")
                                {
                                    Lesson a = new Lesson()
                                    {
                                        Name = sheet.GetRow(para - 1).GetCell(group - 1).StringCellValue, Time = sheet.GetRow(para - 1).GetCell(2).StringCellValue, Room = sheet.GetRow(para - 1).GetCell(group).StringCellValue, Teacher = "", Number = ((para - dayofweek) / 2 + 1).ToString()
                                    };
                                    day1.Lesson.Add(a);
                                }
                            }

                            if (sheet.GetRow(para).GetCell(group - 1) != null)
                            {
                                if (sheet.GetRow(para).GetCell(group - 1).StringCellValue != "")
                                {
                                    day2.Lesson.Add(new Lesson()
                                    {
                                        Name = sheet.GetRow(para).GetCell(group - 1).StringCellValue, Time = sheet.GetRow(para - 1).GetCell(2).StringCellValue, Room = sheet.GetRow(para).GetCell(group).StringCellValue, Teacher = "", Number = ((para - dayofweek) / 2 + 1).ToString()
                                    });
                                }
                            }
                        }

                        week1.Day.Add(day1);
                        week2.Day.Add(day2);
                    }

                    if (sheet.GetRow(1).GetCell(group - 1).NumericCellValue.ToString() == "1")
                    {
                        ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue + " 1 подгруппа", week1);
                        ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue + " 1 подгруппа", week2);
                    }
                    else if (sheet.GetRow(1).GetCell(group - 1).NumericCellValue.ToString() == "2")
                    {
                        if (sheet.GetRow(0).GetCell(group - 1).ToString() == "")
                        {
                            ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 3).StringCellValue + " 2 подгруппа", week1);
                            ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 3).StringCellValue + " 2 подгруппа", week2);
                        }
                        else
                        {
                            ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue + " 2 подгруппа", week1);
                            ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue + " 2 подгруппа", week2);
                        }
                    }
                    else
                    {
                        ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue, week1);
                        ScheduleController.AddScheduleWeek("мисис", FileName, course.ToString(), sheet.GetRow(0).GetCell(group - 1).StringCellValue, week2);
                    }

                    group += 2;
                }
            }
        }
        public async Task <OkResult> Post([FromBody] Update update)
        {
            if (update == null)
            {
                return(Ok());
            }

            var commands  = Bot.Commands;
            var message   = update.Message;
            var botClient = await Bot.GetBotClientAsync();


            foreach (var command in commands)
            {
                if (command.Contains(message))
                {
                    await command.Execute(message, botClient);

                    return(Ok());
                }
            }

            ScheduleController.Unit();

            if (UserController.CheckUser(message.Chat.Id))
            {
                if (UserController.CheckUserElements(message.Chat.Id, "university") == "" && ScheduleController.IsUniversityExist(message.Text))
                {
                    UserController.EditUser(message.Chat.Id, "university", message.Text);

                    List <string> un = ScheduleController.GetFaculties(UserController.CheckUserElements(message.Chat.Id, "university"));

                    string[][] unn = new string[un.ToList().Count][];

                    int count = 0;
                    foreach (string item in un)
                    {
                        unn[count] = new string[] { item };
                        count++;
                    }

                    await botClient.SendTextMessageAsync(message.Chat.Id, "Теперь выбери факультет", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown, replyMarkup : (Telegram.Bot.Types.ReplyMarkups.IReplyMarkup) KeybordController.GetKeyboard(unn, count));

                    return(Ok());
                }
                else if (UserController.CheckUserElements(message.Chat.Id, "faculty") == "" && ScheduleController.IsFacultyExist(UserController.GetUserInfo(message.Chat.Id, "university"), message.Text))
                {
                    UserController.EditUser(message.Chat.Id, "faculty", message.Text);

                    List <string> un = ScheduleController.GetCourses(UserController.CheckUserElements(message.Chat.Id, "university"), UserController.CheckUserElements(message.Chat.Id, "faculty"));

                    string[][] unn = new string[un.ToList().Count][];

                    int count = 0;
                    foreach (string item in un)
                    {
                        unn[count] = new string[] { item };
                        count++;
                    }

                    await botClient.SendTextMessageAsync(message.Chat.Id, "Теперь выбери курс", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown, replyMarkup : (Telegram.Bot.Types.ReplyMarkups.IReplyMarkup) KeybordController.GetKeyboard(unn, count));

                    return(Ok());
                }
                else if (UserController.CheckUserElements(message.Chat.Id, "course") == "" && ScheduleController.IsCourseExist(UserController.GetUserInfo(message.Chat.Id, "university"), UserController.GetUserInfo(message.Chat.Id, "faculty"), message.Text))
                {
                    UserController.EditUser(message.Chat.Id, "course", message.Text);

                    List <string> un = ScheduleController.GetGroups(UserController.CheckUserElements(message.Chat.Id, "university"), UserController.CheckUserElements(message.Chat.Id, "faculty"), UserController.CheckUserElements(message.Chat.Id, "course"));

                    string[][] unn = new string[un.ToList().Count][];

                    int count = 0;
                    foreach (string item in un)
                    {
                        unn[count] = new string[] { item };
                        count++;
                    }

                    await botClient.SendTextMessageAsync(message.Chat.Id, "Теперь выбери группу", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown, replyMarkup : (Telegram.Bot.Types.ReplyMarkups.IReplyMarkup) KeybordController.GetKeyboard(unn, count));

                    return(Ok());
                }
                else if (UserController.CheckUserElements(message.Chat.Id, "group") == "" && ScheduleController.IsGroupExist(UserController.GetUserInfo(message.Chat.Id, "university"), UserController.GetUserInfo(message.Chat.Id, "faculty"), UserController.GetUserInfo(message.Chat.Id, "course"), message.Text))
                {
                    UserController.EditUser(message.Chat.Id, "group", message.Text);

                    string[][] unn = new string[][]
                    {
                        new string[] { "Сегодня", "Завтра" },
                        new string[] { "Сбросить" }
                    };


                    await botClient.SendTextMessageAsync(message.Chat.Id, "Отлично, можем работать!", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown, replyMarkup : (Telegram.Bot.Types.ReplyMarkups.IReplyMarkup) KeybordController.GetKeyboard(unn, 2));

                    return(Ok());
                }
                else if (message.Text == "Сегодня" && UserController.GetUserInfo(message.Chat.Id, "group") != "")
                {
                    int day;
                    int weekNum = (CultureInfo.CurrentCulture).Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday) % 2 + 1;
                    if ((int)DateTime.Now.DayOfWeek == 0)
                    {
                        day = 7;
                    }
                    else
                    {
                        day = (int)DateTime.Now.DayOfWeek;
                    }

                    ScheduleDay schedule = ScheduleController.GetSchedule(UserController.CheckUserElements(message.Chat.Id, "university"), UserController.CheckUserElements(message.Chat.Id, "faculty"), UserController.CheckUserElements(message.Chat.Id, "course"), UserController.CheckUserElements(message.Chat.Id, "group"), weekNum, day);

                    List <Lesson> listPar = schedule.Lesson.ToList();

                    string result = "";
                    foreach (Lesson item in listPar)
                    {
                        result += item.Number + " пара: " + item.Time + "\n" + item.Name + "\n" + item.Room + "\n\n";
                    }
                    if (result != "")
                    {
                        await botClient.SendTextMessageAsync(message.Chat.Id, result, parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown);
                    }
                    else
                    {
                        await botClient.SendTextMessageAsync(message.Chat.Id, "Учебы нет, отдыхай", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown);
                    }

                    return(Ok());
                }
                else if (message.Text == "Завтра" && UserController.GetUserInfo(message.Chat.Id, "group") != "")
                {
                    int day;
                    int weekNum = (CultureInfo.CurrentCulture).Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday) % 2 + 1;
                    if ((int)DateTime.Now.DayOfWeek == 0)
                    {
                        day = 1;
                    }
                    else
                    {
                        if ((int)DateTime.Now.DayOfWeek == 6)
                        {
                            day = 7;
                        }
                        else
                        {
                            day = ((int)DateTime.Now.DayOfWeek + 1) % 7;
                        }
                    }

                    ScheduleDay schedule = ScheduleController.GetSchedule(UserController.CheckUserElements(message.Chat.Id, "university"), UserController.CheckUserElements(message.Chat.Id, "faculty"), UserController.CheckUserElements(message.Chat.Id, "course"), UserController.CheckUserElements(message.Chat.Id, "group"), weekNum, day);

                    List <Lesson> listPar = schedule.Lesson.ToList();

                    string result = "";
                    foreach (Lesson item in listPar)
                    {
                        result += item.Number + " пара: " + item.Time + "\n" + item.Name + "\n" + item.Room + "\n\n";
                    }
                    if (result != "")
                    {
                        await botClient.SendTextMessageAsync(message.Chat.Id, result, parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown);
                    }
                    else
                    {
                        await botClient.SendTextMessageAsync(message.Chat.Id, "Учебы нет, отдыхай", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown);
                    }

                    return(Ok());
                }
                else if (message.Text == "Сбросить")
                {
                    message.Text = @"/start";

                    foreach (var command in commands)
                    {
                        if (command.Contains(message))
                        {
                            await command.Execute(message, botClient);

                            return(Ok());
                        }
                    }

                    return(Ok());
                }
            }

            return(Ok());
        }