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(); }