private void btnTiepNhan_Click(object sender, EventArgs e) { GetImg(); if (string.IsNullOrEmpty(cbLoaiXe.Text) || string.IsNullOrEmpty(txtSoThe.Text) || string.IsNullOrEmpty(txtBienSo.Text)) { MessageBox.Show("Vui lòng nhập đủ thông tin.", "Cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } else { if (checkMaThe(txtSoThe.Text.ToUpper())) { if (CheckTheDangSuDung(txtSoThe.Text.ToUpper())) { if (CheckHSD(txtSoThe.Text.ToUpper())) { try { BUS_XeRaVao ck = new BUS_XeRaVao(); ck.ngayGioVao = DateTime.Now; ck.maLoai = cbLoaiXe.SelectedValue.ToString(); ck.soThe = txtSoThe.Text.ToUpper(); ck.maNV = Frm_Login.MaNV; ck.bienSoXe = txtBienSo.Text; ck.anhTruoc = GetImg(); dll.XeVao(ck); MessageBox.Show("Thành công.", "Tiếp nhận xe vào bãi", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); txtSoThe.Text = ""; txtBienSo.Text = ""; } catch { } } else { MessageBox.Show("Thẻ hỏng hoặc hết hạn sử dụng", "Cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } } else { MessageBox.Show("Thẻ đã sử dụng.", "Cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } } else { MessageBox.Show("Số thẻ không tồn tại.", "Cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } } }
public void XeVao(BUS_XeRaVao dt) { _conSql = con.getConnect(); _conSql.Open(); cmd = new SqlCommand("XeVao", _conSql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@NgayGioVao", SqlDbType.DateTime).Value = dt.ngayGioVao; cmd.Parameters.Add("@maloai", SqlDbType.VarChar).Value = dt.maLoai; cmd.Parameters.Add("@sothe", SqlDbType.VarChar).Value = dt.soThe; cmd.Parameters.Add("@manv", SqlDbType.VarChar).Value = dt.maNV; cmd.Parameters.Add("@biensoxe", SqlDbType.VarChar).Value = dt.bienSoXe; cmd.Parameters.Add("@AnhPhiaTruoc", SqlDbType.Image).Value = dt.anhTruoc; cmd.Parameters.Add("@TinhTrang", SqlDbType.Bit).Value = false; cmd.ExecuteNonQuery(); cmd.Dispose(); _conSql.Close(); }