private void btTaoTaiKhoan_Click(object sender, EventArgs e) { if (txtbEmail.Text != "") { conn = new SqlConnection(string_conn); String qr = "INSERT INTO [dbo].[KhachHang]([Email],[hoTen],[Sdt],[DiaChi],[gioiTinh],[ngaySinh],[password]) VALUES" + "(N'" + txtbEmail.Text + "', N'" + txtbHoTen.Text + "', '" + txtbSĐT.Text + "', N'" + textBoxDc.Text + "', N'" + gt + "', '" + dateTimePickerNgaySinh.Value.ToString("dd/MM/yyyy") + "', '" + txtbCfPassword.Text + "')"; try { SqlCommand cmmd = new SqlCommand(qr, conn); conn.Open(); cmmd.ExecuteNonQuery(); } catch (SqlException err) { MessageBox.Show("Tạo Tài Khoản thất bại" + err.ToString()); conn.Close(); } finally { conn.Close(); ThongTinKhachHang ttkh = new ThongTinKhachHang(); ttkh.getEmail(txtbEmail.Text); MessageBox.Show("Tạo tài khoản thành công"); Form1 f = new Form1(); //f.getProp(txtbHoTen.Text, txtbSĐT.Text); f.ShowDialog(); this.Close(); } } else { MessageBox.Show("Không Được Bỏ Trống Email và Password"); } }
protected override bool ProcessDialogKey(Keys keyData) { if (keyData == Keys.Enter) { if (checkAccountAdmin() == true) { this.Hide(); QuanLyKhachHang qlkh = new QuanLyKhachHang(); qlkh.ShowDialog(); this.Close(); } else if (checkDangNhap() == true) { ThongTinKhachHang ttkh = new ThongTinKhachHang(); ttkh.getEmail(txtBoxAccount.Text); MessageBox.Show("Đăng nhập thành công"); this.Hide(); Form1 f = new Form1(); // //tạo ra connection // String string_conn = //@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + Application.StartupPath + @"\" + "QLKH.mdf" + ";Integrated Security=True"; // SqlConnection conn = new SqlConnection(string_conn); // conn.Open(); // String qr = "Select * from KhachHang where Email='" + txtBoxAccount.Text + "' and password = '******';"; // SqlDataAdapter dataAdapter = new SqlDataAdapter(qr, conn); // DataTable dttb = new DataTable(); // dataAdapter.Fill(dttb); // if (dttb.Rows.Count == 1) // { // foreach (DataRow dr in dttb.Rows) // { // //f.getProp(dr["hoTen"].ToString(), sdt); // } // } f.ShowDialog(); this.Close(); } else { MessageBox.Show("Tài Khoản Hoặc Mật Khẩu Của Bạn Đã Sai"); } return(true); } if (keyData == Keys.Escape) { this.Close(); return(true); } return(base.ProcessDialogKey(keyData)); }
private void GioHang_Load(object sender, EventArgs e) { //Load lại thông tin khách khi sửa //khi sửa thông tin nếu sửa vào số điện thoại hoặc tên thì sẽ load lại cập nhập đã sửa ThongTinKhachHang tt = new ThongTinKhachHang(); tt.Show(); tt.Hide(); tt.Close(); //MessageBox.Show("running"); lbTen.Text = ThongTinKhachHang.ten; lbSoTK.Text = ThongTinKhachHang.std; //lbTen.Text = tenTK; //lbSoTK.Text = soDT; tinhTongTien(); //MessageBox.Show(listView1.Items[1].SubItems[3].Text.ToString()); }
private void thôngTinChiTiếtKháchHàngToolStripMenuItem_Click(object sender, EventArgs e) { ThongTinKhachHang ttkh = new ThongTinKhachHang(); ttkh.ShowDialog(); }