public void Delete(int _trinhdotinhocID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.TrinhDoTinHoc tinhoc = db.TrinhDoTinHocs.FirstOrDefault(x => x.TDTHID == _trinhdotinhocID); db.TrinhDoTinHocs.Remove(tinhoc); db.SaveChanges(); db.Dispose(); }
public void Update(int _trinhdotinhocID, string _trinhdotinhoc, bool _chungchi) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.TrinhDoTinHoc tinhoc = db.TrinhDoTinHocs.FirstOrDefault(x => x.TDTHID == _trinhdotinhocID); tinhoc.TDTHTen = _trinhdotinhoc; tinhoc.TDChungChi = _chungchi; db.SaveChanges(); db.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["account"] != null) { Models.AccountEntity accEntity = new Models.AccountEntity(); string email = Session["account"].ToString(); Models.Account account = accEntity.FindByEmail(email); if (account == null || account.ACCChucNang > 1) { Response.Redirect("~/"); } else if (this.Page.RouteData.Values["trinhdotinhoc"] != null) { try { int tinhocID = Convert.ToInt32(this.Page.RouteData.Values["trinhdotinhoc"]); Models.TrinhDoTinHocEntity thEntity = new Models.TrinhDoTinHocEntity(); Models.TrinhDoTinHoc tinhoc = thEntity.Find(tinhocID); if (tinhoc == null) { Response.Redirect("~/"); } } catch { Response.Redirect("~/"); } } else if (this.Page.RouteData.Values["nhanvien"] != null) { try { int nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); Models.NhanVienEntity nvEntity = new Models.NhanVienEntity(); Models.NhanVien nhanvien = nvEntity.Find_NhanVien(nhanvienID); if (nhanvien == null) { Response.Redirect("~/"); } } catch { Response.Redirect("~/"); } } else { Response.Redirect("~/"); } } else { Response.Redirect("~/"); } }
private string ConvertChungChi(Models.TrinhDoTinHoc _trinhdotinhoc) { if (_trinhdotinhoc.TDChungChi) { return("Chứng chỉ"); } else { return("Hình thức khác"); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Page.RouteData.Values["trinhdotinhoc"] != null) { this.UpdateStatus(); _tinhocID = Convert.ToInt32(this.Page.RouteData.Values["trinhdotinhoc"]); Models.TrinhDoTinHoc tinhoc = _tinhocEntity.Find(_tinhocID); _nhanvienID = tinhoc.NVID; if (!this.Page.IsPostBack) { txtTen.Text = tinhoc.TDTHTen; rblChungChi.SelectedValue = tinhoc.TDChungChi.ToString(); } } else { this.CreateStatus(); _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); } }