Пример #1
0
        public override string[] GetRolesForUser(string username)
        {
            EducationSystemContext context = new EducationSystemContext();
            var user = context.Users.FirstOrDefault(x => x.Username == username);

            return(new string[] { user.Role });
        }
Пример #2
0
 public void DeleteCourse(int id)// удаление курса
 {
     using (EducationSystemContext esc = new EducationSystemContext())
     {
         esc.Database.ExecuteSqlRaw("delete Courses where IDCourse={0}", id);
     }
 }
Пример #3
0
 public void UpdateCountLesson(int idcourses)// добавляем урок в базу данных
 {
     using (EducationSystemContext esc = new EducationSystemContext())
     {
         esc.Database.ExecuteSqlRaw("update Courses set CountLessons=CountLessons+1 where IDCourse={0}", idcourses);
     }
 }
Пример #4
0
 public void AddCourse(int idteacher, string namecours, int numberclass, int?idschooll, int idsubject) // добавляем курс
 {
     using (EducationSystemContext esc = new EducationSystemContext())
     {
         esc.Database.ExecuteSqlRaw("insert into Courses (IDTeachers, Name, IDSubgect, IDSchool, NamberClass,CountLessons) VALUES ({0},{1},{2},{3},{4},0)", idteacher, namecours, idsubject, idschooll, numberclass);
     }
 }
Пример #5
0
 public void UpdateTeacherData(string newname, string newsurname, string newpatr, string newpassword, string newphone, int newschool, int id)// обновление данных в учителя
 {
     using (EducationSystemContext esc = new EducationSystemContext())
     {
         esc.Database.ExecuteSqlRaw("update Teachers set Name={0}, Surname={1}, Patronymic={2}, Phone={3}, IDSchool={4}, Password={5} where IDTeacher={6}", newname, newsurname, newpatr, newphone, newschool, newpassword, id);
     }
 }
Пример #6
0
        public Parents UserDataPa(int [] mas)// получение данных пользователя родитель
        {
            Parents tmp;

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp = esc.Parents.FromSqlRaw("Select * from [Parents] where [IDParent]={0}", mas[0]).First();
            }
            return(tmp);
        }
Пример #7
0
        public Pupils UserDataP(int [] mas)// получение данных пользователя ученик
        {
            Pupils tmp;

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp = esc.Pupils.FromSqlRaw("Select * from [Pupils] where [IDPupil]={0}", mas[0]).First();
            }
            return(tmp);
        }
Пример #8
0
        public Teachers UserDataT(int [] mas)// получение данныхпользователя учитель
        {
            Teachers tmp;

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp = esc.Teachers.FromSqlRaw("Select * from [Teachers] where [IDTeacher]={0}", mas[0]).First();
            }
            return(tmp);
        }
Пример #9
0
        public List <Pupils> GetPupils() // список учеников
        {
            List <Pupils> pupilsusers = new List <Pupils>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Pupils)
                {
                    pupilsusers.Add(tmp);
                }
            }
            return(pupilsusers);
        }
Пример #10
0
        public List <Courses> GetCourses()// получение списка курсов
        {
            List <Courses> sud = new List <Courses>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Courses)
                {
                    sud.Add(tmp);
                }
            }
            return(sud);
        }
Пример #11
0
        public List <Parents> GetParents()// список родителей
        {
            List <Parents> parentsusers = new List <Parents>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Parents)
                {
                    parentsusers.Add(tmp);
                }
            }
            return(parentsusers);
        }
Пример #12
0
        public List <School> GetSchools()// список школ
        {
            List <School> schools = new List <School>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.School)
                {
                    schools.Add(tmp);
                }
            }
            return(schools);
        }
Пример #13
0
        public List <Teachers> GetTeachers()// список учителей
        {
            List <Teachers> teachersuser = new List <Teachers>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Teachers)
                {
                    teachersuser.Add(tmp);
                }
            }
            return(teachersuser);
        }
Пример #14
0
        public List <Subject> GetSubjects()// получение списка предметов
        {
            List <Subject> sud = new List <Subject>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Subject)
                {
                    sud.Add(tmp);
                }
            }
            return(sud);
        }
