/// <summary> /// 删除会议提醒信息 /// </summary> /// <param name="ctx">数据库操作上下文</param> /// <param name="dailyWork">要删除提醒信息对应的日常事务</param> private void DeleteAlarmInfo(TaskManagementDataContext ctx, PRJ_DailyWork dailyWork) { // 删除任务提醒 var alarmSetting = from r in ctx.PRJ_TaskAlarmSetting where r.ItemID == dailyWork.ID select r; ctx.PRJ_TaskAlarmSetting.DeleteAllOnSubmit(alarmSetting); #region 清除报警提示信息 IWarningNotice warningNoticeServer = PlatformFactory.GetObject <IWarningNotice>(); Dictionary <string, string> dicParam = new Dictionary <string, string>(); dicParam.Add("附加信息2", dailyWork.ID); List <Flow_WarningNotice> notices = warningNoticeServer.GetWarningNotice(dicParam); if (notices != null) { foreach (var item in notices) { warningNoticeServer.DeleteWarningNotice(item.序号); } } #endregion }
/// <summary> /// 添加提醒信息 /// </summary> /// <param name="ctx">数据库操作上下文</param> /// <param name="dailyWork">会议信息</param> private void AddAlarmInfo(TaskManagementDataContext ctx, PRJ_DailyWork dailyWork) { View_PRJ_Meeting meeting = (from r in ctx.View_PRJ_Meeting where r.会议编号 == dailyWork.ID select r).Single(); // 会议地址 string address = (from r in ctx.View_PRJ_Resource join a in ctx.PRJ_ResourceUsageList on r.资源编号 equals a.ResourceID where r.资源类别名称 == "会议室" && a.TaskID == dailyWork.ID select r.资源名称).First(); // 报警提示信息 IWarningNotice warningNoticeServer = PlatformFactory.GetObject <IWarningNotice>(); List <string> lstAlarmUser = new List <string>(); lstAlarmUser.Add(meeting.记录人工号); lstAlarmUser.Add(meeting.主持人工号); var peoples = (from r in ctx.PRJ_DailyWorkNotifyPeople where r.DailyWorkID == dailyWork.ID select r.WorkID).ToList(); if (peoples != null && peoples.Count > 0) { lstAlarmUser.AddRange(peoples); } lstAlarmUser = lstAlarmUser.Distinct().ToList(); // 提醒设置 foreach (var user in lstAlarmUser) { if (meeting.提醒方式 == MeetingAlarmMode.短信及消息框提醒.ToString() || meeting.提醒方式 == MeetingAlarmMode.仅短信提醒.ToString()) { PRJ_TaskAlarmSetting alarmSetting = new PRJ_TaskAlarmSetting(); alarmSetting.AlarmUser = user; alarmSetting.ItemID = dailyWork.ID; alarmSetting.AlarmModeID = (int)Enum.Parse(typeof(MeetingAlarmMode), meeting.提醒方式); alarmSetting.AlarmValue = meeting.开始时间.AddMinutes(-meeting.提醒提前分钟数).ToString("yyyy-MM-dd HH:mm"); alarmSetting.AlarmContent = string.Format("请于({0})在({1})开会,主题:{2},主持人:{3}", dailyWork.BeginTime.ToString("MM-dd HH:mm"), address, dailyWork.Title, meeting.主持人姓名); alarmSetting.RecordTime = dailyWork.Date; ctx.PRJ_TaskAlarmSetting.InsertOnSubmit(alarmSetting); } if (meeting.提醒方式 == MeetingAlarmMode.短信及消息框提醒.ToString() || meeting.提醒方式 == MeetingAlarmMode.仅消息框提醒.ToString()) { Flow_WarningNotice notice = new Flow_WarningNotice(); if (meeting.重要性 != TaskImportance.普通.ToString()) { notice.优先级 = "高"; } else { notice.优先级 = "低"; } notice.来源 = "会议管理系统"; View_Auth_User userInfo = PlatformFactory.GetUserManagement().GetUser(meeting.创建人工号); notice.状态 = "未读"; notice.发送方 = string.Format("{0},{1}", PlatformFactory.GetDeptManagement().GetDepartment(userInfo.部门).部门名称, userInfo.姓名); notice.接收方类型 = "用户"; notice.接收方 = user; notice.标题 = dailyWork.Title; notice.内容 = string.Format("请您于({0})在({1})召开会议,主持人:{2},会议正文:{3}", dailyWork.BeginTime.ToString("yyyy-MM-dd HH:mm"), address, meeting.主持人姓名, dailyWork.Content); notice.附加信息1 = "会议管理"; notice.附加信息2 = dailyWork.ID; notice.附加信息3 = dailyWork.BeginTime.ToString(); notice.附加信息4 = dailyWork.EndTime.ToString(); warningNoticeServer.SendWarningNotice(notice); } } }