private void ShowReaderState() { scmodel = ((SeatManage.IPocketBespeak.IMainFunctionPage_Ex)handler).GetSeatUsingInfo(UserSchoolInfo, readingRoomNo, seatNo); bool isCanUseSeat = false; if (scmodel != null && scmodel.SeatInfo != null) { this.seatlblReadingRoomName.InnerText = scmodel.SeatInfo.ReadingRoom.Name; this.seatlblSeatNo.InnerText = scmodel.SeatInfo.ShortSeatNo; switch (scmodel.SeatInfo.SeatUsedState) { case SeatManage.EnumType.EnterOutLogType.ComeBack: case SeatManage.EnumType.EnterOutLogType.ContinuedTime: case SeatManage.EnumType.EnterOutLogType.ReselectSeat: case SeatManage.EnumType.EnterOutLogType.ShortLeave: case SeatManage.EnumType.EnterOutLogType.WaitingSuccess: case SeatManage.EnumType.EnterOutLogType.SelectSeat: case SeatManage.EnumType.EnterOutLogType.BookingConfirmation: case SeatManage.EnumType.EnterOutLogType.BespeakWaiting: this.seatlblSeatStatus.InnerText = "正在使用中"; break; default: this.seatlblSeatStatus.InnerText = "空闲"; isCanUseSeat = true; break; } if (scmodel.SeatInfo.IsSuspended) { this.seatlblSeatStatus.InnerText = "已被停用"; spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "此座位已被停用"; } else if (!scmodel.InReadingRoom.Setting.SeatBespeak.Used) { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "此座位不提供预约"; } else if (scmodel.BookSeatInfo.Count < 1) { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "此座位没有可预约的时间段"; } else { List <ReadingRoomInfo> roomList = handler1.GetAllReadingRoomInfo(this.UserSchoolInfo); if (this.ReadingRoomList == null) { this.ReadingRoomList = new Dictionary <string, ReadingRoomInfo>(); } else { this.ReadingRoomList.Clear(); } foreach (ReadingRoomInfo item in roomList) { this.ReadingRoomList.Add(item.No, item); } StringBuilder sbListInfo = new StringBuilder(); sbListInfo.Append("<li data-theme='d' data-role='list-divider' role='heading'>座位预约 </li>"); foreach (KeyValuePair <DateTime, Seat> item in scmodel.BookSeatInfo) { if (item.Key.Date.CompareTo(DateTime.Now.Date) == 0) { sbListInfo.Append(string.Format("<li date-theme='d' style=\"padding-top: 0px;padding-bottom: 0px;\">{0} <input data-inline='true' data-mini='true' value='预约' type='button'onclick=\"location.href='../BookSeat/BookNowSeatMessage.aspx?seatNo={1}&seatShortNo={2}&roomNo={3}&date={4}&timeSpan={5}'\")' /></li>", item.Key.ToLongDateString(), item.Value.SeatNo, item.Value.ShortSeatNo, readingRoomNo, item.Key.ToLongDateString(), item.Value.CanBespeakStr)); } else { sbListInfo.Append(string.Format("<li date-theme='d' style=\"padding-top: 0px;padding-bottom: 0px;\">{0} <input data-inline='true' data-mini='true' value='预约' type='button'onclick=\"location.href='../BookSeat/BookSeatMessage.aspx?seatNo={1}&seatShortNo={2}&roomNo={3}&date={4}&timeSpan={5}'\")' /></li>", item.Key.ToLongDateString(), item.Value.SeatNo, item.Value.ShortSeatNo, readingRoomNo, item.Key.ToLongDateString(), item.Value.CanBespeakStr)); } //sbListInfo.Append(string.Format("<li><input data-inline='true' data-mini='false' value='预约' type='button'onclick=\"location.href='../MainFunctionPage.aspx'\")' /></li>", bookLogList[i].BsepeaklogID)); } sbListInfo.Append("</li>"); listMessage = sbListInfo.ToString(); } } this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo); ReaderInfo reader = this.LoginUserInfo; if (reader.EnterOutLog == null) { state = "Leave"; } else { state = reader.EnterOutLog.EnterOutState.ToString(); } if (reader.BespeakLog.Count > 0 && state == "Leave") { state = "Booking"; } if (reader.WaitSeatLog != null) { state = "Waiting"; } btnLeave.Visible = false; btnShortLeave.Visible = false; btn_ComeBack.Visible = false; btn_ContinuedWhen.Visible = false; btn_CancelBook.Visible = false; btn_CancelWait.Visible = false; btn_BookConfirm.Visible = false; btn_SelectSeat.Visible = false; btn_ChangeSeat.Visible = false; btn_WaitSeat.Visible = false; lblReadingRoomName.InnerText = "无"; lblSeatNo.InnerText = "无"; lblSeatStatus.InnerText = "无"; lblenterOutTime.InnerText = "无"; lblRemark.InnerText = "无"; switch (state) { case "SelectSeat": case "ComeBack": case "ContinuedTime": case "WaitingSuccess": case "BookingConfirmation": case "ReselectSeat": lblSeatStatus.InnerText = "在座"; lblReadingRoomName.InnerText = reader.EnterOutLog.ReadingRoomName; lblSeatNo.InnerText = reader.EnterOutLog.ShortSeatNo; lblenterOutTime.InnerText = reader.EnterOutLog.EnterOutTime.ToLongTimeString(); lblRemark.InnerText = reader.EnterOutLog.Remark; if (reader.EnterOutLog.SeatNo == seatNo && readingRoomNo == reader.EnterOutLog.ReadingRoomNo) { if (reader.PecketWebSetting.UseShortLeave) { btnShortLeave.Visible = true; } if (reader.PecketWebSetting.UseCanLeave) { btnLeave.Visible = true; } if (reader.PecketWebSetting.UseContinue && reader.AtReadingRoom.Setting.SeatUsedTimeLimit.Used && reader.AtReadingRoom.Setting.SeatUsedTimeLimit.IsCanContinuedTime) { btn_ContinuedWhen.Visible = true; } } else if (isCanUseSeat) { if (reader.PecketWebSetting.UseChangeSeat) { btn_ChangeSeat.Visible = true; } } break; case "Leave": if (isCanUseSeat) { if (reader.PecketWebSetting.UseSelectSeat) { btn_SelectSeat.Visible = true; } } else if (scmodel.SeatInfo.SeatUsedState != EnterOutLogType.ShortLeave) { if (reader.PecketWebSetting.UseWaitSeat) { btn_WaitSeat.Visible = true; } } break; case "Booking": lblSeatStatus.InnerText = "预约等待签到中"; lblReadingRoomName.InnerText = reader.BespeakLog[0].ReadingRoomName; lblSeatNo.InnerText = reader.BespeakLog[0].ShortSeatNum; lblenterOutTime.InnerText = reader.BespeakLog[0].BsepeakTime.ToLongTimeString(); lblRemark.InnerText = reader.BespeakLog[0].Remark; if (reader.BespeakLog[0].SeatNo == seatNo && readingRoomNo == reader.BespeakLog[0].ReadingRoomNo) { if (reader.PecketWebSetting.UseCancelBook) { btn_CancelBook.Visible = true; } if (reader.PecketWebSetting.UseBookComfirm) { if (reader.BespeakLog[0].SubmitTime == reader.BespeakLog[0].BsepeakTime) { btn_BookConfirm.Visible = true; } else { if (reader.BespeakLog[0].BsepeakTime.AddMinutes(-double.Parse(reader.AtReadingRoom.Setting.SeatBespeak.ConfirmTime.BeginTime)) <= DateTime.Now) { btn_BookConfirm.Visible = true; } } } } break; case "Waiting": lblSeatStatus.InnerText = "等待座位"; lblReadingRoomName.InnerText = reader.WaitSeatLog.EnterOutLog.ReadingRoomName; lblSeatNo.InnerText = reader.WaitSeatLog.EnterOutLog.ShortSeatNo; lblenterOutTime.InnerText = reader.WaitSeatLog.SeatWaitTime.ToLongTimeString(); lblRemark.InnerText = "您把读者" + reader.WaitSeatLog.EnterOutLog.CardNo + "设置为暂离,并等待此座位。"; if (reader.WaitSeatLog.EnterOutLog.SeatNo == seatNo && readingRoomNo == reader.WaitSeatLog.EnterOutLog.ReadingRoomNo) { if (reader.PecketWebSetting.UseCancelWait) { btn_CancelWait.Visible = true; } } break; case "ShortLeave": lblSeatStatus.InnerText = "暂离"; lblReadingRoomName.InnerText = reader.EnterOutLog.ReadingRoomName; lblSeatNo.InnerText = reader.EnterOutLog.ShortSeatNo; lblenterOutTime.InnerText = reader.EnterOutLog.EnterOutTime.ToLongTimeString(); lblRemark.InnerText = reader.EnterOutLog.Remark; if (reader.EnterOutLog.SeatNo == seatNo && readingRoomNo == reader.EnterOutLog.ReadingRoomNo) { if (reader.PecketWebSetting.UseComeBack) { btn_ComeBack.Visible = true; } if (reader.PecketWebSetting.UseCanLeave) { btnLeave.Visible = true; } } else if (isCanUseSeat) { if (reader.PecketWebSetting.UseChangeSeat) { btn_ChangeSeat.Visible = true; } } break; default: lblSeatStatus.InnerText = "没有座位"; if (isCanUseSeat) { if (reader.PecketWebSetting.UseSelectSeat) { btn_ChangeSeat.Visible = true; } } else if (scmodel.SeatInfo.SeatUsedState != EnterOutLogType.ShortLeave) { if (reader.PecketWebSetting.UseWaitSeat) { btn_WaitSeat.Visible = true; } } break; } }
/// <summary> /// 获取座位信息 /// </summary> /// <param name="cardNo"></param> /// <param name="seatNum"></param> /// <param name="readingRoomNum"></param> void DataBind() { scmodel = ((SeatManage.IPocketBespeak.IMainFunctionPage_Ex)handler).GetSeatUsingInfo(UserSchoolInfo, readingRoomNo, seatNo); if (scmodel != null && scmodel.SeatInfo != null) { this.seatlblReadingRoomName.InnerText = scmodel.SeatInfo.ReadingRoom.Name; this.seatlblSeatNo.InnerText = scmodel.SeatInfo.ShortSeatNo; switch (scmodel.SeatInfo.SeatUsedState) { case SeatManage.EnumType.EnterOutLogType.ComeBack: case SeatManage.EnumType.EnterOutLogType.ContinuedTime: case SeatManage.EnumType.EnterOutLogType.ReselectSeat: case SeatManage.EnumType.EnterOutLogType.ShortLeave: case SeatManage.EnumType.EnterOutLogType.WaitingSuccess: case SeatManage.EnumType.EnterOutLogType.SelectSeat: case SeatManage.EnumType.EnterOutLogType.BookingConfirmation: case SeatManage.EnumType.EnterOutLogType.BespeakWaiting: this.seatlblSeatStatus.InnerText = "正在使用中"; break; default: this.seatlblSeatStatus.InnerText = "空闲"; break; } StringBuilder sbListInfo = new StringBuilder(); sbListInfo.Append("<li data-theme='d' data-role='list-divider' role='heading'>座位预约 </li>"); if (scmodel.SeatInfo.IsSuspended) { this.seatlblSeatStatus.InnerText = "已被停用"; spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "此座位已被停用"; return; } if (!scmodel.InReadingRoom.Setting.SeatBespeak.Used) { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "此座位不提供预约"; return; } if (scmodel.BookSeatInfo.Count < 1) { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "此座位没有可预约的时间段"; return; } foreach (KeyValuePair <DateTime, Seat> item in scmodel.BookSeatInfo) { if (item.Key.Date.CompareTo(DateTime.Now.Date) == 0) { sbListInfo.Append(string.Format("<li date-theme='d'>{0}<ul date-theme='d'><input data-inline='true' data-mini='false' value='预约' type='button'onclick=\"location.href='../BookSeat/BookNowSeatMessage.aspx?seatNo=\"{1}\"&seatShortNo=\"{2}\"&roomNo=\"{3}\"&date=\"{4}\"&timeSpan=\"{5}'\")' /></li>", item.Key.ToLongDateString(), item.Value.SeatNo, item.Value.ShortSeatNo, item.Value.ReadingRoomNum, item.Key.ToLongDateString(), item.Value.CanBespeakStr)); } else { sbListInfo.Append(string.Format("<li date-theme='d'>{0}<ul date-theme='d'><input data-inline='true' data-mini='false' value='预约' type='button'onclick=\"location.href='../BookSeat/BookSeatMessage.aspx?seatNo=\"{1}\"&seatShortNo=\"{2}\"&roomNo=\"{3}\"&date=\"{4}\"&timeSpan=\"{5}'\")' /></li>", item.Key.ToLongDateString(), item.Value.SeatNo, item.Value.ShortSeatNo, item.Value.ReadingRoomNum, item.Key.ToLongDateString(), item.Value.CanBespeakStr)); } //sbListInfo.Append(string.Format("<li><input data-inline='true' data-mini='false' value='预约' type='button'onclick=\"location.href='../MainFunctionPage.aspx'\")' /></li>", bookLogList[i].BsepeaklogID)); } sbListInfo.Append("</ul></li>"); listMessage = sbListInfo.ToString(); } }