Example #1
0
        /// <summary>
        /// 将通知类消息批示已阅
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReadNotice_Click(object sender, EventArgs e)
        {
            if (CheckOperation(sender as ToolStripDropDownItem))
            {
                try
                {
                    for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
                    {
                        if ((dataGridView1.Tag as List <Flow_Notice>) != null)
                        {
                            Flow_Notice notice = (dataGridView1.Tag as List <Flow_Notice>)[dataGridView1.SelectedRows[i].Index];
                            m_flowNotice.ReadNotice(BasicInfo.LoginID, notice.序号);

                            WndMsgData msgData = new WndMsgData();

                            msgData.MessageType    = MessageTypeEnum.知会消息;
                            msgData.NoticeSource   = (NoticeSource)Enum.Parse(typeof(NoticeSource), notice.来源);
                            msgData.MessageContent = notice.序号.ToString();

                            m_wndMsgSender.SendMessage(StapleInfo.MessagePromptForm.Handle, WndMsgSender.FinishedMsg, msgData);
                        }
                        else if ((dataGridView1.Tag as List <Flow_WarningNotice>) != null)
                        {
                            Flow_WarningNotice notice = (dataGridView1.Tag as List <Flow_WarningNotice>)[dataGridView1.SelectedRows[i].Index];
                            PlatformFactory.GetObject <IWarningNotice>().ReadWarningNotice(BasicInfo.LoginID, notice.序号);
                        }
                    }

                    InitForm(InitMode.刷新数据显示, m_currentNode);
                }
                catch (Exception err)
                {
                    MessageDialog.ShowErrorMessage(err.Message);
                }
            }
        }
        private void 添加toolStripButton1_Click(object sender, EventArgs e)
        {
            if (!CheckControl())
            {
                return;
            }

            if (!m_personnerServer.AddPersonnelArchive(GetPersonnelArchiveData(), GetPersonnelListData(), out m_error))
            {
                MessageDialog.ShowPromptMessage(m_error);
                return;
            }

            IQueryable <View_Auth_Role> authRole = m_roleManager.GetAllRoles();
            string roleCode = "";

            foreach (var item in authRole)
            {
                if (item.角色名称 == CE_RoleEnum.普通操作员.ToString())
                {
                    roleCode = item.角色编码;
                }
            }

            Auth_User userInfo = new Auth_User();

            userInfo.LoginName          = txtWorkID.Text.Trim();
            userInfo.Password           = "******";
            userInfo.TrueName           = txtName.Text.Trim();
            userInfo.Dept               = m_departmentServer.GetDeptCode(cmbDept.Text);
            userInfo.IsActived          = false;
            userInfo.IsAdmin            = false;
            userInfo.AuthenticationMode = "密码认证";
            userInfo.IsLocked           = false;
            userInfo.CreateDate         = ServerTime.Time;
            userInfo.DestroyFlag        = false;
            userInfo.Remarks            = "通过人员档案自动添加";
            userInfo.Handset            = txtMobilePhone.Text.Trim();

            if (m_userManager.AddUser(userInfo))
            {
                if (!m_roleManager.AddUserInRole(roleCode, txtWorkID.Text))
                {
                    MessageDialog.ShowPromptMessage("员工信档案添加成功,角色分配失败!");
                }

                Flow_WarningNotice warning = new Flow_WarningNotice();

                warning.标题    = "合同等待新签";
                warning.发送方   = "系统";
                warning.发送时间  = ServerTime.Time;
                warning.附加信息1 = "员工合同管理";
                warning.附加信息2 = txtWorkID.Text;
                warning.附加信息3 = "0";
                warning.附加信息4 = "";
                warning.附加信息5 = "";
                warning.附加信息6 = "";
                warning.附加信息7 = "";
                warning.附加信息8 = "";
                warning.接收方   = "人力资源部办公室文员";
                warning.接收方类型 = "角色";
                warning.来源    = "人力资源管理系统";
                warning.内容    = "【" + txtName.Text + "】员工【合同类】等待新签!";
                warning.优先级   = "高";
                warning.状态    = "未读";

                m_warningNotice.SendWarningNotice(warning);
            }

            m_updateFlag = true;
            this.Close();
        }
Example #3
0
        /// <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);
                }
            }
        }