示例#1
0
 private void BtnThem_Click(object sender, EventArgs e)
 {
     ServiceReference1.UserDetail obj = new ServiceReference1.UserDetail();
     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("Nhap Thieu Thong Tin", "Thong bao", MessageBoxButtons.OK);
         return;
     }
     if (client.Them(obj) == true)
     {
         MessageBox.Show("Da Them", "Thong Bao", MessageBoxButtons.OK);
         BtnAccount_Click(sender, e);
     }
     else
     {
         MessageBox.Show("Id Account bị trùng", "Thong Bao", MessageBoxButtons.OK);
     }
 }
示例#2
0
        private void BtnDangNhap_Click(object sender, EventArgs e)
        {
            ServiceReference1.UserDetail obj = new ServiceReference1.UserDetail();
            obj.idacc = TxtDangNhap.Text;
            obj.pass  = TxtMatKhau.Text;
            if (TxtDangNhap.Text == "" || TxtMatKhau.Text == "")
            {
                MessageBox.Show("Vui long them thong tin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (client.KtActivate(obj) == false)
            {
                client.SuaActi(obj);
                if (client.DangNhap(obj) == true)
                {
                    {
                        if (client.Account(obj) == true)
                        {
                            Class1.IdAcc = TxtDangNhap.Text;
                            Class1.Role  = 1;
                            MessageBox.Show("Chao Admin", "Account");
                            FrmOption f = new FrmOption();
                            this.Hide();
                            f.ShowDialog();
                        }
                        else
                        {
                            Class1.IdAcc = TxtDangNhap.Text;
                            Class1.Role  = 0;
                            MessageBox.Show("Chào User", "Acount");
                            FrmVote f = new FrmVote();
                            this.Hide();
                            f.ShowDialog();
                        }
                    }
                }

                else
                {
                    MessageBox.Show("Thất bại", "Error");
                    TxtDangNhap.Clear();
                    TxtMatKhau.Clear();
                    TxtDangNhap.Focus();
                }
            }
            else
            {
                MessageBox.Show("Tài khoản đã đăng nhâp!!", "Thông báo", MessageBoxButtons.OK);
                TxtDangNhap.Clear();
                TxtMatKhau.Clear();
                TxtDangNhap.Focus();
            }
        }
示例#3
0
 private void BtnSua_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc là sửa ?", "NOTE", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
     {
         ServiceReference1.UserDetail obj = new ServiceReference1.UserDetail();
         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.Sua(obj);
         BtnAccount_Click(sender, e);
     }
 }