public IList <PushMsgInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms) { StringBuilder sb = new StringBuilder(250); sb.Append(@"select Id,Title,PushContent,PushType,IsSendOk,SendRange,LastUpdatedDate from PushMsg "); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } IList <PushMsgInfo> list = new List <PushMsgInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), cmdParms)) { if (reader != null && reader.HasRows) { while (reader.Read()) { PushMsgInfo model = new PushMsgInfo(); model.Id = reader.GetGuid(0); model.Title = reader.GetString(1); model.PushContent = reader.GetString(2); model.PushType = reader.GetString(3); model.IsSendOk = reader.GetBoolean(4); model.SendRange = reader.GetString(5); model.LastUpdatedDate = reader.GetDateTime(6); list.Add(model); } } } return(list); }
public PushMsgInfo GetModel(object Id) { PushMsgInfo model = null; StringBuilder sb = new StringBuilder(300); sb.Append(@"select top 1 Id,Title,PushContent,PushType,IsSendOk,SendRange,LastUpdatedDate from PushMsg where Id = @Id " ); SqlParameter parm = new SqlParameter("@Id", SqlDbType.UniqueIdentifier); parm.Value = Guid.Parse(Id.ToString()); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), parm)) { if (reader != null) { if (reader.Read()) { model = new PushMsgInfo(); model.Id = reader.GetGuid(0); model.Title = reader.GetString(1); model.PushContent = reader.GetString(2); model.PushType = reader.GetString(3); model.IsSendOk = reader.GetBoolean(4); model.SendRange = reader.GetString(5); model.LastUpdatedDate = reader.GetDateTime(6); } } } return(model); }
public int Update(PushMsgInfo model) { StringBuilder sb = new StringBuilder(250); sb.Append(@"update PushMsg set Title = @Title,PushContent = @PushContent,PushType = @PushType,IsSendOk = @IsSendOk,SendRange = @SendRange,LastUpdatedDate = @LastUpdatedDate where Id = @Id " ); SqlParameter[] parms = { new SqlParameter("@Id", SqlDbType.UniqueIdentifier), new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@PushContent", SqlDbType.NVarChar, 1000), new SqlParameter("@PushType", SqlDbType.NVarChar, 10), new SqlParameter("@IsSendOk", SqlDbType.Bit), new SqlParameter("@SendRange", SqlDbType.NVarChar, 10), new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime) }; parms[0].Value = model.Id; parms[1].Value = model.Title; parms[2].Value = model.PushContent; parms[3].Value = model.PushType; parms[4].Value = model.IsSendOk; parms[5].Value = model.SendRange; parms[6].Value = model.LastUpdatedDate; return(SqlHelper.ExecuteNonQuery(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), parms)); }
public IList <PushMsgInfo> GetList() { StringBuilder sb = new StringBuilder(250); sb.Append(@"select Id,Title,PushContent,PushType,IsSendOk,SendRange,LastUpdatedDate from PushMsg order by LastUpdatedDate desc " ); IList <PushMsgInfo> list = new List <PushMsgInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString())) { if (reader != null && reader.HasRows) { while (reader.Read()) { PushMsgInfo model = new PushMsgInfo(); model.Id = reader.GetGuid(0); model.Title = reader.GetString(1); model.PushContent = reader.GetString(2); model.PushType = reader.GetString(3); model.IsSendOk = reader.GetBoolean(4); model.SendRange = reader.GetString(5); model.LastUpdatedDate = reader.GetDateTime(6); list.Add(model); } } } return(list); }
public Guid InsertByOutput(PushMsgInfo model) { StringBuilder sb = new StringBuilder(250); sb.Append(@"insert into PushMsg (Title,PushContent,PushType,IsSendOk,SendRange,LastUpdatedDate) output inserted.Id values (@Title,@PushContent,@PushType,@IsSendOk,@SendRange,@LastUpdatedDate) " ); SqlParameter[] parms = { new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@PushContent", SqlDbType.NVarChar, 1000), new SqlParameter("@PushType", SqlDbType.NVarChar, 10), new SqlParameter("@IsSendOk", SqlDbType.Bit), new SqlParameter("@SendRange", SqlDbType.NVarChar, 10), new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime) }; parms[0].Value = model.Title; parms[1].Value = model.PushContent; parms[2].Value = model.PushType; parms[3].Value = model.IsSendOk; parms[4].Value = model.SendRange; parms[5].Value = model.LastUpdatedDate; object obj = SqlHelper.ExecuteScalar(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), parms); if (obj != null) { return(Guid.Parse(obj.ToString())); } return(Guid.Empty); }
/// <summary> /// 添加一条黑名单记录 /// </summary> /// <param name="blacklist"></param> /// <returns>黑名单序列号</returns> public int AddBlacklist(BlackListInfo blacklist) { try { int i = t_sm_Blacklist.Add(blacklist); //黑名单添加后,添加提醒 //ReaderNoticeInfo blackRni = new ReaderNoticeInfo(); //blackRni.IsRead = LogStatus.Valid; //blackRni.CardNo = blacklist.CardNo; //blackRni.Note = blacklist.ReMark; //blackRni.Type = NoticeType.AddBlacklistWarning; //AddReaderNotice(blackRni); PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,你已被加入黑名单"; msg.MsgType = MsgPushType.EnterBlack; msg.StudentNum = blacklist.CardNo; msg.Message = blacklist.ReMark; msg.AddTime = blacklist.AddTime; msg.LeaveDate = blacklist.OutTime; msg.IsAutoLeaveBlack = blacklist.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode; SendMsg(msg); return(i); } catch { throw; } }
public int UpdateBlacklist(BlackListInfo blacklist) { try { if (blacklist.BlacklistState == LogStatus.Fail) { ////黑名单添加后,添加提醒 //ReaderNoticeInfo blackRni = new ReaderNoticeInfo(); //blackRni.IsRead = LogStatus.Valid; //blackRni.CardNo = blacklist.CardNo; //blackRni.Type = NoticeType.DeleteBlacklistWarning; //blackRni.Note = "黑名单已过期。"; //AddReaderNotice(blackRni); PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您的黑名单已失效"; msg.MsgType = MsgPushType.LeaveVrBlack; msg.StudentNum = blacklist.CardNo; msg.AddTime = blacklist.AddTime; msg.LeaveDate = DateTime.Now; msg.Message = string.Format("您在{0}的黑名单状态已经到期或被管理员取消,请遵守系统使用规则。", blacklist.AddTime.ToString("yyyy-MM-dd HH:mm:ss")); SendMsg(msg); } return(t_sm_Blacklist.Update(blacklist)); } catch { throw; } }
/// <summary> /// 添加一条读者消息 /// </summary> /// <param name="model">读者消息的model</param> /// <returns></returns> public static bool SendPushMsg(PushMsgInfo model) { IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService(); bool error = false; try { return(seatService.SendMsg(model)); } catch (Exception ex) { error = true; SeatManageComm.WriteLog.Write("发送读者消息失败:" + ex.Message); return(false); } finally { ICommunicationObject ICommObjectService = seatService as ICommunicationObject; try { if (ICommObjectService.State == CommunicationState.Faulted) { ICommObjectService.Abort(); } else { ICommObjectService.Close(); } } catch { ICommObjectService.Abort(); } } }
public int Insert(PushMsgInfo model) { StringBuilder sb = new StringBuilder(250); sb.Append(@"insert into PushMsg (Title,PushContent,PushType,IsSendOk,SendRange,LastUpdatedDate) values (@Title,@PushContent,@PushType,@IsSendOk,@SendRange,@LastUpdatedDate) " ); SqlParameter[] parms = { new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@PushContent", SqlDbType.NVarChar, 1000), new SqlParameter("@PushType", SqlDbType.NVarChar, 10), new SqlParameter("@IsSendOk", SqlDbType.Bit), new SqlParameter("@SendRange", SqlDbType.NVarChar, 10), new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime) }; parms[0].Value = model.Title; parms[1].Value = model.PushContent; parms[2].Value = model.PushType; parms[3].Value = model.IsSendOk; parms[4].Value = model.SendRange; parms[5].Value = model.LastUpdatedDate; return(SqlHelper.ExecuteNonQuery(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), parms)); }
public IList <PushMsgInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms) { StringBuilder sb = new StringBuilder(250); sb.Append(@"select count(*) from PushMsg "); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), cmdParms); if (totalRecords == 0) { return(new List <PushMsgInfo>()); } sb.Clear(); int startIndex = (pageIndex - 1) * pageSize + 1; int endIndex = pageIndex * pageSize; sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber, Id,Title,PushContent,PushType,IsSendOk,SendRange,LastUpdatedDate from PushMsg " ); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex); IList <PushMsgInfo> list = new List <PushMsgInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcTeamDbConnString, CommandType.Text, sb.ToString(), cmdParms)) { if (reader != null && reader.HasRows) { while (reader.Read()) { PushMsgInfo model = new PushMsgInfo(); model.Id = reader.GetGuid(1); model.Title = reader.GetString(2); model.PushContent = reader.GetString(3); model.PushType = reader.GetString(4); model.IsSendOk = reader.GetBoolean(5); model.SendRange = reader.GetString(6); model.LastUpdatedDate = reader.GetDateTime(7); list.Add(model); } } } return(list); }
/// <summary> /// 添加预约记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public HandleResult AddBespeakLogInfo(BespeakLogInfo model) { try { model.FlagKey = GetBespeakMD5Key(model); List <BespeakLogInfo> list = GetBespeakLogInfoBySeatNoNotCheck(model.SeatNo, model.BsepeakTime); if (list.Count > 0) { foreach (BespeakLogInfo bespeaklog in list) { if (GetBespeakMD5Key(bespeaklog) != bespeaklog.FlagKey) { bespeaklog.BsepeakState = BookingStatus.Cencaled; bespeaklog.CancelPerson = Operation.Service; bespeaklog.Remark = "预约记录校验失败,系统取消此次预约"; bespeaklog.FlagKey = GetBespeakMD5Key(bespeaklog); UpdateBespeakLogInfo(bespeaklog); } } } int resultValue = seatBespeakDal.Add(model); if (resultValue == 0) { List <ReadingRoomInfo> rri = GetReadingRoomInfo(new List <string>() { model.ReadingRoomNo }); if (rri == null || rri.Count == 0) { return(HandleResult.Successed); } PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您已预约成功"; msg.MsgType = MsgPushType.UserOperation; msg.StudentNum = model.CardNo; msg.Message = model.Remark; msg.RoomName = rri[0].Name; msg.SeatNum = SeatManage.SeatManageComm.SeatComm.SeatNoToShortSeatNo(rri[0].Setting.SeatNumAmount, model.SeatNo); SendMsg(msg); return(HandleResult.Successed); } else { return(HandleResult.Failed); } } catch { throw; } }
/// <summary> /// 添加一条读者消息 /// </summary> /// <param name="model">读者消息的model</param> /// <returns></returns> public static bool SendPushMsg(PushMsgInfo model) { IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService(); bool error = false; try { return(seatService.SendMsg(model)); } catch (Exception ex) { error = true; SeatManageComm.WriteLog.Write("发送读者消息失败:" + ex.Message); return(false); } }
private void pushMsgV2(PushMsgInfo model) { try { SocketMsgData.SocketRequest request = new SocketMsgData.SocketRequest(); request.Sender = GetSchoolNum(); request.MsgType = SocketMsgData.TcpMsgDataType.MsgPush; request.Parameters.Add(model.ToString()); request.SubSystem = SocketMsgData.TcpSeatManageSubSystem.SchoolService; //client.Send(SeatManage.SeatManageComm.ByteSerializer.ObjectToByte(request)); thread = new Thread(new ParameterizedThreadStart(client.Send)); thread.Start(request); //ThreadPool.QueueUserWorkItem(new WaitCallback(client.Send), SeatManage.SeatManageComm.ByteSerializer.ObjectToByte(request)); } catch { return; } }
/// <summary> /// 增加一条等待记录 /// </summary> /// <param name="model">等待记录</param> /// <returns></returns> public int AddWaitLog(WaitSeatLogInfo model) { int r = t_sm_seatwaiting_dal.Add(model); WaitSeatLogInfo wsli = GetListWaitLogByCardNo(model.CardNo, null); if (wsli == null) { return(r); } PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您已等待成功"; msg.MsgType = MsgPushType.UserOperation; msg.StudentNum = wsli.CardNo; msg.SeatNum = wsli.EnterOutLog.ShortSeatNo; msg.RoomName = wsli.EnterOutLog.ReadingRoomName; msg.Message = string.Format("您已成功等待{0} {1}号座位。", msg.RoomName, msg.SeatNum); SendMsg(msg); return(r); }
/// <summary> /// 修改一条等待记录 /// </summary> /// <param name="model">等待记录</param> /// <returns></returns> public bool UpdateWaitLog(WaitSeatLogInfo model) { model.SeatWaitTime = GetServerDateTime(); if (model.OperateType == Operation.OtherReader) { if (model.WaitingState == EnterOutLogType.WaitingCancel) { PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您等待已失效"; msg.MsgType = MsgPushType.UserOperation; msg.StudentNum = model.CardNo; msg.SeatNum = model.EnterOutLog.ShortSeatNo; msg.RoomName = model.EnterOutLog.ReadingRoomName; msg.Message = string.Format("您等待的{0} {1}号座位已取消", msg.RoomName, msg.SeatNum); switch (model.OperateType) { case Operation.Admin: msg.Message = string.Format("您等待的{0} {1}号座位已被管理员取消", msg.RoomName, msg.SeatNum); break; case Operation.OtherReader: msg.Message = string.Format("原用户归来,您等待的{0} {1}号座位已取消", msg.RoomName, msg.SeatNum); break; case Operation.Service: msg.Message = string.Format("您等待的{0} {1}号座位已被系统取消", msg.RoomName, msg.SeatNum); break; } SendMsg(msg); } } return(t_sm_seatwaiting_dal.Update(model)); }
public int UpdateBespeakLogInfo(BespeakLogInfo bespeakLog) { try { bespeakLog.FlagKey = GetBespeakMD5Key(bespeakLog); int i = seatBespeakDal.Update(bespeakLog); if (i > 0) { if (bespeakLog.BsepeakState == BookingStatus.Cencaled) { PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您的预约已取消"; switch (bespeakLog.CancelPerson) { case Operation.Admin: msg.Title = string.Format(msg.Title, "您好,您的预约已被管理员取消"); break; case Operation.Service: msg.Title = string.Format(msg.Title, "您好,您的预约已超时"); break; } msg.MsgType = MsgPushType.UserOperation; msg.StudentNum = bespeakLog.CardNo; msg.Message = bespeakLog.Remark; msg.RoomName = bespeakLog.ReadingRoomName; msg.SeatNum = bespeakLog.ShortSeatNum; SendMsg(msg); } } return(i); } catch { throw; } }
protected void btn_btnLeave(object sender, EventArgs e) { SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo); SeatManage.EnumType.EnterOutLogType type = enterOutLog.EnterOutState; enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave; enterOutLog.Flag = SeatManage.EnumType.Operation.Admin; enterOutLog.Remark = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId); int newId = -1; SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId); if (result == SeatManage.EnumType.HandleResult.Successed) { //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo(); //rni.CardNo = enterOutLog.CardNo; //rni.Type = SeatManage.EnumType.NoticeType.ManagerFreeSetWarning; //rni.Note = enterOutLog.Remark; //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni); PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您的座位已被释放"; msg.MsgType = MsgPushType.AdminOperation; msg.StudentNum = enterOutLog.CardNo; msg.Message = enterOutLog.Remark; SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg); if (type == SeatManage.EnumType.EnterOutLogType.ShortLeave) { List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null); SeatManage.ClassModel.WaitSeatLogInfo waitSeatLog = null; if (waitSeatLogs.Count > 0) { waitSeatLog = waitSeatLogs[0]; waitSeatLog.NowState = SeatManage.EnumType.LogStatus.Fail; waitSeatLog.OperateType = SeatManage.EnumType.Operation.OtherReader; waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel; if (SeatManage.Bll.T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog)) { //rni = new SeatManage.ClassModel.ReaderNoticeInfo(); //rni.CardNo = waitSeatLog.CardNo; //rni.Type = SeatManage.EnumType.NoticeType.WaitSeatFail; //rni.Note = "您所等待的座位已被管理员释放,您的等待已被取消"; //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni); //msg = new PushMsgInfo(); //msg.Title = "您好,您的等待已被取消"; //msg.MsgType = MsgPushType.AdminOperation; //msg.StudentNum = waitSeatLog.CardNo; //msg.Message = "您所等待的座位已被管理员释放,您的等待已被取消"; //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg); } } } SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting(); if (roomInfo.Setting.IsRecordViolate) { if (roomInfo.Setting.BlackListSetting.Used) { if (roomInfo.Setting.BlackListSetting.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin]) { SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.ViolationRecordsLogInfo(); violationRecords.CardNo = enterOutLog.CardNo; violationRecords.SeatID = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount); violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo; violationRecords.EnterOutTime = SeatManage.Bll.ServiceDateTime.Now.ToString(); violationRecords.EnterFlag = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin; violationRecords.Remark = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId); violationRecords.BlacklistID = "-1"; SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords); } } else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin]) { SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.ViolationRecordsLogInfo(); violationRecords.CardNo = enterOutLog.CardNo; violationRecords.SeatID = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount); violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo; violationRecords.EnterOutTime = SeatManage.Bll.ServiceDateTime.Now.ToString(); violationRecords.EnterFlag = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin; violationRecords.Remark = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId); violationRecords.BlacklistID = "-1"; SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords); } } FineUI.Alert.ShowInTop("设置读者离开成功", "成功"); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { FineUI.Alert.ShowInTop("设置读者离开失败", "失败"); } }
/// <summary> /// 修改数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Update(PushMsgInfo model) { return(dal.Update(model)); }
/// <summary> /// 添加数据到数据库 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(PushMsgInfo model) { return(dal.Insert(model)); }
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); }
/// <summary> /// 添加数据到数据库 /// </summary> /// <param name="model"></param> /// <returns></returns> public Guid InsertByOutput(PushMsgInfo model) { return(dal.InsertByOutput(model)); }
/// <summary> /// 添加违规记录 /// </summary> /// <param name="blacklist"></param> public HandleResult AddViolationRecordsLog(ViolationRecordsLogInfo ViolationRecordsLog) { //添加违规记录 bool result = violateDiscipline.Add(ViolationRecordsLog); //return HandleResult.Successed; #region 添加提醒,已被注销 if (result) { List <string> roomlist = new List <string>(); roomlist.Add(ViolationRecordsLog.ReadingRoomID); List <ReadingRoomInfo> roominfos = GetReadingRoomInfo(null); Dictionary <string, ReadingRoomSetting> roomSettings = new Dictionary <string, ReadingRoomSetting>(); for (int i = 0; i < roominfos.Count; i++) { roomSettings.Add(roominfos[i].No, roominfos[i].Setting); } if (roomSettings[ViolationRecordsLog.ReadingRoomID] != null && roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.Used) { List <ViolationRecordsLogInfo> violateRecords = GetViolationRecordsLogInfo(ViolationRecordsLog.CardNo, ViolationRecordsLog.ReadingRoomID); //添加读者提醒 //ReaderNoticeInfo rni = new ReaderNoticeInfo(); //rni.Type = NoticeType.ViolationWarning; //rni.IsRead = LogStatus.Valid; //rni.CardNo = ViolationRecordsLog.CardNo; //rni.Note = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes - violateRecords.Count); //AddReaderNotice(rni); PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您有一次违规"; msg.MsgType = MsgPushType.EnterVR; msg.StudentNum = ViolationRecordsLog.CardNo; msg.RoomName = roominfos.Find(u => u.No == ViolationRecordsLog.ReadingRoomID).Name; msg.VrType = ViolationRecordsLog.EnterFlag; msg.Message = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes - violateRecords.Count); SendMsg(msg); if (violateRecords.Count >= roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes) { BlackListInfo bli = new BlackListInfo(); bli.CardNo = ViolationRecordsLog.CardNo; bli.ReadingRoomID = ViolationRecordsLog.ReadingRoomID; bli.AddTime = GetServerDateTime(); bli.OutBlacklistMode = roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.LeaveBlacklist; if (bli.OutBlacklistMode == LeaveBlacklistMode.ManuallyMode) { bli.ReMark = string.Format("违规累计{0}次,被加入黑名单", roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes); } else { bli.OutTime = bli.AddTime.AddDays(roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.LimitDays); bli.ReMark = string.Format("违规累计{0}次,被加入黑名单{1}天", roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.LimitDays); } int blackId = AddBlacklist(bli); //修改黑名单涉及的违规记录 foreach (ViolationRecordsLogInfo vr in violateRecords) { vr.BlacklistID = blackId.ToString(); vr.Flag = LogStatus.Fail; UpdateViolationRecordsLog(vr); } } } else { //判断黑名单 RegulationRulesSetting set = GetRegulationRulesSetting(); List <ViolationRecordsLogInfo> violateRecords = GetViolationRecordsLogInfo(ViolationRecordsLog.CardNo, null); for (int i = 0; i < violateRecords.Count; i++) { if (roomSettings[violateRecords[i].ReadingRoomID].BlackListSetting.Used) { violateRecords.RemoveAt(i); i--; } } //添加读者提醒 //ReaderNoticeInfo rni = new ReaderNoticeInfo(); //rni.Type = NoticeType.ViolationWarning; //rni.IsRead = LogStatus.Valid; //rni.CardNo = ViolationRecordsLog.CardNo; //rni.Note = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, roomSettings[ViolationRecordsLog.ReadingRoomID].BlackListSetting.ViolateTimes - violateRecords.Count); //AddReaderNotice(rni); PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您有一次违规"; msg.MsgType = MsgPushType.EnterVR; msg.StudentNum = ViolationRecordsLog.CardNo; msg.RoomName = roominfos.Find(u => u.No == ViolationRecordsLog.ReadingRoomID).Name; msg.VrType = ViolationRecordsLog.EnterFlag; msg.Message = string.Format("{0},还有{1}次违规,就进入黑名单", ViolationRecordsLog.Remark, set.BlacklistSet.ViolateTimes - violateRecords.Count); SendMsg(msg); if (violateRecords.Count >= set.BlacklistSet.ViolateTimes) { BlackListInfo bli = new BlackListInfo(); bli.CardNo = ViolationRecordsLog.CardNo; bli.ReadingRoomID = ViolationRecordsLog.ReadingRoomID; bli.AddTime = GetServerDateTime(); bli.OutTime = bli.AddTime.AddDays(set.BlacklistSet.LimitDays); bli.OutBlacklistMode = set.BlacklistSet.LeaveBlacklist; if (bli.OutBlacklistMode == LeaveBlacklistMode.ManuallyMode) { bli.ReMark = string.Format("违规累计{0}次,被加入黑名单", set.BlacklistSet.ViolateTimes); } else { bli.ReMark = string.Format("多次违规,被加入黑名单{1}天", set.BlacklistSet.ViolateTimes, set.BlacklistSet.LimitDays); } int blackId = AddBlacklist(bli); //修改黑名单涉及的违规记录 foreach (ViolationRecordsLogInfo vr in violateRecords) { vr.BlacklistID = blackId.ToString(); vr.Flag = LogStatus.Fail; UpdateViolationRecordsLog(vr); } } } return(HandleResult.Successed); } else { return(HandleResult.Failed); } #endregion }
/// <summary> /// 更新违规记录 /// </summary> /// <param name="blacklist"></param> public HandleResult UpdateViolationRecordsLog(ViolationRecordsLogInfo ViolationRecordsLog) { bool result = violateDiscipline.Update(ViolationRecordsLog); if (result) { if (ViolationRecordsLog.Flag == LogStatus.Fail && ViolationRecordsLog.BlacklistID == "-1") { PushMsgInfo msg = new PushMsgInfo(); msg.Title = "您好,您违规已失效"; msg.MsgType = MsgPushType.LeaveVrBlack; msg.StudentNum = ViolationRecordsLog.CardNo; msg.VrType = ViolationRecordsLog.EnterFlag; msg.AddTime = DateTime.Parse(ViolationRecordsLog.EnterOutTime); msg.LeaveDate = DateTime.Now; string type = ""; switch (ViolationRecordsLog.EnterFlag) { case ViolationRecordsType.BookingTimeOut: type = "预约超时"; break; case ViolationRecordsType.CancelWaitByAdmin: type = "被管理员取消等待"; break; case ViolationRecordsType.LeaveByAdmin: type = "被管理员释放座位"; break; case ViolationRecordsType.LeaveNotReadCard: type = "离开没有释放座位"; break; case ViolationRecordsType.SeatOutTime: type = "在座超时"; break; case ViolationRecordsType.ShortLeaveByAdminOutTime: type = "被管理员设置暂离超时"; break; case ViolationRecordsType.ShortLeaveByReaderOutTime: type = "被其他读者设置暂离超时"; break; case ViolationRecordsType.ShortLeaveByServiceOutTime: type = "暂离超时"; break; case ViolationRecordsType.ShortLeaveOutTime: type = "暂离超时"; break; } msg.Message = string.Format("您在{0}的违规:{1},已经到期或被管理员删除,请遵守系统使用规则。", ViolationRecordsLog.EnterOutTime, type); SendMsg(msg); } return(HandleResult.Successed); } else { return(HandleResult.Failed); } }
public void SavePushMsg(HttpContext context) { try { string id = context.Request.Form["ctl00$cphMain$hId"].Trim(); string sTitle = context.Request.Form["ctl00$cphMain$txtTitle"].Trim(); string sPushContent = context.Request.Form["ctl00$cphMain$txtPushContent"].Trim(); string sSendRange = context.Request.Form["ctl00$cphMain$txtSendRange"].Trim(); string sckAll = context.Request.Form["ctl00$cphMain$ckAll"]; Guid gId = Guid.Empty; PushMsgInfo model = new PushMsgInfo(); model.LastUpdatedDate = DateTime.Now; model.Id = gId; model.Title = sTitle; model.PushContent = sPushContent; string PushParam = "1"; if (null != sckAll) { model.SendRange = "全部"; } else { model.SendRange = "个人"; if (-1 == sSendRange.IndexOf(',')) { PushParam = "2@@" + sSendRange; } else { PushParam = "3@@" + sSendRange; } } model.PushType = "zdy"; if (string.IsNullOrWhiteSpace(model.Title) || string.IsNullOrWhiteSpace(model.PushContent)) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Params_InvalidError + "\"}"); return; } PushMsg bll = new PushMsg(); int effect = -1; model.LastUpdatedDate = DateTime.Now; Guid pushMsgId = bll.InsertByOutput(model); if (!pushMsgId.Equals(Guid.Empty)) { effect = 1; if (!PushParam.Equals("1")) { PushUser bllPushUser = new PushUser(); PushUserInfo pushUserInfo = new PushUserInfo(); pushUserInfo.PushId = pushMsgId; pushUserInfo.PushUser = sSendRange; bllPushUser.InsertOW(pushUserInfo); } } if (effect == 110) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Exist + "\"}"); return; } if (effect < 1) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Error + "\"}"); return; } #region 推送信息到推送服务系统 try { PushContentService pushProxy = new PushContentService(); if (System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"] != null) { pushProxy.Url = System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"].ToString(); } string sxml = ""; sxml = string.Format(@"<XmlParameters><ReceivePushContent><PushType>{0}</PushType><PushContent>{1}</PushContent><Title>{2}</Title><PushParam>{3}</PushParam></ReceivePushContent></XmlParameters>", "zdy", model.PushContent, model.Title, PushParam); pushProxy.ReceivePushContentAsync(sxml); } catch { } #endregion context.Response.Write("{\"success\": true,\"message\": \"" + MessageContent.Submit_Success + "\"}"); } catch (Exception ex) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.AlertTitle_Ex_Error + ":" + ex.Message + "\"}"); } }