public ActionResult LopDaDK() { var dao = new LopHocDAO(); var model = dao.FindLopHocHocVien(User.Identity.Name); return(PartialView("~/Areas/HocVien/Views/Shared/LopDaDK.cshtml", model)); }
public ActionResult Index() { var dao = new LopHocDAO(); var model = dao.FindAll(); return(View(model)); }
public LapLichBUS() { lapLichDAO = new LapLichDAO(); phongDao = new PhongDAO(); lopHocDAO = new LopHocDAO(); listPhong = getListPhong(); }
public ActionResult Find(string tim = null, bool Listening = false, bool Speaking = false, bool Reading = false, bool Writing = false, string lvListening = null, string lvSpeaking = null, string lvReading = null, string lvWriting = null) { var dao = new LopHocDAO(); var model = dao.FindLopHocIndex(tim, Listening, Speaking, Reading, Writing, lvListening, lvSpeaking, lvReading, lvWriting); return(View("Index", model)); }
public ActionResult Meeting(LopHoc lopHoc, int tt) //tt=1 sắm tới : -1:cũ ; 0:all { var lh = new LopHocDAO().GetByID(lopHoc.ID); ViewBag.lophoc = lh; DateTime date; IEnumerable <TaiLieu> audiolist = null; if (lh.TaiLieux.Count() > 0) { audiolist = lh.TaiLieux.Where(x => x.idLH == lh.ID && x.idKN == null).OrderBy(x => x.thoiGian); if (tt == 1) { foreach (var item in audiolist) { if (DateTime.Compare(item.thoiGian, DateTime.Now) >= 0) { date = item.thoiGian; List <TaiLieu> list = new List <TaiLieu>(); list.Add(item); audiolist = list; return(View(audiolist)); } } return(View(audiolist)); } } return(View(audiolist)); }
public ActionResult Index() { var model = new LopHocDAO().FindAll(); ViewBag.status = -1; return(View(model)); }
private void button3_Click(object sender, EventArgs e) { bool del = new LopHocDAO().Delete(textBox1.Text); MessageBox.Show("Đã xóa", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information); dtg_LopHoc.DataSource = new LopHocDAO().ListAll(); }
public ActionResult File(HttpPostedFileBase file, int idlh) { //try // if (file.ContentLength > 0) { var lh = new LopHocDAO().GetByID(idlh); string _FileName = Path.GetFileName(file.FileName); string _path = Path.Combine(Server.MapPath("~/Content/img/"), _FileName); file.SaveAs(_path); int fileSize = file.ContentLength; int Size = fileSize / 1000000; var dao = new TaiLieuDAO(); var tailieu = new TaiLieu(); tailieu.ten = _FileName; tailieu.FileSize = Size; tailieu.link = _path; tailieu.idLH = lh.ID; tailieu.thoiGian = DateTime.Now; tailieu.idTK = lh.Giangvien.TaiKhoan.iD; tailieu.idKN = 5; dao.Insert(tailieu); } ViewBag.Message = "File Uploaded Successfully!!"; return(RedirectToAction("File")); //} //catch //{ // ViewBag.Message = "File upload failed!!"; // return RedirectToAction("File"); //} }
public ActionResult Zoom(string ten, string trangthai, string ma, int idlh, string thoigian) { var lh = new LopHocDAO().GetByID(idlh); var dao = new TaiLieuDAO(); var tailieu = new TaiLieu(); tailieu.ten = ten; tailieu.link = ma; tailieu.moTa = trangthai; tailieu.idLH = lh.ID; tailieu.idTK = lh.Giangvien.TaiKhoan.iD; //tailieu.idKN = 6; try { tailieu.thoiGian = DateTime.Parse(thoigian); dao.Insert(tailieu); TempData["testmsg"] = "Tạo phòng ZOOM thành công."; } catch (Exception ex) { TempData["testmsg"] = "Lỗi tạo phòng ZOOM: " + ex.Message; } return(RedirectToAction("ChiTiet/" + lh.ID, "QLLopHoc")); }
private void usr_LH_Load(object sender, EventArgs e) { LopHocDAO dtgv = new LopHocDAO(); dtg_LopHoc.DataSource = dtgv.ListAll(); dtg_LopHoc.Columns["TenLop"].HeaderText = "Lớp"; dtg_LopHoc.Columns["QSo"].HeaderText = "Quân số"; }
private void dtg_LopHoc_CellClick(object sender, DataGridViewCellEventArgs e) { dtg_LopHoc.CurrentRow.Selected = true; string MaGV = dtg_LopHoc.CurrentRow.Cells["TenLop"].Value.ToString(); var chosen = new LopHocDAO().GetByID(MaGV); textBox1.Text = chosen.TenLop; textBox2.Text = chosen.QSo.ToString(); }
public ActionResult Index() { //update data var dao = new LopHocDAO(); dao.upload(); var model = dao.FindAll(); return(View(model)); }
public ActionResult Index(string tim) { //update data var dao = new LopHocDAO(); dao.upload(); var model = dao.TimLopHoc(tim); return(View(model)); }
public ActionResult chitietlophoc(int id) { var dao = new LopHocDAO(); var model = dao.GetByID(id); TimeSpan Time = model.ngayEnd.Value - model.ngayBegin.Value; TempData["Sothang"] = (float.Parse(Time.Days.ToString()) / 30).ToString("#"); ViewBag.hocvien = new HocVienDAO().FindByTDN(User.Identity.Name); return(View(model)); }
public static bool CapNhatSoSinhVienKhiXoa(LopHocDTO lh) { if (!LopHocDAO.KTLopTonTai(lh.Ma_Lop)) { return(false); } else { return(LopHocDAO.CapNhatSoSinhVienKhiXoa(lh)); } }
public static bool XoaLopHoc(LopHocDTO lh) { if (!LopHocDAO.KTLopTonTai(lh.Ma_Lop)) { return(false); } else { return(LopHocDAO.XoaLop(lh)); } }
public static bool CapNhatLopHoc(LopHocDTO lh) { if (LopHocDAO.KTLopTonTai(lh.Ma_Lop)) { return(LopHocDAO.CapNhatLop(lh)); } else { return(false); } }
public static bool ThemLop(LopHocDTO lh) { if (LopHocDAO.KTLopTonTai(lh.Ma_Lop)) { return(false); } else { return(LopHocDAO.ThemLopHoc(lh)); } }
public ActionResult Tailieu(LopHoc lopHoc, int idkn) { var lh = new LopHocDAO().GetByID(lopHoc.ID); IEnumerable <TaiLieu> model = null; if (lh.TaiLieux.Count() > 0) { model = lh.TaiLieux.Where(x => x.idKN == idkn); } return(View(model)); }
public static bool CapNhatSoLuongSinhVien(LopHocDTO lh) { if (LopHocDAO.KTLopTonTai(lh.Ma_Lop)) { return(LopHocDAO.CapNhatSinhVien(lh)); } else { return(false); } }
public ActionResult File(int id = 1) { var lh = new LopHocDAO().GetByID(id); ViewBag.lophoc = lh; IEnumerable <TaiLieu> audiolist = null; if (lh.TaiLieux.Count() > 0) { audiolist = lh.TaiLieux.Where(x => x.TaiKhoan.tenDangNhap == User.Identity.Name && x.idKN == 5); } return(View(audiolist)); }
public ActionResult BinhLuan(int idlh, string noidung, int idtk, int idcha = 0) { var tk = new TaiKhoanDAO().FindByID(idtk); var lh = new LopHocDAO().GetByID(idlh); var dao = new BinhLuanDAO(); var bl = new BinhLuan(); bl.noiDung = noidung; bl.idLH = idlh; if (idcha == 0) { bl.idCha = null; } else { bl.idCha = idcha; } bl.thoiGian = DateTime.Now; bl.idTK = idtk; int kt = 0; try { kt = dao.Insert(bl); var daotb = new ThongBaoDAO(); var tb = new ThongBao(); tb.icon = "a fa-comment"; tb.ngay = DateTime.Now; tb.trangThai = 0; tb.idTK = lh.Giangvien.TaiKhoan.iD; tb.link = "http://localhost:52790/GiaoVien/Hoc/" + idlh; tb.noiDung = tk.hovaten + " đã bình luận vào lớp học " + lh.tenLopHoc + " của bạn."; daotb.Insert(tb); } catch (Exception e) { TempData["testmsg"] = "Có lỗi trong quá trình bình luận. Vui lòng thử lại sau. \nLỗi: " + e.Message; return(RedirectToAction("chitietlophoc/" + idlh, "Tim")); } if (kt != 0) { TempData["testmsg"] = "Bình luận thành công."; return(RedirectToAction("chitietlophoc/" + idlh, "Tim")); } else { TempData["testmsg"] = "Có lỗi trong quá trình bình luận. Vui lòng thử lại sau."; return(RedirectToAction("chitietlophoc/" + idlh, "Tim")); } }
public ActionResult Baitap(LopHoc lopHoc, int idkn) { var lh = new LopHocDAO().GetByID(lopHoc.ID); ViewBag.lophoc = lh; ViewBag.idkn = idkn; IEnumerable <TaiLieu> audiolist = null; if (lh.TaiLieux.Count() > 0) { audiolist = lh.TaiLieux.Where(x => x.idLH == lopHoc.ID && x.idKN == idkn && !string.IsNullOrEmpty(x.idBT.ToString())); } return(View(audiolist)); }
public ActionResult Index(string lophoc) { var dao = new LopHocDAO(); int trangthai = int.Parse(lophoc); if (trangthai == -1) { return(RedirectToAction("Index", "ThongKe")); } var model = dao.FindLopHocGiaoVien(User.Identity.Name).Where(x => x.trangThai == trangthai); ViewBag.status = trangthai; return(View(model)); }
public ActionResult Doc(string ten, string link, int idlh) { var lh = new LopHocDAO().GetByID(idlh); var dao = new TaiLieuDAO(); var tailieu = new TaiLieu(); tailieu.ten = ten; tailieu.link = link; tailieu.idLH = lh.ID; tailieu.idTK = lh.Giangvien.TaiKhoan.iD; tailieu.idKN = 3; tailieu.thoiGian = DateTime.Now; dao.Insert(tailieu); return(RedirectToAction("Doc/" + lh.ID, "Doc")); }
// GET: HocVien/Learning public ActionResult Index(int id = 0) { var dao = new LopHocDAO(); var md = dao.FindLopHocHocVien(User.Identity.Name); if (md.Count() <= 0) { return(RedirectToAction("ChuaDK", "Learning")); } if (id == 0) { return(View(md.First())); } var model = dao.GetByID(id); return(View(model)); }
private void button2_Click(object sender, EventArgs e) { LopHoc gv = new LopHoc(); gv.TenLop = textBox1.Text; gv.QSo = Convert.ToInt32(textBox2.Text); bool edit = new LopHocDAO().Update(gv); if (!edit) { MessageBox.Show("Không tồn tại lớp", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Đã sửa", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information); dtg_LopHoc.DataSource = new LopHocDAO().ListAll(); } }
public ActionResult UploadAudio(HttpPostedFileBase fileupload, int idlh) { if (fileupload != null) { var lh = new LopHocDAO().GetByID(idlh); string fileName = Path.GetFileName(fileupload.FileName); int fileSize = fileupload.ContentLength; int Size = fileSize / 1000000; fileupload.SaveAs(Server.MapPath("~/" + fileName)); var dao = new TaiLieuDAO(); var tailieu = new TaiLieu(); tailieu.ten = fileName; tailieu.FileSize = Size; tailieu.link = "~/" + fileName; tailieu.idLH = lh.ID; tailieu.idTK = lh.Giangvien.TaiKhoan.iD; tailieu.idKN = 1; dao.Insert(tailieu); } return(RedirectToAction("UploadAudio")); }
private void button1_Click(object sender, EventArgs e) { LopHoc gv = new LopHoc(); gv.TenLop = textBox1.Text; gv.QSo = Convert.ToInt32(textBox2.Text); bool add = new LopHocDAO().Insert(gv); if (!add) { MessageBox.Show("Lớp đã tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Đã thêm lớp", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information); dtg_LopHoc.DataSource = new LopHocDAO().ListAll(); textBox1.Text = ""; textBox2.Text = ""; } }
public ActionResult InfoGV(int idgv, int rating = 0, string nhanxet = null, int idlh = 0) { if (idlh == 0) { TempData["testmsg"] = "Giáo viên này chưa có lớp học nào hoàng thành."; return(RedirectToAction("InfoGV/" + idgv, "Tim"));; } if (rating == 0) { TempData["testmsg"] = "Vui lòng chọn điểm đánh giá ."; return(RedirectToAction("InfoGV/" + idgv, "Tim"));; } if (nhanxet == null) { TempData["testmsg"] = "Vui lòng cho vài lời nhận xét."; return(RedirectToAction("InfoGV/" + idgv, "Tim"));; } var hv = new HocVienDAO().FindByTDN(User.Identity.Name); var lh = new LopHocDAO().GetByID(idlh); var dslh = lh.DSLopHocs.FirstOrDefault(x => x.HocVien.TaiKhoan.tenDangNhap == User.Identity.Name && x.idLH == idlh); if (dslh == null) { TempData["testmsg"] = "Bạn hãy hoành thành lớp học " + lh.tenLopHoc + " của giáo viên để có thể đánh giá."; return(RedirectToAction("InfoGV/" + idgv, "Tim"));; } if (!string.IsNullOrEmpty(dslh.danhgia.ToString())) { TempData["testmsg"] = "Bạn đã đánh giá & nhận xét rồi."; return(RedirectToAction("InfoGV/" + idgv, "Tim"));; } dslh.danhgia = rating; dslh.binhluan = nhanxet; dslh.ngayDanhGia = DateTime.Now; bool kt = new DSLopHocDAO().Update(dslh); TempData["testmsg"] = "Đánh giá & nhận xét thành công ."; return(RedirectToAction("InfoGV/" + idgv, "Tim")); }