public ActionResult Create([Bind(Include = "id,MaNV,HoatDong,Bang")] log log) { if (ModelState.IsValid) { db.logs.Add(log); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaNV = new SelectList(db.NhanViens, "MaNV", "HoTen", log.MaNV); return(View(log)); }
public ActionResult Create([Bind(Include = "MaBL,MaCV,MaNV,BinhLuan1")] BinhLuan binhLuan) { if (ModelState.IsValid) { db.BinhLuans.Add(binhLuan); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaCV = new SelectList(db.CongViecs, "MaCV", "TieuDe", binhLuan.MaCV); ViewBag.MaNV = new SelectList(db.NhanViens, "MaNV", "HoTen", binhLuan.MaNV); return(View(binhLuan)); }
public ActionResult Create([Bind(Include = "MaNV,HoTen,NgaySinh,Email,Password,TrangThai,ChucVu,Quyen")] NhanVien nhanVien) { if (ModelState.IsValid) { nhanVien.Password = MD5Hash.hash(nhanVien.Password); db.NhanViens.Add(nhanVien); db.SaveLog(SessionHelper.GetSession().id, "Tạo mới 1 nhân viên", "Nhân viên"); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Quyen = new SelectList(db.PhanQuyens, "MaQuyen", "Ten", nhanVien.Quyen); return(View(nhanVien)); }
public ActionResult Create([Bind(Include = "MaNV,MaCV,TrangThai")] ChiTietCV_NV chiTietCV_NV) { if (ModelState.IsValid) { db.ChiTietCV_NV.Add(chiTietCV_NV); db.SaveChanges(); db.SaveLog(SessionHelper.GetSession().id, "Đã sửa thêm " + chiTietCV_NV.NhanVien.MaNV + "_" + chiTietCV_NV.NhanVien.HoTen + " vào danh sách cho công việc: " + chiTietCV_NV.MaCV + "_" + chiTietCV_NV.CongViec.TieuDe, "Công việc"); return(RedirectToAction("Index", new { id = chiTietCV_NV.MaCV })); } ViewBag.MaCV = new SelectList(db.CongViecs, "MaCV", "TieuDe", chiTietCV_NV.MaCV); ViewBag.MaNV = new SelectList(db.NhanViens, "MaNV", "HoTen", chiTietCV_NV.MaNV); ViewBag.TrangThai = new SelectList(db.TrangThais, "Ma", "TinhTrang", chiTietCV_NV.TrangThai); return(View(chiTietCV_NV)); }
public void InsertBAOCAO(BAOCAOCONGVIEC bc) { using (QLCVEntities e = new QLCVEntities()) { e.BAOCAOCONGVIECs.Add(bc); e.SaveChanges(); } }
public void UpdateTaskAfterInsert(int id, string thumuc) { using (QLCVEntities e = new QLCVEntities()) { CONGVIEC cv = e.CONGVIECs.Find(id); cv.THUMUC = thumuc; e.SaveChanges(); } }
public int InsertTask(CONGVIEC cv) { using (QLCVEntities e = new QLCVEntities()) { e.CONGVIECs.Add(cv); e.SaveChanges(); int id = cv.ID; return(id); } }
public ActionResult Create([Bind(Include = "MaCV,TieuDe,NgayBatDau,NgayKetKhuc,TrangThai,PhamVi")] CongViec congViec) { if (ModelState.IsValid) { if (DateTime.Compare(congViec.NgayBatDau, congViec.NgayKetKhuc) > 0) { ViewBag.TrangThai = new SelectList(db.TrangThais, "Ma", "TinhTrang", congViec.TrangThai); ModelState.AddModelError("NgayBatDau", "Ngày bắt đầu hơn ngày kết thúc"); return(View(congViec)); } db.CongViecs.Add(congViec); db.SaveChanges(); db.SaveLog(SessionHelper.GetSession().id, "Đã tạo một công việc mới", "Công việc"); return(RedirectToAction("Index")); } ViewBag.TrangThai = new SelectList(db.TrangThais, "Ma", "TinhTrang", congViec.TrangThai); return(View(congViec)); }
public void UpdateTask(CONGVIEC cv1) { using (QLCVEntities e = new QLCVEntities()) { CONGVIEC cv2 = e.CONGVIECs.Find(cv1.ID); cv2.TIEUDE = cv1.TIEUDE; cv2.NOIDUNG = cv1.NOIDUNG; cv2.TAPTIN = cv1.TAPTIN; cv2.NGAYCAPNHAT = cv1.NGAYCAPNHAT; cv2.PHANCONGs.Clear(); cv2.PHANCONGs = cv1.PHANCONGs; e.SaveChanges(); } }
public void UpdateTrangThaiCongViec(int idCongViec) { using (QLCVEntities e = new QLCVEntities()) { CONGVIEC cv = e.CONGVIECs.Find(idCongViec); if (cv.HOANTHANH == true) { cv.NGAYCAPNHAT = DateTime.Now; cv.HOANTHANH = false; } else { cv.NGAYCAPNHAT = DateTime.Now; cv.HOANTHANH = true; } e.SaveChanges(); } }
public void UpdateTrangThaiPhanCong(int idCongViec, int idPhanCong) { using (QLCVEntities e = new QLCVEntities()) { var result = e.PHANCONGs.Where(a => a.IDCONGVIEC == idCongViec && a.IDPHANCONG == idPhanCong).ToList(); result.ForEach(a => { if (a.IDTRANGTHAI == 5) { a.NGAYCAPNHAT = DateTime.Now; a.IDTRANGTHAI = 3; } else { a.NGAYCAPNHAT = DateTime.Now; a.IDTRANGTHAI = a.IDTRANGTHAI + 1; } }); //result.ForEach(a => a.IDTRANGTHAI = a.IDTRANGTHAI + 1); e.SaveChanges(); } }
public ActionResult Index(ObjFile doc, int cv) { CongViec c = db.CongViecs.Find(cv); ViewBag.title = c.TieuDe; foreach (var file in doc.files) { if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var filePath = Path.Combine(Server.MapPath("~/Files"), fileName); TapTin t = new TapTin(); t.MaCV = cv; t.DuongDan = file.FileName; t.NhanVienUp = SessionHelper.GetSession().id; db.TapTins.Add(t); db.SaveLog(SessionHelper.GetSession().id, "Đã upfile có tên: " + fileName + " cho công việc " + c.TieuDe, "Tập tin"); db.SaveChanges(); file.SaveAs(filePath); } } TempData["Message"] = "files uploaded successfully"; return(RedirectToAction("Index/" + cv)); }