Ejemplo n.º 1
0
        public void btnXoaND_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int[] l     = GridView2.GetSelectedRows();
            var   index = l[0];

            switch (MessageBox.Show("Bạn có chắc chắn muốn xóa người dùng này không?", "Hỏi Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
            case DialogResult.Yes:
                TaiKhoan_DTO nd = default(TaiKhoan_DTO);
                nd = ((List <TaiKhoan_DTO>)gridNguoiDung.DataSource)[index];
                bool test = TaiKhoan_BUS.XoaNguoiDung(nd);
                if (test == true)
                {
                    LoadGridNguoiDung();

                    MessageBox.Show("Xóa thành công");
                }
                else
                {
                    MessageBox.Show("Xóa không thành công");
                }
                break;

            case DialogResult.No:
                return;
            }
        }
Ejemplo n.º 2
0
        private void btnXoaND_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int[] l     = GridView2.GetSelectedRows();
            var   index = l[0];

            switch (Interaction.MsgBox("Bạn có chắc chắn muốn xóa người dùng này không?", MsgBoxStyle.YesNo, "Xóa"))
            {
            case MsgBoxResult.Yes:
                TaiKhoan_DTO nd = null;
                nd = (List <TaiKhoan_DTO>)gridNguoiDung.DataSource[index];
                bool test = TaiKhoan_BUS.XoaNguoiDung(nd);
                if (test == true)
                {
                    LoadGridNguoiDung();

                    Interaction.MsgBox("Xóa thành công");
                }
                else
                {
                    Interaction.MsgBox("Xóa không thành công");
                }
                break;

            case MsgBoxResult.No:
                return;

                break;
            }
        }