//开单个牌,用于以刷卡方式 private void open_one_seat(Seat seat, BathDBDataContext dc) { if (seat.status == 3) { BathClass.reset_seat(seat); dc.SubmitChanges(); } seat.openEmployee = LogIn.m_User.id.ToString(); seat.openTime = BathClass.Now(LogIn.connectionString); seat.systemId = BathClass.systemId(dc, LogIn.connectionString); //seat.chainId = chainId; seat.status = 2; //SeatType seatType = db.SeatType.FirstOrDefault(x => x.id == seat.typeId); //var menu = db.Menu.FirstOrDefault(x => x.id == seatType.menuId); //if (menu != null) //{ // Orders order = new Orders(); // order.menu = menu.name; // order.text = seat.text; // order.systemId = seat.systemId; // order.number = 1; // order.money = menu.price; // order.inputTime = BathClass.Now(LogIn.connectionString); // order.inputEmployee = LogIn.m_User.id.ToString(); // order.paid = false; // dc.Orders.InsertOnSubmit(order); //} dc.SubmitChanges(); }
private void open_one_seat(HotelRoom seat, bool child, BathDBDataContext dc) { if (seat.status == 3) { BathClass.reset_seat(seat); dc.SubmitChanges(); } seat.openEmployee = LogIn.m_User.id.ToString(); seat.openTime = BathClass.Now(LogIn.connectionString); seat.systemId = BathClass.systemId(db, LogIn.connectionString); seat.status = 2; if (!seatlock) { seat.chainId = chainId; } HotelRoomType seatType = dc.HotelRoomType.FirstOrDefault(x => x.id == seat.typeId); var menu = dc.Menu.FirstOrDefault(x => x.id == seatType.menuId); if (menu != null) { Orders order = new Orders(); order.menu = menu.name; order.text = seat.text; order.systemId = seat.systemId; order.number = 1; order.money = menu.price; order.inputTime = BathClass.Now(LogIn.connectionString); order.inputEmployee = LogIn.m_User.id.ToString(); order.paid = false; dc.Orders.InsertOnSubmit(order); } if (child) { var child_menu = dc.Menu.FirstOrDefault(x => x.name == "儿童浴资"); if (child_menu != null) { Orders order = new Orders(); order.menu = child_menu.name; order.text = seat.text; order.systemId = seat.systemId; order.number = 1; order.money = child_menu.price; order.inputTime = BathClass.Now(LogIn.connectionString); order.inputEmployee = LogIn.m_User.id.ToString(); order.paid = false; dc.Orders.InsertOnSubmit(order); } } dc.SubmitChanges(); }
private void set_one_seat_status(HotelRoom seat, BathDBDataContext dc) { if (seat.status == 3) { BathClass.reset_seat(seat); dc.SubmitChanges(); } seat.openEmployee = LogIn.m_User.id.ToString(); seat.openTime = BathClass.Now(LogIn.connectionString); seat.systemId = BathClass.systemId(dc, LogIn.connectionString); seat.status = 2; dc.SubmitChanges(); }
//确定 private void btnOk_Click(object sender, EventArgs e) { var dc_new = new BathDBDataContext(LogIn.connectionString); if (m_open) { int i = 0; foreach (var seat in m_Seats) { var seat_tmp = dc_new.HotelRoom.FirstOrDefault(x => x.text == seat.text); var child = Convert.ToBoolean(dgv.Rows[i].Cells[2].Value); if (!seatlock) { open_one_seat(seat_tmp, child, dc_new); } else { var mtype = dc_new.HotelRoomType.FirstOrDefault(x => x.id == seat_tmp.typeId); if (mtype.menuId == null) { if (seat_tmp.status == 3) { BathClass.reset_seat(seat_tmp); dc_new.SubmitChanges(); } seat_tmp.openEmployee = LogIn.m_User.id.ToString(); seat_tmp.openTime = BathClass.Now(LogIn.connectionString); seat_tmp.systemId = BathClass.systemId(db, LogIn.connectionString); seat_tmp.status = 2; } seat_tmp.chainId = chainId; HotelRoomType seatType = dc_new.HotelRoomType.FirstOrDefault(x => x.id == seat_tmp.typeId); var menu = dc_new.Menu.FirstOrDefault(x => x.id == seatType.menuId); var child_menu = dc_new.Menu.FirstOrDefault(x => x.name == "儿童浴资"); if (menu != null) { Orders order = new Orders(); order.menu = menu.name; order.text = seat_tmp.text; order.systemId = seat_tmp.systemId; order.number = 1; order.money = menu.price; order.inputTime = BathClass.Now(LogIn.connectionString); order.inputEmployee = LogIn.m_User.id.ToString(); order.paid = false; order.departmentId = 1; dc_new.Orders.InsertOnSubmit(order); if (child) { Orders child_order = new Orders(); child_order.menu = child_menu.name; child_order.text = seat_tmp.text; child_order.systemId = seat_tmp.systemId; child_order.number = 1; child_order.money = child_menu.price; child_order.inputTime = BathClass.Now(LogIn.connectionString); child_order.inputEmployee = LogIn.m_User.id.ToString(); child_order.paid = false; order.departmentId = 1; dc_new.Orders.InsertOnSubmit(child_order); } } } i++; } dc_new.SubmitChanges(); } else { foreach (var seat in m_Seats) { seat.chainId = chainId; } db.SubmitChanges(); } this.DialogResult = DialogResult.OK; }