public ActionResult Delete(int lecturerId)
        {
            LecturerViewModel lec = new LecturerViewModel();

            lec.deleteLecturer(lecturerId);
            return(RedirectToAction("Crud", "Lecturer"));
        }
        private void Lecturer_Page_Loaded(object sender, RoutedEventArgs e)
        {
            _lecturerViewModel   = new LecturerViewModel();
            _centerViewModel     = new CenterViewModel();
            _buildingViewModel   = new BuildingViewModel();
            _facultyViewModel    = new FacultyViewModel();
            _departmentViewModel = new DepartmentViewModel();

            List <LecturerEntity> lecturers = _lecturerViewModel.LoadLecturerData();

            lecturer_data_grid.ItemsSource = lecturers;
            center_combobx.ItemsSource     = _centerViewModel.LoadCenterData();
            building_combobx.ItemsSource   = _buildingViewModel.LoadBuildingData();
            faculty_combobx.ItemsSource    = _facultyViewModel.LoadFacultyData();
            department_combobx.ItemsSource = _departmentViewModel.LoadDepartmentData();

            foreach (LecturerEntity l in lecturers)
            {
                lecturerIds.Add(l.EmployeeId);
            }

            add_btn_.IsEnabled    = false;
            update_btn_.IsEnabled = false;
            delete_btn_.IsEnabled = false;
            emp_id_txtbx.Text     = "Eg: 000150";
        }
