Esempio n. 1
0
        private void ActiveButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> accountIds = (from DataGridViewRow r in AccountDataGridView.Rows
                                         where Convert.ToBoolean(r.Cells[1].Value) == true
                                         select Convert.ToInt32(r.Cells[0].Value)).ToList();

                if (accountIds.Count == 0)
                {
                    //MessageBox.Show("Chưa chọn tài khoản nào", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Chưa chọn tài khoản nào", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }


                int result = accountService.ActiveManyAccount(accountIds);
                if (accountIds.Count > 0)
                {
                    //MessageBox.Show("Kích hoạt tài khoản thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    NotificationForm notificationForm = new NotificationForm("Kích hoạt tài khoản thành công", "Thông báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                }
                else
                {
                    //MessageBox.Show("Kích hoạt tài khoản không thành công", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Kích hoạt tài khoản không thành công", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }

                LoadAccountList();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }