public static bool UpdateRegulationRulesSetting(RegulationRulesSetting set)
        {
            IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                return(seatService.UpdateRegulationRulesSetting(set));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("获取设置失败:" + ex.Message);
                return(false);
            }
            finally
            {
                ICommunicationObject ICommObjectService = seatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        /// <summary>
        /// 更新黑名单设置
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        public bool UpdateRegulationRulesSetting(RegulationRulesSetting set)
        {
            string strSet = set.ToString();

            SqlParameter[] parameters =
            {
                new SqlParameter("@ServiceSet",   SqlDbType.Text),
                new SqlParameter("@ServiceSetID", SqlDbType.Int, 4)
            };
            parameters[0].Value = strSet;
            parameters[1].Value = 2;
            return(t_sm_service.Update(strSet, parameters));
        }
        /// <summary>
        /// 获取黑名单设置
        /// </summary>
        /// <returns></returns>
        public RegulationRulesSetting GetRegulationRulesSetting()
        {
            DataSet ds = t_sm_service.GetList(" ServiceSetID = 2", null);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(RegulationRulesSetting.Convert(ds.Tables[0].Rows[0]["ServiceSet"].ToString()));
            }
            else
            {
                return(null);
            }
        }
        public static bool UpdateRegulationRulesSetting(RegulationRulesSetting set)
        {
            IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService();
            bool error = false;

            try
            {
                return(seatService.UpdateRegulationRulesSetting(set));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("获取设置失败:" + ex.Message);
                return(false);
            }
        }
 /// <summary>
 /// 获取最新设置
 /// </summary>
 public void GetSetting()
 {
     try
     {
         //获取全部阅览室信息和黑名单设置
         List <ReadingRoomInfo> rooms = T_SM_ReadingRoom.GetReadingRooms(null, null, null);
         regulationRulesSetting = T_SM_SystemSet.GetRegulationRulesSetting();
         roomList.Clear();
         foreach (ReadingRoomInfo room in rooms)
         {
             roomList.Add(room.No, room);
         }
     }
     catch (Exception e)
     {
         WriteLog.Write(string.Format("监控服务:获取阅览室设置时遇到错误:{0}", e.Message));
     }
 }
        private SystemObject()
        {
            //设置定时器,间隔10s执行一次阅览室设置更新
            timeloop         = new SeatManage.SeatManageComm.TimeLoop(20000);
            timeloop.TimeTo += timeloop_TimeTo;
            try
            {
                _RegulationRulesSet = GetRegulationRulesSetting();

                GetAdvert();
                //SchoolLogoImagesResource = GetSchoolLogoBitmapImageResource(_clientSetting.DeviceSetting);
                timeloop.TimeStrat();
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 7
0
 private SystemObject()
 {
     //设置定时器,间隔10s执行一次阅览室设置更新
     timeloop         = new TimeLoop(20000);
     timeloop.TimeTo += timeloop_TimeTo;
     try
     {
         _RegulationRulesSet = GetRegulationRulesSetting();
         _clientSetting      = GetClientSet();
         if (_clientSetting == null)
         {
             return;
         }
         _BackgroundImagesResource = GetBitmapImageResource(_clientSetting.DeviceSetting);
         timeloop.TimeStrat();
     }
     catch
     {
         throw;
     }
 }
        private SystemObject()
        {
            //设置定时器,间隔10s执行一次阅览室设置更新
            timeloop         = new SeatManage.SeatManageComm.TimeLoop(20000);
            timeloop.TimeTo += timeloop_TimeTo;
            try
            {
                _RegulationRulesSet = GetRegulationRulesSetting();
                _clientSetting      = GetClientSet();
                if (_clientSetting == null)
                {
                    return;
                }

                GetAdvert();
                timeloop.TimeStrat();
            }
            catch
            {
                throw;
            }
        }
        private SystemObject()
        {
            //设置定时器,间隔10s执行一次阅览室设置更新
            _timeloop         = new SeatManage.SeatManageComm.TimeLoop(20000);
            _timeloop.TimeTo += timeloop_TimeTo;
            try
            {
                _regulationRulesSet = GetRegulationRulesSetting();
                _clientSetting      = GetClientSet();
                _closeCheckPassword = GetClosePw();
                if (_clientSetting == null)
                {
                    return;
                }

                GetAdvert();
                _timeloop.TimeStrat();
            }
            catch (Exception ex)
            {
                SeatManage.SeatManageComm.WriteLog.Write("初始化终端设置失败" + ex.Message);
                throw;
            }
        }
Exemplo n.º 10
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
            }
        }
        /// <summary>
        /// 添加违规记录
        /// </summary>
        /// <param name="blacklist"></param>
        public HandleResult AddViolationRecordsLog(ViolationRecordsLogInfo ViolationRecordsLog)
        {
            //添加违规记录
            bool result = violateDiscipline.Add(ViolationRecordsLog);

            //return HandleResult.Successed;
            #region 添加提醒,已被注销
            if (result)
            {
                List <string> roomlist = new List <string>();
                roomlist.Add(ViolationRecordsLog.ReadingRoomID);
                List <ReadingRoomInfo> roominfos = GetReadingRoomInfo(null);
                Dictionary <string, ReadingRoomSetting> roomSettings = new Dictionary <string, ReadingRoomSetting>();
                for (int i = 0; i < roominfos.Count; i++)
                {
                    roomSettings.Add(roominfos[i].No, roominfos[i].Setting);
                }
                if (roomSettings[ViolationRecordsLog.ReadingRoomID] != null && roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.Used)
                {
                    List <ViolationRecordsLogInfo> violateRecords = GetViolationRecordsLogInfo(ViolationRecordsLog.CardNo, ViolationRecordsLog.ReadingRoomID);
                    //添加读者提醒
                    //ReaderNoticeInfo rni = new ReaderNoticeInfo();
                    //rni.Type = NoticeType.ViolationWarning;
                    //rni.IsRead = LogStatus.Valid;
                    //rni.CardNo = ViolationRecordsLog.CardNo;
                    //rni.Note = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes - violateRecords.Count);
                    //AddReaderNotice(rni);

                    PushMsgInfo msg = new PushMsgInfo();
                    msg.Title      = "您好,您有一次违规";
                    msg.MsgType    = MsgPushType.EnterVR;
                    msg.StudentNum = ViolationRecordsLog.CardNo;
                    msg.RoomName   = roominfos.Find(u => u.No == ViolationRecordsLog.ReadingRoomID).Name;
                    msg.VrType     = ViolationRecordsLog.EnterFlag;
                    msg.Message    = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes - violateRecords.Count);
                    SendMsg(msg);


                    if (violateRecords.Count >= roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes)
                    {
                        BlackListInfo bli = new BlackListInfo();
                        bli.CardNo           = ViolationRecordsLog.CardNo;
                        bli.ReadingRoomID    = ViolationRecordsLog.ReadingRoomID;
                        bli.AddTime          = GetServerDateTime();
                        bli.OutBlacklistMode = roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.LeaveBlacklist;
                        if (bli.OutBlacklistMode == LeaveBlacklistMode.ManuallyMode)
                        {
                            bli.ReMark = string.Format("违规累计{0}次,被加入黑名单", roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes);
                        }
                        else
                        {
                            bli.OutTime = bli.AddTime.AddDays(roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.LimitDays);
                            bli.ReMark  = string.Format("违规累计{0}次,被加入黑名单{1}天", roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.LimitDays);
                        }

                        int blackId = AddBlacklist(bli);
                        //修改黑名单涉及的违规记录
                        foreach (ViolationRecordsLogInfo vr in violateRecords)
                        {
                            vr.BlacklistID = blackId.ToString();
                            vr.Flag        = LogStatus.Fail;
                            UpdateViolationRecordsLog(vr);
                        }
                    }
                }
                else
                {
                    //判断黑名单
                    RegulationRulesSetting         set            = GetRegulationRulesSetting();
                    List <ViolationRecordsLogInfo> violateRecords = GetViolationRecordsLogInfo(ViolationRecordsLog.CardNo, null);
                    for (int i = 0; i < violateRecords.Count; i++)
                    {
                        if (roomSettings[violateRecords[i].ReadingRoomID].BlackListSetting.Used)
                        {
                            violateRecords.RemoveAt(i);
                            i--;
                        }
                    }
                    //添加读者提醒
                    //ReaderNoticeInfo rni = new ReaderNoticeInfo();
                    //rni.Type = NoticeType.ViolationWarning;
                    //rni.IsRead = LogStatus.Valid;
                    //rni.CardNo = ViolationRecordsLog.CardNo;
                    //rni.Note = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes - violateRecords.Count);
                    //AddReaderNotice(rni);


                    PushMsgInfo msg = new PushMsgInfo();
                    msg.Title      = "您好,您有一次违规";
                    msg.MsgType    = MsgPushType.EnterVR;
                    msg.StudentNum = ViolationRecordsLog.CardNo;
                    msg.RoomName   = roominfos.Find(u => u.No == ViolationRecordsLog.ReadingRoomID).Name;
                    msg.VrType     = ViolationRecordsLog.EnterFlag;
                    msg.Message    = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, set.BlacklistSet.ViolateTimes - violateRecords.Count);
                    SendMsg(msg);

                    if (violateRecords.Count >= set.BlacklistSet.ViolateTimes)
                    {
                        BlackListInfo bli = new BlackListInfo();
                        bli.CardNo           = ViolationRecordsLog.CardNo;
                        bli.ReadingRoomID    = ViolationRecordsLog.ReadingRoomID;
                        bli.AddTime          = GetServerDateTime();
                        bli.OutTime          = bli.AddTime.AddDays(set.BlacklistSet.LimitDays);
                        bli.OutBlacklistMode = set.BlacklistSet.LeaveBlacklist;
                        if (bli.OutBlacklistMode == LeaveBlacklistMode.ManuallyMode)
                        {
                            bli.ReMark = string.Format("违规累计{0}次,被加入黑名单", set.BlacklistSet.ViolateTimes);
                        }
                        else
                        {
                            bli.ReMark = string.Format("多次违规,被加入黑名单{1}天", set.BlacklistSet.ViolateTimes, set.BlacklistSet.LimitDays);
                        }

                        int blackId = AddBlacklist(bli);
                        //修改黑名单涉及的违规记录
                        foreach (ViolationRecordsLogInfo vr in violateRecords)
                        {
                            vr.BlacklistID = blackId.ToString();
                            vr.Flag        = LogStatus.Fail;
                            UpdateViolationRecordsLog(vr);
                        }
                    }
                }

                return(HandleResult.Successed);
            }
            else
            {
                return(HandleResult.Failed);
            }
            #endregion
        }