/// <summary> /// 判断当前时间阅览室选座状态 /// </summary> /// <param name="set"></param> /// <param name="time"></param> /// <returns></returns> public static SelectSeatMode RoomSelectSeatMode(SeatChooseMethodSet set, DateTime date) { SelectSeatMode chooseMethod = set.DefaultChooseMethod; //判断是否启用高级设置 if (set.UsedAdvancedSet) { DayOfWeek day = date.DayOfWeek; try { SeatChooseMethodPlan plan = set.AdvancedSelectSeatMode[day]; DateTime strDate = date; //遍历当天的时间段,判断是是否有满足当前时间的设置项 foreach (SeatChooseMethodOption option in plan.PlanOption) { DateTime beginDatetime = DateTime.Parse(strDate.ToShortDateString() + " " + option.UsedTime.BeginTime); DateTime endDatetime = DateTime.Parse(strDate.ToShortDateString() + " " + option.UsedTime.EndTime); if (DateTimeOperate.DateAccord(beginDatetime, endDatetime, date))//判断当前时间是否满足项 { chooseMethod = option.ChooseMethod; break; } } } catch { chooseMethod = set.DefaultChooseMethod; } } return(chooseMethod); }
private void btnExit_Click(object sender, EventArgs e) { this.clientObject.EnterOutLogData.FlowControl = ClientOperation.None; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = ""; this._RoomSelectSeatMethod = SelectSeatMode.None; this.clientObject.EnterOutLogData.FlowControl = ClientOperation.Exit; this.Hide(); }
/// <summary> /// 选座方式验证 /// </summary> /// <param name="clientset">终端选座方式</param> /// <param name="roomSelectSeatSet">阅览室设置的选座方式</param> /// <returns></returns> public static SelectSeatMode ProvenSelectSeatMethod(ClientConfig clientset, SeatChooseMethodSet roomSelectSeatSet) { SelectSeatMode method = SelectSeatMode.OptionalMode; if (clientset.SelectMethod == SelectSeatMode.Default) { method = NowReadingRoomState.RoomSelectSeatMode(roomSelectSeatSet, ServiceDateTime.Now); } else { method = clientset.SelectMethod; } return(method); }
/// <summary> /// ÔÄÀÀÊҹرÕʼþ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void formClose_EventCountdown(object sender, EventArgs e) { FormCloseCountdown obj = sender as FormCloseCountdown; if (obj != null) { this.Invoke(new Action(() => { lblCountdown.Text = obj.CountdownSceonds.ToString(); if (obj.CountdownSceonds <= 0) { this.clientObject.EnterOutLogData.FlowControl = ClientOperation.Exit; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = ""; this._RoomSelectSeatMethod = SelectSeatMode.None; this.Close(); } } )); } }
/// <summary> /// 进入阅览室前判断 /// </summary> /// <param name="roomNo"></param> public void EnterReadingRoom(ReadingRoomUC_ViewModel vm_Room) { try { //ClientObject.EnterOutLogData.FlowControl = ClientOperation.Back; ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = vm_Room.ReadingRoomNo; ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(vm_Room.ReadingRoomNo); if (vm_Room.Status == ReadingRoomStatus.Close || vm_Room.Status == ReadingRoomStatus.BeforeClose) { ClientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo; PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReadingRoomClosing); ClientObject.EnterOutLogData.Student.AtReadingRoom = null; return; } if (vm_Room.Usage == ReadingRoomUsingStatus.Full && (!roomInfo.Setting.NoManagement.Used)) { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReadingRoomFull); return; } ClientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//给读者所在的阅览室赋值。 //验证读者身份是否允许选择该阅览室。 if (!SelectSeatProven.ProvenReaderType(ClientObject.EnterOutLogData.Student, roomInfo.Setting)) { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReaderTypeInconformity); return; } //验证读者黑名单,选座次数。 if (SelectSeatProven.ProvenReaderState(ClientObject.EnterOutLogData.Student, roomInfo, ClientObject.RegulationRulesSet.BlacklistSet, ClientObject.ClientSetting.DeviceSetting)) { ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = ""; return; } //TODO:验证终端选座方式 if (vm_Room.Usage == ReadingRoomUsingStatus.Full && roomInfo.Setting.NoManagement.Used) { ClientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat; ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = roomInfo.No; ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name; //ReadingRoomWindowObject.GetInstance().Window.Hide(); RoomSeatWindowObject.GetInstance(roomInfo.No).Window[roomInfo.No].ShowMessage(); } else { SelectSeatMode selectSeatMethod = SelectSeatProven.ProvenSelectSeatMethod(ClientObject.ClientSetting.DeviceSetting, roomInfo.Setting.SeatChooseMethod); if (selectSeatMethod == SelectSeatMode.OptionalMode || selectSeatMethod == SelectSeatMode.ManualMode) { ClientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat; ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = roomInfo.No; ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name; //ReadingRoomWindowObject.GetInstance().Window.Hide(); RoomSeatWindowObject.GetInstance(roomInfo.No).Window[roomInfo.No].ShowMessage(); } else { ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = roomInfo.No; ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name; string tempSeatNo = T_SM_Seat.RandomAllotSeat(ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo); if (T_SM_Seat.LockSeat(tempSeatNo) != SeatLockState.Locked)//座位锁定失败,则提示 { ClientObject.EnterOutLogData.EnterOutlog.SeatNo = ""; PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SeatLocking); return; } ClientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡,自动选择{1} {2}号座位", ClientObject.ClientSetting.ClientNo, ClientObject.EnterOutLogData.Student.AtReadingRoom.Name, tempSeatNo.Substring(tempSeatNo.Length - ClientObject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount)); ClientObject.EnterOutLogData.EnterOutlog.SeatNo = tempSeatNo; ClientObject.EnterOutLogData.EnterOutlog.TerminalNum = ClientObject.ClientSetting.ClientNo; ClientObject.EnterOutLogData.EnterOutlog.ShortSeatNo = SeatComm.SeatNoToShortSeatNo(ClientObject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, ClientObject.EnterOutLogData.EnterOutlog.SeatNo); ClientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat; //操作为选择座位 } } //RoomSeatWindowObject.GetInstance(roomInfo.No).Window[roomInfo.No] = null; } catch (Exception ex) { WriteLog.Write("加载阅览室遇到异常" + ex.Message); PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception); } }
//选择手动选座 private void btnManualMode_Click(object sender, EventArgs e) { _RoomSelectSeatMethod = SelectSeatMode.ManualMode; this.Close(); }
//选择自动选座 private void btnAutomaticMode_Click(object sender, EventArgs e) { _RoomSelectSeatMethod = SelectSeatMode.AutomaticMode; this.Close(); }
/// <summary> /// Ñ¡Ôñ×ùλ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void roomButton_Click(object sender, EventArgs e) { SeatManage.MyUserControl.ReadingRoomButton room = sender as ReadingRoomButton; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum; ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(room.RoomNum); if (room.SeatUsingStatus == ReadingRoomUsingStatus.Full && (!roomInfo.Setting.NoManagement.Used)) { Tip_Framework tipForm = new Tip_Framework(TipType.ReadingRoomFull, 9); formClose.Pause(); tipForm.ShowDialog(); formClose.Start(); return; } clientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//¸ø¶ÁÕßËùÔÚµÄÔÄÀÀÊÒ¸³Öµ¡£ //ÑéÖ¤¶ÁÕßÉí·ÝÊÇ·ñÔÊÐíÑ¡Ôñ¸ÃÔÄÀÀÊÒ¡£ if (!SelectSeatProven.ProvenReaderType(clientObject.EnterOutLogData.Student, roomInfo.Setting)) { Tip_Framework tipForm = new Tip_Framework(TipType.ReaderTypeInconformity, 9); formClose.Pause(); tipForm.ShowDialog(); formClose.Start(); return; } //ÑéÖ¤¶ÁÕߺÚÃûµ¥£¬Ñ¡×ù´ÎÊý¡£ if (SelectSeatProven.ProvenReaderState(clientObject.EnterOutLogData.Student, roomInfo, clientObject.RegulationRulesSet.BlacklistSet, clientObject.ClientSetting.DeviceSetting)) { this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = ""; return; } //TODO:ÑéÖ¤ÖÕ¶ËÑ¡×ù·½Ê½ if (room.SeatUsingStatus == ReadingRoomUsingStatus.Full && roomInfo.Setting.NoManagement.Used) { this._RoomSelectSeatMethod = SelectSeatMode.ManualMode; this.clientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum; this.Close(); } else { SelectSeatMode selectSeatMethod = SelectSeatProven.ProvenSelectSeatMethod(clientObject.ClientSetting.DeviceSetting, roomInfo.Setting.SeatChooseMethod); if (selectSeatMethod == SelectSeatMode.OptionalMode) { ChooseSeatState frmChooseSeatState = new ChooseSeatState(); frmChooseSeatState.ShowDialog(); _RoomSelectSeatMethod = frmChooseSeatState.RoomSelectSeatMethod; if (frmChooseSeatState.RoomSelectSeatMethod != SelectSeatMode.None) { this.clientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum; this.Close(); } else { this.clientObject.EnterOutLogData.FlowControl = ClientOperation.None; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = ""; } } else { this._RoomSelectSeatMethod = selectSeatMethod; this.clientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat; this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum; this.Close(); } } }