Esempio n. 1
0
        public ActionResult SearchTeachersBySurname(string Person)
        {
            string[] parts = Person.Split(' ');
            List <TeacherShortInf> teachers = new List <TeacherShortInf>();

            if (parts.Length == 3)
            {
                string part1 = parts[0];
                string part2 = parts[1];
                string part3 = parts[2];

                teachers = TeachersDB.SearchTeacherByThreeParameters(part1, part2, part3);
            }
            else if (parts.Length == 2)
            {
                string part1 = parts[0];
                string part2 = parts[1];

                teachers = TeachersDB.SearchTeacherByTwoParameters(part1, part2);
            }

            ViewBag.Teachers = TeachersDB.GetTeachersShortInf();

            if (teachers.Count != 0)
            {
                ViewBag.Teacher = teachers[0];
            }

            return(PartialView(teachers));
        }
Esempio n. 2
0
        public ActionResult AddClassForm()
        {
            List <TeacherShortInf> teachers = TeachersDB.GetTeachersShortInf();

            ViewBag.Teachers = teachers;
            return(View());
        }
Esempio n. 3
0
        public ActionResult EditClassInformation(int action)
        {
            ClassWithManagment     Class    = ClassesDB.GetClassFullInf(action);
            List <TeacherShortInf> teachers = TeachersDB.GetTeachersShortInf();

            ViewBag.Teachers = teachers;
            return(View(Class));
        }
Esempio n. 4
0
        public ActionResult AddNewTeacher(TeacherFullInformation t)
        {
            TeachersDB.AddTeacher(t.Name, t.Surname, t.Patronymic);
            int teacherID = TeachersDB.GetTeachersLastIndex();

            TeachersDB.AddTeacherForm(teacherID, t.Date_Of_Birth, t.Experience, t.Address, t.Phone_Number, t.Email);
            return(RedirectToActionPermanent("ViewTeachers", "Teacher"));
        }
Esempio n. 5
0
    void AddTeacherToDB()
    {
        var teachersDB = new TeachersDB();

        MenuUIManager.currTeacherId = teachersDB.addTeacher(new Teacher(Name, Family, MdlName, Position, Login, Passw, Ipaddress, Regtime, 0));
        teachersDB.close();
        MenuUIManager.Instance.OpenTaskPanel();
    }
Esempio n. 6
0
 public ActionResult TeacherInfo(int action = 0, int delete = 0)
 {
     if (action != 0)
     {
         return(RedirectToAction("TeacherFullInf", "Teacher", new { id = action }));
     }
     else
     {
         TeachersDB.DeleteTeacher(delete);
         return(RedirectToAction("ViewTeachers", "Teacher"));
     }
 }
Esempio n. 7
0
 public ActionResult SaveTeacherFullInformation(TeacherFullInformation t, string cancel)
 {
     if (cancel != "cancel")
     {
         TeachersDB.UpdateTeacher(t.Teacher_ID, t.Name, t.Surname, t.Patronymic);
         TeachersDB.UpdateTeacherFullInf(t.Teacher_ID, t.Date_Of_Birth, t.Experience, t.Phone_Number, t.Address, t.Email);
         return(RedirectToActionPermanent("ViewTeachers", "Teacher"));
     }
     else
     {
         return(RedirectToActionPermanent("TeacherFullInf", "Teacher", new { id = t.Teacher_ID }));
     }
 }
Esempio n. 8
0
        public ActionResult AddLessonForm()
        {
            List <Class> classes = ClassesDB.GetClasses();

            ViewBag.Classes = classes;
            List <TeacherShortInf> teachers = TeachersDB.GetTeachersShortInf();

            ViewBag.Teachers = teachers;
            List <Subject> subjects = SubjectsDB.GetSubjects();

            ViewBag.Subjects = subjects;
            return(View());
        }
Esempio n. 9
0
        public ActionResult EditLesson(int lessonID)
        {
            LessonFullInf lesson  = LessonsDB.GetLessonFullInf(lessonID);
            List <Class>  classes = ClassesDB.GetClasses();

            ViewBag.Classes = classes;
            List <TeacherShortInf> teachers = TeachersDB.GetTeachersShortInf();

            ViewBag.Teachers = teachers;
            List <Subject> subjects = SubjectsDB.GetSubjects();

            ViewBag.Subjects = subjects;
            return(View(lesson));
        }
Esempio n. 10
0
    public static void UnloadButtonTeacherClick(int teacherDbId)
    {
        var teachersDB = new TeachersDB();
        var outputFile = new StringBuilder();
        var reader     = teachersDB.findTeacherById(teacherDbId);

        reader.Read();
        var id        = Convert.ToInt32(reader[0]);
        var name      = reader[1].ToString();
        var family    = reader[2].ToString();
        var mdlName   = reader[3].ToString();
        var position  = reader[4].ToString();
        var login     = reader[5].ToString();
        var password  = reader[6].ToString();
        var ipaddress = reader[7].ToString();
        var regtime   = Convert.ToDateTime(reader[8]);

        outputFile.AppendLine("");
        outputFile.AppendLine("Преподаватель:");
        outputFile.AppendLine("");
        var newLine = string.Format("Id: {0}", id);

        outputFile.AppendLine(newLine);
        newLine = string.Format("Имя: {0}", name);
        outputFile.AppendLine(newLine);
        newLine = string.Format("Отчество: {0}", mdlName);
        outputFile.AppendLine(newLine);
        newLine = string.Format("Фамилия: {0}", family);
        outputFile.AppendLine(newLine);
        newLine = string.Format("Должность: {0}", position);
        outputFile.AppendLine(newLine);
        newLine = string.Format("Логин: {0}", login);
        outputFile.AppendLine(newLine);
        newLine = string.Format("Пароль (MD5): {0}", password);
        outputFile.AppendLine(newLine);
        newLine = string.Format("IP адрес: {0}", ipaddress);
        outputFile.AppendLine(newLine);
        newLine = string.Format("Дата и время регистрации: {0}", regtime);
        outputFile.AppendLine(newLine);
        var outputFileFilePath = "c:\\" + login + "_teacher.txt";

        File.WriteAllText(outputFileFilePath, outputFile.ToString());
        reader.Close();
        teachersDB.close();
    }
Esempio n. 11
0
    private void SLFindNameChangedTeachers(string currInput)
    {
        foreach (Transform child in SLListContent.transform)
        {
            Destroy(child.gameObject);
        }
        var teachersDB = new TeachersDB();
        var reader     = teachersDB.findTeachersLike(currInput);
        var i          = 0;

        while (reader.Read())
        {
            SpawnTeacher(i, Convert.ToInt32(reader[0]), reader[1].ToString(), reader[2].ToString(),
                         reader[3].ToString(), reader[4].ToString(), reader[5].ToString(),
                         Convert.ToInt32(reader[9]));
            i++;
        }
        ;
        teachersDB.close();
    }
Esempio n. 12
0
    public void SpawnTeachers()
    {
        SLFindName.onValueChanged.AddListener(currInput => SLFindNameChangedTeachers(currInput));
        foreach (Transform child in SLListContent.transform)
        {
            Destroy(child.gameObject);
        }
        var teachersDB = new TeachersDB();
        var reader     = teachersDB.getAllTeachers();
        var i          = 0;

        while (reader.Read())
        {
            SpawnTeacher(i, Convert.ToInt32(reader[0]), reader[1].ToString(), reader[2].ToString(),
                         reader[3].ToString(), reader[4].ToString(), reader[5].ToString(),
                         Convert.ToInt32(reader[9]));
            i++;
        }
        teachersDB.close();
        toggleAllButtons.PrefabType = 0;
        toggleAllButtons.AnalizeChecks();
        unloadAllChecked.IsTeacher = true;
    }
Esempio n. 13
0
        private void Switch()
        {
            if (isInGroup)
            {
                return;
            }
            isOn = !isOn;
            tickImage.gameObject.SetActive(isOn);

            if (isTeacher)
            {
                var teachersDB = new TeachersDB();
                teachersDB.checkTeacher(userDbId, isOn);
                teachersDB.close();
            }
            else
            {
                var studentsDB = new StudentsDB();
                studentsDB.checkStudent(userDbId, isOn);
                studentsDB.close();
            }
            toggleAllButtons.AnalizeChecks();
        }
Esempio n. 14
0
    void EnterButton()
    {
        var teachersDB   = new TeachersDB();
        var currPassword = MenuUIManager.PasswEncryption(passw.text);
        var reader       = teachersDB.findTeacher(login.text);

        if (reader.HasRows)
        {
            reader.Read();
            if (reader[1].ToString() == currPassword)
            {
                MenuUIManager.currTeacherId = Convert.ToInt32(reader[0]);
                MenuUIManager.Instance.OpenTaskPanel();
            }
            else
            {
                Debug.Log("Введенные логин и пароль не соответствуют друг другу");
            }
        }
        else
        {
            Debug.Log("Введенный логин не найден в БД");
        }
    }
Esempio n. 15
0
        public ActionResult EditTeacherInformation(int action)
        {
            TeacherFullInformation t = TeachersDB.GetTeacherFullInformation(action);

            return(View(t));
        }
