private void btLayXe_Click(object sender, EventArgs e) { btMoiXeVao.Visible = false; panelThanhToan.Visible = true; char s = btKhuVuc.Text.Trim()[0]; char sp = btKhuVuc.Text.Trim()[1]; switch (s.ToString()) { case "A": kh.updateBaiXe("0", sp.ToString()); break; case "B": kh.updateBaiXe2("0", sp.ToString()); break; case "C": kh.updateBaiXe3("0", sp.ToString()); break; case "D": kh.updateBaiXe4("0", sp.ToString()); break; case "E": kh.updateBaiXe5("0", sp.ToString()); break; case "F": kh.updateBaiXe6("0", sp.ToString()); break; case "G": kh.updateBaiXe7("0", sp.ToString()); break; case "H": kh.updateBaiXe8("0", sp.ToString()); break; case "K": kh.updateBaiXe9("0", sp.ToString()); break; } kh.deleteCus(btKhuVuc.Text.Trim()); BaiXeForm baiXe = new BaiXeForm(); baiXe.BaiXeForm_Load(sender, e); MessageBox.Show("Mời xe ra"); KTChoTrong(); btMoiXeVao.Visible = true; panelThanhToan.Visible = false; }
//Nút lưu xe (Lưu vào database rồi đổ lên Form Quản Lí Tất Cả Xe) private void btMoiXeVao_Click(object sender, EventArgs e) { string vitri = btKhuVuc.Text.Replace(".", "").Trim(); string loaixe; if (Oto.Checked == true) { loaixe = btOto.Text; } else if (XeMay.Checked == true) { loaixe = btXeMay.Text; } else { loaixe = btXeDap.Text; } string yeucau; if (radHour.Checked == true) { yeucau = "Hour"; } else if (radDay.Checked == true) { yeucau = "Day"; } else if (radWeek.Checked == true) { yeucau = "Week"; } else { yeucau = "Month"; } MemoryStream nguoigui = new MemoryStream(); MemoryStream bienso = new MemoryStream(); DateTime ngaygui = DTPNgayGui.Value; TimeSpan giogui = Convert.ToDateTime(txtGioGui.Text).TimeOfDay; pictureBoxBienSoXe.Image.Save(bienso, pictureBoxBienSoXe.Image.RawFormat); pictureBoxNguoiGui.Image.Save(nguoigui, pictureBoxNguoiGui.Image.RawFormat); if (kh.insertCus(vitri, loaixe, bienso, nguoigui, ngaygui, giogui, yeucau)) { MessageBox.Show("Xe Đã Nhận Vào Bãi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (loaixe == "Ô tô") { txtOtoTrong.Text = (Convert.ToInt32(txtOtoTrong.Text) - 1).ToString(); } else if (loaixe == "Xe máy") { btXeMayTrong.Text = (Convert.ToInt32(btXeMayTrong.Text) - 1).ToString(); } else { btXeDapTrong.Text = (Convert.ToInt32(btXeDapTrong.Text) - 1).ToString(); } } else { MessageBox.Show("Error", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } string s = btKhuVuc.Text.ToString(); string[] sp = s.Split('.'); switch (sp[0]) { case "A": kh.updateBaiXe("1", sp[1]); break; case "B": kh.updateBaiXe2("1", sp[1]); break; case "C": kh.updateBaiXe3("1", sp[1]); break; case "D": kh.updateBaiXe4("1", sp[1]); break; case "E": kh.updateBaiXe5("1", sp[1]); break; case "F": kh.updateBaiXe6("1", sp[1]); break; case "G": kh.updateBaiXe7("1", sp[1]); break; case "H": kh.updateBaiXe8("1", sp[1]); break; case "K": kh.updateBaiXe9("1", sp[1]); break; } pictureBoxBienSoXe.Image = pictureBoxBienSoXe.BackgroundImage; pictureBoxNguoiGui.Image = pictureBoxNguoiGui.BackgroundImage; btKhuVuc.Text = ""; BaiXeForm baiXe = new BaiXeForm(); baiXe.BaiXeForm_Load(sender, e); txtGioGui.Text = DateTime.Now.ToString("HH:mm:ss"); }