Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Bạn có chắc xóa không", "Xóa?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                AccountBUS.USERLOGIN deleteAccount = new AccountBUS.USERLOGIN()
                {
                    ID         = textBox2.Text,
                    username   = textBox3.Text,
                    password   = textBox4.Text,
                    permission = comboBox2.Text.ToString()
                };
                bool result = accountBUS.Delete(new AccountBUS.TokenChange(deleteAccount, DataStatic.user, DataStatic.token));
                if (result)
                {
                    MessageBox.Show("Xóa thành công");
                    DataGridViewChanged();
                }
                else
                {
                    MessageBox.Show("Xóa thất bại");
                }
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AccountBUS.USERLOGIN newAccount = new AccountBUS.USERLOGIN()
            {
                ID         = textBox2.Text,
                username   = textBox3.Text,
                password   = textBox4.Text,
                permission = comboBox2.Text.ToString()
            };
            bool result = accountBUS.Insert(new AccountBUS.TokenChange(newAccount, DataStatic.user, DataStatic.token));

            if (result)
            {
                MessageBox.Show("Đăng ký thành công");
                DataGridViewChanged();
            }
            else
            {
                MessageBox.Show("Đăng ký thất bại");
            }
        }
Example #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     try {
         AccountBUS.USERLOGIN updateAccount = new AccountBUS.USERLOGIN()
         {
             ID         = textBox2.Text,
             username   = textBox3.Text,
             password   = textBox4.Text,
             permission = comboBox2.Text.ToString()
         };
         bool result = accountBUS.Update(new AccountBUS.TokenChange(updateAccount, DataStatic.user, DataStatic.token));
         if (result)
         {
             MessageBox.Show("Cập nhật thành công");
             DataGridViewChanged();
         }
         else
         {
             MessageBox.Show("Cập nhật thất bại");
         }
     }
     catch { MessageBox.Show("User name không thể thay đổi"); }
 }