Esempio n. 16
0
        public ActionResult MailMerge(string send, List <int> Mail)
        {
            StringBuilder result = new StringBuilder();

            try
            {
                List <Parenthood> parenthoods = new List <Parenthood>();
                if (Mail == null)
                {
                    parenthoods = ParentsDB.GetParenthoods();
                }
                else
                {
                    List <Pupil> pupils = new List <Pupil>();

                    foreach (int c in Mail)
                    {
                        foreach (Pupil p in PupilsDB.GetPupilsInClass(c))
                        {
                            pupils.Add(p);
                        }
                    }

                    foreach (Pupil p in pupils)
                    {
                        foreach (Parenthood parenthood in ParentsDB.GetPupilParenthoods(p.Pupil_ID))
                        {
                            parenthoods.Add(parenthood);
                        }
                    }
                }


                foreach (Parenthood p in parenthoods)
                {
                    StringBuilder message = new StringBuilder();

                    PupilFullInformation pupil          = PupilsDB.GetPupilsFullInformation(p.Pupil_ID);
                    Parent                 parent       = ParentsDB.GetParentInfo(p.Parent_ID);
                    ClassWithManagment     c            = ClassesDB.GetClassFullInf(ClassesDB.GetClassId(pupil.Class));
                    TeacherFullInformation classManager = TeachersDB.GetTeacherFullInformation(c.Teacher_ID);

                    List <Subject> subjects = SubjectsDB.GetPupilSubjects(p.Pupil_ID);

                    List <List <Mark> > marks = new List <List <Mark> >();

                    for (int i = 0; i < subjects.Count; i++)
                    {
                        marks.Add(MarksDB.GetPupilSubjectMark(pupil.Pupil_ID, subjects[i].Subject_ID));
                    }

                    if (DateTime.Now.Hour < 10)
                    {
                        message.AppendLine($"<p>Доброе утро, {parent.Name} {parent.Patronymic}!</p>");
                    }
                    else if (DateTime.Now.Hour >= 10 && DateTime.Now.Hour <= 17)
                    {
                        message.AppendLine($"<p>Добрый день, {parent.Name} {parent.Patronymic}!</p>");
                    }
                    else
                    {
                        message.AppendLine($"<p>Добрый вечер, {parent.Name} {parent.Patronymic}!</p>");
                    }

                    if (marks.Count != 0)
                    {
                        message.AppendLine($"<p>Высылаем вам отчет об успеваемости, так как вы подписаны на рассылку.</p>");
                        message.AppendLine("<p>.</p>");

                        message.AppendLine($"<p><b>Ученик(ица)</b>: {pupil.Surname} {pupil.Name} {pupil.Patronymic}.</p>");
                        message.AppendLine($"<p><b>Класс</b>: {pupil.Class}.</p>");

                        DateTime from = LessonsDB.GetClassFirstLesson(ClassesDB.GetClassId(pupil.Class));
                        message.AppendLine($"<p><b>Оценки с {from.ToLongDateString()} по {DateTime.Now.ToLongDateString()}: </b></p>");

                        for (int i = 0; i < subjects.Count; i++)
                        {
                            message.Append("<p>" + subjects[i].Subject_Name + ": ");
                            foreach (Mark mark in marks[i])
                            {
                                if (mark.PupilMark != null)
                                {
                                    message.Append($"{mark.PupilMark.ToString()} ");
                                }
                                else
                                {
                                    message.Append("н ");
                                }
                            }
                            message.Append("</p>");
                            message.AppendLine();
                        }

                        message.AppendLine($"<p><b>Количество пропусков</b>: {PupilsDB.GetPupilAbsentCount(pupil.Pupil_ID)}.</p>");

                        List <KeyValuePair <string, double> > weakSubjects   = PupilsDB.GetPupilWeakSubjects(pupil.Pupil_ID);
                        List <KeyValuePair <string, double> > strongSubjects = PupilsDB.GetPupilStrongSubjects(pupil.Pupil_ID);

                        if (weakSubjects.Count != 0)
                        {
                            message.AppendLine("<p><b>Слабые предметы</b>: </p>");
                            foreach (var subject in weakSubjects)
                            {
                                message.AppendLine($"<p>{subject.Key} (средний балл - {subject.Value.ToString()})</p>");
                            }
                            message.AppendLine("Если вы хотите связаться с учителями по проблемным предметам ученика(ицы), то вы можете написать им по следующим <b>электронным адрессам</b>:");
                            foreach (var subject in weakSubjects)
                            {
                                int teacherID = SubjectsDB.GetSubjectTeacher(ClassesDB.GetClassId(pupil.Class), subject.Key);
                                TeacherFullInformation teacher = TeachersDB.GetTeacherFullInformation(teacherID);

                                message.AppendLine($"<p>{subject.Key}: {teacher.Surname} {teacher.Name} {teacher.Patronymic }. Почта: {teacher.Email}</p>");
                            }
                        }
                        else
                        {
                            message.AppendLine("У данного ученика(ицы) нет слабых предметов. Успеваемость на хорошем уровне.");
                        }

                        if (strongSubjects.Count != 0)
                        {
                            message.AppendLine("<p><b>Сильные предметы</b>: </p>");
                            foreach (var subject in strongSubjects)
                            {
                                message.AppendLine($"<p>{subject.Key} (средний балл - {subject.Value.ToString()})</p>");
                            }
                            message.AppendLine("<p>(По данным предметам рекомендуется посетить олимпиады или турниры. Для более подробной информации необходимо связаться с классным руководителем.)</p>");
                            message.AppendLine($"<p><b>Классный руководитель: </b>{classManager.Surname} {classManager.Name} {classManager.Patronymic }. Почта: {classManager.Email}</p>");
                        }
                        else
                        {
                            message.AppendLine("<p>У данного ученика нет сильных предметов.</p>");
                        }

                        DateTime currentDate        = DateTime.Now;
                        int      currentMonth       = currentDate.Month;
                        int      Year               = currentDate.Year;
                        int      allDayCurrentMonth = DateTime.DaysInMonth(Year, currentMonth);
                        DateTime currentBegin       = new DateTime(Year, currentMonth, 1);
                        DateTime currentEnd         = currentBegin.AddMonths(1).AddDays(-1);

                        int      previousMonth       = currentMonth - 1;
                        int      allDayPreviousMonth = DateTime.DaysInMonth(Year, previousMonth);
                        DateTime previousBegin       = new DateTime(Year, previousMonth, 1);
                        DateTime previousEnd         = previousBegin.AddMonths(1).AddDays(-1);

                        double previousMonthAvgMark = PupilsDB.GetPupilsAvgMarkInMonth(pupil.Pupil_ID, previousBegin, previousEnd);
                        double currentMonthAvgMark  = PupilsDB.GetPupilsAvgMarkInMonth(pupil.Pupil_ID, currentBegin, currentEnd);

                        int change = Convert.ToInt32(((currentMonthAvgMark - previousMonthAvgMark) / previousMonthAvgMark) * 100);

                        message.AppendLine("<p><b>Анализ успеваемости:</b></p>");
                        if (change >= 0)
                        {
                            message.AppendLine($"<p>По сравнению с прошлым месяцем успеваесмость выросла на {change}%. Продолжайте в том же духе!</p>");
                        }
                        else
                        {
                            message.AppendLine($"<p>По сравнению с прошлым месяцем успеваесмость упала на {change}%. Стоит больше внимания уделить учебе!</p>");
                        }

                        for (int i = 0; i < subjects.Count; i++)
                        {
                            message.Append("<p> Предположительная оценка в семестре по " + subjects[i].Subject_Name + ": " + Convert.ToUInt32(PupilsDB.GetPupilsSubjectAvgMark(pupil.Pupil_ID, subjects[i].Subject_ID)) + " ");
                            message.Append("</p>");
                            message.AppendLine();
                        }
                    }
                    else
                    {
                        message.AppendLine("<p>.</p>");
                        message.AppendLine("<p>У данного ученика(ицы) нет оценок, поэтому мы не можем сформировать отчет. Возможно, Вам стоит связаться с классным руководителем по электронной почте.</p>");
                        message.AppendLine($"<p><b>Классный руководитель: </b>{classManager.Surname} {classManager.Name} {classManager.Patronymic }. Почта: {classManager.Email}</p>");
                    }
                    message.AppendLine("<p>.</p>");
                    message.AppendLine("<p>С уважением, администрация школы!</p>");

                    EmailService emailService = new EmailService();
                    emailService.SendEmailAsync(parent.Email, $"Отчет об успеваемости {pupil.Surname} {pupil.Name[0]}. {pupil.Patronymic[0]}.", message.ToString());
                }

                result.AppendLine("Рассылка прошла успешно!");
            }
            catch
            {
                result.AppendLine("<h3> К сожалению, при рассылке проиошла ошибка. Возможно, отсутствует подключение к интернету. Попробуйте позжу! </h3>");
            }

            ViewBag.Message = result.ToString();

            return(View("~/Views/Some/Result.cshtml"));
        }
Esempio n. 17
0
        public ActionResult TeacherFullInf(int id)
        {
            TeacherFullInformation t = TeachersDB.GetTeacherFullInformation(id);

            return(View(t));
        }
Esempio n. 18
0
        public ActionResult ViewTeachers()
        {
            List <TeacherShortInf> t = TeachersDB.GetTeachersShortInf();

            return(View(t));
        }
Esempio n. 19
0
        public ActionResult GetTeachersOrderByExperience()
        {
            List <TeacherShortInf> teachers = TeachersDB.GetTeachersShortInfOrderByExperience();

            return(PartialView(teachers));
        }