/// <summary> /// 根据记录ID查询记录 /// </summary> /// <param name="enterOutLogID"></param> /// <returns></returns> public EnterOutLogInfo GetEnterOutLogBakInfoById(int enterOutLogID) { SeatManage.ClassModel.EnterOutLogInfo enterOutInfo = null;//创建一个进出记录实体 string strWhere = " [EnterOutLogID]=@EnterOutLogID "; SqlParameter[] parameters = { new SqlParameter("@EnterOutLogID", enterOutLogID) }; try { DataSet dsEnterOutLog = enteroutlog_bak_dal.GetList(strWhere, parameters);//获取读者的信息 if (dsEnterOutLog.Tables[0].Rows.Count > 0) { enterOutInfo = DataRowToEnterOutLogBakInfo(dsEnterOutLog.Tables[0].Rows[0]); } } catch (Exception ex) { //TODO:记录错误日志 return (null); } return(enterOutInfo); }
/// <summary> /// 根据座位号获取座位信息 /// </summary> /// <param name="seatNum"></param> /// <returns></returns> public SeatManage.ClassModel.Seat GetSeatInfoBySeatNum(string seatNum) { string strWhere = string.Format(" SeatNo='{0}' ", seatNum); DataSet ds = t_sm_seat.GetList(strWhere.ToString(), null); if (ds.Tables[0].Rows.Count > 0) { SeatManage.ClassModel.Seat seat = DataRowToSeatModel(ds.Tables[0].Rows[0]); if (!string.IsNullOrEmpty(seat.ReadingRoomNum)) { List <SeatManage.ClassModel.ReadingRoomInfo> room = GetReadingRoomInfo(new List <string>() { seat.ReadingRoomNum }); if (room.Count > 0 && room[0].SeatList.Seats.ContainsKey(seat.SeatNo)) { seat.IsSuspended = room[0].SeatList.Seats[seat.SeatNo].IsSuspended; seat.HavePower = room[0].SeatList.Seats[seat.SeatNo].HavePower; seat.ReadingRoom = room[0]; } } SeatManage.ClassModel.EnterOutLogInfo enteroutlog = GetEnterOutLogInfoBySeatNum(seatNum); if (enteroutlog != null) { seat.SeatUsedState = enteroutlog.EnterOutState; seat.UserCardNo = enteroutlog.CardNo; seat.UserName = enteroutlog.ReaderName; seat.ShortSeatNo = enteroutlog.ShortSeatNo; seat.BeginUsedTime = enteroutlog.EnterOutTime; } else { seat.SeatUsedState = EnterOutLogType.Leave; seat.UserCardNo = ""; seat.UserName = ""; seat.ShortSeatNo = SeatManage.SeatManageComm.SeatComm.SeatNoToShortSeatNo(seat.ReadingRoom.Setting.SeatNumAmount, seat.SeatNo); } return(seat); } else { return(null); } }
public string SubmitWaitInfo(WaitSeatLogInfo waitInfo) { try { SeatManage.ClassModel.EnterOutLogInfo enterOutLog = seatManage.GetEnterOutLogInfoBySeatNum(waitInfo.SeatNo); if (enterOutLog == null) { return("等待座位失败,请刷新页面重新尝试"); } if (enterOutLog.EnterOutState == EnterOutLogType.BookingConfirmation || enterOutLog.EnterOutState == EnterOutLogType.ComeBack || enterOutLog.EnterOutState == EnterOutLogType.ContinuedTime || enterOutLog.EnterOutState == EnterOutLogType.ReselectSeat || enterOutLog.EnterOutState == EnterOutLogType.SelectSeat || enterOutLog.EnterOutState == EnterOutLogType.WaitingSuccess) { enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave; enterOutLog.EnterOutType = SeatManage.EnumType.LogStatus.Valid; enterOutLog.Flag = SeatManage.EnumType.Operation.OtherReader; enterOutLog.Remark = string.Format("在{0} {1}号座位,被读者{2}在手机预约网站设置为暂离并等待该座位", enterOutLog.ReadingRoomName, enterOutLog.ShortSeatNo, waitInfo.CardNo); int newLogId = -1; HandleResult result = seatManage.AddEnterOutLogInfo(enterOutLog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { waitInfo.EnterOutLogID = newLogId; seatManage.AddWaitLog(waitInfo); return(string.Format("您以成功等待{0} {1}号座位", enterOutLog.ReadingRoomName, enterOutLog.ShortSeatNo)); } else { return("等待座位失败!"); } } else { return("此座位不能被等待,请重新选择!"); } } catch (Exception ex) { throw ex; } }
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 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("设置读者离开失败", "失败"); } }
protected void btn_shortLeave(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); if (btnShortLeave.Text == "暂离") { enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave; 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.ManagerSetShortLeaveWarning; //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); FineUI.Alert.ShowInTop("设置读者暂离成功", "成功"); PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference()); } else { FineUI.Alert.ShowInTop("设置读者暂离失败", "失败"); } } else { enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ComeBack; 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.RecoverSeat; //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); 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); FineUI.Alert.ShowInTop("取消读者暂离成功", "成功"); PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference()); } else { FineUI.Alert.ShowInTop("取消读者暂离成功,取消等待失败", "失败"); } } else { FineUI.Alert.ShowInTop("取消读者暂离成功", "成功"); PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference()); } } else { FineUI.Alert.ShowInTop("取消读者暂离失败", "失败"); } } }
/// <summary> /// 获取实时记录 /// 预约记录 ///选座记录 ///等待记录 ///黑名单记录 /// </summary> /// <param name="cardNum"></param> /// <param name="getItemsParameter"></param> /// <returns></returns> public string GetReaderActualTimeRecord(string cardNum, string getItemsParameter) { try { if (string.IsNullOrEmpty(cardNum) || string.IsNullOrEmpty(getItemsParameter)) { JM_HandleResult result = new JM_HandleResult(); result.Result = false; result.Msg = "输入的数据数据不能为空!"; return(SeatManage.SeatManageComm.JSONSerializer.Serialize(result)); } JsonModel.JM_ActualTimeRecordParam param = SeatManageComm.JSONSerializer.Deserialize <JsonModel.JM_ActualTimeRecordParam>(getItemsParameter); JsonModel.JM_ActualTimeRecords records = new JsonModel.JM_ActualTimeRecords(); if (param.GetEnterOutLog)//获取进出记录 { SeatManage.ClassModel.EnterOutLogInfo enterOutLog = seatDataService.GetEnterOutLogInfoByCardNo(cardNum); JsonModel.JM_EnterOutLog jm_enterOutLog = null; if (enterOutLog != null) { jm_enterOutLog = new JsonModel.JM_EnterOutLog(); jm_enterOutLog.EnterOutTime = enterOutLog.EnterOutTime.ToString("yyyy-MM-dd HH:mm:ss"); jm_enterOutLog.EnterOutState = enterOutLog.EnterOutState.ToString(); jm_enterOutLog.Id = enterOutLog.EnterOutLogID; jm_enterOutLog.SeatId = enterOutLog.SeatNo; jm_enterOutLog.SeatNum = enterOutLog.ShortSeatNo; jm_enterOutLog.RoomName = enterOutLog.ReadingRoomName; jm_enterOutLog.RoomNum = enterOutLog.ReadingRoomNo; SeatManage.ClassModel.ReadingRoomInfo room = seatDataService.GetReadingRoomInfo(new List <string>() { enterOutLog.ReadingRoomNo })[0]; if (enterOutLog.EnterOutState == EnterOutLogType.ShortLeave) { String seatInfo = enterOutLog.Remark; double saveTimeLength = 0; if (enterOutLog.Flag == Operation.Admin) { if (room.Setting.AdminShortLeave.IsUsed) { saveTimeLength = room.Setting.AdminShortLeave.HoldTimeLength; } else { saveTimeLength = SeatManage.ClassModel.ReadingRoomSetting.GetSeatHoldTime(room.Setting.SeatHoldTime, enterOutLog.EnterOutTime); } } else { saveTimeLength = SeatManage.ClassModel.ReadingRoomSetting.GetSeatHoldTime(room.Setting.SeatHoldTime, enterOutLog.EnterOutTime); } string saveTime = enterOutLog.EnterOutTime.AddMinutes(saveTimeLength).ToShortTimeString(); jm_enterOutLog.Remark = string.Format("座位将为您保留至{2}。", enterOutLog.ReadingRoomName, enterOutLog.ShortSeatNo, saveTime); } else { switch (enterOutLog.EnterOutState) { case EnterOutLogType.BookingConfirmation: case EnterOutLogType.SelectSeat: case EnterOutLogType.ContinuedTime: case EnterOutLogType.ComeBack: case EnterOutLogType.ReselectSeat: case EnterOutLogType.WaitingSuccess: List <SeatManage.ClassModel.BespeakLogInfo> bespeaklist = seatDataService.GetBespeakLogInfoBySeatNo(enterOutLog.SeatNo, DateTime.Now); DateTime dt = new DateTime(); if (bespeaklist.Count > 0) { dt = bespeaklist[0].BsepeakTime.AddMinutes(-double.Parse(room.Setting.SeatBespeak.ConfirmTime.BeginTime)); } else if (room.Setting.SeatUsedTimeLimit.Used) { if (room.Setting.SeatUsedTimeLimit.Mode == "Free") { dt = enterOutLog.EnterOutTime.AddMinutes(room.Setting.SeatUsedTimeLimit.UsedTimeLength); if (dt > room.Setting.RoomOpenSet.NowCloseTime(enterOutLog.EnterOutTime)) { dt = room.Setting.RoomOpenSet.NowCloseTime(enterOutLog.EnterOutTime); } } else { for (int i = 0; i < room.Setting.SeatUsedTimeLimit.FixedTimes.Count; i++) { if (enterOutLog.EnterOutTime < room.Setting.SeatUsedTimeLimit.FixedTimes[i]) { if (room.Setting.SeatUsedTimeLimit.IsCanContinuedTime && enterOutLog.EnterOutTime > room.Setting.SeatUsedTimeLimit.FixedTimes[i].AddMinutes(-room.Setting.SeatUsedTimeLimit.CanDelayTime)) { if (i + 1 < room.Setting.SeatUsedTimeLimit.FixedTimes.Count) { dt = room.Setting.SeatUsedTimeLimit.FixedTimes[i + 1]; } else { dt = room.Setting.RoomOpenSet.NowCloseTime(enterOutLog.EnterOutTime); } } else { dt = room.Setting.SeatUsedTimeLimit.FixedTimes[i]; } break; } } } } //TODO:如果是续时模式,提示续时时间。 jm_enterOutLog.Remark = string.Format("您的座位可以使用到{0}。", dt.ToShortTimeString()); break; } } } records.EnterOutLog = jm_enterOutLog; } if (param.GetBespeakLog) { JsonModel.JM_BespeakLog jm_bespeakLog = null; SeatManage.ClassModel.BespeakLogInfo bespeakLogs = seatDataService.GetSingleBespeakLogForWait(cardNum); if (bespeakLogs != null) { jm_bespeakLog = new JM_BespeakLog(); jm_bespeakLog.DateTime = bespeakLogs.BsepeakTime.ToString("yyyy-MM-dd HH:mm:ss"); jm_bespeakLog.Id = bespeakLogs.BsepeaklogID; if (bespeakLogs.BsepeakState == EnumType.BookingStatus.Waiting) { jm_bespeakLog.IsValid = true; } jm_bespeakLog.RoomName = bespeakLogs.ReadingRoomName; jm_bespeakLog.RoomNum = bespeakLogs.ReadingRoomNo; jm_bespeakLog.SeatId = bespeakLogs.SeatNo; jm_bespeakLog.SeatNum = bespeakLogs.ShortSeatNum; jm_bespeakLog.Remark = bespeakLogs.Remark; records.BespeakLog = jm_bespeakLog; } } if (param.GetWaitLog) { List <EnterOutLogType> logType = new List <EnterOutLogType>(); logType.Add(EnterOutLogType.Waiting); List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatlogs = seatDataService.GetWaitLogList(cardNum, null, null, null, logType); if (waitSeatlogs.Count > 0) { EnterOutLogInfo waitEnterOutLog = seatDataService.GetEnterOutLogInfoById(waitSeatlogs[0].EnterOutLogID); if (waitEnterOutLog != null) { JsonModel.JM_WaitSeatLog jm_waitSeatLog = new JM_WaitSeatLog(); jm_waitSeatLog.CardNo = waitSeatlogs[0].CardNo; jm_waitSeatLog.CardNoB = waitSeatlogs[0].CardNoB; jm_waitSeatLog.RoomName = waitEnterOutLog.ReadingRoomName; jm_waitSeatLog.RoomNum = waitEnterOutLog.ReadingRoomNo; jm_waitSeatLog.SeatId = waitEnterOutLog.SeatNo; jm_waitSeatLog.SeatNum = waitEnterOutLog.ShortSeatNo; jm_waitSeatLog.SeatWaitTime = waitSeatlogs[0].SeatWaitTime.ToString("yyyy-MM-dd HH:mm:ss"); jm_waitSeatLog.SeatWaitingID = waitSeatlogs[0].SeatWaitingID; records.WaitSeatLog = jm_waitSeatLog; } } } if (param.GetBlackList) { List <BlackListInfo> blacklist = seatDataService.GetBlacklistInfo(cardNum); if (blacklist.Count > 0) { JM_Blacklist jm_blacklist = new JM_Blacklist(); jm_blacklist.AddTime = blacklist[0].AddTime.ToString("yyyy-MM-dd HH:mm:ss"); jm_blacklist.CardNo = blacklist[0].CardNo; jm_blacklist.ID = blacklist[0].ID; switch (blacklist[0].BlacklistState) { case LogStatus.Valid: jm_blacklist.IsValid = true; break; default: jm_blacklist.IsValid = false; break; } jm_blacklist.OutBlacklistMode = blacklist[0].OutBlacklistMode.ToString(); jm_blacklist.OutTime = blacklist[0].OutTime.ToString("yyyy-MM-dd HH:mm:ss"); jm_blacklist.ReMark = blacklist[0].ReMark; records.BlacklistLog = jm_blacklist; } } return(SeatManageComm.JSONSerializer.Serialize(records)); } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write("选择座位遇到异常:" + ex.Message); JM_HandleResult result = new JM_HandleResult(); result.Result = false; result.Msg = "执行遇到异常!"; return(SeatManage.SeatManageComm.JSONSerializer.Serialize(result)); } }
/// <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; }
/// <summary> /// 获取 /// </summary> /// <param name="bespeakInfo"></param> /// <returns></returns> public string SubmitNowDayBespeakInfo(BespeakLogInfo bespeakInfo) { string returnValue = ""; List <BespeakLogInfo> seatbespeak = seatManage.GetBespeakLogInfoBySeatNo(bespeakInfo.SeatNo, bespeakInfo.BsepeakTime); List <ReadingRoomInfo> rooms = seatManage.GetReadingRooms(new List <string>() { bespeakInfo.ReadingRoomNo }, null, null); if (rooms.Count == 0) { throw new SeatBespeakException.BespeakSeatFailed("获取阅览室信息失败。"); } List <BespeakLogInfo> bespeak = seatManage.GetBespeakLogs(bespeakInfo.CardNo, null, bespeakInfo.BsepeakTime, 0, new List <SeatManage.EnumType.BookingStatus> { SeatManage.EnumType.BookingStatus.Confinmed, SeatManage.EnumType.BookingStatus.Waiting }); //.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus); if (bespeak.Count >= rooms[0].Setting.SeatBespeak.BespeakSeatCount) { throw new SeatBespeakException.BespeakSeatFailed("对不起,您一天最多预约" + rooms[0].Setting.SeatBespeak.BespeakSeatCount + "个座位。"); } //判断读者是否有座位 if (!rooms[0].Setting.SeatBespeak.BespeatWithOnSeat) { SeatManage.ClassModel.EnterOutLogInfo eol = seatManage.GetEnterOutLogInfoByCardNo(bespeakInfo.CardNo); if (eol != null && eol.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave) { throw new SeatBespeakException.BespeakSeatFailed("您已有座位,不能再预约座位"); } } if (rooms[0].Setting.SeatBespeak.CanBookMultiSpan && rooms[0].Setting.SeatBespeak.SpecifiedTime) { foreach (BespeakLogInfo b in seatbespeak) { if (b.BsepeakTime == bespeakInfo.BsepeakTime) { throw new SeatBespeakException.BespeakSeatFailed("对不起,此时间段已被预约。"); } } foreach (BespeakLogInfo b in bespeak) { if (b.BsepeakTime == bespeakInfo.BsepeakTime && b.BsepeakState == BookingStatus.Waiting) { throw new SeatBespeakException.BespeakSeatFailed("对不起,同一时间段只能预约一个座位。"); } } if (bespeakInfo.SubmitTime == bespeakInfo.BsepeakTime) { foreach (BespeakLogInfo b in bespeak) { if (b.BsepeakTime == b.SubmitTime && b.BsepeakState == BookingStatus.Waiting) { throw new SeatBespeakException.BespeakSeatFailed("对不起,只能同时进行一次及时预约。"); } } } } else { foreach (BespeakLogInfo b in bespeak) { if (b.BsepeakState == BookingStatus.Waiting) { throw new SeatBespeakException.BespeakSeatFailed("对不起,您已有等待签到的座位。"); } } foreach (BespeakLogInfo b in seatbespeak) { if (b.BsepeakState == EnumType.BookingStatus.Waiting) { throw new Exception("所选座位已经被预约。"); } } } List <BlackListInfo> blackLog = seatManage.GetBlacklistInfo(bespeakInfo.CardNo); if (blackLog.Count > 0) { throw new SeatBespeakException.BespeakSeatFailed("你已被记录黑名单,无法预约座位。"); } if (rooms.Count > 0) { ReadingRoomInfo r = rooms[0]; EnumType.HandleResult result = seatManage.AddBespeakLogInfo(bespeakInfo); if (result == EnumType.HandleResult.Successed) { string beginTime; string endTime; if (bespeakInfo.SubmitTime == bespeakInfo.BsepeakTime) { beginTime = bespeakInfo.BsepeakTime.ToShortTimeString(); endTime = bespeakInfo.BsepeakTime.AddMinutes(r.Setting.SeatBespeak.SeatKeepTime).ToShortTimeString(); } else { beginTime = bespeakInfo.BsepeakTime.AddMinutes(-double.Parse(r.Setting.SeatBespeak.ConfirmTime.BeginTime)).ToShortTimeString(); endTime = bespeakInfo.BsepeakTime.AddMinutes(double.Parse(r.Setting.SeatBespeak.ConfirmTime.EndTime)).ToShortTimeString(); } returnValue = string.Format("座位预约成功,请在{0}至{1}到图书馆刷卡确认", beginTime, endTime); } else { throw new SeatBespeakException.BespeakSeatFailed("所选座位已经被预约。"); } } return(returnValue); }
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 } }
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); }
/// <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); }
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); }
public JsonResult ShortLeave(string seatNo, string seatShortNo, string used, string isShortLeave) { 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); if (isShortLeave == "y") { enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave; 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) { ret = Json(new { status = "yes", message = "设置读者暂离成功" }, JsonRequestBehavior.AllowGet); } else { ret = Json(new { status = "no", message = "设置读者暂离失败" }, JsonRequestBehavior.AllowGet); } } else { enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ComeBack; 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) { 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)) { ret = Json(new { status = "yes", message = "取消读者暂离成功" }, JsonRequestBehavior.AllowGet); } else { ret = Json(new { status = "yes", message = "取消读者暂离成功,取消等待失败" }, JsonRequestBehavior.AllowGet); } } else { ret = Json(new { status = "yes", message = "取消读者暂离成功" }, JsonRequestBehavior.AllowGet); } } else { ret = Json(new { status = "no", message = "取消读者暂离失败" }, JsonRequestBehavior.AllowGet); } } return(ret); }