Exemple #1
0
        /// <summary>
        /// 选座座位
        /// </summary>
        /// <param name="seatBtn"></param>
        /// <returns></returns>
        public bool SelectSeat(UsuallySeatUC_ViewModel seatBtn)
        {
            ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(seatBtn.ReadingRoomNo);

            ClientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//给读者所在的阅览室赋值。

            //验证读者身份是否允许选择该阅览室。
            if (!SelectSeatProven.ProvenReaderType(ClientObject.EnterOutLogData.Student, roomInfo.Setting))
            {
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReaderTypeInconformity);
                return(false);
            }
            //验证读者黑名单,选座次数。
            if (SelectSeatProven.ProvenReaderState(ClientObject.EnterOutLogData.Student, roomInfo, ClientObject.RegulationRulesSet.BlacklistSet, ClientObject.ClientSetting.DeviceSetting))
            {
                //ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                return(false);
            }
            SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);

            if (lockseat != SeatLockState.Locked) //座位成功加锁
            {
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SeatLocking);
                return(false);
            }

            ClientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
            ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = seatBtn.ReadingRoomName;
            PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SelectSeatConfinmed);
            if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule != HandleResult.Successed)
            {
                T_SM_Seat.UnLockSeat(seatBtn.SeatNo); //确认窗口点击取消或者自动关闭,则解锁。
                return(false);
            }
            ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = seatBtn.ReadingRoomName;
            ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = seatBtn.ReadingRoomNo;
            ClientObject.EnterOutLogData.EnterOutlog.SeatNo          = seatBtn.SeatNo;
            ClientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
            ClientObject.EnterOutLogData.EnterOutlog.TerminalNum     = ClientObject.ClientSetting.ClientNo;
            ClientObject.EnterOutLogData.FlowControl        = ClientOperation.SelectSeat; //操作为选择座位
            ClientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}选择常坐座位,{1},{2}号座位", ClientObject.ClientSetting.ClientNo, ClientObject.EnterOutLogData.Student.AtReadingRoom.Name, seatBtn.ShortSeatNo);
            return(true);
        }
 /// <summary>
 /// 显示当前读者的详细进出记录
 /// </summary>
 /// <param name="cardNo"></param>
 private void ShowEnterOutLogMessage(string cardNo)
 {
     if (!string.IsNullOrEmpty(cardNo))
     {
         DateTime nowdt = ServiceDateTime.Now;
         List <EnterOutLogInfo> eollist = readerLogQuery.QueryEnterOugLogs(cardNo, nowdt);
         //List<BespeakLogInfo> blilist = readerLogQuery.QueryBespeakLogs(cardNo, nowdt);
         //List<WaitSeatLogInfo> wslilist = readerLogQuery.QueryWaitSeatLogs(cardNo, nowdt);
         lblCardNo.Text = cardNo;
         bool flag = false;
         for (int i = 0; i < eollist.Count; i++)
         {
             if (eollist[i].EnterOutType == SeatManage.EnumType.LogStatus.Valid && eollist[i].EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
             {
                 ReadingRoomInfo room = T_SM_ReadingRoom.GetSingleRoomInfo(eollist[i].ReadingRoomNo);
                 lblReadingRoomName.Text = room.Name;
                 lblSeatNo.Text          = SeatComm.SeatNoToShortSeatNo(room.Setting.SeatNumAmount, eollist[i].SeatNo);
                 lblNowState.Text        = SeatComm.ConvertReaderState(eollist[i].EnterOutState);
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             lblReadingRoomName.Text = "没有选择座位";
             lblNowState.Text        = "无座";
             lblSeatNo.Text          = "无";
         }
         List <Label> labelList = readerLogQuery.GetEnterOutLogLabels(eollist);
         panel1.Controls.Clear();
         for (int i = 0; i < labelList.Count; i++)
         {
             panel1.Controls.Add(labelList[i]);
         }
     }
 }
        /// <summary>
        /// 进出记录的消息
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        private string EnterOutLogMessage(EnterOutLogInfo log)
        {
            ReadingRoomInfo room = null;

            try
            {
                room = clientObject.ReadingRoomList[log.ReadingRoomNo];
            }
            catch
            {
                room = T_SM_ReadingRoom.GetSingleRoomInfo(log.ReadingRoomNo);
            }
            string strMessage = "";

            if (room != null)
            {
                strMessage = string.Format("{0}  {1}", log.EnterOutTime.ToLongTimeString(), log.Remark);
            }
            else
            {
                strMessage = string.Format("{0}  {1}", log.EnterOutTime.ToLongTimeString(), log.Remark);
            }
            return(strMessage);
        }
        /// <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);
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LoginId"] == null)
            {
                Response.Redirect("../Login.aspx");
            }
            if (!IsPostBack)
            {
                BindReadingRoomList(Session[CookiesManager.LoginID].ToString());
                GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
            }

            cmd = Request.Form["subCmd"];
            if (cmd != null)
            {
                #region 座位相关操作
                switch (cmd)
                {
                case "search":    //查询座位
                    try
                    {
                        GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                    }
                    catch
                    {
                    }
                    break;

                case "ShortLeave":    //设置暂离
                    try
                    {
                        string   seatStr = hidSeatNo.Value;
                        string[] noArr   = seatStr.Split(',');
                        string   seatNo  = "";
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            seatNo = noArr[i].Trim();
                            EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.ShortLeave)
                            {
                                ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
                                enterOutLog.EnterOutState = EnterOutLogType.ShortLeave;
                                enterOutLog.Flag          = Operation.Admin;
                                enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置为暂离", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]);
                                int          newId  = -1;
                                HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                if (result == HandleResult.Successed)
                                {
                                    Page.RegisterStartupScript("", "<script>alert('设置读者暂离成功');</script>");
                                    GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                                }
                                else
                                {
                                    Page.RegisterStartupScript("", "<script>alert('设置读者暂离失败');</script>");
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                    break;

                case "ReleaseShortLeave":    //取消暂离
                    try
                    {
                        string   seatStr = hidSeatNo.Value;
                        string[] noArr   = seatStr.Split(',');
                        string   seatNo  = "";
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            seatNo = noArr[i].Trim();
                            EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState == EnterOutLogType.ShortLeave)
                            {
                                ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
                                enterOutLog.EnterOutState = EnterOutLogType.ComeBack;
                                enterOutLog.Flag          = Operation.Admin;
                                enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备取消暂离,恢复为在座", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]);
                                int          newId  = -1;
                                HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                if (result == HandleResult.Successed)
                                {
                                    List <WaitSeatLogInfo> waitSeatLogs = T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null);
                                    WaitSeatLogInfo        waitSeatLog  = null;
                                    if (waitSeatLogs.Count > 0)
                                    {
                                        waitSeatLog              = waitSeatLogs[0];
                                        waitSeatLog.NowState     = LogStatus.Fail;
                                        waitSeatLog.OperateType  = Operation.OtherReader;
                                        waitSeatLog.WaitingState = EnterOutLogType.WaitingCancel;
                                        if (T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog))
                                        {
                                            Page.RegisterStartupScript("", "<script>alert('取消读者暂离成功');</script>");
                                            GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                                        }
                                        else
                                        {
                                            Page.RegisterStartupScript("", "<script>alert('取消读者暂离成功,取消读者等待失败');</script>");
                                            GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                                        }
                                    }
                                    else
                                    {
                                        Page.RegisterStartupScript("", "<script>alert('取消读者暂离成功');</script>");
                                        GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                                    }
                                }
                                else
                                {
                                    Page.RegisterStartupScript("", "<script>alert('取消读者暂离失败');</script>");
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                    break;

                case "Release":    //释放座位
                    try
                    {
                        string   seatStr = hidSeatNo.Value;
                        string[] noArr   = seatStr.Split(',');
                        string   seatNo  = "";
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            seatNo = noArr[i].Trim();
                            EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.Leave)
                            {
                                ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);

                                enterOutLog.EnterOutState = EnterOutLogType.Leave;
                                enterOutLog.Flag          = Operation.Admin;
                                enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]);
                                int          newId  = -1;
                                HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                if (result == HandleResult.Successed)
                                {
                                    RegulationRulesSetting rulesSet = T_SM_SystemSet.GetRegulationRulesSetting();
                                    if (roomInfo.Setting.IsRecordViolate)
                                    {
                                        if (roomInfo.Setting.BlackListSetting.Used)
                                        {
                                            if (roomInfo.Setting.BlackListSetting.ViolateRoule[ViolationRecordsType.LeaveByAdmin])
                                            {
                                                ViolationRecordsLogInfo violationRecords = new ViolationRecordsLogInfo();
                                                violationRecords.CardNo        = enterOutLog.CardNo;
                                                violationRecords.SeatID        = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount);
                                                violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo;
                                                violationRecords.EnterOutTime  = ServiceDateTime.Now.ToString();
                                                violationRecords.EnterFlag     = ViolationRecordsType.LeaveByAdmin;
                                                violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]);
                                                violationRecords.BlacklistID   = "-1";
                                                T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                                            }
                                        }
                                        else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[ViolationRecordsType.LeaveByAdmin])
                                        {
                                            ViolationRecordsLogInfo violationRecords = new ViolationRecordsLogInfo();
                                            violationRecords.CardNo        = enterOutLog.CardNo;
                                            violationRecords.SeatID        = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount);
                                            violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo;
                                            violationRecords.EnterOutTime  = ServiceDateTime.Now.ToString();
                                            violationRecords.EnterFlag     = ViolationRecordsType.LeaveByAdmin;
                                            violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]);
                                            violationRecords.BlacklistID   = "-1";
                                            T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                                        }
                                    }
                                    Page.RegisterStartupScript("", "<script>alert('设置读者离开成功');</script>");
                                    GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                                }
                                else
                                {
                                    Page.RegisterStartupScript("", "<script>alert('设置读者离开失败');</script>");
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                    break;

                case "onTime":    //计时
                    try
                    {
                        string   seatStr = hidSeatNo.Value;
                        string[] noArr   = seatStr.Split(',');
                        string   seatNo  = "";
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            seatNo = noArr[i].Trim();
                            EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.ShortLeave)
                            {
                                DateTime markTime = ServiceDateTime.Now;
                                EnterOutOperate.UpdateMarkTime(enterOutLog.EnterOutLogID, markTime);
                                GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                            }
                        }
                    }
                    catch
                    {
                    }

                    break;

                case "offTime":    //取消计时
                    try
                    {
                        string   seatStr = hidSeatNo.Value;
                        string[] noArr   = seatStr.Split(',');
                        string   seatNo  = "";
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            seatNo = noArr[i].Trim();
                            EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && !string.IsNullOrEmpty(enterOutLog.MarkTime.ToString()) && enterOutLog.MarkTime.CompareTo(DateTime.Parse("1900/1/1")) != 0)
                            {
                                DateTime markTime = DateTime.Parse("1900-1-1");
                                EnterOutOperate.UpdateMarkTime(enterOutLog.EnterOutLogID, markTime);
                                GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                            }
                        }
                    }
                    catch
                    {
                    }

                    break;

                case "AddBlacklist":
                    try
                    {
                        string   seatStr = hidSeatNo.Value;
                        string[] noArr   = seatStr.Split(',');
                        string   seatNo  = "";
                        int      newId   = -1;
                        RegulationRulesSetting rulesSet = T_SM_SystemSet.GetRegulationRulesSetting();
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            newId  = -1;
                            seatNo = noArr[i].Trim();
                            EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.Leave)
                            {
                                ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
                                if (roomInfo != null && roomInfo.Setting.BlackListSetting.Used)
                                {
                                    BlackListInfo blacklistModel = new BlackListInfo();
                                    blacklistModel.AddTime          = ServiceDateTime.Now;
                                    blacklistModel.ReadingRoomID    = roomInfo.No;
                                    blacklistModel.BlacklistState   = LogStatus.Valid;
                                    blacklistModel.CardNo           = enterOutLog.CardNo;
                                    blacklistModel.OutBlacklistMode = roomInfo.Setting.BlackListSetting.LeaveBlacklist;
                                    if (blacklistModel.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode)
                                    {
                                        blacklistModel.ReMark  = string.Format("管理员{0}通过手持设备{0}把读者加入黑名单,记录黑名单{1}天", Session["LoginID"], roomInfo.Setting.BlackListSetting.LimitDays);
                                        blacklistModel.OutTime = blacklistModel.AddTime.AddDays(roomInfo.Setting.BlackListSetting.LimitDays);
                                    }
                                    else
                                    {
                                        blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", Session["LoginID"]);
                                    }
                                    blacklistModel.ReadingRoomID = roomInfo.No;
                                    newId = T_SM_Blacklist.AddBlackList(blacklistModel);
                                }
                                else if (rulesSet.BlacklistSet.Used)
                                {
                                    BlackListInfo blacklistModel = new BlackListInfo();
                                    blacklistModel.AddTime          = ServiceDateTime.Now;
                                    blacklistModel.OutTime          = blacklistModel.AddTime.AddDays(rulesSet.BlacklistSet.LimitDays);
                                    blacklistModel.BlacklistState   = LogStatus.Valid;
                                    blacklistModel.CardNo           = enterOutLog.CardNo;
                                    blacklistModel.OutBlacklistMode = rulesSet.BlacklistSet.LeaveBlacklist;
                                    if (blacklistModel.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode)
                                    {
                                        blacklistModel.ReMark  = string.Format("管理员{0}通过手持设备把读者加入黑名单,记录黑名单{1}天", Session["LoginID"], rulesSet.BlacklistSet.LimitDays);
                                        blacklistModel.OutTime = blacklistModel.AddTime.AddDays(rulesSet.BlacklistSet.LimitDays);
                                    }
                                    else
                                    {
                                        blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", Session["LoginID"]);
                                    }
                                    blacklistModel.ReadingRoomID = roomInfo.No;
                                    newId = T_SM_Blacklist.AddBlackList(blacklistModel);
                                }
                                else
                                {
                                    Page.RegisterStartupScript("", "<script>alert('对不起,此阅览室以及图书馆没有启用黑名单功能');</script>");
                                    return;
                                }
                                if (newId > 0)
                                {
                                    enterOutLog.EnterOutState = EnterOutLogType.Leave;
                                    enterOutLog.Flag          = Operation.Admin;
                                    enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]);

                                    HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                    if (result == HandleResult.Successed)
                                    {
                                        Page.RegisterStartupScript("", "<script>alert('设置读者黑名单成功');</script>");
                                        GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
                                    }
                                    else
                                    {
                                        Page.RegisterStartupScript("", "<script>alert('设置读者黑名单失败');</script>");
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                    break;

                case "LoginOut":
                    HttpCookie aCookie;
                    string     cookieName;
                    int        limit = Request.Cookies.Count;
                    for (int i = 0; i < limit; i++)
                    {
                        cookieName      = Request.Cookies[i].Name;
                        aCookie         = new HttpCookie(cookieName);
                        aCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(aCookie);
                    }
                    Response.Redirect("../Login.aspx");
                    break;
                }
                #endregion
            }
        }
Exemple #6
0
 /// <summary>
 /// 根据阅览室编号获取阅览室信息
 /// </summary>
 /// <param name="roomNum"></param>
 /// <returns></returns>
 private ReadingRoomInfo GetSingleRoomInfo(string roomNum)
 {
     return(T_SM_ReadingRoom.GetSingleRoomInfo(roomNum));
 }
        /// <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();
                }
            }
        }