public void createaccount() { string sqlquery = "select ThanhVien.IDThanhVien,HoThanhVien,TenThanhVien,MSSV,TenChucVu as ChucVu,NgaySinh from ThanhVien,ChucVu,TaiKhoan where RoiCLB is null and ThanhVien.IDThanhVien != TaiKhoan.IDThanhVien and ThanhVien.IDChucVu = ChucVu.IDChucVu and ThanhVien.IDThanhVien = 394"; DataTable dt = dalcreateaccount.getDataBase(sqlquery); XuLyChuoi.LoaiBoDau boDau = new XuLyChuoi.LoaiBoDau(); SECURITY.BamChuoi bc = new SECURITY.BamChuoi(); SECURITY.RandomClass rd = new SECURITY.RandomClass(); string userName = (dt.Rows[0]["TenThanhVien"].ToString() + layKyTuCuaHo(dt.Rows[0]["HoThanhVien"].ToString()) + dt.Rows[0]["MSSV"].ToString().Substring(dt.Rows[0]["MSSV"].ToString().Length - 4, 4)); userName = boDau.ConvertToUnsign(userName).ToLower(); MessageBox.Show(userName); userName = bc.maHoaKyTu(userName); string randomstr = rd.RandomText(10); string pass = dt.Rows[0]["MSSV"].ToString(); MessageBox.Show(pass); pass = bc.maHoaKyTu(pass + randomstr); sqlquery = "insert into TaiKhoan(IDThanhVien,UserName,PassWD,RandomString,DangNhap,KhoaTaiKhoan) values(394,N'" + userName + "',N'" + pass + "',N'" + randomstr + "',0,0)"; dalcreateaccount.createaccount(sqlquery); }
public void doipasswd() { if (frmaddmember.tb_NewPass.Text != "") { if (frmaddmember.tb_NewPass.Text == frmaddmember.tb_ReNewPass.Text) { SECURITY.BamChuoi security = new SECURITY.BamChuoi(); SECURITY.RandomClass rad = new SECURITY.RandomClass(); string random = rad.RandomText(10); string passwd = security.maHoaKyTu(frmaddmember.tb_NewPass.Text + random); string sqlquery = "update TaiKhoan set PassWD = N'" + passwd + "', RandomString = N'" + random + "' where IDThanhVien = " + caseData.DataTam.DuLieu.idTemp; if (daladdmember.addMember(sqlquery) > 0) { MessageBox.Show("Đổi mật khẩu thành công"); } else { MessageBox.Show("Lỗi không mong muốn"); } } else { MessageBox.Show("Nhập lại mật khẩu không đúng"); } } else { MessageBox.Show("Mật khẩu không được để trống!"); } }