Exemplo n.º 1
0
        private void Barbtnphanquyen_ItemClick(object sender, ItemClickEventArgs e)
        {
            PhanQuyen phanQuyen = new PhanQuyen();

            phanQuyen.MdiParent = this;
            phanQuyen.Show();
        }
Exemplo n.º 2
0
        private void Barbtnphanquyen_ItemClick(object sender, ItemClickEventArgs e)
        {
            PhanQuyen phanQuyen = new PhanQuyen();

            if (ExistsForm(phanQuyen))
            {
                return;
            }
            phanQuyen.MdiParent = this;
            phanQuyen.Show();
        }
Exemplo n.º 3
0
 private void dgvNguoiDung_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if ((mUser.isAdmin == 1 || mUR.isEdit.Value) && e.ColumnIndex == (tempSua - 11)) // click nut sua
         {
             User objUser = new User();
             objUser.ID          = int.Parse(dgvNguoiDung["ID", e.RowIndex].Value.ToString());
             objUser.DisplayName = dgvNguoiDung["DisplayName", e.RowIndex].Value.ToString();
             objUser.Gender      = dgvNguoiDung["Gender", e.RowIndex].Value.ToString() == "Nam" ? true : false;
             objUser.isPay       = dgvNguoiDung["QuyenThanhToan", e.RowIndex].Value.ToString() == "Có" ? true : false;
             objUser.Phone       = dgvNguoiDung["Phone", e.RowIndex].Value.ToString();
             objUser.Email       = dgvNguoiDung["Email", e.RowIndex].Value.ToString();
             objUser.DateOfBirth = DateTime.ParseExact(dgvNguoiDung["DateOfBirth", e.RowIndex].Value.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
             objUser.Address     = dgvNguoiDung["Address", e.RowIndex].Value.ToString();
             SuaNguoiDung mSuaNguoiDung = new SuaNguoiDung(mUser, objUser);
             this.Parent.Parent.Enabled = false;
             mSuaNguoiDung.UCNguoiDung  = this;
             mSuaNguoiDung.Show();
         }
         if ((mUser.isAdmin == 1 || mUR.isRemove.Value) && e.ColumnIndex == (tempXoa - 11))
         {
             var result = MessageBox.Show($"Bạn có muốn xóa{dgvNguoiDung["DisplayName", e.RowIndex].Value.ToString().ToUpper()}?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 if (new UserLDM().Delete(int.Parse(dgvNguoiDung["ID", e.RowIndex].Value.ToString())))
                 {
                     ReloadDataNguoiDung();
                     MessageBox.Show("Xóa thành công!");
                 }
                 else
                 {
                     MessageBox.Show("Xóa thất bại!");
                 }
             }
         }
         if ((mUser.isAdmin == 1) && e.ColumnIndex == (tempPQ - 11))
         {
             PhanQuyen mPhanQuyen = new PhanQuyen(mUser, int.Parse(dgvNguoiDung["ID", e.RowIndex].Value.ToString()));
             mPhanQuyen.mUC             = this;
             this.Parent.Parent.Enabled = false;
             mPhanQuyen.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }