Ejemplo n.º 1
0
 /// <summary>
 /// 获取座位管理规则设置
 /// </summary>
 /// <returns></returns>
 private RegulationRulesSetting GetRegulationRulesSetting()
 {
     try
     {
         return(T_SM_SystemSet.GetRegulationRulesSetting());
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 同步读者信息
 /// </summary>
 public void SysnceReaderInfo(ref bool isUpdate)
 {
     try
     {
         StuLibSyncSetting syncSet = T_SM_SystemSet.GetStuLibSync();
         if (syncSet == null)
         {
             return;
         }
         if (syncSet.SyncMode != StudentSyncMode.OptionalSync)
         {
             return;
         }
         if (DateTime.Compare(DateTime.Parse(ServiceDateTime.Now.ToShortDateString() + " " + syncSet.SyncTime), ServiceDateTime.Now) < 0)
         {
             if (!isUpdate)
             {
                 return;
             }
             addAmount    = 0;
             updateAmount = 0;
             filedAmount  = 0;
             IStuLibSync stuLibSync;
             try
             {
                 stuLibSync = AssemblyFactory.CreateAssembly("IStuLibSync") as IStuLibSync;
             }
             catch
             {
                 isUpdate = true;
                 throw;
             }
             stuLibSync.StuLibSyncSet = syncSet;
             //同步开始执行事件
             stuLibSync.Syncing += StuLibSync_Syncing;
             //同步结束事件
             stuLibSync.Synced += StuLibSync_Synced;
             isUpdate           = false;
             stuLibSync.Sync();
         }
         else  //如果时间过了,重新变为true;
         {
             isUpdate = true;
         }
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("读者信息同步:读者信息同步遇到异常:{0}", ex.Message));
     }
 }
 /// <summary>
 /// 获取最新设置
 /// </summary>
 public void GetSetting()
 {
     try
     {
         //获取全部阅览室信息和黑名单设置
         List <ReadingRoomInfo> rooms = T_SM_ReadingRoom.GetReadingRooms(null, null, null);
         regulationRulesSetting = T_SM_SystemSet.GetRegulationRulesSetting();
         roomList.Clear();
         foreach (ReadingRoomInfo room in rooms)
         {
             roomList.Add(room.No, room);
         }
     }
     catch (Exception e)
     {
         WriteLog.Write(string.Format("监控服务:获取阅览室设置时遇到错误:{0}", e.Message));
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 连接测试
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void testsconn_Click(object sender, EventArgs e)
        {
            StuLibSyncSetting SyncSet = T_SM_SystemSet.GetStuLibSync();

            if (SyncSet != null)
            {
                IStuLibSync StuLibSync = AssemblyFactory.CreateAssembly("IStuLibSync") as IStuLibSync;// SystemTerminalFactory.CreateStuLibSync();
                StuLibSync.StuLibSyncSet = SyncSet;
                if (StuLibSync.LinkDataSourceTest())
                {
                    FineUI.Alert.Show("测试成功!");
                }
                else
                {
                    FineUI.Alert.Show("测试失败!");
                }
            }
            else
            {
                FineUI.Alert.Show("获取设置失败!");
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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("添加失败!");
                }
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LoginId"] == null)
            {
                Response.Redirect("../Login.aspx");
            }
            if (!IsPostBack)
            {
                BindReadingRoomList(Session[CookiesManager.LoginID].ToString());
                GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value);
            }

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

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

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

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

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

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

                    break;

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

                    break;

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

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

                case "LoginOut":
                    HttpCookie aCookie;
                    string     cookieName;
                    int        limit = Request.Cookies.Count;
                    for (int i = 0; i < limit; i++)
                    {
                        cookieName      = Request.Cookies[i].Name;
                        aCookie         = new HttpCookie(cookieName);
                        aCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(aCookie);
                    }
                    Response.Redirect("../Login.aspx");
                    break;
                }
                #endregion
            }
        }