private void LoadNhomNguoiDung() { cboGroup.DataSource = NhomNguoiDungDataProvider.LoadAll(); cboGroup.DisplayMember = "TenNhom"; cboGroup.ValueMember = "IdNhomNguoiDung"; cboGroup.SelectedIndex = -1; }
private void ShowNTK_NganhHang() { try { if (gvNhomNguoiDung.FocusedRowHandle < 0) { return; } if (arrPhanQuyenNganhHang.Count == 0) { LoadAllPhanQuyenNganhHang(); } NhomNguoiDungInfor nhomND = (NhomNguoiDungInfor)gvNhomNguoiDung.GetRow(gvNhomNguoiDung.FocusedRowHandle); NhomNguoiDungDataProvider.GetPhanQuyenNganhHang(nhomND); //thiet lap nganh hang selectorNH.ClearSelection(); foreach (PhanQuyenNganhHangInfor pq in nhomND.PhanQuyenNganhHang) { for (int i = 0; i < gvNhomSanPham.DataRowCount; i++) { PhanQuyenNganhHangInfor gpq = (PhanQuyenNganhHangInfor)gvNhomSanPham.GetRow(i); if (gpq.MaLoai.Equals(pq.MaLoai)) { selectorNH.SelectRow(i, true); // dánh dấu trạng thái break; } } } //so ton duoc xem txtSoTon.Text = Common.Double2Str(nhomND.XemTon); } catch { } }
private void btnSaveCN_Click(object sender, EventArgs e) { try { if (gvNhomNguoiDung.FocusedRowHandle < 0) { return; } NhomNguoiDungInfor nhomND = (NhomNguoiDungInfor)gvNhomNguoiDung.GetRow(gvNhomNguoiDung.FocusedRowHandle); //cap nhat lai chuc nang moi nhomND.ChucNangNguoiDung = new ArrayList(); nhomND.ChucNangNguoiDung.AddRange(selectorCN.selection); //cap nhat lai hang san xuat moi nhomND.PhanQuyenHangSanXuat = new ArrayList(); nhomND.PhanQuyenHangSanXuat.AddRange(selectorSX.selection); //cap nhat lai nganh hang moi nhomND.PhanQuyenNganhHang = new ArrayList(); nhomND.PhanQuyenNganhHang.AddRange(selectorNH.selection); //tham so khac nhomND.XemTon = Common.IntValue(txtSoTon.Text); NhomNguoiDungDataProvider.Update(nhomND); MessageBox.Show("Cập nhật thành công!"); } catch (Exception ex) { MessageBox.Show("Lỗi ghi dữ liệu: " + ex.Message); } }
private void ShowNTK_HangSanXuat() { try { if (gvNhomNguoiDung.FocusedRowHandle < 0) { return; } if (arrPhanQuyenHangSanXuat.Count == 0) { LoadAllPhanQuyenHangSanXuat(); } NhomNguoiDungInfor nhomND = (NhomNguoiDungInfor)gvNhomNguoiDung.GetRow(gvNhomNguoiDung.FocusedRowHandle); NhomNguoiDungDataProvider.GetPhanQuyenHangSanXuat(nhomND); txtSoTon.Text = Common.Double2Str(nhomND.XemTon); //thiet lap chuc nang selectorSX.ClearSelection(); foreach (PhanQuyenHangSanXuatInfor hsx in nhomND.PhanQuyenHangSanXuat) { for (int i = 0; i < gvHangSanXuat.DataRowCount; i++) { PhanQuyenHangSanXuatInfor ghsx = (PhanQuyenHangSanXuatInfor)gvHangSanXuat.GetRow(i); if (ghsx.MaHang.Equals(hsx.MaHang)) { selectorSX.SelectRow(i, true); // dánh dấu trạng thái break; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ShowNTK_ChucNang() { try { if (gvNhomNguoiDung.FocusedRowHandle < 0) { return; } if (arrChucNang.Count == 0) { LoadAllChucNang(); } NhomNguoiDungInfor nhomND = (NhomNguoiDungInfor)gvNhomNguoiDung.GetRow(gvNhomNguoiDung.FocusedRowHandle); NhomNguoiDungDataProvider.GetChucNang(nhomND); //thiet lap chuc nang selectorCN.ClearSelection(); foreach (ChucNangInfor cn in nhomND.ChucNangNguoiDung) { for (int i = 0; i < gvChucNang.DataRowCount; i++) { ChucNangInfor gcn = (ChucNangInfor)gvChucNang.GetRow(i); if (gcn.IdChucNang == cn.IdChucNang) { selectorCN.SelectRow(i, true); // dánh dấu trạng thái break; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadDuLieu() { string nhomND = txtNhomNguoiDung.Text.Trim(); string chucNang = txtNhanVien.Text.Trim(); liPhanQuyen = NhomNguoiDungDataProvider.LoadPhanQuyenChucNang(nhomND, chucNang); frmProgress.Instance.Value = frmProgress.Instance.MaxValue; frmProgress.Instance.IsCompleted = true; frmProgress.Instance.Description = "Đã xong"; }
private void LoadDuLieu() { int idTrungTam = bteTrungTam.Tag != null ? ((DMTrungTamInfor)bteTrungTam.Tag).IdTrungTam : 0; string nhomND = txtNhomNguoiDung.Text.Trim(); string nhanVien = txtNhanVien.Text.Trim(); liPhanQuyen = NhomNguoiDungDataProvider.LoadPhanQuyenNguoiDungChucNang(idTrungTam, nhomND, nhanVien); frmProgress.Instance.Value = frmProgress.Instance.MaxValue; frmProgress.Instance.IsCompleted = true; frmProgress.Instance.Description = "Đã xong"; }
private void LoadDuLieu() { string nhomND = txtNhomNguoiDung.Text.Trim(); string nganhHang = lueLoaiSanPham.EditValue != null ? lueLoaiSanPham.EditValue.ToString() : ((nguoiDung.SupperUser == 1 || nguoiDung.SaleAdmin == 1) ? "" : "-1"); liPhanQuyen = NhomNguoiDungDataProvider.LoadPhanQuyenNganhHang(nhomND, nganhHang); frmProgress.Instance.Value = frmProgress.Instance.MaxValue; frmProgress.Instance.IsCompleted = true; frmProgress.Instance.Description = "Đã xong"; }
private void btnDelete_Click(object sender, EventArgs e) { if (objNhomNguoiDung != null) { if (MessageBox.Show("Bạn có chắc chắn xóa nhóm tài khoản này không ?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { NhomNguoiDungDataProvider.Delete(objNhomNguoiDung); MessageBox.Show("Cập nhật thông tin nhóm người dùng thành công!"); this.Close(); } } else { MessageBox.Show("Nhóm chưa được tạo. Không thể xóa"); } }
private void btnXoaNND_Click(object sender, EventArgs e) { try { if (gvNhomNguoiDung.FocusedRowHandle < 0) { return; } if (MessageBox.Show("Bạn có chắc chắn xóa nhóm tài khoản này không ?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { int[] indx = gvNhomNguoiDung.GetSelectedRows(); for (int i = 0; i < indx.Length; i++) { NhomNguoiDungInfor nhomND = (NhomNguoiDungInfor)gvNhomNguoiDung.GetRow(indx[i]); NhomNguoiDungDataProvider.Delete(nhomND); } LoadAllNhomNguoiDung(); } else { } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void LoadAllNhomNguoiDung() { gNhomNguoiDung.DataSource = NhomNguoiDungDataProvider.LoadAll(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtMaNhom.Text)) { MessageBox.Show("Bạn chưa nhập mã nhóm người dùng!"); txtMaNhom.Focus(); return; } if (string.IsNullOrEmpty(txtTenNhom.Text)) { MessageBox.Show("Bạn chưa nhập tên nhóm người dùng!"); txtTenNhom.Focus(); return; } if (objNhomNguoiDung == null) { if (NhomNguoiDungDataProvider.Exist(txtMaNhom.Text)) { MessageBox.Show("Mã nhóm này đã được sử dụng. Hãy chọn mã khác!"); txtMaNhom.Focus(); return; } objNhomNguoiDung = new NhomNguoiDungInfor(); //cap nhat thong tin NND objNhomNguoiDung.MaNhom = txtMaNhom.Text.Trim(); objNhomNguoiDung.TenNhom = txtTenNhom.Text.Trim(); objNhomNguoiDung.MoTa = txtMoTa.Text.Trim(); objNhomNguoiDung.SuDung = chkSuDung.Checked;// (chkSuDung.Checked ? 1 : 0); objNhomNguoiDung.QuanTri = Common.Bool2Int(chkQuanTri.Checked); objNhomNguoiDung.DieuChuyen = Common.Bool2Int(chkDieuChuyenKhacTrungTam.Checked); objNhomNguoiDung.SuaChungTu = Common.Bool2Int(chkSuaChungTu.Checked); objNhomNguoiDung.SaleAdmin = Common.Bool2Int(chkSaleAdmin.Checked); objNhomNguoiDung.XemBaoCao = Common.Bool2Int(chkXemBaoCao.Checked); objNhomNguoiDung.ShowNotify = Common.Bool2Int(chkShowNotify.Checked); objNhomNguoiDung.NhomQuyenHan = Common.IntValue(cboNhomQuyen.SelectedValue); objNhomNguoiDung.ChonTrungTamHienTai = Common.Bool2Int(chkOnlyTon.Checked); NhomNguoiDungDataProvider.Insert(objNhomNguoiDung); MessageBox.Show("Thêm mới thông tin nhóm người dùng thành công!"); } else { objNhomNguoiDung.MaNhom = txtMaNhom.Text.Trim(); objNhomNguoiDung.TenNhom = txtTenNhom.Text.Trim(); objNhomNguoiDung.MoTa = txtMoTa.Text.Trim(); objNhomNguoiDung.SuDung = chkSuDung.Checked;// (chkSuDung.Checked ? 1 : 0); objNhomNguoiDung.QuanTri = Common.Bool2Int(chkQuanTri.Checked); objNhomNguoiDung.DieuChuyen = Common.Bool2Int(chkDieuChuyenKhacTrungTam.Checked); objNhomNguoiDung.SuaChungTu = Common.Bool2Int(chkSuaChungTu.Checked); objNhomNguoiDung.SaleAdmin = Common.Bool2Int(chkSaleAdmin.Checked); objNhomNguoiDung.XemBaoCao = Common.Bool2Int(chkXemBaoCao.Checked); objNhomNguoiDung.ShowNotify = Common.Bool2Int(chkShowNotify.Checked); objNhomNguoiDung.NhomQuyenHan = Common.IntValue(cboNhomQuyen.SelectedValue); objNhomNguoiDung.ChonTrungTamHienTai = Common.Bool2Int(chkOnlyTon.Checked); NhomNguoiDungDataProvider.Update(objNhomNguoiDung); MessageBox.Show("Cập nhật thông tin nhóm người dùng thành công!"); } this.frm.LoadAllNhomNguoiDung(); this.Close(); } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.ToString()); } }