Esempio n. 1
0
        //点击台位按钮
        private void btn_Click(object sender, EventArgs e)
        {
            var btn    = sender as Button;
            var strs   = btn.Text.Split('\n');
            var str    = strs.FirstOrDefault(x => x.Contains("房间"));
            var roomId = str.Split(':')[1];

            var room = db.Room.FirstOrDefault(x => x.name == roomId);

            if (room.status != "服务")
            {
                BathClass.printErrorMsg("客房不在服务状态,不能催钟");
                return;
            }

            if (BathClass.printAskMsg("确定催钟?") != DialogResult.Yes)
            {
                return;
            }

            var roomCall = new RoomCall();

            roomCall.roomId = roomId;
            roomCall.read   = false;
            roomCall.msg    = "催钟";

            db.RoomCall.InsertOnSubmit(roomCall);
            db.SubmitChanges();
            this.Close();
        }
Esempio n. 2
0
        //点击台位按钮
        private void btn_Click(object sender, EventArgs e)
        {
            var btn        = sender as Button;
            var strs       = btn.Text.Split('\n');
            var str        = strs.FirstOrDefault(x => x.Contains("房间"));
            var roomId_str = str.Split(':')[1];
            var room_str   = roomId_str.Split('-');
            var roomId     = room_str[0];
            var room       = db.Room.FirstOrDefault(x => x.name == roomId);

            int index = 0;

            if (room.population != 1)
            {
                index = Convert.ToInt32(room_str[1]) - 1;
            }

            var status = room.status.Split('|');

            if (status.Length <= index || status[index] != "服务")
            {
                BathClass.printErrorMsg("客房不在服务状态,不能催钟");
                return;
            }

            if (BathClass.printAskMsg("确定催钟?") != DialogResult.Yes)
            {
                return;
            }

            var roomCall = new RoomCall();

            roomCall.roomId = roomId;
            roomCall.seatId = room.seat.Split('|')[index];
            roomCall.read   = false;
            roomCall.msg    = "催钟";

            db.RoomCall.InsertOnSubmit(roomCall);
            db.SubmitChanges();

            this.Close();
        }