protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { int interval = new Nandasoft.BaseModule.MessageRule().GetMessageAwokeInterval(SessionState.EmployeeID); timerRefresh.Interval = interval == 0 ? 300000 : interval * 60000; btnRefresh_Click(null, null); } }
/// <summary> /// 刷新新的在线消息数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRefresh_Click(object sender, EventArgs e) { try { long employeeID = WebUI.SessionState.EmployeeID; int newMsgConut = new Nandasoft.BaseModule.MessageRule().GetMyReceivedMessageList(employeeID, 1, 100).Tables[1].Rows.Count; PageHelper.ShowMessage("Message count=" + newMsgConut); } catch //(Exception ex) { } }
/// <summary> /// 得到新消息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRefresh_Click(object sender, EventArgs e) { try { List <Nandasoft.BaseModule.OnLineMessage> content = new Nandasoft.BaseModule.MessageRule().GetOnlineMessage(WebUI.SessionState.EmployeeID, 5); string titles = string.Empty; string links = string.Empty; foreach (Nandasoft.BaseModule.OnLineMessage message in content) { titles += message.Title + ","; links += message.Link + ","; } if (titles.Length > 0) { titles = titles.Remove(titles.Length - 1, 1); } if (links.Length > 0) { links = links.Remove(links.Length - 1, 1); } if (!string.IsNullOrEmpty(titles)) { PageHelper.ShowPopMessage(titles, links); } } catch //(Exception ex) { ////写入日志 //new Nandasoft.BaseModule.LogRule().WriteLog( // SessionState.UserAccount, // SessionState.UserName, // "得到用户最新消息时发生错误:" + ex.Message, // PageHelper.GetMachineIP(), // PageHelper.GetMachineName(), // (int)Nandasoft.BaseModule.LogTypeEnum.错误日志); } }