private void FrmChucVu_Load(object sender, EventArgs e) { model = new ChucVuModel(); model.setControl(dataGridView1, lblMessage); model.getAllData("TEN_CV"); model.ShowDetail(ShowDetail); validate.SetTooltip(toolTip1); if (CurrentRowSelected != null) { dataGridView1.ClearSelection(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value.ToString().Equals(CurrentRowSelected)) { row.Cells[0].Selected = true; } } dataGridView1.DoubleClick += new EventHandler(dataGridView1_DoubleClick); } ShowDetail(dataGridView1.CurrentRow); }
public ActionResult ThemMoiNhanVien(ChucVu std) { ChucVuModel chucVuModel = new ChucVuModel(); ViewBag.ChucVu = chucVuModel.GetData(); return(View()); }
public int Xoa(string msChucVu) { ChucVuModel cv = new ChucVuModel(); cv.MSCHUCVU = int.Parse(msChucVu); return(cv.Xoa()); }
public int Them(string tenChucVu) { ChucVuModel cv = new ChucVuModel(); cv.TENCHUCVU = tenChucVu; return(cv.Them()); }
public int CapNhat(string msChucVu, string tenChucVu) { ChucVuModel cv = new ChucVuModel(); cv.MSCHUCVU = int.Parse(msChucVu); cv.TENCHUCVU = tenChucVu; return(cv.CapNhat()); }
public ActionResult EditChucVu(ChucVuModel model) { var chucvu = db.ChucVus.Find(model.Id); chucvu.TenChucVu = model.TenChucVu; chucvu.Luong = model.Luong; db.SaveChanges(); return(RedirectToAction("Index", "ChucVuAdmin")); }
public ActionResult EditChucVu(int machucvu) { var model = new ChucVuModel(); var chucvu = db.ChucVus.FirstOrDefault(x => x.Id == machucvu); model.Id = chucvu.Id; model.TenChucVu = chucvu.TenChucVu; model.Luong = chucvu.Luong; return(View(model)); }
public ActionResult CreateChucVu(ChucVuModel model) { var chucvu = new ChucVu(); chucvu.TenChucVu = model.TenChucVu; chucvu.Luong = model.Luong; db.ChucVus.Add(chucvu); db.SaveChanges(); return(RedirectToAction("Index", "ChucVuAdmin")); }
/* * ________ LOAD COMBOBOX ________ */ private void loadComboBoxChucVu() { //Variable ChucVuModel chucVu = new ChucVuModel(); DataTable td = new DataTable(); ComboboxItem comboboxItem = new ComboboxItem(); td = chucVu.getAllTable(); foreach (DataRow row in td.Rows) { comboboxItem = new ComboboxItem(); comboboxItem.Text = row[1].ToString(); //Gan ten chuc vu comboboxItem.Value = row[0].ToString(); //Gan ma chuc vu cbChucVu.Items.Add(comboboxItem); //Add item moi vao trong comboBox } }
public ActionResult Index() { var model = new List <ChucVuModel>(); var list = db.ChucVus.ToList(); int i = 0; foreach (var item in list) { i++; var itemmodel = new ChucVuModel(); itemmodel.Id = item.Id; itemmodel.TenChucVu = item.TenChucVu; itemmodel.Luong = item.Luong; itemmodel.STT = i; model.Add(itemmodel); } return(View(model)); }
// GET: Admin/GiangVien public ActionResult Index() { ViewData["DSGiangVien"] = new GiangVienModel().DanhSach(); ViewData["DSChucVu"] = new ChucVuModel().DanhSach(); return(View()); }