public void Delete(int _ngoainguID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.TrinhDoNgoaiNgu ngoaingu = db.TrinhDoNgoaiNgus.FirstOrDefault(x => x.TDNNID == _ngoainguID); db.TrinhDoNgoaiNgus.Remove(ngoaingu); db.SaveChanges(); db.Dispose(); }
public void Update(int _ngoainguID, string _ten, bool _chungchi, bool _tiengdantoc) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.TrinhDoNgoaiNgu ngoaingu = db.TrinhDoNgoaiNgus.FirstOrDefault(x => x.TDNNID == _ngoainguID); ngoaingu.TDNNTen = _ten; ngoaingu.TDNNChungChi = _chungchi; ngoaingu.TDNNTiengDanToc = _tiengdantoc; 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) { this.RedirectToIndex(); } else if (this.Page.RouteData.Values["trinhdongoaingu"] != null) { try { int ngoainguID = Convert.ToInt32(this.Page.RouteData.Values["trinhdongoaingu"]); Models.TrinhDoNgoaiNguEntity nnEntity = new Models.TrinhDoNgoaiNguEntity(); Models.TrinhDoNgoaiNgu ngoaingu = nnEntity.Find(ngoainguID); if (ngoaingu == null) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } 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) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } }
private string ConvertTiengDanToc(Models.TrinhDoNgoaiNgu _ngoaingu) { if (_ngoaingu.TDNNTiengDanToc) { return("Tiếng dân tộc"); } else { return("Tiếng quốc ngữ"); } }
private string ConvertChungChi(Models.TrinhDoNgoaiNgu _ngoaingu) { if (_ngoaingu.TDNNChungChi) { 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["trinhdongoaingu"] != null) { this.UpdateStatus(); _ngoainguID = Convert.ToInt32(this.Page.RouteData.Values["trinhdongoaingu"]); Models.TrinhDoNgoaiNgu ngoaingu = _nnEntity.Find(_ngoainguID); _nhanvienID = ngoaingu.NVID; if (!this.Page.IsPostBack) { txtTen.Text = ngoaingu.TDNNTen; rblChungChi.SelectedValue = ngoaingu.TDNNChungChi.ToString(); rblTiengDanToc.SelectedValue = ngoaingu.TDNNTiengDanToc.ToString(); } } else { this.CreateStatus(); _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); } }