private void btnDangNhap_Click(object sender, EventArgs e) { if (txtUsername.Text == "kieukhang" && txtPass.Text == "1230") { //this.Hide(); frmAdmin fma = new frmAdmin(); fma.id = 0; fma.ShowDialog(); this.Close(); txtPass.Clear(); txtUsername.Clear(); txtUsername.Focus(); } else if (txtUsername.Text == "caoan" && txtPass.Text == "2535") { //this.Hide(); frmAdmin fma = new frmAdmin(); fma.id = 1; fma.ShowDialog(); this.Close(); txtPass.Clear(); txtUsername.Clear(); txtUsername.Focus(); } else { MessageBox.Show("Sai Thông Tin Tài Khoản Hoặc Mật Khẩu!", "Thông Báo", MessageBoxButtons.OKCancel); } }
private void btnXacNhan_TT_Click(object sender, EventArgs e) { conn.Open(); sql = @"update khachhang set CongNo += N'" + txtConLai.Text + @"' where Makh = N'" + makh + @"' "; thuchien = new SqlCommand(sql, conn); thuchien.ExecuteNonQuery(); conn.Close(); if (txtTraTruoc.Text != "") { frmAdmin fm = new frmAdmin(); fm.sotientra = int.Parse(txtTraTruoc.Text); } conn.Open(); sql = @"update HoaDon set Tong = '" + thanhtoan.ToString() + @"' where mahd = N'" + mahd + @"'"; thuchien = new SqlCommand(sql, conn); thuchien.ExecuteNonQuery(); conn.Close(); MessageBox.Show("Thanh Toán Thành Công!"); this.Close(); }