public ActionResult ProfileTeacher(int id) { var teacher = new TeacherDao().ViewDetails(id); ViewBag.teacher = teacher; var science = new ScienseDao().GetScienceById(teacher.SicenceID); ViewBag.science = science; return(View()); }
private Teacher DaoToDomain(TeacherDao teacherDao) { var teacher = Teacher.Create(teacherDao.Id, teacherDao.Name); foreach (var tsDao in teacherDao.AvailableTimeslots) { var timeslot = Timeslot.Create(tsDao.Id, tsDao.StartTime, tsDao.EndTime, teacher); teacher.AvailableTimeslots.Add(timeslot); } return(teacher); }
public ActionResult Edit(course cou, HttpPostedFileBase photo) { TeacherDao teDao = new TeacherDao(); CourseDao couDao = new CourseDao(); if (ModelState.IsValid) { try { if (photo != null && photo.ContentLength > 0) { course exists_cou = couDao.GetById(cou.co_id); string image = String.Concat(cou.co_name, photo.FileName); if (!image.Equals(exists_cou.co_image)) { var image_old = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/course/"), System.IO.Path.GetFileName(exists_cou.co_image)); if (System.IO.File.Exists(image_old)) { System.IO.File.Delete(image_old); } var image_new = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/course/"), System.IO.Path.GetFileName(image)); photo.SaveAs(image_new); } cou.co_image = image; cou.co_updated_at = DateTime.Now; couDao.Update(cou); } else { course exists_cou = couDao.GetById(cou.co_id); cou.co_image = exists_cou.co_image; couDao.Update(cou); } return(RedirectToAction("Index")); } catch (Exception ex) { Console.WriteLine(ex.Message); return(View("Error")); } } else { ViewBag.lst_te = teDao.GetAll(); var teacher = teDao.GetAll(); SelectList list_te = new SelectList(teacher, "te_id", "te_name"); ViewBag.list_te = list_te; return(View(cou)); } }
public ActionResult ListTeacher(long idscience) { var teacherDao = new TeacherDao(); var scienceDao = new ScienseDao(); var science = scienceDao.GetScienceById(idscience); ViewBag.science = science; var listTeacher = teacherDao.GetListTeacherByScienceID(idscience); ViewBag.listTeacher = listTeacher; return View(); }
public ActionResult ListCalendarWorking(int idteacher) { var teacherDao = new TeacherDao(); var calendarWorking = new CalendarWorkingDao(); var teacher = teacherDao.ViewDetails(idteacher); ViewBag.teacher = teacher; var calendarWorkings = calendarWorking.GetListByTeacher(idteacher); ViewBag.calendarWorkings = calendarWorkings; return View(); }
/// <summary> /// 当点击教师登录按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_teacherLogin_Click(object sender, EventArgs e) { //教师工号 TeacherBean teacher = new TeacherDao().FindByTCode(txTextBox2.Text); if (teacher != null) { new TeacherHome(teacher, this).Show(); this.Hide(); } else { this.Error("错误!不存在此教师工号"); } }
public ActionResult ManageTeacher() { //var TeacherList = db.Teacher.Where(x => x.ID > 0).OrderByDescending(y => y.CreatedDate).ToList(); //ViewBag.TeacherList = TeacherList; //var listScience = db.Science.Where(x => x.ID > 0).OrderByDescending(y => y.CreatedDate).ToList(); //ViewBag.listScience = listScience; //return View(); var teacherDao = new TeacherDao(); var listTeacher = teacherDao.ListAll(); ViewBag.listTeacher = listTeacher; return View(); }
public Sesion login(int id, String password) { TeacherDao helper = new TeacherDao(); Teacher teacher = helper.findById(id); if (teacher == null) { throw new ObjectNotFoundException(); } if (teacher.password.Equals(password)) { return(new Sesion(new User(teacher, Roles.TEACHER))); } throw new ObjectNotFoundException(); }
public ActionResult Create(course cou, HttpPostedFileBase photo) { TeacherDao teDao = new TeacherDao(); CourseDao dao = new CourseDao(); if (ModelState.IsValid) { try { if (photo != null && photo.ContentLength > 0) { string image = String.Concat(photo.FileName); var path = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/Course/"), System.IO.Path.GetFileName(image)); photo.SaveAs(path); cou.co_image = image; cou.co_created_at = DateTime.Now; //var filename = Path.GetFileName(photo.FileName); //var path = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/Course/"), filename); //photo.SaveAs(path); //// Add avatar reference to model and save //cou.co_image = string.Concat("~/Areas/Admins/Content/Photo/Course/", filename); dao.Create(cou); } return(RedirectToAction("Index")); } catch (Exception ex) { Console.WriteLine(ex.Message); return(View("Error")); } } else { ViewBag.lst_te = teDao.GetAll(); DBIeltsContext db = new DBIeltsContext(); var teacher = db.teachers.ToList(); SelectList listTe = new SelectList(teacher, "te_id", "te_name"); ViewBag.list_te = listTe; return(View(cou)); } }
public ActionResult Edit(int?id) { CourseDao couDao = new CourseDao(); if (id == null) { return(View("Error")); } course course = couDao.GetById(id); if (course == null) { return(HttpNotFound()); } TeacherDao teDao = new TeacherDao(); var teacher = teDao.GetAll(); SelectList list_te = new SelectList(teacher, "te_id", "te_name"); ViewBag.list_te = list_te; return(View(course)); }
private void FillDropDownsInfo() { buildings.ItemsSource = ClassRoomsDao.GetAllBuildings(); classRoomNumbers.ItemsSource = ClassRoomsDao.GetAllNumbers(); var allSpecialties = SpecialtyDao.GetAllSpecialties(); var allSubjects = ScheduleRecordDao.GetAllSubjects(); var allYears = ScheduleRecordDao.GetAllYears(); teacherSpecialtyCb.ItemsSource = allSpecialties; teacherSubjectCb.ItemsSource = allSubjects; teacherYearOfStudyingCb.ItemsSource = allYears; studentSpecialtyCb.ItemsSource = allSpecialties; studentSubjectCb.ItemsSource = allSubjects; studentYearOfStudyingCb.ItemsSource = allYears; var allWeeks = WeeksDao.GetFormattedWeeks(); mquery2Weeks.ItemsSource = allWeeks; var selectWeeks = new string[allWeeks.Length + 1]; selectWeeks[0] = "Всі тижні"; Array.Copy(allWeeks, 0, selectWeeks, 1, allWeeks.Length); teacherWeekSelect.ItemsSource = selectWeeks; teacherWeekSelect.SelectedIndex = 0; mquery1Weeks.ItemsSource = selectWeeks; mquery1Weeks.SelectedIndex = 0; teacherNameSelect.ItemsSource = TeacherDao.GetFormattedTeachers(); studentWeekSelect.ItemsSource = selectWeeks; studentWeekSelect.SelectedIndex = 0; studentSpecialtySelect.ItemsSource = allSpecialties; studentCourseSelect.ItemsSource = allYears; }
public TeacherService() { teacherdb = new TeacherDao(); }
public TeacherCollectionPresenter() { _teacherDao = new TeacherDao(); }
public FileResult ExportListCalendarWorking(int idteacher) { var teacherDao = new TeacherDao(); var calendarWorking = new CalendarWorkingDao(); var teacher = teacherDao.ViewDetails(idteacher); ViewBag.teacher = teacher; var calendarWorkings = calendarWorking.GetListByTeacher(idteacher); ViewBag.calendarWorkings = calendarWorkings; //Create new Excel Workbook var workbook = new HSSFWorkbook(); //Create new Excel Sheet var sheet = workbook.CreateSheet(); HSSFCellStyle borderedCellStyle = (HSSFCellStyle)workbook.CreateCellStyle(); borderedCellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Medium; borderedCellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Medium; borderedCellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Medium; borderedCellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Medium; //Create a title row var font = workbook.CreateFont(); font.FontHeightInPoints = 11; font.FontName = "Calibri"; font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold; ICellStyle styleMiddle = workbook.CreateCellStyle(); styleMiddle.Alignment = HorizontalAlignment.Center; styleMiddle.VerticalAlignment = VerticalAlignment.Center; styleMiddle.WrapText = true; //wrap the text in the cell var titleRow = sheet.CreateRow(0); CellRangeAddress region = new CellRangeAddress(0, 0, 0, 5); sheet.AddMergedRegion(region); titleRow.CreateCell(0).SetCellValue("Danh sách công tác của giảng viên " + teacher.Name_Teacher); titleRow.Cells[0].CellStyle = styleMiddle; titleRow.Cells[0].CellStyle = borderedCellStyle; titleRow.RowStyle = (HSSFCellStyle)workbook.CreateCellStyle(); titleRow.RowStyle.SetFont(font); //Create a header row var headerRow = sheet.CreateRow(1); headerRow.CreateCell(0).SetCellValue("Công tác"); headerRow.CreateCell(1).SetCellValue("Ngày bắt đầu"); headerRow.CreateCell(2).SetCellValue("Ngày kết thúc"); headerRow.CreateCell(3).SetCellValue("Địa chỉ"); headerRow.CreateCell(4).SetCellValue("Trạng thái"); headerRow.CreateCell(5).SetCellValue("Tình trạng công việc"); headerRow.Cells[0].CellStyle = borderedCellStyle; headerRow.Cells[1].CellStyle = borderedCellStyle; headerRow.Cells[2].CellStyle = borderedCellStyle; headerRow.Cells[3].CellStyle = borderedCellStyle; headerRow.Cells[4].CellStyle = borderedCellStyle; headerRow.Cells[5].CellStyle = borderedCellStyle; headerRow.RowStyle = (HSSFCellStyle)workbook.CreateCellStyle(); headerRow.RowStyle.SetFont(font); //(Optional) freeze the header row so it is not scrolled sheet.CreateFreezePane(0, 1, 0, 1); int rowNumber = 2; //Populate the sheet with values from the grid data foreach (var item in calendarWorkings) { //Create a new Row var row = sheet.CreateRow(rowNumber++); //Set the Values for Cells row.CreateCell(0).SetCellValue(item.Name_CalendarWorking); row.CreateCell(1).SetCellValue(item.DateStart.ToString("dd/MM/yyyy")); row.CreateCell(2).SetCellValue(item.DateEnd.ToString("dd/MM/yyyy")); row.CreateCell(3).SetCellValue(item.Address); row.CreateCell(4).SetCellValue(item.Status == "HoatDong" ? "Hoạt động" : "Không hoạt động"); if(item.WorkState == "DangThucHien") { row.CreateCell(5).SetCellValue("Đang thực hiện"); } else if(item.WorkState == "DaHoanThanh") { row.CreateCell(5).SetCellValue("Đã hoàn thành"); } else if (item.WorkState == "KhongHoanThanh") { row.CreateCell(5).SetCellValue("Không hoàn thành"); } else if (item.WorkState == "ChuaHoanThanh") { row.CreateCell(5).SetCellValue("Chưa hoàn thành"); } else if (item.WorkState == "DaDiemDanh") { row.CreateCell(5).SetCellValue("Đã điểm danh"); } else if (item.WorkState == "DangDiemDanh") { row.CreateCell(5).SetCellValue("Đang điểm danh"); } row.Cells[0].CellStyle = borderedCellStyle; row.Cells[1].CellStyle = borderedCellStyle; row.Cells[2].CellStyle = borderedCellStyle; row.Cells[3].CellStyle = borderedCellStyle; row.Cells[4].CellStyle = borderedCellStyle; row.Cells[5].CellStyle = borderedCellStyle; } //(Optional) set the width of the columns sheet.AutoSizeColumn(0); sheet.AutoSizeColumn(1); sheet.AutoSizeColumn(2); sheet.AutoSizeColumn(3); sheet.AutoSizeColumn(4); sheet.AutoSizeColumn(5); //Write the Workbook to a memory stream MemoryStream output = new MemoryStream(); workbook.Write(output); //Return the result to the end user return File(output.ToArray(), //The binary data of the XLS file "application/vnd.ms-excel",//MIME type of Excel files string.Format("Danh sách công tác của giảng viên {0}.xls",teacher.Name_Teacher)); }
public void registerTeacher(Teacher teacher) { TeacherDao logger = new TeacherDao(); logger.add(teacher); }
public void deleteTeacher(int id) { TeacherDao helper = new TeacherDao(); helper.delete(id); }
public TeacherFormPresenter() { _teacherDao = new TeacherDao(); _subjectDao = new SubjectDao(); }
public MainPresenter() { _studentDao = new StudentDao(); _subjectDao = new SubjectDao(); _teacherDao = new TeacherDao(); }