//构造函数 public TransferSelectForm(List <Seat> seats, SeatExpenseForm form) { db = new BathDBDataContext(LogIn.connectionString); //m_Seat = db.Seat.FirstOrDefault(x => x.text == seat.text); foreach (var s in seats) { m_Seats.Add(db.Seat.FirstOrDefault(x => x.text == s.text)); } m_Seat = m_Seats[0]; m_form = form; InitializeComponent(); }
//构造函数 public TransferSelectForm(List<Seat> seats, SeatExpenseForm form) { db = new BathDBDataContext(LogIn.connectionString); //m_Seat = db.Seat.FirstOrDefault(x => x.text == seat.text); foreach (var s in seats) { m_Seats.Add(db.Seat.FirstOrDefault(x => x.text == s.text)); } m_Seat = m_Seats[0]; m_form = form; InitializeComponent(); }
//点击台位按钮 private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = BathClass.ToBool(db_new.Options.FirstOrDefault().允许手工输入手牌号结账); m_Seat = db_new.HotelRoom.FirstOrDefault(x => x.text == btn.Text); var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == m_Seat.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } switch (m_Seat.status) { case 1: //可用 case 3: //已经结账 break; case 2: //正在使用 case 6: //警告 case 7: //押金离场 case 8: //重新结账 if (m_Seat.note != null && m_Seat.note != "") { BathClass.printInformation(m_Seat.note); } SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat); seatExpenseForm.ShowDialog(); break; case 4: //锁定 break; case 5: //停用 BathClass.printErrorMsg("台位已经停用!"); break; default: break; } }
//点击台位按钮 private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = MConvert<bool>.ToTypeOrDefault(LogIn.options.允许手工输入手牌号结账, false); //m_Seat = db_new.Seat.FirstOrDefault(x => x.text == btn.Text); m_Seat = dao.get_seat("text", btn.Text); var mtype = dao.get_seattype("id", m_Seat.typeId); //var mtype = db_new.SeatType.FirstOrDefault(x => x.id == m_Seat.typeId); switch (m_Seat.status) { case SeatStatus.AVILABLE://可用 case SeatStatus.PAIED://已经结账 case SeatStatus.RESERVE://预定客房 if (mtype.department == "客房部") { var form = new OpenRoomForm(m_Seat); form.ShowDialog(); } else if (mtype.menuId == null) { BathClass.printErrorMsg("手牌未开牌"); return; } else if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } break; case SeatStatus.USING://正在使用 case SeatStatus.WARNING://警告 case SeatStatus.DEPOSITLEFT://押金离场 case SeatStatus.REPAIED://重新结账 if (MConvert<bool>.ToTypeOrDefault(m_Seat.ordering, false)) { BathClass.printErrorMsg("正在录单!"); return; } if (mtype.department != "客房部" && !manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } if (m_Seat.deposit != null) BathClass.printInformation("交押金:" + m_Seat.deposit.ToString()); if (m_Seat.note != null && m_Seat.note != "") BathClass.printInformation(m_Seat.note); if (mtype.menuId == null) { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat, seat_length, false, false, dao); seatExpenseForm.Show(); } else { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat, seat_length, seatLock, auto_seat_card, dao); seatExpenseForm.Show(); } break; case SeatStatus.LOCKING://锁定 break; case SeatStatus.STOPPED://停用 BathClass.printErrorMsg("台位已经停用!"); break; default: break; } }
//F6开牌 private void tool_open_seat() { if (tSeat.Text == "") return; string text = tSeat.Text; tSeat.Text = ""; //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); //var ops = db_new.Options.FirstOrDefault(); var manuInput = MConvert<bool>.ToTypeOrDefault(LogIn.options.允许手工输入手牌号结账, false); var use_idCard = MConvert<bool>.ToTypeOrDefault(LogIn.options.启用ID手牌锁, false); var seat1 = dao.get_seat("text", text); //var seat1 = db_new.Seat.FirstOrDefault(x => x.text == text); if (seat1 != null) { var mtype = dao.get_seattype("id", seat1.typeId); //var seatType = db_new.SeatType.FirstOrDefault(x => x.id == seat1.typeId); if (mtype.department == "客房部") { var form = new OpenRoomForm(seat1); form.ShowDialog(); } else { if (manuInput) { //var mtype = dao.get_seattype("id", seat1.typeId); //var mtype = db_new.SeatType.FirstOrDefault(x => x.id == seat1.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } SeatStatus status = seat1.status; if (status == SeatStatus.USING || status == SeatStatus.WARNING || status == SeatStatus.DEPOSITLEFT || status == SeatStatus.REPAIED) { if (MConvert<bool>.ToTypeOrDefault(seat1.ordering, false)) { BathClass.printErrorMsg("正在录单!"); return; } if (seat1.deposit != null) BathClass.printInformation("交押金:" + seat1.deposit.ToString()); if (seat1.note != null && seat1.note != "") BathClass.printInformation(seat1.note); if (mtype.menuId == null) { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat1, seat_length, false, false, dao); seatExpenseForm.Show(); } else { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat1, seat_length, seatLock, auto_seat_card, dao); seatExpenseForm.Show(); } } else if (status == SeatStatus.LOCKING) BathClass.printErrorMsg("台位已经锁定!"); else if (status == SeatStatus.STOPPED) BathClass.printErrorMsg("台位已经停用!"); } } } else if (use_idCard) { var seat2 = dao.get_seat("oId", text); var mtype = dao.get_seattype("id", seat2.typeId); //var seat2 = db_new.Seat.FirstOrDefault(x => x.oId == text); SeatStatus status = seat2.status; if (status == SeatStatus.USING || status == SeatStatus.WARNING || status == SeatStatus.DEPOSITLEFT || status == SeatStatus.REPAIED) { if (MConvert<bool>.ToTypeOrDefault(seat2.ordering, false)) { BathClass.printErrorMsg("正在录单!"); return; } if (seat2.deposit != null) BathClass.printInformation("交押金:" + seat2.deposit.ToString()); if (seat2.note != null && seat2.note != "") BathClass.printInformation(seat2.note); if (mtype.menuId == null) { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat2, seat_length, false, false, dao); seatExpenseForm.Show(); } else { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat2, seat_length, seatLock, auto_seat_card, dao); seatExpenseForm.Show(); } } else if (status == SeatStatus.LOCKING) BathClass.printErrorMsg("台位已经锁定!"); else if (status == SeatStatus.STOPPED) BathClass.printErrorMsg("台位已经停用!"); } }
private void show_seat_expense_form(CSeat seat) { SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat, seat_length, seatLock, auto_seat_card, dao); seatExpenseForm.ShowDialog(); }
//点击台位按钮 private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = BathClass.ToBool(db_new.Options.FirstOrDefault().允许手工输入手牌号结账); m_Seat = db_new.HotelRoom.FirstOrDefault(x => x.text == btn.Text); var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == m_Seat.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } switch (m_Seat.status) { case 1://可用 case 3://已经结账 break; case 2://正在使用 case 6://警告 case 7://押金离场 case 8://重新结账 if (m_Seat.note != null && m_Seat.note != "") BathClass.printInformation(m_Seat.note); SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat); seatExpenseForm.ShowDialog(); break; case 4://锁定 break; case 5://停用 BathClass.printErrorMsg("台位已经停用!"); break; default: break; } }
//F6开牌 private void tool_open_seat() { if (tSeat.Text == "") return; string text = tSeat.Text; tSeat.Text = ""; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = BathClass.ToBool(db_new.Options.FirstOrDefault().允许手工输入手牌号结账); var seat1 = db_new.HotelRoom.FirstOrDefault(x => x.text == text); var seat2 = db_new.HotelRoom.FirstOrDefault(x => x.oId == text); if (seat1 == null && seat2 == null) { BathClass.printErrorMsg("手牌不可用!"); return; } if (seat1 != null) { var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == seat1.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } int status = seat1.status; if (status == 2 || status == 6 || status == 7 || status == 8) { if (seat1.note != null && seat1.note != "") BathClass.printInformation(seat1.note); SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat1); seatExpenseForm.ShowDialog(); } else if (status == 4) BathClass.printErrorMsg("台位已经锁定!"); else if (status == 5) BathClass.printErrorMsg("台位已经停用!"); } else if (seat2 != null) { var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == seat2.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } int status = seat2.status; if (status == 2 || status == 6 || status == 7 || status == 8) { if (seat2.note != null && seat2.note != "") BathClass.printInformation(seat2.note); SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat2); seatExpenseForm.ShowDialog(); } else if (status == 4) BathClass.printErrorMsg("台位已经锁定!"); else if (status == 5) BathClass.printErrorMsg("台位已经停用!"); } }
//结账 private void payTool_Click(object sender, EventArgs e) { m_Seat = read_seat_by_card(); if (m_Seat == null) { BathClass.printErrorMsg("读取房卡数据失败或者房间未定义!"); return; } var mtype = dao.get_seattype("id", m_Seat.typeId); switch (m_Seat.status) { case SeatStatus.AVILABLE://可用 case SeatStatus.PAIED://已经结账 case SeatStatus.RESERVE://预定客房 var form = new OpenRoomForm(m_Seat); form.ShowDialog(); break; case SeatStatus.USING://正在使用 case SeatStatus.WARNING://警告 case SeatStatus.DEPOSITLEFT://押金离场 case SeatStatus.REPAIED://重新结账 if (m_Seat.deposit != null || m_Seat.depositBank != null) { BathClass.printInformation("现金押金:" + m_Seat.deposit.ToString() + "\n银联预授:" + m_Seat.depositBank.ToString()); } if (m_Seat.note != null && m_Seat.note != "") BathClass.printInformation(m_Seat.note); SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat, -1, false, false, dao); seatExpenseForm.Show(); break; case SeatStatus.LOCKING://锁定 break; case SeatStatus.STOPPED://停用 BathClass.printErrorMsg("台位已经停用!"); break; default: break; } }
private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; m_Seat = dao.get_seat("text", btn.Text); var mtype = dao.get_seattype("id", m_Seat.typeId); switch (m_Seat.status) { case SeatStatus.AVILABLE://可用 case SeatStatus.PAIED://已经结账 case SeatStatus.RESERVE://预定客房 var form = new OpenRoomForm(m_Seat); form.ShowDialog(); break; case SeatStatus.USING://正在使用 case SeatStatus.WARNING://警告 case SeatStatus.DEPOSITLEFT://押金离场 case SeatStatus.REPAIED://重新结账 if (m_Seat.deposit != null || m_Seat.depositBank != null) { BathClass.printInformation("现金押金:" + m_Seat.deposit.ToString() + "\n银联预授:" + m_Seat.depositBank.ToString()); } if (m_Seat.note != null && m_Seat.note != "") BathClass.printInformation(m_Seat.note); SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat, -1, false, false, dao); seatExpenseForm.Show(); break; case SeatStatus.LOCKING://锁定 break; case SeatStatus.STOPPED://停用 BathClass.printErrorMsg("台位已经停用!"); break; default: break; } }
//F6开牌 private void tool_open_seat() { if (tSeat.Text == "") { return; } string text = tSeat.Text; tSeat.Text = ""; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = BathClass.ToBool(db_new.Options.FirstOrDefault().允许手工输入手牌号结账); var seat1 = db_new.HotelRoom.FirstOrDefault(x => x.text == text); var seat2 = db_new.HotelRoom.FirstOrDefault(x => x.oId == text); if (seat1 == null && seat2 == null) { BathClass.printErrorMsg("手牌不可用!"); return; } if (seat1 != null) { var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == seat1.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } int status = seat1.status; if (status == 2 || status == 6 || status == 7 || status == 8) { if (seat1.note != null && seat1.note != "") { BathClass.printInformation(seat1.note); } SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat1); seatExpenseForm.ShowDialog(); } else if (status == 4) { BathClass.printErrorMsg("台位已经锁定!"); } else if (status == 5) { BathClass.printErrorMsg("台位已经停用!"); } } else if (seat2 != null) { var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == seat2.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } int status = seat2.status; if (status == 2 || status == 6 || status == 7 || status == 8) { if (seat2.note != null && seat2.note != "") { BathClass.printInformation(seat2.note); } SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat2); seatExpenseForm.ShowDialog(); } else if (status == 4) { BathClass.printErrorMsg("台位已经锁定!"); } else if (status == 5) { BathClass.printErrorMsg("台位已经停用!"); } } }