Пример #15
0
        public string NameCourses(int id)// получение имени курса
        {
            string resulte = "";

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Courses)
                {
                    if (tmp.Idcourse == id)
                    {
                        resulte = tmp.Name; break;
                    }
                }
            }
            return(resulte);
        }
Пример #16
0
        public int GetCountLesson(int idcourses)// пролучение количества уроков
        {
            int result = 0;

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Courses)
                {
                    if (tmp.Idcourse == idcourses)
                    {
                        result = tmp.CountLessons; break;
                    }
                }
            }
            return(result);
        }
Пример #17
0
        public List <string> GetArrayEmailPupils(int?idschool, int number)// получения email учеников для отправки уведомлений на почту
        {
            List <string> email = new List <string>();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Pupils)
                {
                    if (tmp.Idschool == idschool && tmp.NamberClass == number)
                    {
                        email.Add(tmp.Email);
                    }
                }
            }
            return(email);
        }
Пример #18
0
        public int GetNumberClass(int id)// получение номер класса
        {
            int result = 0;

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                foreach (var tmp in esc.Courses)
                {
                    if (tmp.Idcourse == id)
                    {
                        result = tmp.NamberClass; break;
                    }
                }
            }
            return(result);
        }
Пример #19
0
        public void AddNewUserTeacher(string name, string surnam, string patr, string phone, int?idschool, int?idsubject, string email, string password)  // добавление нового пользователя учитель
        {
            Teachers tmp = new Teachers();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp.Name       = name;
                tmp.Surname    = surnam;
                tmp.Patronymic = patr;
                tmp.Phone      = phone;
                tmp.Idschool   = idschool;
                tmp.Idsubject  = idsubject;
                tmp.Email      = email;
                tmp.Password   = password;
                esc.Teachers.Add(tmp);
                esc.SaveChanges();
            }
        }
Пример #20
0
        public void AddNewUserPupil(string name, string surnam, string patr, string phone, int?idschool, string email, string password, int number) // добавление нового пользователя ученик
        {
            Pupils tmp = new Pupils();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp.Name        = name;
                tmp.Surname     = surnam;
                tmp.Patronymic  = patr;
                tmp.Phone       = phone;
                tmp.Idschool    = idschool;
                tmp.NamberClass = number;
                tmp.Email       = email;
                tmp.Password    = password;
                tmp.Code        = 1000;
                esc.Pupils.Add(tmp);
                esc.SaveChanges();
            }
        }
Пример #21
0
        public void AddNewUserParent(string nameMather, string surnameMather, string PatrMathe, string nameFather, string surnameFather, string PatrFather, string phoneMathe, string phoneFather, string email, string password, int code)// добавление нового пользователя родитель
        {
            Parents tmp = new Parents();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp.NameMather       = nameMather;
                tmp.SurnameFather    = surnameMather;
                tmp.PatronymicMather = PatrMathe;
                tmp.NameFather       = nameFather;
                tmp.SurnameFather    = surnameFather;
                tmp.PatronymicFather = PatrFather;
                tmp.PhoneFather      = phoneFather;
                tmp.PhoneMathe       = phoneMathe;
                tmp.Email            = email;
                tmp.Password         = password;
                esc.Parents.Add(tmp);
                esc.SaveChanges();
                esc.Database.ExecuteSqlRaw("UPDATE [Pupils] Set [IDParent]={0} where [IDPupil]={0}", tmp.Idparent, code);
                esc.SaveChanges();
            }
        }
Пример #22
0
 public HomeController(EducationSystemContext context)
 {
     _context = context;
 }
 public AuthenticationController(EducationSystemContext context, IAccountService accountService)
 {
     _context        = context;
     _accountService = accountService;
 }
Пример #24
0
 public LinkRepository(EducationSystemContext EducationSystemContext) : base(EducationSystemContext)
 {
 }
Пример #25
0
 public StudentsController(EducationSystemContext context)
 {
     _context = context;
 }
 public CourseRepository(EducationSystemContext EducationSystemContext) : base(EducationSystemContext)
 {
 }
 public ArticleRepository(EducationSystemContext EducationSystemContext) : base(EducationSystemContext)
 {
 }
Пример #28
0
 public AccountService(EducationSystemContext context)
 {
     _context = context;
 }
 public CategoryRepository(EducationSystemContext EducationSystemContext) : base(EducationSystemContext)
 {
 }