Beispiel #1
0
        public JsonResult SaveBlacklistInfoSetting()
        {
            JsonResult result = null;

            SeatManage.ClassModel.RegulationRulesSetting rulessetting = new SeatManage.ClassModel.RegulationRulesSetting();

            rulessetting.BlacklistSet.Used         = Request.Params["IsBlUserd"] == null ? false : true;                                                                                                                                              // IsBlUserd.Checked;
            rulessetting.BlacklistSet.ViolateTimes = Request.Params["nbvrcont"] == null ? 3 : int.Parse(Request.Params["nbvrcont"].Trim());                                                                                                           //(nbvrcont.Text);

            rulessetting.BlacklistSet.LeaveBlacklist = Request.Params["ddlleavemode"] == null ? SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode : (SeatManage.EnumType.LeaveBlacklistMode) int.Parse(Request.Params["ddlleavemode"].ToString()); //Request.Params["ddlleavemode"]==null? SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode: (SeatManage.EnumType.LeaveBlacklistMode)int.Parse(Request.Params["ddlleavemode"]);//(ddlleavemode.SelectedValue);

            rulessetting.BlacklistSet.LimitDays       = Request.Params["nbleavetime"] == null ? 7 : int.Parse(Request.Params["nbleavetime"].Trim());                                                                                                  //(nbleavetime.Text);
            rulessetting.BlacklistSet.ViolateFailDays = Request.Params["nbvrovertime"] == null ? 30 : int.Parse(Request.Params["nbvrovertime"].Trim());                                                                                               //(nbvrovertime.Text);

            rulessetting.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.BookingTimeOut]            = Request.Params["cbBookOverTime"] == null ? false : true;                                                                     //cbBookOverTime.Checked;
            rulessetting.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin]              = Request.Params["cbLeaveByAdmin"] == null ? false : true;                                                                     //cbLeaveByAdmin.Checked;
            rulessetting.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.SeatOutTime]               = Request.Params["cbSeatOverTime"] == null ? false : true;                                                                     //cbSeatOverTime.Checked;
            rulessetting.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.ShortLeaveByAdminOutTime]  = Request.Params["cbShortLeaveByAdmin"] == null ? false : true;                                                                //cbShortLeaveByAdmin.Checked;
            rulessetting.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.ShortLeaveByReaderOutTime] = Request.Params["cbShortLeaveByReader"] == null ? false : true;                                                               //cbShortLeaveByReader.Checked;
            rulessetting.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.ShortLeaveOutTime]         = Request.Params["cbShortLeaveOverTime"] == null ? false : true;                                                               // cbShortLeaveOverTime.Checked;

            if (SeatManage.Bll.T_SM_SystemSet.UpdateRegulationRulesSetting(rulessetting))
            {
                result = Json(new { status = "yes", message = "黑名单规则配置保存成功" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                result = Json(new { status = "no", message = "黑名单规则配置保存失败" }, JsonRequestBehavior.AllowGet);
            }

            return(result);
        }
        /// <summary>
        /// 创建黑名单设置节点
        /// </summary>
        /// <param name="blacklist"></param>
        /// <returns></returns>
        private static string Convert(RegulationRulesSetting set)
        {
            doc = new XmlDocument();
            XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);

            doc.AppendChild(dec);
            XmlElement root             = doc.CreateElement("regulationRulesSetting");
            XmlElement blacklistNode    = ConvertBlacklistSet(set.BlacklistSet);
            XmlElement realNameSeatList = ConvertRealNameSeat(set.RealNameSeatList);

            root.AppendChild(blacklistNode);
            root.AppendChild(realNameSeatList);
            doc.AppendChild(root);
            return(doc.OuterXml.ToString());
        }
        /// <summary>
        /// 解析黑名单设置节点
        /// </summary>
        /// <param name="xmlBlacklist">黑名单的Xml</param>
        /// <returns></returns>
        public static RegulationRulesSetting Convert(string xmlBlacklist)
        {
            doc = new XmlDocument();
            RegulationRulesSetting set = new RegulationRulesSetting();

            if (!string.IsNullOrEmpty(xmlBlacklist))
            {
                doc.LoadXml(xmlBlacklist);
                XmlNode node = doc.SelectSingleNode("//regulationRulesSetting/blacklist");
                if (node != null)
                {
                    set.BlacklistSet = ConvertBlacklistSet(node);
                }
                node = doc.SelectSingleNode("//regulationRulesSetting/realNameSeatList");
                if (node != null)
                {
                    set.RealNameSeatList = ConvertRealNameSeat(node);
                }
            }
            return(set);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            seatNo = Request.QueryString["seatNo"];
            string seatShortNo = Request.QueryString["seatShortNo"];
            string seatUsed    = Request.QueryString["used"];

            if (!IsPostBack)
            {
                if (Request.ServerVariables["HTTP_REFERER"] != null)
                {
                    string url      = Request.ServerVariables["HTTP_REFERER"].Trim();
                    string pageName = SeatManage.SeatManageComm.SeatComm.GetPageName(url);
                    if (pageName != "SeatGraph.aspx" && pageName != "FormSYS.aspx" && pageName != "MonitorListMode.aspx")
                    {
                        WriteLogs(url);
                        Response.Write("请通过正确方式访问网站!");
                        Response.End();
                        return;
                        //PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                    }
                }
                else
                {
                    WriteLogs(HttpContext.Current.Request.Url.AbsoluteUri);
                    Response.Write("请通过正确方式访问网站!");
                    Response.End();
                    return;
                    //PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                }
                BindUIElement(seatNo, seatShortNo, seatUsed);
            }
            SeatManage.ClassModel.Seat seat = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            SeatManage.ClassModel.RegulationRulesSetting rulesSet    = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            SeatManage.ClassModel.ReadingRoomInfo        readingroom = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(seat.ReadingRoomNum);
            if ((!rulesSet.BlacklistSet.Used) && (!readingroom.Setting.BlackListSetting.Used))
            {
                btnAddBlackList.Enabled = false;
            }
        }
Beispiel #5
0
        public JsonResult SaveNewViolate()
        {
            JsonResult result = null;

            SeatManage.ClassModel.RegulationRulesSetting regulationRulesSetting = T_SM_SystemSet.GetRegulationRulesSetting();
            string CardNo       = Request.Params["txtNum"].Trim();
            string SeatNo       = Request.Params["txtSeat"].Trim();
            string seatnoremark = "";

            if (!string.IsNullOrEmpty(SeatNo))
            {
                seatnoremark = SeatNo + "号座位,";
            }
            string Remark                 = Request.Params["txtRemark"].Trim();   // txtRemark.Text;
            ViolationRecordsType Type     = (ViolationRecordsType)int.Parse(Request.Params["selectVrType"].Trim());
            string          ReadingRoomNo = Request.Params["selectRooms"].Trim(); //ddlroom.SelectedValue;
            ReadingRoomInfo room          = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(ReadingRoomNo);

            if (room.Setting.IsRecordViolate)
            {
                ViolationRecordsLogInfo vrli = new ViolationRecordsLogInfo();
                vrli.CardNo        = CardNo;
                vrli.SeatID        = SeatNo;
                vrli.ReadingRoomID = ReadingRoomNo;
                vrli.EnterOutTime  = ServiceDateTime.Now.ToString();
                vrli.EnterFlag     = Type;
                vrli.Remark        = string.Format("在{0},{1}被管理员{2},手动记录违规,备注{3}", room.Name, seatnoremark, this.LoginId, Remark);
                if (T_SM_ViolateDiscipline.AddViolationRecords(vrli))
                {
                    result = Json(new { status = "yes", message = "添加成功" }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    result = Json(new { status = "no", message = "添加失败" }, JsonRequestBehavior.AllowGet);
                    //  FineUI.Alert.Show("添加失败!");
                }
            }
            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// 保存设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            SeatManage.ClassModel.RegulationRulesSetting regulationRulesSetting = T_SM_SystemSet.GetRegulationRulesSetting();
            string CardNo       = txtCardno.Text;
            string SeatNo       = txtseatno.Text;
            string seatnoremark = "";

            if (!string.IsNullOrEmpty(SeatNo))
            {
                seatnoremark = SeatNo + "号座位,";
            }
            string Remark                 = txtRemark.Text;
            ViolationRecordsType Type     = (ViolationRecordsType)int.Parse(ddltype.SelectedValue);
            string          ReadingRoomNo = ddlroom.SelectedValue;
            ReadingRoomInfo room          = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(ReadingRoomNo);

            if (room.Setting.IsRecordViolate)
            {
                ViolationRecordsLogInfo vrli = new ViolationRecordsLogInfo();
                vrli.CardNo        = CardNo;
                vrli.SeatID        = SeatNo;
                vrli.ReadingRoomID = ReadingRoomNo;
                vrli.EnterOutTime  = ServiceDateTime.Now.ToString();
                vrli.EnterFlag     = Type;
                vrli.Remark        = string.Format("在{0},{1}被管理员{2},手动记录违规,备注{3}", room.Name, seatnoremark, this.LoginId, Remark);
                if (T_SM_ViolateDiscipline.AddViolationRecords(vrli))
                {
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    FineUI.Alert.Show("添加成功!");
                }
                else
                {
                    FineUI.Alert.Show("添加失败!");
                }
            }
        }
        protected void btn_btnLeave(object sender, EventArgs e)
        {
            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
            SeatManage.ClassModel.ReadingRoomInfo roomInfo    = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
            SeatManage.EnumType.EnterOutLogType   type        = enterOutLog.EnterOutState;
            enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
            enterOutLog.Flag          = SeatManage.EnumType.Operation.Admin;
            enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId);
            int newId = -1;

            SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
            if (result == SeatManage.EnumType.HandleResult.Successed)
            {
                //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                //rni.CardNo = enterOutLog.CardNo;
                //rni.Type = SeatManage.EnumType.NoticeType.ManagerFreeSetWarning;
                //rni.Note = enterOutLog.Remark;
                //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                PushMsgInfo msg = new PushMsgInfo();
                msg.Title      = "您好,您的座位已被释放";
                msg.MsgType    = MsgPushType.AdminOperation;
                msg.StudentNum = enterOutLog.CardNo;
                msg.Message    = enterOutLog.Remark;
                SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);

                if (type == SeatManage.EnumType.EnterOutLogType.ShortLeave)
                {
                    List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null);
                    SeatManage.ClassModel.WaitSeatLogInfo        waitSeatLog  = null;
                    if (waitSeatLogs.Count > 0)
                    {
                        waitSeatLog              = waitSeatLogs[0];
                        waitSeatLog.NowState     = SeatManage.EnumType.LogStatus.Fail;
                        waitSeatLog.OperateType  = SeatManage.EnumType.Operation.OtherReader;
                        waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel;
                        if (SeatManage.Bll.T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog))
                        {
                            //rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                            //rni.CardNo = waitSeatLog.CardNo;
                            //rni.Type = SeatManage.EnumType.NoticeType.WaitSeatFail;
                            //rni.Note = "您所等待的座位已被管理员释放,您的等待已被取消";
                            //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                            //msg = new PushMsgInfo();
                            //msg.Title = "您好,您的等待已被取消";
                            //msg.MsgType = MsgPushType.AdminOperation;
                            //msg.StudentNum = waitSeatLog.CardNo;
                            //msg.Message = "您所等待的座位已被管理员释放,您的等待已被取消";
                            //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);
                        }
                    }
                }

                SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
                if (roomInfo.Setting.IsRecordViolate)
                {
                    if (roomInfo.Setting.BlackListSetting.Used)
                    {
                        if (roomInfo.Setting.BlackListSetting.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin])
                        {
                            SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.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  = SeatManage.Bll.ServiceDateTime.Now.ToString();
                            violationRecords.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin;
                            violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId);
                            violationRecords.BlacklistID   = "-1";
                            SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                        }
                    }
                    else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin])
                    {
                        SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.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  = SeatManage.Bll.ServiceDateTime.Now.ToString();
                        violationRecords.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin;
                        violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId);
                        violationRecords.BlacklistID   = "-1";
                        SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                    }
                }

                FineUI.Alert.ShowInTop("设置读者离开成功", "成功");
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                FineUI.Alert.ShowInTop("设置读者离开失败", "失败");
            }
        }
        /// <summary>
        /// 管理员对座位进行管理操作
        /// </summary>
        /// <param name="seatNoList">多选座位列表</param>
        /// <param name="operateType">操作类型</param>
        /// <param name="loginId">登录名</param>
        /// <returns></returns>
        public string SeatOperation(string seatNoList, string operateType, string loginId)
        {
            try
            {
                JM_HandleResultObject result = new JM_HandleResultObject();
                result.Result = false;
                List <JM_Seat> list          = SeatManage.SeatManageComm.JSONSerializer.Deserialize <List <JM_Seat> >(seatNoList);
                int            successResult = 0;
                int            failResult    = 0;
                List <string>  noList        = new List <string>();
                string         no            = list[0].ReadingRoomNum;
                noList.Add(no);
                List <ReadingRoomInfo> room = seatDataService.GetReadingRoomInfo(noList);

                switch (operateType)
                {
                    #region 设置暂离
                case "shortLeave":
                    try
                    {
                        foreach (JM_Seat seat in list)
                        {
                            EnterOutLogInfo model = seatDataService.GetEnterOutLogInfoBySeatNum(seat.SeatNo);
                            if (model != null && model.EnterOutState != SeatManage.EnumType.EnterOutLogType.ShortLeave)
                            {
                                model.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
                                model.Flag          = SeatManage.EnumType.Operation.Admin;
                                model.Remark        = "在" + model.ReadingRoomName + "," + model.SeatNo + "号座位,被管理员" + loginId + ",通过手持设备设置为暂离";
                                int newId = -1;
                                SeatManage.EnumType.HandleResult rs = seatDataService.AddEnterOutLogInfo(model, ref newId);
                                if (rs == SeatManage.EnumType.HandleResult.Successed)
                                {
                                    successResult++;
                                    result.Result = true;
                                }
                                else
                                {
                                    failResult++;
                                }
                            }
                        }
                        result.Msg = "设置读者暂离";
                    }
                    catch (Exception ex)
                    {
                        SeatManage.SeatManageComm.WriteLog.Write("设置读者暂离遇到异常:" + ex.Message);
                        result.Result = false;
                        result.Msg    = "执行遇到异常!";
                    }
                    break;
                    #endregion

                    #region 取消暂离
                case "comeBack":
                    try
                    {
                        foreach (JM_Seat seat in list)
                        {
                            EnterOutLogInfo model = seatDataService.GetEnterOutLogInfoBySeatNum(seat.SeatNo);
                            if (model != null && model.EnterOutState == EnterOutLogType.ShortLeave)
                            {
                                model.EnterOutState = EnterOutLogType.ComeBack;
                                model.Flag          = Operation.Admin;
                                model.Remark        = "在" + model.ReadingRoomName + "," + model.SeatNo + "号座位,被管理员" + loginId + ",通过手持设备取消暂离,恢复为在座";
                                int newId = -1;
                                SeatManage.EnumType.HandleResult rs = seatDataService.AddEnterOutLogInfo(model, ref newId);
                                if (rs == SeatManage.EnumType.HandleResult.Successed)
                                {
                                    List <SeatManage.ClassModel.WaitSeatLogInfo> logs = seatDataService.GetWaitLogList("", model.EnterOutLogID, null, null, null);
                                    WaitSeatLogInfo log = null;
                                    if (logs.Count > 0)
                                    {
                                        log              = logs[0];
                                        log.NowState     = LogStatus.Fail;
                                        log.OperateType  = Operation.OtherReader;
                                        log.WaitingState = EnterOutLogType.WaitingCancel;
                                        if (seatDataService.UpdateWaitLog(log))
                                        {
                                            //result.Result = true;
                                            //result.Msg = "取消读者暂离成功";
                                            successResult++;
                                            result.Result = true;
                                        }
                                        else
                                        {
                                            //result.Result = true;
                                            //result.Msg = "取消读者暂离成功,释放读者等待失败";
                                            successResult++;
                                            result.Result = true;
                                        }
                                    }
                                    else
                                    {
                                        //result.Result = true;
                                        //result.Msg = "取消读者暂离成功";
                                        successResult++;
                                        result.Result = true;
                                    }
                                }
                                else
                                {
                                    //result.Result = false;
                                    //result.Msg = "取消读者暂离失败";
                                    failResult++;
                                }
                            }
                        }
                        result.Msg = "取消读者暂离";
                    }
                    catch (Exception ex)
                    {
                        SeatManage.SeatManageComm.WriteLog.Write("取消读者暂离遇到异常:" + ex.Message);
                        result.Result = false;
                        result.Msg    = "执行遇到异常!";
                    }
                    break;
                    #endregion

                    #region 释放座位
                case "leave":
                    try
                    {
                        foreach (JM_Seat seat in list)
                        {
                            EnterOutLogInfo model = seatDataService.GetEnterOutLogInfoBySeatNum(seat.SeatNo);
                            if (model != null && model.EnterOutState != EnterOutLogType.Leave)
                            {
                                model.EnterOutState = EnterOutLogType.Leave;
                                model.Flag          = Operation.Admin;
                                model.Remark        = "在" + model.ReadingRoomName + "," + model.SeatNo + "号座位,被管理员" + loginId + ",通过手持设备设置离开";
                                int          newId = -1;
                                HandleResult rs    = seatDataService.AddEnterOutLogInfo(model, ref newId);
                                if (rs == HandleResult.Successed)
                                {
                                    SeatManage.ClassModel.RegulationRulesSetting rules = seatDataService.GetRegulationRulesSetting();
                                    if (room[0].Setting.IsRecordViolate)
                                    {
                                        if (room[0].Setting.BlackListSetting.Used)
                                        {
                                            if (room[0].Setting.BlackListSetting.ViolateRoule[ViolationRecordsType.LeaveByAdmin])
                                            {
                                                ViolationRecordsLogInfo logs = new ViolationRecordsLogInfo();
                                                logs.CardNo        = model.CardNo;
                                                logs.SeatID        = model.SeatNo.Substring(model.SeatNo.Length - room[0].Setting.SeatNumAmount, room[0].Setting.SeatNumAmount);
                                                logs.ReadingRoomID = model.ReadingRoomNo;
                                                logs.EnterOutTime  = DateTime.Now.ToString();
                                                logs.EnterFlag     = ViolationRecordsType.LeaveByAdmin;
                                                logs.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", room[0].Name, model.ShortSeatNo, loginId);
                                                logs.BlacklistID   = "-1";
                                                seatDataService.AddViolationRecordsLog(logs);
                                            }
                                        }
                                        else if (rules.BlacklistSet.Used && rules.BlacklistSet.ViolateRoule[ViolationRecordsType.LeaveByAdmin])
                                        {
                                            ViolationRecordsLogInfo logs = new ViolationRecordsLogInfo();
                                            logs.CardNo        = model.CardNo;
                                            logs.SeatID        = model.SeatNo.Substring(model.SeatNo.Length - room[0].Setting.SeatNumAmount, room[0].Setting.SeatNumAmount);
                                            logs.ReadingRoomID = model.ReadingRoomNo;
                                            logs.EnterOutTime  = DateTime.Now.ToString();
                                            logs.EnterFlag     = ViolationRecordsType.LeaveByAdmin;
                                            logs.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", room[0].Name, model.ShortSeatNo, loginId);
                                            logs.BlacklistID   = "-1";
                                            seatDataService.AddViolationRecordsLog(logs);
                                        }
                                    }
                                    result.Result = true;
                                    //result.Msg = "成功释放读者座位";
                                    successResult++;
                                }
                                else
                                {
                                    //result.Result = false;
                                    //result.Msg = "释放读者座位失败";
                                    failResult++;
                                }
                            }
                        }
                        result.Msg = "释放读者座位";
                    }
                    catch (Exception ex)
                    {
                        SeatManage.SeatManageComm.WriteLog.Write("释放读者座位遇到异常:" + ex.Message);
                        result.Result = false;
                        result.Msg    = "执行遇到异常!";
                    }
                    break;
                    #endregion

                    #region 加入计时
                case "timing":
                    try
                    {
                        foreach (JM_Seat seat in list)
                        {
                            EnterOutLogInfo model = seatDataService.GetEnterOutLogInfoBySeatNum(seat.SeatNo);
                            if (model != null && model.EnterOutState != EnterOutLogType.ShortLeave)
                            {
                                DateTime markTime = DateTime.Now;
                                if (seatDataService.UpdateMarkTime(model.EnterOutLogID, markTime))
                                {
                                    //result.Result = true;
                                    //result.Msg = "加入计时成功";
                                    successResult++;
                                    result.Result = true;
                                }
                                else
                                {
                                    //result.Result = false;
                                    //result.Msg = "加入计时失败";
                                    failResult++;
                                }
                            }
                        }
                        result.Msg = "加入计时";
                    }
                    catch (Exception ex)
                    {
                        SeatManage.SeatManageComm.WriteLog.Write("加入计时遇到异常:" + ex.Message);
                        result.Result = false;
                        result.Msg    = "执行遇到异常!";
                    }
                    break;
                    #endregion

                    #region 取消计时
                case "cancelTiming":
                    try
                    {
                        foreach (JM_Seat seat in list)
                        {
                            EnterOutLogInfo model = seatDataService.GetEnterOutLogInfoBySeatNum(seat.SeatNo);
                            if (model != null && !string.IsNullOrEmpty(model.MarkTime.ToString()) && model.MarkTime.CompareTo(DateTime.Parse("1900/1/1")) != 0)
                            {
                                DateTime markTime = DateTime.Parse("1900/1/1");
                                if (seatDataService.UpdateMarkTime(model.EnterOutLogID, markTime))
                                {
                                    //result.Result = true;
                                    //result.Msg = "取消计时成功";
                                    successResult++;
                                    result.Result = true;
                                }
                                else
                                {
                                    //result.Result = false;
                                    //result.Msg = "取消计时失败";
                                    failResult++;
                                }
                            }
                        }
                        result.Msg = "取消计时";
                    }
                    catch (Exception ex)
                    {
                        SeatManage.SeatManageComm.WriteLog.Write("取消计时遇到异常:" + ex.Message);
                        result.Result = false;
                        result.Msg    = "执行遇到异常!";
                    }
                    break;
                    #endregion

                    #region 加入黑名单
                case "addBlackList":
                    try
                    {
                        int newId = -1;
                        SeatManage.ClassModel.RegulationRulesSetting rules = seatDataService.GetRegulationRulesSetting();
                        if (!room[0].Setting.BlackListSetting.Used && !rules.BlacklistSet.Used)
                        {
                            result.Result = false;
                            result.Msg    = "阅览室未开启记录黑名单功能";
                            break;
                        }
                        foreach (JM_Seat seat in list)
                        {
                            EnterOutLogInfo model = seatDataService.GetEnterOutLogInfoBySeatNum(seat.SeatNo);
                            if (model != null && model.EnterOutState != EnterOutLogType.Leave)
                            {
                                if (room[0] != null && room[0].Setting.BlackListSetting.Used)
                                {
                                    BlackListInfo info = new BlackListInfo();
                                    info.AddTime          = DateTime.Now;
                                    info.BlacklistState   = LogStatus.Valid;
                                    info.CardNo           = model.CardNo;
                                    info.ReadingRoomID    = model.ReadingRoomNo;
                                    info.OutBlacklistMode = rules.BlacklistSet.LeaveBlacklist;
                                    if (info.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode)
                                    {
                                        info.ReMark  = string.Format("管理员{0}通过手持设备{0}把读者加入黑名单,记录黑名单{1}天", loginId, room[0].Setting.BlackListSetting.LimitDays);
                                        info.OutTime = info.AddTime.AddDays(room[0].Setting.BlackListSetting.LimitDays);
                                    }
                                    else
                                    {
                                        info.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", loginId);
                                    }
                                    newId = seatDataService.AddBlacklist(info);
                                }
                                else if (rules.BlacklistSet.Used)
                                {
                                    BlackListInfo info = new BlackListInfo();
                                    info.AddTime          = DateTime.Now;
                                    info.OutTime          = info.AddTime.AddDays(rules.BlacklistSet.LimitDays);
                                    info.BlacklistState   = LogStatus.Valid;
                                    info.CardNo           = model.CardNo;
                                    info.OutBlacklistMode = rules.BlacklistSet.LeaveBlacklist;
                                    if (info.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode)
                                    {
                                        info.ReMark  = string.Format("管理员{0}通过手持设备把读者加入黑名单,记录黑名单{1}天", loginId, rules.BlacklistSet.LimitDays);
                                        info.OutTime = info.AddTime.AddDays(rules.BlacklistSet.LimitDays);
                                    }
                                    else
                                    {
                                        info.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", loginId);
                                    }
                                    newId = seatDataService.AddBlacklist(info);
                                }

                                if (newId > 0)
                                {
                                    model.EnterOutState = EnterOutLogType.Leave;
                                    model.Flag          = Operation.Admin;
                                    model.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", room[0].Name, model.ShortSeatNo, loginId);

                                    HandleResult rs = seatDataService.AddEnterOutLogInfo(model, ref newId);
                                    if (rs == HandleResult.Successed)
                                    {
                                        //result.Result = true;
                                        //result.Msg = "成功将读者加入黑名单!";
                                        successResult++;
                                        result.Result = true;
                                    }
                                    else
                                    {
                                        //result.Result = false;
                                        //result.Msg = "将读者加入黑名单失败!";
                                        failResult++;
                                    }
                                }
                                else
                                {
                                    //result.Result = false;
                                    //result.Msg = "将读者加入黑名单失败!";
                                    failResult++;
                                }
                            }
                        }
                        result.Msg = "加入黑名单";
                    }
                    catch (Exception ex)
                    {
                        SeatManage.SeatManageComm.WriteLog.Write("加入黑名单遇到异常:" + ex.Message);
                        result.Result = false;
                        result.Msg    = "执行遇到异常!";
                    }
                    break;
                    #endregion
                }
                StringBuilder str = new StringBuilder();
                if (result.Result)
                {
                    str.Append("成功");
                }
                else
                {
                    str.Append("失败");
                }
                if (successResult > 0)
                {
                    str.Append(string.Format(",成功{0}条", successResult));
                }
                if (failResult > 0)
                {
                    str.Append(string.Format(",失败{0}条", failResult));
                }
                result.Msg = result.Msg + str.ToString();
                return(SeatManage.SeatManageComm.JSONSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                SeatManage.SeatManageComm.WriteLog.Write("对座位进行操作遇到异常:" + ex.Message);
                JM_HandleResultObject result = new JM_HandleResultObject();
                result.Result = false;
                result.Msg    = "执行遇到异常!";
                return(SeatManage.SeatManageComm.JSONSerializer.Serialize(result));
            }
        }
Beispiel #9
0
        /// <summary>
        /// 绑定UI元素
        /// </summary>
        /// <param name="seatNo"></param>
        /// <param name="seatShortNo"></param>GetBespeakLogInfoBySeatNo
        void BindUIElement(string seatNo, string seatShortNo, DateTime date)
        {
            SeatManage.ClassModel.ReadingRoomInfo room           = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo);
            SeatManage.Bll.T_SM_ReadingRoom       bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            foreach (DateTime dt in room.Setting.SeatBespeak.SpecifiedTimeList)
            {
                DropDownList_Time.Items.Add(new FineUI.ListItem(dt.ToShortTimeString(), dt.ToShortTimeString()));
            }
            DateTime minTime = DateTime.Parse(date.ToShortDateString() + " " + bllReadingRoom.GetRoomOpenTimeByDate(room.Setting, date.ToShortDateString()).BeginTime);

            while (true)
            {
                minTime = minTime.AddMinutes(10);
                if (minTime.Date > date.Date)
                {
                    break;
                }
                if (Code.NowReadingRoomState.ReadingRoomOpenState(room.Setting.RoomOpenSet, minTime) == SeatManage.EnumType.ReadingRoomStatus.Close)
                {
                    continue;
                }
                DropDownList_FreeTime.Items.Add(new FineUI.ListItem(minTime.ToShortTimeString(), minTime.ToShortTimeString()));
            }
            if (!room.Setting.SeatBespeak.SpecifiedBespeak)
            {
                rblModel.Hidden = true;
            }
            if (rblModel.SelectedValue == "0")
            {
                DropDownList_FreeTime.Hidden = true;
                DropDownList_Time.Hidden     = true;
            }
            else
            {
                if (!room.Setting.SeatBespeak.SpecifiedTime)
                {
                    DropDownList_Time.Hidden     = true;
                    DropDownList_FreeTime.Hidden = false;
                }
                else
                {
                    DropDownList_FreeTime.Hidden = true;
                    DropDownList_Time.Hidden     = false;
                }
            }
            lblbeginDate.Text     = date.ToShortDateString();
            this.lblSeatNo.Text   = seatShortNo;
            this.lblRoomName.Text = room.Name;
            //判断自己是否已经预约座位
            List <SeatManage.EnumType.BookingStatus> bespeakStatus = new List <SeatManage.EnumType.BookingStatus>();

            bespeakStatus.Add(SeatManage.EnumType.BookingStatus.Waiting);
            List <SeatManage.ClassModel.BespeakLogInfo> readerBespeaklist = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoByCardNo(this.LoginId, date);//.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus);

            if (readerBespeaklist.Count > 0)
            {
                FineUI.Alert.ShowInTop("您选择的日期已经预约了座位,请先取消原来的预约。");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断座位是否被别人预约
            List <SeatManage.ClassModel.BespeakLogInfo> list = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoBySeatNo(seatNo, date);

            roomOpenTime.Value   = bllReadingRoom.GetRoomOpenTimeByDate(room.Setting, date.ToShortDateString()).BeginTime;
            this.lblEndDate.Text = bespeakSureTimeSpan(room.Setting);
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].BsepeakState == SeatManage.EnumType.BookingStatus.Waiting)
                {
                    FineUI.Alert.ShowInTop("座位已经被别人预约,请预约其他座位");
                    btnBespeak.Enabled = false;
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            //判断是否已加入黑名单
            List <SeatManage.ClassModel.BlackListInfo> blacklistInfoByCardNo = SeatManage.Bll.T_SM_Blacklist.GetBlackListInfo(this.LoginId);

            SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            if (room.Setting.UsedBlacklistLimit && blacklistInfoByCardNo.Count > 0)
            {
                if (room.Setting.BlackListSetting.Used)
                {
                    bool isblack = false;
                    foreach (SeatManage.ClassModel.BlackListInfo blinfo in blacklistInfoByCardNo)
                    {
                        if (blinfo.ReadingRoomID == room.No)
                        {
                            isblack = true;
                            break;
                        }
                    }
                    if (isblack)
                    {
                        FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
                else
                {
                    FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                    PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            if (room.Setting.LimitReaderEnter.Used)
            {
                SeatManage.ClassModel.ReaderInfo readerInfo = SeatManage.Bll.EnterOutOperate.GetReaderInfo(this.LoginId);
                string[] litype = room.Setting.LimitReaderEnter.ReaderTypes.Split(';');
                if (!room.Setting.LimitReaderEnter.CanEnter)
                {
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                            PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                            return;
                        }
                    }
                }
                else
                {
                    bool isintype = false;
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            isintype = true;
                            break;
                        }
                    }
                    if (!isintype)
                    {
                        FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
            }

            btnBespeak.Enabled = true;
        }
        /// <summary>
        /// 绑定UI元素
        /// </summary>
        /// <param name="seatNo"></param>
        /// <param name="seatShortNo"></param>GetBespeakLogInfoBySeatNo
        void BindUIElement(string seatNo, string seatShortNo, DateTime date)
        {
            SeatManage.ClassModel.ReadingRoomInfo room           = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo);
            SeatManage.Bll.T_SM_ReadingRoom       bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            foreach (DateTime dt in room.Setting.SeatBespeak.SpecifiedTimeList)
            {
                if (dt <= date)
                {
                    continue;
                }
                DropDownList_Time.Items.Add(new FineUI.ListItem(dt.ToShortTimeString(), dt.ToShortTimeString()));
            }
            DateTime minTime = date.AddMinutes(10 - date.Minute % 10);

            while (true)
            {
                minTime = minTime.AddMinutes(10);
                if (minTime.Date > date.Date)
                {
                    break;
                }
                if (Code.NowReadingRoomState.ReadingRoomOpenState(room.Setting.RoomOpenSet, minTime) == SeatManage.EnumType.ReadingRoomStatus.Close)
                {
                    continue;
                }
                DropDownList_FreeTime.Items.Add(new FineUI.ListItem(minTime.ToShortTimeString(), minTime.ToShortTimeString()));
            }
            if (!room.Setting.SeatBespeak.SpecifiedBespeak)
            {
                rblModel.Hidden = true;
            }
            if (rblModel.SelectedValue == "0")
            {
                DropDownList_FreeTime.Hidden = true;
                DropDownList_Time.Hidden     = true;
            }
            else
            {
                if (!room.Setting.SeatBespeak.SpecifiedTime)
                {
                    DropDownList_Time.Hidden     = true;
                    DropDownList_FreeTime.Hidden = false;
                }
                else
                {
                    DropDownList_FreeTime.Hidden = true;
                    DropDownList_Time.Hidden     = false;
                }
            }
            lblbeginDate.Text     = date.ToShortDateString();
            this.lblSeatNo.Text   = seatShortNo;
            this.lblRoomName.Text = room.Name;
            //判断自己是否已经预约座位
            List <SeatManage.EnumType.BookingStatus> bespeakStatus = new List <SeatManage.EnumType.BookingStatus>();

            bespeakStatus.Add(SeatManage.EnumType.BookingStatus.Waiting);
            List <SeatManage.ClassModel.BespeakLogInfo> readerBespeaklist = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoByCardNo(this.LoginId, date);//.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus);

            if (readerBespeaklist.Count > 0)
            {
                FineUI.Alert.ShowInTop("您今天已有预约的座位,请先取消原来的预约。");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断可预约次数是否超过
            readerBespeaklist = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakList(this.LoginId, null, date, 0, new List <SeatManage.EnumType.BookingStatus> {
                SeatManage.EnumType.BookingStatus.Confinmed
            });                                                                                                                                                                                          //.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus);
            if (readerBespeaklist.Count >= room.Setting.SeatBespeak.BespeakSeatCount)
            {
                FineUI.Alert.ShowInTop("您一天只能预约" + room.Setting.SeatBespeak.BespeakSeatCount + "次座位。");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断读者是否有座位
            if (!room.Setting.SeatBespeak.BespeatWithOnSeat)
            {
                SeatManage.ClassModel.EnterOutLogInfo eol = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogInfoByCardNo(this.LoginId);
                if (eol != null && eol.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
                {
                    FineUI.Alert.ShowInTop("您已有座位,不能再预约座位");
                    btnBespeak.Enabled = false;
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            //判断操作次数
            if (SeatManage.Bll.EnterOutOperate.CheckReaderChooseSeatTimesByReadingRoom(this.LoginId, room.Setting.PosTimes, room.No))
            {
                FineUI.Alert.ShowInTop("您的选座/预约操作过于频繁,请稍后重试");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断座位是否被别人使用
            SeatManage.ClassModel.Seat seat = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            if (seat.SeatUsedState != SeatManage.EnumType.EnterOutLogType.Leave)
            {
                FineUI.Alert.ShowInTop("座位已经被别人选择,请预约其他座位");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断座位是否被预约
            List <SeatManage.ClassModel.BespeakLogInfo> list = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoBySeatNo(seatNo, date);

            seatKeepTime.Value   = room.Setting.SeatBespeak.SeatKeepTime.ToString();
            this.lblEndDate.Text = string.Format("{0}至{1}", date.ToShortTimeString(), date.AddMinutes(room.Setting.SeatBespeak.SeatKeepTime).ToShortTimeString());
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].BsepeakState == SeatManage.EnumType.BookingStatus.Waiting)
                {
                    FineUI.Alert.ShowInTop("座位已经被别人预约,请预约其他座位");
                    btnBespeak.Enabled = false;
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            //判断是否已加入黑名单
            List <SeatManage.ClassModel.BlackListInfo> blacklistInfoByCardNo = SeatManage.Bll.T_SM_Blacklist.GetBlackListInfo(this.LoginId);

            SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            if (room.Setting.UsedBlacklistLimit && blacklistInfoByCardNo.Count > 0)
            {
                if (room.Setting.BlackListSetting.Used)
                {
                    bool isblack = false;
                    foreach (SeatManage.ClassModel.BlackListInfo blinfo in blacklistInfoByCardNo)
                    {
                        if (blinfo.ReadingRoomID == room.No)
                        {
                            isblack = true;
                            break;
                        }
                    }
                    if (isblack)
                    {
                        FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
                else
                {
                    FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                    PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            if (room.Setting.LimitReaderEnter.Used)
            {
                SeatManage.ClassModel.ReaderInfo readerInfo = SeatManage.Bll.EnterOutOperate.GetReaderInfo(this.LoginId);
                string[] litype = room.Setting.LimitReaderEnter.ReaderTypes.Split(';');
                if (!room.Setting.LimitReaderEnter.CanEnter)
                {
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                            PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                            return;
                        }
                    }
                }
                else
                {
                    bool isintype = false;
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            isintype = true;
                            break;
                        }
                    }
                    if (!isintype)
                    {
                        FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
            }

            btnBespeak.Enabled = true;
        }
Beispiel #11
0
        public JsonResult SaveNewBlack()
        {
            JsonResult result = null;

            SeatManage.ClassModel.RegulationRulesSetting regulationRulesSetting = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            string CardNo        = Request.Params["txtNum"].Trim();
            string Remark        = Request.Params["txtRemark"].Trim();       //txtRemark.Text;
            string ReadingRoomNo = Request.Params["selectRooms"].ToString(); //ddlroom.SelectedValue;

            SeatManage.ClassModel.ReadingRoomInfo room = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(ReadingRoomNo);
            SeatManage.ClassModel.BlackListInfo   bli  = new SeatManage.ClassModel.BlackListInfo();
            bli.CardNo  = CardNo;
            bli.AddTime = SeatManage.Bll.ServiceDateTime.Now;
            if (Request.Params["ddlleaveMode"] == "0") //(ddlleaveMode.SelectedValue == "0")
            {
                if (DateTime.Parse(Request.Params["dpEndDate"]) < bli.AddTime.Date)
                {
                    result = Json(new { status = "no", message = "请输入不小于今天的日期" }, JsonRequestBehavior.AllowGet);
                    //FineUI.Alert.Show("请输入不小于今天的日期!");
                    return(result);
                }
                bli.OutTime = DateTime.Parse(Request.Params["dpEndDate"] + " 23:59:59");
            }
            bli.OutBlacklistMode = (SeatManage.EnumType.LeaveBlacklistMode) int.Parse(Request.Params["ddlleaveMode"]);
            if (bli.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.ManuallyMode)
            {
                bli.ReMark = string.Format("被管理员{0}加入手动加入黑名单,管理员手动移除黑名单,备注:{1}", this.LoginId, Remark);
            }
            else
            {
                bli.ReMark = string.Format("被管理员{0}加入手动加入黑名单,记录黑名单{1}天,备注:{2}", this.LoginId, (bli.OutTime - bli.AddTime).Days, Remark);
            }
            bli.ReadingRoomID = ReadingRoomNo;
            int  blackId   = 0;
            bool cbIsAllRR = Request.Params["cbIsAllRR"] == null ? false : true;

            if (cbIsAllRR)
            {
                int roomCount = 0;
                List <SeatManage.ClassModel.ReadingRoomInfo> roomlist = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(null);
                foreach (SeatManage.ClassModel.ReadingRoomInfo roominfo in roomlist)
                {
                    if (roominfo.Setting.BlackListSetting.Used)
                    {
                        bli.ReadingRoomID = roominfo.No;
                        if (!(SeatManage.Bll.T_SM_Blacklist.AddBlackList(bli) > 0))
                        {
                            result = Json(new { status = "no", message = "添加失败" }, JsonRequestBehavior.AllowGet);
                            //  FineUI.Alert.Show("添加失败!");
                            // return;
                        }
                        else
                        {
                            roomCount++;
                        }
                    }
                }
                if (roomCount == 0)
                {
                    blackId = SeatManage.Bll.T_SM_Blacklist.AddBlackList(bli);
                }
                result = Json(new { status = "yes", message = "添加成功" }, JsonRequestBehavior.AllowGet);
                //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                //FineUI.Alert.Show("添加成功!");
            }
            else
            {
                blackId = SeatManage.Bll.T_SM_Blacklist.AddBlackList(bli);
                if (blackId > 0)
                {
                    result = Json(new { status = "yes", message = "添加成功" }, JsonRequestBehavior.AllowGet);
                    // PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    //  FineUI.Alert.Show("添加成功!");
                }
                else
                {
                    result = Json(new { status = "no", message = "添加失败" }, JsonRequestBehavior.AllowGet);
                    //FineUI.Alert.Show("添加失败!");
                }
            }

            return(result);
        }
Beispiel #12
0
        public JsonResult SureAllotSeat(string seatNo, string seatShortNo, string used, string cardNo)
        {
            JsonResult ret = null;

            SeatManage.ClassModel.Seat            seat     = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(seat.ReadingRoomNum);
            if (seat == null)
            {
                ret = Json(new { status = "no", message = "座位号错误,没有找到座位的相关信息" }, JsonRequestBehavior.AllowGet);
            }
            //判断当前座位上是否有读者在座。
            SeatManage.ClassModel.EnterOutLogInfo enterOutLogByseatNo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
            if (enterOutLogByseatNo != null && enterOutLogByseatNo.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
            {
                ret = Json(new { status = "no", message = "座位已经被其他读者选择" }, JsonRequestBehavior.AllowGet);
            }
            //判断读者是否有座位
            string strCardNo = cardNo;// txtCardNo1.Text;
            List <SeatManage.ClassModel.BlackListInfo> blacklistInfoByCardNo = SeatManage.Bll.T_SM_Blacklist.GetBlackListInfo(strCardNo);

            SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            if (roomInfo.Setting.UsedBlacklistLimit && blacklistInfoByCardNo.Count > 0)
            {
                if (roomInfo.Setting.BlackListSetting.Used)
                {
                    bool isblack = false;
                    foreach (SeatManage.ClassModel.BlackListInfo blinfo in blacklistInfoByCardNo)
                    {
                        if (blinfo.ReadingRoomID == roomInfo.No)
                        {
                            isblack = true;
                            break;
                        }
                    }
                    if (isblack)
                    {
                        ret = Json(new { status = "no", message = "该读者已进入黑名单,不能在该阅览室为其分配座位" }, JsonRequestBehavior.AllowGet);
                    }
                }
                else
                {
                    ret = Json(new { status = "no", message = "该读者已进入黑名单,不能在该阅览室为其分配座位" }, JsonRequestBehavior.AllowGet);
                }
            }
            SeatManage.ClassModel.EnterOutLogInfo enterOutLogByCardNo = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogInfoByCardNo(strCardNo);
            if (enterOutLogByCardNo != null && enterOutLogByCardNo.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
            {
                ret = Json(new { status = "no", message = string.Format("读者已经在{0},{1}号座位就做", enterOutLogByCardNo.ReadingRoomName, enterOutLogByCardNo.ShortSeatNo) }, JsonRequestBehavior.AllowGet);
            }

            SeatManage.ClassModel.EnterOutLogInfo enterOutLogModel = new SeatManage.ClassModel.EnterOutLogInfo();
            enterOutLogModel.CardNo        = strCardNo;
            enterOutLogModel.EnterOutLogNo = SeatManage.SeatManageComm.SeatComm.RndNum();
            enterOutLogModel.EnterOutState = SeatManage.EnumType.EnterOutLogType.SelectSeat;
            enterOutLogModel.EnterOutTime  = SeatManage.Bll.ServiceDateTime.Now;
            enterOutLogModel.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
            enterOutLogModel.Flag          = SeatManage.EnumType.Operation.Admin;
            enterOutLogModel.ReadingRoomNo = seat.ReadingRoomNum;
            enterOutLogModel.Remark        = string.Format("在后台管理网站被管理员{0},分配{1},{2}座位", this.LoginId, roomInfo.Name, seat.SeatNo.Substring(seat.SeatNo.Length - roomInfo.Setting.SeatNumAmount));
            enterOutLogModel.SeatNo        = seatNo;
            int newId = -1;

            SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLogModel, ref newId);
            if (result == SeatManage.EnumType.HandleResult.Successed)
            {
                ret = Json(new { status = "yes", message = "分配座位成功" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                ret = Json(new { status = "no", message = "分配座位失败" }, JsonRequestBehavior.AllowGet);
            }

            return(ret);
        }
Beispiel #13
0
        /// <summary>
        /// 添加黑名单
        /// </summary>
        /// <param name="seatNo"></param>
        /// <param name="seatShortNo"></param>
        /// <param name="used"></param>
        /// <param name="CardNo"></param>
        /// <param name="addBlackListRemark"></param>
        /// <returns></returns>
        public JsonResult SureAddBlacklist(string seatNo, string seatShortNo, string used, string CardNo, string addBlackListRemark)
        {
            addBlackListRemark = string.IsNullOrEmpty(addBlackListRemark) ? "未备注" : addBlackListRemark;

            JsonResult ret = null;

            SeatManage.ClassModel.Seat seat = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            SeatManage.ClassModel.RegulationRulesSetting rulesSet     = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            SeatManage.ClassModel.BlacklistSetting       blacklistSet = rulesSet.BlacklistSet;
            SeatManage.ClassModel.ReadingRoomInfo        readingroom  = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(seat.ReadingRoomNum);
            int i = -1;

            if (readingroom != null && readingroom.Setting.BlackListSetting.Used)
            {
                SeatManage.ClassModel.BlackListInfo blacklistModel = new SeatManage.ClassModel.BlackListInfo();
                blacklistModel.AddTime          = SeatManage.Bll.ServiceDateTime.Now;
                blacklistModel.ReadingRoomID    = readingroom.No;
                blacklistModel.BlacklistState   = SeatManage.EnumType.LogStatus.Valid;
                blacklistModel.CardNo           = CardNo;
                blacklistModel.OutBlacklistMode = readingroom.Setting.BlackListSetting.LeaveBlacklist;
                if (blacklistModel.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode)
                {
                    blacklistModel.ReMark  = string.Format("管理员{0}把读者加入黑名单,记录黑名单{1}天,备注:{2}", this.LoginId, readingroom.Setting.BlackListSetting.LimitDays, addBlackListRemark);
                    blacklistModel.OutTime = blacklistModel.AddTime.AddDays(readingroom.Setting.BlackListSetting.LimitDays);
                }
                else
                {
                    blacklistModel.ReMark = string.Format("管理员{0}把读者加入黑名单,手动离开黑名单,备注:{1}", this.LoginId, addBlackListRemark);
                }
                blacklistModel.ReadingRoomID = seat.ReadingRoomNum;
                i = SeatManage.Bll.T_SM_Blacklist.AddBlackList(blacklistModel);
            }
            else if (blacklistSet.Used)
            {
                SeatManage.ClassModel.BlackListInfo blacklistModel = new SeatManage.ClassModel.BlackListInfo();
                blacklistModel.AddTime          = SeatManage.Bll.ServiceDateTime.Now;
                blacklistModel.OutTime          = blacklistModel.AddTime.AddDays(blacklistSet.LimitDays);
                blacklistModel.BlacklistState   = SeatManage.EnumType.LogStatus.Valid;
                blacklistModel.CardNo           = CardNo;
                blacklistModel.OutBlacklistMode = blacklistSet.LeaveBlacklist;
                if (blacklistModel.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode)
                {
                    blacklistModel.ReMark  = string.Format("管理员{0}把读者加入黑名单,记录黑名单{1}天,备注:{2}", this.LoginId, blacklistSet.LimitDays, addBlackListRemark);
                    blacklistModel.OutTime = blacklistModel.AddTime.AddDays(blacklistSet.LimitDays);
                }
                else
                {
                    blacklistModel.ReMark = string.Format("管理员{0}把读者加入黑名单,手动离开黑名单,备注:{1}", this.LoginId, addBlackListRemark);
                }
                blacklistModel.ReadingRoomID = seat.ReadingRoomNum;
                i = SeatManage.Bll.T_SM_Blacklist.AddBlackList(blacklistModel);
            }
            else
            {
                ret = Json(new { status = "no", message = "对不起,此阅览室以及图书馆没有启用黑名单功能" }, JsonRequestBehavior.AllowGet);
            }
            if (i > 0)
            {
                SeatManage.ClassModel.EnterOutLogInfo enterOutLogModel = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogInfoByCardNo(CardNo);
                SeatManage.EnumType.EnterOutLogType   type             = enterOutLogModel.EnterOutState;
                enterOutLogModel.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
                enterOutLogModel.Flag          = SeatManage.EnumType.Operation.Admin;
                enterOutLogModel.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站加入黑名单并释放座位", enterOutLogModel.ReadingRoomName, enterOutLogModel.ShortSeatNo, this.LoginId);
                SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLogModel, ref i);
                if (result == SeatManage.EnumType.HandleResult.Successed)
                {
                    //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                    //rni.CardNo = enterOutLogModel.CardNo;
                    //rni.Type = SeatManage.EnumType.NoticeType.ManagerFreeSetWarning;
                    //rni.Note = enterOutLogModel.Remark;
                    //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                    //PushMsgInfo msg = new PushMsgInfo();
                    //msg.Title = "您好,您的座位已被释放";
                    //msg.MsgType = MsgPushType.AdminOperation;
                    //msg.StudentNum = enterOutLogModel.CardNo;
                    //msg.Message = enterOutLogModel.Remark;
                    //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);


                    if (type == SeatManage.EnumType.EnterOutLogType.ShortLeave)
                    {
                        List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLogModel.EnterOutLogID, null, null, null);
                        SeatManage.ClassModel.WaitSeatLogInfo        waitSeatLog  = null;
                        if (waitSeatLogs.Count > 0)
                        {
                            waitSeatLog              = waitSeatLogs[0];
                            waitSeatLog.NowState     = SeatManage.EnumType.LogStatus.Fail;
                            waitSeatLog.OperateType  = SeatManage.EnumType.Operation.OtherReader;
                            waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel;
                            if (SeatManage.Bll.T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog))
                            {
                                //rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                                //rni.CardNo = waitSeatLog.CardNo;
                                //rni.Type = SeatManage.EnumType.NoticeType.WaitSeatFail;
                                //rni.Note = "您所等待的座位已被管理员释放,您的等待已被取消";
                                //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                                //msg = new PushMsgInfo();
                                //msg.Title = "您好,您已被取消等待";
                                //msg.MsgType = MsgPushType.AdminOperation;
                                //msg.StudentNum = waitSeatLog.CardNo;
                                //msg.Message = "您所等待的座位已被管理员释放,您的等待已被取消";
                                //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);
                            }
                        }
                    }
                    ret = Json(new { status = "yes", message = "黑名单添加成功" }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    ret = Json(new { status = "no", message = "黑名单添加失败" }, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                ret = Json(new { status = "no", message = "黑名单添加失败" }, JsonRequestBehavior.AllowGet);
            }
            return(ret);
        }
Beispiel #14
0
        public JsonResult Leave(string seatNo, string seatShortNo, string used)
        {
            JsonResult ret = null;

            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
            SeatManage.ClassModel.ReadingRoomInfo roomInfo    = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
            SeatManage.EnumType.EnterOutLogType   type        = enterOutLog.EnterOutState;
            enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
            enterOutLog.Flag          = SeatManage.EnumType.Operation.Admin;
            enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId);
            int newId = -1;

            SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
            if (result == SeatManage.EnumType.HandleResult.Successed)
            {
                //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                //rni.CardNo = enterOutLog.CardNo;
                //rni.Type = SeatManage.EnumType.NoticeType.ManagerFreeSetWarning;
                //rni.Note = enterOutLog.Remark;
                //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                PushMsgInfo msg = new PushMsgInfo();
                msg.Title      = "您好,您的座位已被释放";
                msg.MsgType    = MsgPushType.AdminOperation;
                msg.StudentNum = enterOutLog.CardNo;
                msg.Message    = enterOutLog.Remark;
                SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);

                if (type == SeatManage.EnumType.EnterOutLogType.ShortLeave)
                {
                    List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null);
                    SeatManage.ClassModel.WaitSeatLogInfo        waitSeatLog  = null;
                    if (waitSeatLogs.Count > 0)
                    {
                        waitSeatLog              = waitSeatLogs[0];
                        waitSeatLog.NowState     = SeatManage.EnumType.LogStatus.Fail;
                        waitSeatLog.OperateType  = SeatManage.EnumType.Operation.OtherReader;
                        waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel;
                        if (SeatManage.Bll.T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog))
                        {
                            //rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                            //rni.CardNo = waitSeatLog.CardNo;
                            //rni.Type = SeatManage.EnumType.NoticeType.WaitSeatFail;
                            //rni.Note = "您所等待的座位已被管理员释放,您的等待已被取消";
                            //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                            //msg = new PushMsgInfo();
                            //msg.Title = "您好,您的等待已被取消";
                            //msg.MsgType = MsgPushType.AdminOperation;
                            //msg.StudentNum = waitSeatLog.CardNo;
                            //msg.Message = "您所等待的座位已被管理员释放,您的等待已被取消";
                            //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);
                        }
                    }
                }

                SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
                if (roomInfo.Setting.IsRecordViolate)
                {
                    if (roomInfo.Setting.BlackListSetting.Used)
                    {
                        if (roomInfo.Setting.BlackListSetting.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin])
                        {
                            SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.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  = SeatManage.Bll.ServiceDateTime.Now.ToString();
                            violationRecords.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin;
                            violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId);
                            violationRecords.BlacklistID   = "-1";
                            SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                        }
                    }
                    else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin])
                    {
                        SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.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  = SeatManage.Bll.ServiceDateTime.Now.ToString();
                        violationRecords.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin;
                        violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId);
                        violationRecords.BlacklistID   = "-1";
                        SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                    }
                }
                ret = Json(new { status = "yes", message = "设置读者离开成功" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                ret = Json(new { status = "no", message = "设置读者离开失败" }, JsonRequestBehavior.AllowGet);
            }

            return(ret);
        }
        protected void btn_SureAddBlacklist(object sender, EventArgs e)
        {
            SeatManage.ClassModel.Seat seat = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            SeatManage.ClassModel.RegulationRulesSetting rulesSet     = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            SeatManage.ClassModel.BlacklistSetting       blacklistSet = rulesSet.BlacklistSet;
            SeatManage.ClassModel.ReadingRoomInfo        readingroom  = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(seat.ReadingRoomNum);
            int i = -1;

            if (readingroom != null && readingroom.Setting.BlackListSetting.Used)
            {
                SeatManage.ClassModel.BlackListInfo blacklistModel = new SeatManage.ClassModel.BlackListInfo();
                blacklistModel.AddTime          = SeatManage.Bll.ServiceDateTime.Now;
                blacklistModel.ReadingRoomID    = readingroom.No;
                blacklistModel.BlacklistState   = SeatManage.EnumType.LogStatus.Valid;
                blacklistModel.CardNo           = txtCardNo.Text;
                blacklistModel.OutBlacklistMode = readingroom.Setting.BlackListSetting.LeaveBlacklist;
                if (blacklistModel.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode)
                {
                    blacklistModel.ReMark  = string.Format("管理员{0}把读者加入黑名单,记录黑名单{1}天,备注:{2}", this.LoginId, readingroom.Setting.BlackListSetting.LimitDays, txtRemark.Text);
                    blacklistModel.OutTime = blacklistModel.AddTime.AddDays(readingroom.Setting.BlackListSetting.LimitDays);
                }
                else
                {
                    blacklistModel.ReMark = string.Format("管理员{0}把读者加入黑名单,手动离开黑名单,备注:{1}", this.LoginId, txtRemark.Text);
                }
                blacklistModel.ReadingRoomID = seat.ReadingRoomNum;
                i = SeatManage.Bll.T_SM_Blacklist.AddBlackList(blacklistModel);
            }
            else if (blacklistSet.Used)
            {
                SeatManage.ClassModel.BlackListInfo blacklistModel = new SeatManage.ClassModel.BlackListInfo();
                blacklistModel.AddTime          = SeatManage.Bll.ServiceDateTime.Now;
                blacklistModel.OutTime          = blacklistModel.AddTime.AddDays(blacklistSet.LimitDays);
                blacklistModel.BlacklistState   = SeatManage.EnumType.LogStatus.Valid;
                blacklistModel.CardNo           = txtCardNo.Text;
                blacklistModel.OutBlacklistMode = blacklistSet.LeaveBlacklist;
                if (blacklistModel.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode)
                {
                    blacklistModel.ReMark  = string.Format("管理员{0}把读者加入黑名单,记录黑名单{1}天,备注:{2}", this.LoginId, blacklistSet.LimitDays, txtRemark.Text);
                    blacklistModel.OutTime = blacklistModel.AddTime.AddDays(blacklistSet.LimitDays);
                }
                else
                {
                    blacklistModel.ReMark = string.Format("管理员{0}把读者加入黑名单,手动离开黑名单,备注:{1}", this.LoginId, txtRemark.Text);
                }
                blacklistModel.ReadingRoomID = seat.ReadingRoomNum;
                i = SeatManage.Bll.T_SM_Blacklist.AddBlackList(blacklistModel);
            }
            else
            {
                FineUI.Alert.ShowInTop("对不起,此阅览室以及图书馆没有启用黑名单功能", "失败");
                return;
            }
            if (i > 0)
            {
                SeatManage.ClassModel.EnterOutLogInfo enterOutLogModel = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogInfoByCardNo(txtCardNo.Text);
                SeatManage.EnumType.EnterOutLogType   type             = enterOutLogModel.EnterOutState;
                enterOutLogModel.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
                enterOutLogModel.Flag          = SeatManage.EnumType.Operation.Admin;
                enterOutLogModel.Remark        = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站加入黑名单并释放座位", enterOutLogModel.ReadingRoomName, enterOutLogModel.ShortSeatNo, this.LoginId);
                SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLogModel, ref i);
                if (result == SeatManage.EnumType.HandleResult.Successed)
                {
                    //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                    //rni.CardNo = enterOutLogModel.CardNo;
                    //rni.Type = SeatManage.EnumType.NoticeType.ManagerFreeSetWarning;
                    //rni.Note = enterOutLogModel.Remark;
                    //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                    //PushMsgInfo msg = new PushMsgInfo();
                    //msg.Title = "您好,您的座位已被释放";
                    //msg.MsgType = MsgPushType.AdminOperation;
                    //msg.StudentNum = enterOutLogModel.CardNo;
                    //msg.Message = enterOutLogModel.Remark;
                    //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);


                    if (type == SeatManage.EnumType.EnterOutLogType.ShortLeave)
                    {
                        List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLogModel.EnterOutLogID, null, null, null);
                        SeatManage.ClassModel.WaitSeatLogInfo        waitSeatLog  = null;
                        if (waitSeatLogs.Count > 0)
                        {
                            waitSeatLog              = waitSeatLogs[0];
                            waitSeatLog.NowState     = SeatManage.EnumType.LogStatus.Fail;
                            waitSeatLog.OperateType  = SeatManage.EnumType.Operation.OtherReader;
                            waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel;
                            if (SeatManage.Bll.T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog))
                            {
                                //rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                                //rni.CardNo = waitSeatLog.CardNo;
                                //rni.Type = SeatManage.EnumType.NoticeType.WaitSeatFail;
                                //rni.Note = "您所等待的座位已被管理员释放,您的等待已被取消";
                                //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                                //msg = new PushMsgInfo();
                                //msg.Title = "您好,您已被取消等待";
                                //msg.MsgType = MsgPushType.AdminOperation;
                                //msg.StudentNum = waitSeatLog.CardNo;
                                //msg.Message = "您所等待的座位已被管理员释放,您的等待已被取消";
                                //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);
                            }
                        }
                    }

                    FineUI.Alert.ShowInTop("黑名单添加成功", "成功");
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else
                {
                    FineUI.Alert.ShowInTop("黑名单添加失败", "失败");
                }
            }
            else
            {
                FineUI.Alert.ShowInTop("黑名单添加失败", "失败");
            }
        }
        protected void btnSureAllotSeat_Click(object sender, EventArgs e)
        {
            SeatManage.ClassModel.Seat            seat     = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(seat.ReadingRoomNum);
            if (seat == null)
            {
                FineUI.Alert.ShowInTop("座位号错误,没有找到座位的相关信息");
                return;
            }
            //判断当前座位上是否有读者在座。
            SeatManage.ClassModel.EnterOutLogInfo enterOutLogByseatNo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
            if (enterOutLogByseatNo != null && enterOutLogByseatNo.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
            {
                FineUI.Alert.ShowInTop("座位已经被其他读者选择");
                return;
            }
            //判断读者是否有座位
            string strCardNo = txtCardNo1.Text;
            List <SeatManage.ClassModel.BlackListInfo> blacklistInfoByCardNo = SeatManage.Bll.T_SM_Blacklist.GetBlackListInfo(strCardNo);

            SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            if (roomInfo.Setting.UsedBlacklistLimit && blacklistInfoByCardNo.Count > 0)
            {
                if (roomInfo.Setting.BlackListSetting.Used)
                {
                    bool isblack = false;
                    foreach (SeatManage.ClassModel.BlackListInfo blinfo in blacklistInfoByCardNo)
                    {
                        if (blinfo.ReadingRoomID == roomInfo.No)
                        {
                            isblack = true;
                            break;
                        }
                    }
                    if (isblack)
                    {
                        FineUI.Alert.ShowInTop("该读者已进入黑名单,不能在该阅览室为其分配座位");
                        return;
                    }
                }
                else
                {
                    FineUI.Alert.ShowInTop("该读者已进入黑名单,不能在该阅览室为其分配座位");
                    return;
                }
            }
            SeatManage.ClassModel.EnterOutLogInfo enterOutLogByCardNo = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogInfoByCardNo(strCardNo);
            if (enterOutLogByCardNo != null && enterOutLogByCardNo.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
            {
                FineUI.Alert.ShowInTop(string.Format("读者已经在{0},{1}号座位就做", enterOutLogByCardNo.ReadingRoomName, enterOutLogByCardNo.ShortSeatNo));
                return;
            }

            SeatManage.ClassModel.EnterOutLogInfo enterOutLogModel = new SeatManage.ClassModel.EnterOutLogInfo();
            enterOutLogModel.CardNo        = strCardNo;
            enterOutLogModel.EnterOutLogNo = SeatManage.SeatManageComm.SeatComm.RndNum();
            enterOutLogModel.EnterOutState = SeatManage.EnumType.EnterOutLogType.SelectSeat;
            enterOutLogModel.EnterOutTime  = SeatManage.Bll.ServiceDateTime.Now;
            enterOutLogModel.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
            enterOutLogModel.Flag          = SeatManage.EnumType.Operation.Admin;
            enterOutLogModel.ReadingRoomNo = seat.ReadingRoomNum;
            enterOutLogModel.Remark        = string.Format("在后台管理网站被管理员{0},分配{1},{2}座位", this.LoginId, roomInfo.Name, seat.SeatNo.Substring(seat.SeatNo.Length - roomInfo.Setting.SeatNumAmount));
            enterOutLogModel.SeatNo        = seatNo;
            int newId = -1;

            SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLogModel, ref newId);
            if (result == SeatManage.EnumType.HandleResult.Successed)
            {
                FineUI.Alert.ShowInTop("分配座位成功", "成功");
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                FineUI.Alert.ShowInTop("分配座位失败", "失败");
            }
        }
        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();
                            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != SeatManage.EnumType.EnterOutLogType.ShortLeave)
                            {
                                SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
                                enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
                                enterOutLog.Flag          = SeatManage.EnumType.Operation.Admin;
                                enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置为暂离", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"].ToString());
                                int newId = -1;
                                SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                if (result == SeatManage.EnumType.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();
                            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState == SeatManage.EnumType.EnterOutLogType.ShortLeave)
                            {
                                SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
                                enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ComeBack;
                                enterOutLog.Flag          = SeatManage.EnumType.Operation.Admin;
                                enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备取消暂离,恢复为在座", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"].ToString());
                                int newId = -1;
                                SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                if (result == SeatManage.EnumType.HandleResult.Successed)
                                {
                                    List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null);
                                    SeatManage.ClassModel.WaitSeatLogInfo        waitSeatLog  = null;
                                    if (waitSeatLogs.Count > 0)
                                    {
                                        waitSeatLog              = waitSeatLogs[0];
                                        waitSeatLog.NowState     = SeatManage.EnumType.LogStatus.Fail;
                                        waitSeatLog.OperateType  = SeatManage.EnumType.Operation.OtherReader;
                                        waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel;
                                        if (SeatManage.Bll.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();
                            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
                            {
                                SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);

                                enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
                                enterOutLog.Flag          = SeatManage.EnumType.Operation.Admin;
                                enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"].ToString());
                                int newId = -1;
                                SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId);
                                if (result == SeatManage.EnumType.HandleResult.Successed)
                                {
                                    SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
                                    if (roomInfo.Setting.IsRecordViolate)
                                    {
                                        if (roomInfo.Setting.BlackListSetting.Used)
                                        {
                                            if (roomInfo.Setting.BlackListSetting.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin])
                                            {
                                                SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.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  = SeatManage.Bll.ServiceDateTime.Now.ToString();
                                                violationRecords.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin;
                                                violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"].ToString());
                                                violationRecords.BlacklistID   = "-1";
                                                SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords);
                                            }
                                        }
                                        else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin])
                                        {
                                            SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.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  = SeatManage.Bll.ServiceDateTime.Now.ToString();
                                            violationRecords.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin;
                                            violationRecords.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"].ToString());
                                            violationRecords.BlacklistID   = "-1";
                                            SeatManage.Bll.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();
                            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != SeatManage.EnumType.EnterOutLogType.ShortLeave)
                            {
                                DateTime markTime = SeatManage.Bll.ServiceDateTime.Now;
                                SeatManage.Bll.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();
                            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.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");
                                SeatManage.Bll.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;
                        SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
                        for (int i = 0; i < noArr.Length; i++)
                        {
                            newId  = -1;
                            seatNo = noArr[i].Trim();
                            SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo);
                            if (enterOutLog != null && enterOutLog.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
                            {
                                SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo);
                                if (roomInfo != null && roomInfo.Setting.BlackListSetting.Used)
                                {
                                    SeatManage.ClassModel.BlackListInfo blacklistModel = new SeatManage.ClassModel.BlackListInfo();
                                    blacklistModel.AddTime          = SeatManage.Bll.ServiceDateTime.Now;
                                    blacklistModel.ReadingRoomID    = roomInfo.No;
                                    blacklistModel.BlacklistState   = SeatManage.EnumType.LogStatus.Valid;
                                    blacklistModel.CardNo           = enterOutLog.CardNo;
                                    blacklistModel.OutBlacklistMode = roomInfo.Setting.BlackListSetting.LeaveBlacklist;
                                    if (blacklistModel.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode)
                                    {
                                        blacklistModel.ReMark  = string.Format("管理员{0}通过手持设备{0}把读者加入黑名单,记录黑名单{1}天", Session["LoginID"].ToString(), roomInfo.Setting.BlackListSetting.LimitDays);
                                        blacklistModel.OutTime = blacklistModel.AddTime.AddDays(roomInfo.Setting.BlackListSetting.LimitDays);
                                    }
                                    else
                                    {
                                        blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", Session["LoginID"].ToString());
                                    }
                                    blacklistModel.ReadingRoomID = roomInfo.No;
                                    newId = SeatManage.Bll.T_SM_Blacklist.AddBlackList(blacklistModel);
                                }
                                else if (rulesSet.BlacklistSet.Used)
                                {
                                    SeatManage.ClassModel.BlackListInfo blacklistModel = new SeatManage.ClassModel.BlackListInfo();
                                    blacklistModel.AddTime          = SeatManage.Bll.ServiceDateTime.Now;
                                    blacklistModel.OutTime          = blacklistModel.AddTime.AddDays(rulesSet.BlacklistSet.LimitDays);
                                    blacklistModel.BlacklistState   = SeatManage.EnumType.LogStatus.Valid;
                                    blacklistModel.CardNo           = enterOutLog.CardNo;
                                    blacklistModel.OutBlacklistMode = rulesSet.BlacklistSet.LeaveBlacklist;
                                    if (blacklistModel.OutBlacklistMode == SeatManage.EnumType.LeaveBlacklistMode.AutomaticMode)
                                    {
                                        blacklistModel.ReMark  = string.Format("管理员{0}通过手持设备把读者加入黑名单,记录黑名单{1}天", Session["LoginID"].ToString(), rulesSet.BlacklistSet.LimitDays);
                                        blacklistModel.OutTime = blacklistModel.AddTime.AddDays(rulesSet.BlacklistSet.LimitDays);
                                    }
                                    else
                                    {
                                        blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", Session["LoginID"].ToString());
                                    }
                                    blacklistModel.ReadingRoomID = roomInfo.No;
                                    newId = SeatManage.Bll.T_SM_Blacklist.AddBlackList(blacklistModel);
                                }
                                else
                                {
                                    Page.RegisterStartupScript("", "<script>alert('对不起,此阅览室以及图书馆没有启用黑名单功能');</script>");
                                    return;
                                }
                                if (newId > 0)
                                {
                                    enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
                                    enterOutLog.Flag          = SeatManage.EnumType.Operation.Admin;
                                    enterOutLog.Remark        = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"].ToString());

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