Exemplo n.º 1
0
        /// <summary>
        /// 获取座位使用状态
        /// </summary>
        /// <param name="seatNo"></param>
        /// <returns></returns>
        public static EnterOutLogType GetSeatUsedState(string seatNo)
        {
            IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService();
            bool error = false;

            try
            {
                EnterOutLogInfo model = seatService.GetEnterOutLogInfoWithBookWaitBySeatNum(seatNo);
                if (model != null)
                {
                    SeatManage.EnumType.EnterOutLogType type = model.EnterOutState;
                    return(type);
                }
                else
                {
                    List <BespeakLogInfo> bespeakLogs = seatService.GetBespeakLogInfoBySeatNo(seatNo, DateTime.Now);
                    if (bespeakLogs.Count > 0 && bespeakLogs[0].BsepeakState == SeatManage.EnumType.BookingStatus.Waiting)
                    {
                        return(EnterOutLogType.BespeakWaiting);
                    }
                    return(EnterOutLogType.None);
                }
            }
            catch (Exception ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("获取座位状态失败:" + ex.Message);
                return(EnterOutLogType.None);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取座位使用状态
        /// </summary>
        /// <param name="seatNo"></param>
        /// <returns></returns>
        public static EnterOutLogType GetSeatUsedState(string seatNo)
        {
            IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                EnterOutLogInfo model = seatService.GetEnterOutLogInfoWithBookWaitBySeatNum(seatNo);
                if (model != null)
                {
                    SeatManage.EnumType.EnterOutLogType type = model.EnterOutState;
                    return(type);
                }
                else
                {
                    List <BespeakLogInfo> bespeakLogs = seatService.GetBespeakLogInfoBySeatNo(seatNo, DateTime.Now);
                    if (bespeakLogs.Count > 0 && bespeakLogs[0].BsepeakState == SeatManage.EnumType.BookingStatus.Waiting)
                    {
                        return(EnterOutLogType.BespeakWaiting);
                    }
                    return(EnterOutLogType.None);
                }
            }
            catch (Exception ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("获取座位状态失败:" + ex.Message);
                return(EnterOutLogType.None);
            }
            finally
            {
                ICommunicationObject ICommObjectService = seatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        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 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("设置读者离开失败", "失败");
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }