Example #1
0
 private void BtnThem_Click(object sender, EventArgs e)
 {
     ServiceReference1.Account obj = new ServiceReference1.Account();
     obj.name = txtname.Text;
     obj.pass = txtpass.Text;
     if (txtrole.Text == "1")
     {
         obj.role = bool.Parse("true");
     }
     else
     {
         obj.role = bool.Parse("false");
     }
     obj.idacc = txtid.Text;
     if (txtname.Text == "" || txtpass.Text == "" || txtid.Text == "" || txtrole.Text == "")
     {
         MessageBox.Show("Nhập Thiếu Thông Tin", "Thông Báo", MessageBoxButtons.OK);
         return;
     }
     if (client.ThemAc(obj) == true)
     {
         MessageBox.Show("Đã Thêm", "Thông Báo", MessageBoxButtons.OK);
         BtnAccount_Click(sender, e);
     }
     else
     {
         MessageBox.Show("Id bị trùng", "Thông Báo", MessageBoxButtons.OK);
     }
 }
Example #2
0
 private void BtnXoa_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc là xóa ?", "NOTE", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
     {
         ServiceReference1.Account obj = new ServiceReference1.Account();
         if (txtrole.Text == "0")
         {
             obj.name = txtname.Text;
             obj.pass = txtpass.Text;
             if (txtrole.Text == "1")
             {
                 obj.role = bool.Parse("true");
             }
             else
             {
                 obj.role = bool.Parse("false");
             }
             obj.idacc = txtid.Text;
             client.XoaAc(obj);
             MessageBox.Show("Đã Xóa", "Thông báo");
             BtnAccount_Click(sender, e);
         }
         else if (txtrole.Text == "1")
         {
             MessageBox.Show("Khong The Xoa", "Thong Bao");
         }
     }
 }
Example #3
0
        private void BtnDangNhap_Click(object sender, EventArgs e)
        {
            ServiceReference1.Account obj = new ServiceReference1.Account();
            obj.idacc = TxtDangNhap.Text;
            obj.pass  = TxtMatKhau.Text;
            if (TxtDangNhap.Text == "" || TxtMatKhau.Text == "")
            {
                MessageBox.Show("Vui lòng thêm thông tin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (client.DangNhap(obj) == true)
            {
                {
                    if (client.Account(obj) == true)
                    {
                        Class1.IdAcc = TxtDangNhap.Text;
                        Class1.Role  = 1;
                        MessageBox.Show("Chào Admin", "Account");
                        FrmOption f = new FrmOption();
                        this.Hide();
                        f.ShowDialog();
                    }
                    else
                    {
                        Class1.IdAcc = TxtDangNhap.Text;
                        Class1.Role  = 0;
                        MessageBox.Show("Chào User", "Acount");
                        FrmOption f = new FrmOption();
                        this.Hide();
                        f.ShowDialog();
                    }
                }
            }

            else
            {
                MessageBox.Show("Thất bại", "Error");
                TxtDangNhap.Clear();
                TxtMatKhau.Clear();
                TxtDangNhap.Focus();
            }
        }