public ActionResult them_NV(NHANVIEN Nv, FormCollection form) { Nv.MA_NhanVien = UUID.GetUUID(5); Nv.MA_ChucVu = form["cv"].ToString();; Nv.MA_PhongBan = form["pb"].ToString(); Nv.MA_QNSD = form["qsd"].ToString(); if (form["GioiTinh_NV"] != null) { if ((form["GioiTinh_NV"].ToString() == "on")) { Nv.GioiTinh_NV = true; } else { Nv.GioiTinh_NV = false; } } else { Nv.GioiTinh_NV = false; } db.NHANVIENs.Add(Nv); db.SaveChanges(); return(RedirectToAction("ListNV")); }
public ActionResult Edit_XX1(XETXU xx, FormCollection form) { XETXU newXetXu = db.XETXUs.FirstOrDefault(nxx => nxx.MA_XetXu == xx.MA_XetXu); newXetXu.Ngay_XetXu = xx.Ngay_XetXu; newXetXu.MA_DiaDiem = form["dd"].ToString(); CHITIET_XX newThuKy = db.CHITIET_XX.FirstOrDefault(ntk => ntk.MA_XetXu == xx.MA_XetXu && ntk.MA_VaiTro == "C1"); newThuKy.MA_NhanVien = form["tk"].ToString(); CHITIET_XX newKiemSat = db.CHITIET_XX.FirstOrDefault(nks => nks.MA_XetXu == xx.MA_XetXu && nks.MA_VaiTro == "C3"); newKiemSat.MA_NhanVien = form["ks"].ToString(); ClearHoiDong(xx.MA_XetXu); List <string> selectedHoiDongList = form["hd"].Split(',').ToList(); for (int i = 0; i < selectedHoiDongList.Count; i++) { CHITIET_XX hoidong = new CHITIET_XX { MA_NhanVien = selectedHoiDongList[i], MA_VaiTro = "C4", MA_XetXu = xx.MA_XetXu, MA_ChiTietXX = UUID.GetUUID(5) }; themChiTietXetXu(hoidong); } db.SaveChanges(); return(RedirectToAction("ListXX")); }
public ActionResult them_KQ(KETQUA_XX kqxx, FormCollection form, string troVe) { var listKetQua = from s in db.KETQUA_XX select s; if (db.KETQUA_XX.Any(x => x.MA_KetQuaXX == kqxx.MA_KetQuaXX)) { return(RedirectToAction("ListKQ", new { error = 1 })); } kqxx.MA_XetXu = Convert.ToInt32(form["lxx"]); if (!ModelState.IsValid) { return(View(kqxx)); } kqxx.MA_KetQuaXX = UUID.GetUUID(5); db.KETQUA_XX.Add(kqxx); db.SaveChanges(); KETQUA_XX newKQXX = db.KETQUA_XX.Where(newKQ => newKQ.MA_KetQuaXX == kqxx.MA_KetQuaXX).FirstOrDefault(); XETXU newXX = db.XETXUs.Where(xx => xx.MA_XetXu == newKQXX.MA_XetXu).FirstOrDefault(); string maHoSo = newXX.MA_HoSo; HOSO_VUAN hoSo = db.HOSO_VUAN.Where(hs => hs.MA_HoSo == maHoSo).FirstOrDefault(); hoSo.MA_TrangThai = "03"; db.SaveChanges(); if (troVe == "troVe") { return(RedirectToAction("ListHS", "HoSoVuAn")); } return(RedirectToAction("ListKQ")); }
//[ValidateInput(false)] ///[ValidateAntiForgeryToken] public ActionResult sua_HS1(HOSO_VUAN hs, FormCollection form, string id) { //ViewBag.lva = new SelectList(db.LOAI_VUAN.OrderBy(x => x.Ten_LoaiVA), "MA_LoaiVA", "Ten_LoaiVA"); //ViewBag.tths = new SelectList(db.TRANGTHAI_HS.OrderBy(x => x.Ten_TT), "MA_TrangThai", "Ten_TT"); //ViewBag.mnv = new SelectList(db.NHANVIENs.OrderBy(x => x.HoTen_NV), "MA_NhanVien", "HoTen_NV"); hs.MA_LoaiVA = form["lva"].ToString();; hs.MA_NhanVien = form["mnv"].ToString(); //hs.MA_HoSo = id; HOSO_VUAN hoSo = db.HOSO_VUAN.Where(newHoSo => newHoSo.MA_HoSo == hs.MA_HoSo).FirstOrDefault(); hoSo.MA_NhanVien = hs.MA_NhanVien; hoSo.MA_LoaiVA = hs.MA_LoaiVA; hoSo.Ten_VuAn = hs.Ten_VuAn; hoSo.NoiDung_VA = hs.NoiDung_VA; hoSo.Loai_HS = hs.Loai_HS; hoSo.NgayNhan_HS = hs.NgayNhan_HS; // db.Entry(hs).State = EntityState.Modified; db.SaveChanges(); ClearNguyenDonBiDon(hs.MA_HoSo); List <string> selectedNguyenDonList = form["nd"].Split(',').ToList(); for (int i = 0; i < selectedNguyenDonList.Count; i++) { CHITIET_DS nguyendon = new CHITIET_DS { MA_DuongSu = selectedNguyenDonList[i], MA_LoaiDS = "ND", MA_HoSo = hs.MA_HoSo, MA_ChiTietDS = UUID.GetUUID(5) }; themChiTietDuongSu(nguyendon); } List <string> selectedBiDonList = form["bd"].Split(',').ToList(); for (int i = 0; i < selectedBiDonList.Count; i++) { CHITIET_DS bidon = new CHITIET_DS { MA_DuongSu = selectedBiDonList[i], MA_LoaiDS = "BD", MA_HoSo = hs.MA_HoSo, MA_ChiTietDS = UUID.GetUUID(5) }; themChiTietDuongSu(bidon); } return(RedirectToAction("ListHS")); }
public ActionResult them_HS(HOSO_VUAN hs, FormCollection form) { //Tao ma tu dong hs.MA_HoSo = UUID.GetUUID(5); hs.MA_LoaiVA = form["lva"].ToString(); hs.MA_TrangThai = "01"; hs.MA_NhanVien = form["mnv"].ToString(); db.HOSO_VUAN.Add(hs); db.SaveChanges(); List <string> selectedNguyenDonList = form["nd"].Split(',').ToList(); for (int i = 0; i < selectedNguyenDonList.Count; i++) { CHITIET_DS nguyendon = new CHITIET_DS { MA_DuongSu = selectedNguyenDonList[i], MA_LoaiDS = "ND", MA_HoSo = hs.MA_HoSo, MA_ChiTietDS = UUID.GetUUID(5) }; themChiTietDuongSu(nguyendon); } List <string> selectedBiDonList = form["bd"].Split(',').ToList(); for (int i = 0; i < selectedBiDonList.Count; i++) { CHITIET_DS bidon = new CHITIET_DS { MA_DuongSu = selectedBiDonList[i], MA_LoaiDS = "BD", MA_HoSo = hs.MA_HoSo, MA_ChiTietDS = UUID.GetUUID(5) }; themChiTietDuongSu(bidon); } var list_HS = from s in db.HOSO_VUAN select s; ViewBag.lva = new SelectList(db.LOAI_VUAN.OrderBy(x => x.Ten_LoaiVA), "MA_LoaiVA", "Ten_LoaiVA"); ViewBag.tths = new SelectList(db.TRANGTHAI_HS.OrderBy(x => x.Ten_TT), "MA_TrangThai", "Ten_TT"); ViewBag.nd = new SelectList(db.DUONGSUs.OrderBy(x => x.HoTen_DS), "MA_DuongSu", "HoTen_DS"); ViewBag.bd = new SelectList(db.DUONGSUs.OrderBy(x => x.HoTen_DS), "MA_DuongSu", "HoTen_DS"); ViewBag.mnv = new SelectList(db.NHANVIENs.OrderBy(x => x.HoTen_NV), "MA_NhanVien", "HoTen_NV"); return(RedirectToAction("ListHS")); }
public ActionResult AddVT(QUYEN_NSD vt, FormCollection form) { if (db.QUYEN_NSD.Any(x => x.MA_QNSD == vt.MA_QNSD)) { return(View(vt)); } if (!ModelState.IsValid) { return(View(vt)); } vt.MA_QNSD = UUID.GetUUID(5); db.QUYEN_NSD.Add(vt); db.SaveChanges(); return(RedirectToAction("ListVT")); }
public ActionResult them_DS(DUONGSU ds, FormCollection form) { ds.MA_DuongSu = UUID.GetUUID(5); if (form["GioiTinh_DS"] != null) { if ((form["GioiTinh_DS"].ToString() == "on")) { ds.GioiTinh_DS = true; } else { ds.GioiTinh_DS = false; } } db.DUONGSUs.Add(ds); db.SaveChanges(); return(RedirectToAction("ListDS")); }
public ActionResult themLXX(XETXU xx, FormCollection form) { ViewBag.dd = new SelectList(db.DIADIEM_XX.OrderBy(x => x.Ten_DiaDiem), "MA_DiaDiem", "Ten_DiaDiem"); ViewBag.hs = new SelectList(db.HOSO_VUAN.OrderBy(x => x.MA_HoSo), "MA_HoSo", "Ten_VuAn"); ViewBag.hd = new SelectList(db.NHANVIENs.OrderBy(x => x.HoTen_NV), "MA_NhanVien", "HoTen_NV"); ViewBag.ks = new SelectList(db.NHANVIENs.OrderBy(x => x.HoTen_NV), "MA_NhanVien", "HoTen_NV"); ViewBag.tk = new SelectList(db.NHANVIENs.OrderBy(x => x.HoTen_NV), "MA_NhanVien", "HoTen_NV"); ViewBag.cxx = new SelectList(db.CAPXETXUs.OrderBy(x => x.MA_CapXetXu), "MA_CapXetXu", "TenCapXetXu"); if (db.XETXUs.Any(x => x.MA_XetXu == xx.MA_XetXu)) { return(RedirectToAction("ListXX", new { error = 1 })); } xx.MA_CapXetXu = form["cxx"].ToString(); xx.MA_DiaDiem = form["dd"].ToString(); xx.MA_HoSo = form["hs"].ToString(); if (!ModelState.IsValid) { return(View(xx)); } db.XETXUs.Add(xx); db.SaveChanges(); HOSO_VUAN hoSo = db.HOSO_VUAN.Where(hs => hs.MA_HoSo == xx.MA_HoSo).FirstOrDefault(); hoSo.MA_TrangThai = "02"; db.SaveChanges(); List <string> selectedHoiDongList = form["hd"].Split(',').ToList(); for (int i = 0; i < selectedHoiDongList.Count; i++) { CHITIET_XX hoidong = new CHITIET_XX { MA_NhanVien = selectedHoiDongList[i], MA_VaiTro = "C4", MA_XetXu = xx.MA_XetXu, MA_ChiTietXX = UUID.GetUUID(5) }; themChiTietXetXu(hoidong); } CHITIET_XX kiemSat = new CHITIET_XX { MA_NhanVien = form["ks"].ToString(), MA_VaiTro = "C3", MA_XetXu = xx.MA_XetXu, MA_ChiTietXX = UUID.GetUUID(5) }; themChiTietXetXu(kiemSat); CHITIET_XX thuky = new CHITIET_XX { MA_NhanVien = form["tk"].ToString(), MA_VaiTro = "C1", MA_XetXu = xx.MA_XetXu, MA_ChiTietXX = UUID.GetUUID(5) }; themChiTietXetXu(thuky); return(RedirectToAction("ListXX")); }