public string Update(ThongTinDuLieuCuoi obj) { myData.ThongTinDuLieuCuois.Update(obj); myData.SaveChanges(); return(null); }
public IActionResult AddDuAn(DuAnDTO duAnDTO) { (List <DuAnDTO> duAnDTOs, ThongTinDuLieuCuoi thongTinDuLieuCuois, DuAnDTO duAnDTO)objs; objs = new(duAnSv.GetList(), thongTinDuLieuCuoiAc.FindById("1"), duAnSv.FindById("da00001")); duAnDTO.PhanTramDuAn = 100; duAnDTO.TrangThai = 1; DateTime dt = DateTime.Now; if (dt.Date > duAnDTO.NgayBatDau) { ViewBag.Error = "Ngày bắt đầu dự án phải lớn hơn ngày hiện tại!"; return(View("Index", objs)); } if ((int)((DateTime)duAnDTO.NgayKetThuc - (DateTime)duAnDTO.NgayBatDau).Days < 15) { ViewBag.Error = "Ngày kết thúc dự án phải sau ngày bắt đầu 15 ngày!"; return(View("Index", objs)); } string messerror = duAnSv.AddDuAn(duAnDTO); ViewBag.error = "Add " + messerror; if (messerror == null) { ThongTinDuLieuCuoi t = thongTinDuLieuCuoiAc.FindById("1"); t.DuAnId = duAnDTO.DuAnId; thongTinDuLieuCuoiAc.Update(t); } return(RedirectToAction(actionName: "Index", controllerName: "DuAn")); }
public string Add(NhanVien obj) { ////Tự động tạo khóa chính cho nhân viên ////Lấy dữ liệu từ database //ThongTinDuLieuCuoiAc thongTinDuLieuCuoiAc = new ThongTinDuLieuCuoiAc(myData); ////Lấy trường có khóa chính là "1", hàm FindById() đã truyền tham số mặc định là "1" //ThongTinDuLieuCuoi thongTinDuLieuCuoi = thongTinDuLieuCuoiAc.FindById(); ////Lấy mã nhân viên đã cập nhật vào database lần cuối rồi tăng lên 1 //string nhanVienId = thongTinDuLieuCuoi.NhanVienId; //nhanVienId = AutoKey.InCreasedByOne(nhanVienId); //obj.NhanVienId = nhanVienId; myData.NhanViens.Add(obj); //Thay đổi dữ liệu cuối ThongTinDuLieuCuoi thongTinDuLieuCuoi = myData.ThongTinDuLieuCuois.Find("1"); thongTinDuLieuCuoi.NhanVienId = obj.NhanVienId; myData.ThongTinDuLieuCuois.Update(thongTinDuLieuCuoi); myData.SaveChanges(); return(null); }
public string Remove(ThongTinDuLieuCuoi obj) { //Không được phép xóa //myData.ThongTinDuLieuCuois.Remove(obj); //myData.SaveChanges(); return(null); }
public string Add(ThongTinDuLieuCuoi obj) { //Không được phép thêm mới //myData.ThongTinDuLieuCuois.Add(obj); //myData.SaveChanges(); return(null); }
public IActionResult AddPB(PhongBanDTO phongBanDTO) { string messerror = phongBanSv.AddPhongBan(phongBanDTO); ViewBag.error = "Add " + messerror; if (messerror == null) { ThongTinDuLieuCuoi t = thongTinDuLieuCuoiAc.FindById("1"); t.PhongBanId = phongBanDTO.PhongBanId; thongTinDuLieuCuoiAc.Update(t); } return(RedirectToAction(actionName: "Index", controllerName: "PhongBan")); }
public IActionResult AddPhuCap(PhuCapDTO phuCapDTO) { phuCapDTO.TrangThai = 1; string messerror = phuCapSv.AddPhuCap(phuCapDTO); ViewBag.error = "Add " + messerror; if (messerror == null) { ThongTinDuLieuCuoi t = thongTinDuLieuCuoiAc.FindById("1"); t.PhuCapId = phuCapDTO.PhuCapId; thongTinDuLieuCuoiAc.Update(t); } return(RedirectToAction(actionName: "Index", controllerName: "Phucap")); }