/// <summary> /// 发布知会消息 /// </summary> /// <param name="noticeInfo">知会信息</param> /// <param name="noticeRoles">知会角色</param> /// <param name="noticeUserCodes">知会用户编码列表</param> public void NotifyMessage(NoticePublicInfo noticeInfo, List <string> noticeRoles, List <string> noticeUserCodes) { List <string> userCodes = GetUserCodes(noticeRoles, noticeUserCodes); for (int i = 0; i < userCodes.Count; i++) { // 去除自己给自己发的现象 if (noticeInfo.Sender == userCodes[i]) { continue; } Flow_Notice notice = new Flow_Notice(); notice.标题 = noticeInfo.Title; notice.优先级 = noticeInfo.Priority.ToString(); notice.来源 = noticeInfo.Source.ToString(); notice.内容 = noticeInfo.Content; notice.发送时间 = ServerModule.ServerTime.Time; notice.发送人 = noticeInfo.Sender; notice.状态 = NoticeStatus.未读.ToString(); notice.接收人 = userCodes[i]; m_flowNotice.SendNotice(notice); } }
/// <summary> /// 发布通知 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSend_Click(object sender, EventArgs e) { if (!CheckData()) { return; } try { if (m_notice == null) { m_notice = new Flow_Notice(); m_notice.发送人 = BasicInfo.LoginID; } string[] users = txtReceivedPersonal.Text.Split(new char[] { ',' }); foreach (var user in users) { Flow_Notice notice = new Flow_Notice(); notice.发送人 = BasicInfo.LoginID; notice.接收人 = user; notice.来源 = cmbSource.Text; notice.标题 = txtTitle.Text; notice.优先级 = cmbPriority.Text; notice.内容 = txtContent.Text; notice.状态 = NoticeStatus.未读.ToString(); if (GlobalObject.GeneralFunction.IsNullOrEmpty(m_oldReceivedPersonal)) { m_flowNoticeManagement.SendNotice(notice); } else if (user == m_oldReceivedPersonal) { notice.序号 = m_notice.序号; m_flowNoticeManagement.UpdateNotice(BasicInfo.LoginID, notice); } } txtReceivedPersonal.Text = ""; txtTitle.Text = ""; txtContent.Text = ""; MessageDialog.ShowPromptMessage("发送成功!"); } catch (Exception err) { MessageDialog.ShowErrorMessage(err.Message); } }