//void khoidongct() //{ // var con = ketnoisqlite.khoitao(); // var conmy = ketnoi.Instance(); // string ghinho = con.laygiatri_ghinho(); // string[] tentk = con.laytaikhoan(); // bool check = conmy.kiemtraTaikhoan(tentk[0], tentk[1]); // if (ghinho != "OK") // { // hamload(); // } // else if (ghinho == "OK" && !string.IsNullOrEmpty(tentk[0]) && !string.IsNullOrEmpty(tentk[1]) && check) // { // lbchaomung.Invoke(new MethodInvoker(delegate () // { // lbchaomung.Text = "WELCOME ... " + tentk[0].ToUpper(); // })); // chay3giay = new Thread(ham3giay); // chay3giay.IsBackground = true; // chay3giay.Start(); // } // else // { // this.Invoke(new MethodInvoker(delegate () // { // MessageBox.Show("Xem lại tài khoản và mật khẩu"); // })); // usdangnhap.Location = new Point(150, 260); // usdangnhap.Name = "usdangnhap"; // this.Controls.Add(usdangnhap); // usdangnhap.Show(); // usdangnhap.BringToFront(); // } //} void hamload() { var con = ketnoisqlite.khoitao(); string[] taikhoan = new string[2]; taikhoan = con.laytaikhoan(); if (string.IsNullOrEmpty(taikhoan[0]) || string.IsNullOrEmpty(taikhoan[1])) { ustaotaikhoan.Location = new Point(150, 260); ustaotaikhoan.Name = "ustaotaikhoan"; this.Controls.Add(ustaotaikhoan); ustaotaikhoan.Show(); ustaotaikhoan.BringToFront(); } else { usdangnhap.Location = new Point(150, 260); usdangnhap.Name = "usdangnhap"; this.Controls.Add(usdangnhap); usdangnhap.Show(); usdangnhap.BringToFront(); } }
void hamDangky() { if (!string.IsNullOrEmpty(txttaikhoan.Text) && !string.IsNullOrEmpty(txtmatkhau.Text)) { var conmy = ketnoi.Instance(); var conlite = ketnoisqlite.khoitao(); string tk = conmy.kiemtraTaikhoan(txttaikhoan.Text); if (tk == null) { conmy.taotaikhoanmoi(txttaikhoan.Text, txtmatkhau.Text); conmy.themcotmoi_hangduocban(txttaikhoan.Text); conlite.updatetaikhoan(txttaikhoan.Text, txtmatkhau.Text); MessageBox.Show("Tạo tài khoản thành công\nTên tài khoản là: \"" + txttaikhoan.Text + "\""); usdangnhap = new dangnhap(); this.Controls.Add(usdangnhap); usdangnhap.BringToFront(); } else { MessageBox.Show("Tên tài khoản: \" " + tk + " \" đã tồn tại\nChọn tên khác"); txttaikhoan.Clear(); txtmatkhau.Clear(); txttaikhoan.Focus(); } } else { MessageBox.Show("Không được để trống trường dữ liệu nào"); txttaikhoan.Clear(); txtmatkhau.Clear(); txttaikhoan.Focus(); } }