Exemple #3
0
        public async Task <IActionResult> PutLecturer(int id, LecturerViewModel lecturer)
        {
            if (lecturer.Id != id)
            {
                throw new Exception(string.Format("Id và Id của giáo viên không giống nhau!"));
            }

            try
            {
                await Task.Run(() =>
                {
                    _lecturerService.Update(lecturer);
                    _lecturerService.SaveChanges();
                    return(Ok("Cập nhập thành công!"));
                });
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LecturerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #4
0
        public bool Add(LecturerViewModel lecturerVm)
        {
            try
            {
                var lecturer = Mapper.Map <LecturerViewModel, Lecturer>(lecturerVm);
                lecturer.DateCreated = DateTime.Now;
                string cardId = _lecturerRepository.FindAll().OrderByDescending(x => x.DateCreated).First().CardId;
                lecturer.CardId = cardId.Substring(2);

                int newCardId = Convert.ToInt32(lecturer.CardId) + 1;

                cardId = newCardId.ToString();
                while (cardId.Length < 7)
                {
                    cardId = "0" + cardId;
                }
                lecturer.CardId = "GV" + cardId;

                _lecturerRepository.Add(lecturer);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #5
0
 public StudentTimetable()
 {
     InitializeComponent();
     _lecturerViewModel = new LecturerViewModel();
     _sessionViewModel  = new SessionViewModel();
     lecturers          = _lecturerViewModel.LoadLecturerData();
 }
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     _prefferedRoomForLecturerViewModel = new PrefferedRoomForLecturerViewModel();
     _lecturerViewModel = new LecturerViewModel();
     lecturername_combobx.ItemsSource = _lecturerViewModel.LoadLecturerData();
     prefferedRoomForLecturers        = _prefferedRoomForLecturerViewModel.LoadData();
 }
Exemple #7
0
 public ActionResult AddOrEdit(string Id = "")
 {
     try
     {
         var data = lecturerService.GetLecturerByID(Id);
         if (data != null)
         {
             var model = new LecturerViewModel();
             model.FullName             = data.FullName;
             model.Code                 = data.Code;
             model.Degree               = data.Degree;
             model.Url_Image            = data.Url_Image;
             model.Url_Facebook         = data.Url_Facebook;
             model.Phone                = data.Phone;
             model.Email                = data.Email;
             model.Serial               = data.Serial;
             model.Position             = data.Position;
             model.Academic_Rank        = data.Academic_Rank;
             model.Specialized          = data.Specialized;
             model.Title                = data.Title;
             model.Native_Land          = data.Native_Land;
             model.Url_Scientific_Works = data.Url_Scientific_Works;
             model.Specialized_Research = data.Specialized_Research;
             model.Teaching             = data.Teaching;
             return(PartialView("CRUDLecturer", model));
         }
     }
     catch (Exception)
     {
     }
     return(PartialView("CRUDLecturer", new LecturerViewModel()));
 }
Exemple #8
0
        public ActionResult EditExamGradeConfirmLec(int ExamIndex)
        {
            Exam exam             = db.Exams.Find(ExamIndex);
            LecturerViewModel lvm = new LecturerViewModel();

            return(View(exam));
        }
        public IActionResult UpdateBio(LecturerViewModel model)
        {
            var lecturer = _repos.Lecturers
                           .GetWith(this.GetAccountId(), "Skills");

            lecturer.Bio = model.Bio;
            if (lecturer.Skills == null)
            {
                lecturer.Skills = new List <Skill>();
            }
            foreach (var item in model.Skills)
            {
                if (lecturer.Skills.Contains(x => x.Name == item.Name))
                {
                    continue;
                }
                else
                {
                    lecturer.Skills.Add(item);
                }
            }

            lecturer = _repos.Lecturers.Update(lecturer);
            _repos.Commit();

            return(Ok(lecturer));
        }
Exemple #10
0
 public LecturerTimetable()
 {
     InitializeComponent();
     //_timeSlotViewModel.LoadTimeSlotData();
     _lecturerViewModel = new LecturerViewModel();
     _sessionViewModel  = new SessionViewModel();
     lecturers          = _lecturerViewModel.LoadLecturerData();
 }
        // GET: Lecturer/UploadPhoto/5
        public ActionResult UploadPhoto(int id)
        {
            APIClient         api      = new APIClient(HttpContext);
            APIResponse       response = api.CallAPI("GET", "/api/lecturer/" + id);
            LecturerViewModel lecturer = JsonConvert.DeserializeObject <LecturerViewModel>(response.Content);

            return(View(lecturer));
        }
Exemple #12
0
 private void Searchbar_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (string.IsNullOrEmpty(Searchbar.Text))
     {
         lecturerViewModel           = new LecturerViewModel();
         LecturerList.BindingContext = lecturerViewModel;
     }
 }
Exemple #13
0
        public IActionResult GetProfessorsJson()
        {
            var lecturers = LecturerManagementService.GetLecturers();

            var responseModel = lecturers.Select(l => LecturerViewModel.FormLecturers(l, null));

            return(Ok(responseModel));
        }
Exemple #14
0
        private List <string> GetAllPropertyNameOfLecturerViewModel()
        {
            var lecturerViewModel = new LecturerViewModel();

            var type = lecturerViewModel.GetType();

            return(ReflectionUtilities.GetAllPropertyNamesOfType(type));
        }
        public ActionResult Crud()
        {
            LecturerViewModel    lec          = new LecturerViewModel();
            List <LecturerModel> lecturerList = new List <LecturerModel>();

            lecturerList = lec.getLecturers();
            return(View(lecturerList));
        }
        private void Lecturer_NA_Page_loaded(object sender, RoutedEventArgs e)
        {
            lecturerNAViewModel = new LecturerNAViewModel();
            lecturerViewModel   = new LecturerViewModel();

            lecturers = lecturerViewModel.LoadLecturerData();
            lecturer_combobx.ItemsSource = lecturers;
            lecturerNAs = lecturerNAViewModel.LoadLecturerNAData();
        }
Exemple #17
0
        public async Task <ActionResult> Update(LecturerViewModel model)
        {
            if (model == null || !ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var result = await _lecturerService.Update(model.ToLecturer());

            return(Ok(result));
        }
Exemple #18
0
        public ActionResult LecturersJournal(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            Teachers          Lecturer;
            LecturerViewModel viewModel = new LecturerViewModel();

            using (DiaryConnection db = new DiaryConnection())
            {
                //Находим семестер, группу и предмет для запроса.
                //Вначале находим самый близкий к сегодняшней дате семестер
                var             TGS            = db.TeachersGroupsSubjects.Where(p => p.TeacherId == id);
                List <Semester> founsSemesters = new List <Semester>();
                //Находим все семестры в которые преподавал преподаватель
                foreach (var item in TGS)
                {
                    var tables = item.TableOfGrades;
                    foreach (var table in tables)
                    {
                        founsSemesters.Add(table.Semester);
                    }
                }
                founsSemesters = founsSemesters.Distinct().ToList();
                //Находим самый близкий к сегодняшней дате семестер
                Semester youngestSemester = founsSemesters.First();
                foreach (var semester in founsSemesters)
                {
                    if (semester.BeginningDate > youngestSemester.BeginningDate)
                    {
                        youngestSemester = youngestSemester;
                    }
                }
                //Получаем первую попавшиеся группу и предмет для найденного семестра.
                Groups   group   = youngestSemester.TableOfGrades.First().TeachersGroupsSubjects.Groups;
                Subjects subject = youngestSemester.TableOfGrades.First().TeachersGroupsSubjects.Subjects;
                //Заполняем модель представления.
                viewModel.GetAllFinalGrades(db, group.Id, id.Value, subject.Id, youngestSemester);
                //Заполнения модели представления
                //Получение название предметов для журнала
                viewModel.GetNamesOfStudents(db, group.Id, id.Value, subject.Id, youngestSemester);
                //Получение данных для заполнения области таблицы с оценками
                viewModel.GetStudentsGrades(db, group.Id, id.Value, subject.Id, youngestSemester);
                //Для строки с названиями месяцев
                viewModel.GetMounthNames();
                //С количеством дней в месяцах для для colspan.
                viewModel.GetDaysMounth();
                //Для отображение строки где день месяца + день недели.
                viewModel.GetDaysSemester();
                //Для формирование таблиц с итоговыми оценками
                viewModel.GetAllFinalGrades(db, group.Id, id.Value, subject.Id, youngestSemester);
            }
            return(View(viewModel));
        }
        public DataTablesResult <LecturerViewModel> GetCollectionLecturers(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();

            ViewBag.EditActionLink   = "/Administration/EditProfessor";
            ViewBag.DeleteActionLink = "/Administration/DeleteLecturer";
            ViewBag.StatActionLink   = "/Administration/Attendance";
            var lecturers = LecturerManagementService.GetLecturersPageable(pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            return(DataTableExtensions.GetResults(lecturers.Items.Select(l => LecturerViewModel.FormLecturers(l, PartialViewToString("_EditGlyphLinks", l.Id))), dataTableParam, lecturers.TotalCount));
        }
Exemple #20
0
 public ViewNavigation()
 {
     studentView  = new StudentView();
     lecturerView = new LecturerView();
     studentsRegisteredTableView      = new StudentsRegisteredTableView();
     studentsRegisteredViewModel      = new StudentsRegisteredTableViewModel();
     lecturerRegisteredTableView      = new LecturersRegisteredTableView();
     lecturerRegisteredTableViewModel = new RegisteredLecturersViewModel();
     lecturerViewModel = new LecturerViewModel();
     studentViewModel  = new StudentViewModel();
 }
Exemple #21
0
        public ActionResult AssignLecturer()
        {
            Dal               dal       = new Dal();
            List <User>       objUsers  = dal.Users.ToList <User>();
            List <Course>     objCourse = dal.Courses.ToList <Course>();
            LecturerViewModel lvm       = new LecturerViewModel();

            lvm.Courses = objCourse;
            lvm.Users   = objUsers;
            return(View(lvm));
        }
Exemple #22
0
 public IActionResult Index()
 {
     if (User.IsInRole("ADMIN"))
     {
         LecturerViewModel model = new LecturerViewModel();
         model.Lecturers = _db._BCPUsers.Where(e => e.Status == 2 || e.Status == 4).Where(e => e.Deleted == false).OrderBy(e => e.Name).ToList();
         return(View(model));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemple #23
0
        public ActionResult ShowSchedule()
        {
            Dal               dal         = new Dal();
            List <Lecturer>   objLecturer = dal.Lecturers.ToList <Lecturer>();
            List <Course>     objCourse   = dal.Courses.ToList <Course>();
            List <Student>    objStudents = dal.Students.ToList <Student>();
            LecturerViewModel lvm         = new LecturerViewModel();

            lvm.Courses   = objCourse;
            lvm.Lecturers = objLecturer;
            lvm.Students  = objStudents;
            return(View(lvm));
        }
Exemple #24
0
 public bool Update(LecturerViewModel lecturerVm)
 {
     try
     {
         var lecturer = Mapper.Map <LecturerViewModel, Lecturer>(lecturerVm);
         lecturer.DateModified = DateTime.Now;
         _lecturerRepository.Update(lecturer);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #25
0
        public ActionResult EditExamGradeLec()
        {
            Dal               dal         = new Dal();
            List <Lecturer>   objLecturer = dal.Lecturers.ToList <Lecturer>();
            List <Exam>       objExams    = dal.Exams.ToList <Exam>();
            List <Course>     objCourse   = dal.Courses.ToList <Course>();
            List <Student>    objStudents = dal.Students.ToList <Student>();
            LecturerViewModel lvm         = new LecturerViewModel();

            lvm.Students  = objStudents;
            lvm.Exams     = objExams;
            lvm.Lecturers = objLecturer;
            lvm.Courses   = objCourse;
            return(View(lvm));
        }
Exemple #26
0
 public StudyGuideViewModel(StudyGuide studyGuide) : this()
 {
     if (studyGuide != null)
     {
         Id              = studyGuide.Id;
         Name            = studyGuide.Name;
         Literacy        = studyGuide.Literacy;
         PlaceOfTraining = studyGuide.PlaceOfTraining;
         InstructionTime = studyGuide.InstructionTime;
         GraduationTime  = studyGuide.GraduationTime;
         LevelStudyGuide = new LevelStudyGuideViewModel(studyGuide.LevelStudyGuide);
         Lecturer        = new LecturerViewModel(studyGuide.Lecturer);
         //User = new UserViewModel(scientificWork.User);
         //Lecturer = new LecturerViewModel;
     }
 }
 public static Lecturer ToLecturer(this LecturerViewModel obj)
 {
     return(new Lecturer
     {
         Id = obj.Id,
         Name = obj.Name,
         LecturerStudents = obj.Students != null ? (obj.Students.Select(s => new LecturerStudent
         {
             LecturerId = obj.Id,
             Student = new Student
             {
                 Id = s.Id,
                 Name = s.Name
             }
         }).ToList()) : new List <LecturerStudent>()
     });
 }
Exemple #28
0
 private void Session_Page_Loaded(object sender, RoutedEventArgs e)
 {
     _lecturerViewModel         = new LecturerViewModel();
     _subjectViewModel          = new SubjectViewModel();
     _tagViewModel              = new TagViewModel();
     _sessionViewModel          = new SessionViewModel();
     _Student_GroupViewModel    = new Student_GroupViewModel();
     _Student_SubGroupViewModel = new Student_SubGroupViewModel();
     lecturers = _lecturerViewModel.LoadLecturerData();
     lecturer_combobx.ItemsSource = lecturers;
     code_combobx.ItemsSource     = _subjectViewModel.LoadSubjectData();
     tag_combobx.ItemsSource      = _tagViewModel.LoadTagData();
     sessions = _sessionViewModel.LoadSessionData();
     //grp_combobx.ItemsSource = _Student_GroupViewModel.LoadStudentData();
     //session_data_grid.ItemsSource = sessions;
     SetDataGrid();
     create_btn_.IsEnabled = false;
 }
Exemple #29
0
        //public ActionResult StudentList()
        //{
        //    return View();
        //}

        //[HttpPost]
        public ActionResult StudentList(LecturerViewModel lvm)
        {
            Dal             dal         = new Dal();
            List <Lecturer> objLecturer = dal.Lecturers.ToList <Lecturer>();
            List <Course>   objCourse   = dal.Courses.ToList <Course>();
            List <Student>  objStudents = dal.Students.ToList <Student>();

            //LecturerViewModel lvm = new LecturerViewModel();
            lvm.Students  = objStudents;
            lvm.Lecturers = objLecturer;
            lvm.Courses   = objCourse;
            //lvm.Course.CourseId = courseId;
            //lvm.Course.CourseName = courseName;
            //Session["SelectedCourseId"] = lvm.Course.CourseId;
            //Session["CourseName"] = lvm.Course.CourseName;

            return(View(lvm));
        }
Exemple #30
0
        private void SearchBar_SearchButtonPressed(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Searchbar.Text))
            {
                List <LecOrSubView> currentItems = new List <LecOrSubView>();

                foreach (LecOrSubView item in lecturerViewModel.LecturerViewList)
                {
                    if (item.Item1.ToLower().Contains(Searchbar.Text.ToLower()))
                    {
                        currentItems.Add(item);
                        System.Diagnostics.Debug.WriteLine(item.Item1);
                    }
                }

                lecturerViewModel           = new LecturerViewModel(currentItems);
                LecturerList.BindingContext = lecturerViewModel;
            }
        }