public PartialViewResult _LoadDanhSachChucVu(int?ChucVuId) { ChucVuService service = new ChucVuService(); ViewBag._LoadDanhSachChucVu = new SelectList(service.DSChucVu(), "ChucVuId", "TenChucVu", ChucVuId); return(PartialView("_LoadDanhSachChucVu")); }
public PartialViewResult dsChucVu(int?id) { ChucVuService _chucvu = new ChucVuService(); IEnumerable <ChucVu> dsChucVu = _chucvu.DanhSach(TrangThai: true); return(PartialView("_dmChucVu", new SelectList(dsChucVu, "ChucVuId", "TenChucVu", id))); }
public PartialViewResult HieuChinh(int?id) { var chucvu = new ChucVu(); if (id.HasValue && id.Value > 0) { var _chucvu = new ChucVuService(); chucvu = _chucvu.FindByKey(id); } return(PartialView("_HieuChinh", chucvu)); }
public PartialViewResult HienThiDanhSach(string MaChucVu, string TenChucVu, int?Page) { ChucVuService _chucvu = new ChucVuService(); int currentPage = Page.HasValue && Page > 0 ? Page.Value : 1; var danhsach = _chucvu.DanhSach(MaChucVu, TenChucVu, currentPage); if (Page.HasValue && danhsach.PageCount < Page.Value) { danhsach = _chucvu.DanhSach(MaChucVu, TenChucVu, danhsach.PageCount); } return(PartialView("_DanhSach", danhsach)); }
public JsonResult GhiLai(ChucVu model) { try { ChucVuService _chucvu = new ChucVuService(); var result = _chucvu.InsertOrUpdate(model.ChucVuId, model.MaChucVu, model.TenChucVu, model.ConHoatDong, model.ThuTuUuTien, null); return(Json(new { status = result }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { status = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult ThayDoiTrangThai(int?id) { if (id.HasValue) { ChucVuService _chucvu = new ChucVuService(); var chucvu = _chucvu.FindByKey(id.Value); if (chucvu != null) { chucvu.ConHoatDong = chucvu.ConHoatDong.HasValue ? !chucvu.ConHoatDong : true; _chucvu.Update(chucvu); return(Json(new { status = true }, JsonRequestBehavior.AllowGet)); } } return(Json(new { status = false, message = "Chức vụ không khả dụng" })); }
public JsonResult XoaChucVu(int?id) { try { if (id.HasValue) { var _chucvu = new ChucVuService(); var result = _chucvu.XoaChucVu(id.Value); return(Json(new { status = true, message = "Chức vụ đã được xóa" })); } return(Json(new { status = false, message = "Chức vụ không khả dụng" })); } catch (Exception ex) { return(Json(new { status = false, message = ex.Message })); } }
private void btnLuu_Click(object sender, EventArgs e) { var dtChucVu = grcChucVu.DataSource as DataTable; if (dtChucVu == null || dtChucVu.GetChanges() == null) { return; } if (ChucVuService.SaveChanges(dtChucVu)) { XtraMessageBox.Show("Lưu thành công", "Lưu", MessageBoxButtons.OK, MessageBoxIcon.Information); grcChucVu.DataSource = ChucVuService.LoadDataTable(); } else { XtraMessageBox.Show("Lưu thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void frmNhanVienThemSua_Load(object sender, EventArgs e) { if (mode == MODE_ADDNEW) { initThem(); } else { initSua(); } cbbGioiTinh.Properties.Items.Add("Nam"); cbbGioiTinh.Properties.Items.Add("Nữ"); cbbGioiTinh.Properties.Items.Add("Khác"); lueChucVu.Properties.ValueMember = "MaChucVu"; lueChucVu.Properties.DisplayMember = "TenChucVu"; lueChucVu.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("TenChucVu", 200, "Tên Chức Vụ")); lueChucVu.Properties.DataSource = ChucVuService.LoadDataTable(); }
private void frmNhaCungCap_FormClosing(object sender, FormClosingEventArgs e) { var dt = grcChucVu.DataSource as DataTable; if (dt == null || dt.GetChanges() == null) { return; } if ( XtraMessageBox.Show("Bạn có muốn lưu những thay đổi không?", "Thoát", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ChucVuService.SaveChanges(dt.GetChanges())) { XtraMessageBox.Show("Lưu thất bại", "Lưu", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } } }
private void FrmChucVu_Load(object sender, EventArgs e) { var dt = ChucVuService.LoadDataTable(); grcChucVu.DataSource = dt; }