private void Create() { string Id = Request["Id"]; Project pEnt = Project.Find(Id); IList <ProjectUser> puEnts = ProjectUser.FindAllByProperty(ProjectUser.Prop_ProjectId, Id); pEnt.Status = "已下达"; pEnt.DoUpdate(); foreach (ProjectUser puEnt in puEnts) { ExamineTask etEnt = new ExamineTask(); etEnt.ProjectId = Id; etEnt.ProjectUserId = puEnt.Id;//str ProjectUser 的主键 etEnt.MajorName = puEnt.MajorName; etEnt.PlanBackTime = Convert.ToDateTime(Request["BackTime"]); etEnt.State = "未结束"; etEnt.CreateId = WebPortalService.CurrentUserInfo.UserID; etEnt.CreateName = WebPortalService.CurrentUserInfo.UserID; etEnt.CreateTime = DateTime.Now; etEnt.DoCreate(); Expert eEnt = Expert.Find(puEnt.UserId); //发送邮件 try { //string url = "http://192.168.15.81:7007/ConsultationManage/ExamineOpinionEdit.aspx?ExamineTaskId=" + etEnt.Id; //PhoneMessage.SendWebMail("*****@*****.**", eEnt.Email, "审查任务", "项目名称:【" + pEnt.ProjectName + "】 专业:" + eEnt.MajorName + ",填写审查意见请点击此链接:" + url, "fpxt", "000000", "mail.nerin.com"); } catch (Exception ex) { } } }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); //如果考核阶段的状态是已生成 任务状态是0 如果是已启动 任务状态为1 state = esEnt.State == 1 ? "0" : "1"; } switch (RequestActionString) { case "AmendTask": //需要添加的任务 ttEnts = TempTask.FindAllByProperties(TempTask.Prop_ExamineStageId, ExamineStageId, TempTask.Prop_AmendState, "+"); int addQuan = ttEnts.Count; foreach (TempTask ttEnt in ttEnts) //特殊任务也连同判断了 { ExamineTask etEnt = new ExamineTask("", ttEnt.ExamineStageId, ttEnt.ToUserId, ttEnt.ToUserName, ttEnt.ToDeptId, ttEnt.ToDeptName, ttEnt.ToRoleCode, ttEnt.ToRoleName, ttEnt.BeUserId, ttEnt.BeUserName, ttEnt.BeDeptId, ttEnt.BeDeptName, ttEnt.BeRoleCode, ttEnt.BeRoleName, null, state, ttEnt.Tag, null, UserInfo.UserID, UserInfo.Name, System.DateTime.Now, ttEnt.ExamineIndicatorId, ttEnt.ExamineRelationId); etEnt.DoCreate(); ttEnt.DoDelete(); } etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, ExamineTask.Prop_AmendState, "-"); int reduceQuan = etEnts.Count; foreach (ExamineTask etEnt in etEnts) { etEnt.DoDelete(); } esEnt.TaskQuan = esEnt.TaskQuan + addQuan - reduceQuan; esEnt.DoUpdate(); PageState.Add("Result", "增补任务数量:【" + addQuan.ToString() + "】 删除任务数量:【" + reduceQuan.ToString() + "】!"); break; case "CancelAmendTask": ttEnts = TempTask.FindAllByProperties(TempTask.Prop_ExamineStageId, ExamineStageId, TempTask.Prop_AmendState, "+"); foreach (TempTask ttEnt in ttEnts) //特殊任务也连同判断了 { ttEnt.DoDelete(); } etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, ExamineTask.Prop_AmendState, "-"); foreach (ExamineTask etEnt in etEnts) { etEnt.AmendState = null; etEnt.DoUpdate(); } break; default: DoSelect(); break; } }
private void CreateTask() { IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, esEnt.Id); foreach (ExamineStageDetail esdEnt in esdEnts) { DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId); string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(derEnt.BeUserIds)) { beUserIdArray = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string toUserIds = derEnt.UpLevelUserIds + "," + derEnt.SameLevelUserIds + "," + derEnt.DownLevelUserIds; string toUserNames = derEnt.UpLevelUserNames + "," + derEnt.SameLevelUserNames + "," + derEnt.DownLevelUserNames; string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(toUserIds)) { toUserIdArray = toUserIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); toUserNameArray = toUserNames.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { //2013-12-5追加功能 生成考核任务的时候针对每一个考核对象,自动创建本阶段考核的自定义考核指标 CreateCustomIndicator(beUserIdArray[i], beUserNameArray[i], esEnt, esdEnt); for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); etEnt.ExamineStageId = esEnt.Id; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; string[] bedept = Utility.GetDeptInfo(beUserIdArray[i]); etEnt.BeDeptId = bedept[0]; etEnt.BeDeptName = bedept[1]; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; string[] todept = Utility.GetDeptInfo(toUserIdArray[j]); etEnt.ToDeptId = todept[0]; etEnt.ToDeptName = todept[1]; etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } } }
private void CreateExamineTask() // { IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, esEnt.Id); //if (esEnt.ExamineType == "院级考核") //{ // foreach (ExamineStageDetail esdEnt in esdEnts) // { // string beUserIds = string.Empty;//存储被考核对象具体的人 // string beUserNames = string.Empty; // string beDeptIds = string.Empty; // string beDeptNames = string.Empty; // string[] array = GetBeUsersInfo(esdEnt); // beUserIds = array[0]; // beUserNames = array[1]; // beDeptIds = array[2]; // beDeptNames = array[3]; // ExamineRelation erEnt = ExamineRelation.Find(esdEnt.ExamineRelationId); // ConfirmPara(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt, erEnt); // CreateSpecialTask(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt); // } //} //else//部门级考核 //{ foreach (ExamineStageDetail esdEnt in esdEnts) { DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId); string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(derEnt.BeUserIds)) { beUserIdArray = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string toUserIds = derEnt.UpLevelUserIds + "," + derEnt.SameLevelUserIds + "," + derEnt.DownLevelUserIds; string toUserNames = derEnt.UpLevelUserNames + "," + derEnt.SameLevelUserNames + "," + derEnt.DownLevelUserNames; string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(toUserIds)) { toUserIdArray = toUserIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); toUserNameArray = toUserNames.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { //2013-12-5追加功能 生成考核任务的时候针对每一个考核对象,自动创建本阶段考核的自定义考核指标 CreateCustomIndicator(beUserIdArray[i], beUserNameArray[i], esEnt, esdEnt); for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j]) //防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); //部门级考核不存在角色的概念。直接对人生成任务 etEnt.ExamineStageId = esEnt.Id; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; etEnt.BeDeptId = esEnt.LaunchDeptId; etEnt.BeDeptName = esEnt.LaunchDeptName; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; etEnt.ToDeptId = esEnt.LaunchDeptId; etEnt.ToDeptName = esEnt.LaunchDeptName; etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } // } } }
private void CreateSpecialTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt) //特例 如果被考对象经营目标单位正职 还需要推送一部分任务到 人力资源部 工作业绩打分人 { if (esdEnt.BeRoleCode == "BeBusinessDeptLeader") { IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "HRAchievementWritor"); IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty(IndicatorFirst.Prop_InsteadColumn, "T");//配置考核项中。 确实有人力资源打分项 if (pcEnts.Count > 0 && ifEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { string[] beUserIdArray = new string[] { }; if (!string.IsNullOrEmpty(beUserIds)) { beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(beUserNames)) { beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] beDeptIdArray = new string[] { }; if (!string.IsNullOrEmpty(beDeptIds)) { beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] beDeptNameArray = new string[] { }; if (!string.IsNullOrEmpty(beDeptNames)) { beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] toUserIdArray = new string[] { }; if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { toUserIdArray = pcEnts[0].ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] toUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(pcEnts[0].ClerkNames)) { toUserNameArray = pcEnts[0].ClerkNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); etEnt.ExamineStageId = esEnt.Id; etEnt.BeRoleCode = esdEnt.BeRoleCode; etEnt.BeRoleName = esdEnt.BeRoleName; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; if (i <= beDeptIdArray.Length - 1) { etEnt.BeDeptId = beDeptIdArray[i]; } if (i <= beDeptNameArray.Length - 1) { etEnt.BeDeptName = beDeptNameArray[i]; } etEnt.ToRoleCode = "HRAchievementWritor"; etEnt.ToRoleName = ifEnts[0].IndicatorFirstName + "填报人"; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; sql = @" select Id,GroupName from BJKY_Examine..PersonConfig where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位')"; sql = string.Format(sql, toUserIdArray[j]); IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql); if (dics3.Count > 0) { etEnt.ToDeptId = dics3[0].Get <string>("Id"); etEnt.ToDeptName = dics3[0].Get <string>("GroupName"); } etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.Tag = "1"; etEnt.DoCreate(); } } } } } } }
private void CreateTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt, string toRoleCode, string toRoleName) { string toUserIds = ""; string toUserNames = ""; string toDeptIds = ""; string toDeptNames = ""; string sql = ""; string[] array = null; DataTable dt = new DataTable(); IList <PersonConfig> pcEnts = null; switch (toRoleCode) //对所有的考核对象进行判断 确定参与考核打分的人员 { case "DirectorSecretary": //院长书记 case "DeputyDirector": //副院长 case "EnterpriseDirector": //如果上级里面有控股企业董事长和监事长 case "EnterpriseDeputyDirector": pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, toRoleCode); if (pcEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { toUserIds = pcEnts[0].ClerkIds; toUserNames = pcEnts[0].ClerkNames; toDeptIds = pcEnts[0].ClerkGroupIds; toDeptNames = pcEnts[0].ClerkGroupNames; } } break; case "ExcutiveDeptLeader": //职能服务部门正职 sql = @"select FirstLeaderIds as UserIds,FirstLeaderNames as UserNames,FirstLeaderGroupIds as DeptIds,FirstLeaderGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; case "BusinessDeptLeader": //经营目标单位正职 sql = @"select FirstLeaderIds as UserIds, FirstLeaderNames as UserNames,FirstLeaderGroupIds as DeptIds,FirstLeaderGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; case "ExcutiveDeptClerkDelegate": //职能部门员工代表 sql = @"select InstituteClerkDelegateIds as UserIds,InstituteClerkDelegateNames as UserNames,InstituteClerkDelegateGroupIds as DeptIds,InstituteClerkDelegateGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; case "BusinessDeptClerkDelegate": //经营单位员工代表 sql = @"select InstituteClerkDelegateIds as UserIds, InstituteClerkDelegateNames as UserNames,InstituteClerkDelegateGroupIds as DeptIds,InstituteClerkDelegateGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; } string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; string[] beDeptIdArray = new string[] { }; string[] beDeptNameArray = new string[] { }; string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { }; string[] toDeptIdArray = new string[] { }; string[] toDeptNameArray = new string[] { }; if (!string.IsNullOrEmpty(beUserIds)) { beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beUserNames)) { beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beDeptIds)) { beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beDeptNames)) { beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toUserIds)) { toUserIdArray = toUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toUserNames)) { toUserNameArray = toUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toDeptIds)) { toDeptIdArray = toDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toDeptNames)) { toDeptNameArray = toDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } #region for (int i = 0; i < beUserIdArray.Length; i++) { for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); etEnt.ExamineStageId = esEnt.Id; etEnt.BeRoleCode = esdEnt.BeRoleCode; etEnt.BeRoleName = esdEnt.BeRoleName; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; if (i <= beDeptIdArray.Length - 1) { etEnt.BeDeptId = beDeptIdArray[i]; } if (i <= beDeptNameArray.Length - 1) { etEnt.BeDeptName = beDeptNameArray[i]; } etEnt.ToRoleCode = toRoleCode; etEnt.ToRoleName = toRoleName; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; etEnt.ToDeptId = toDeptIdArray[j]; etEnt.ToDeptName = toDeptNameArray[j]; etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } #endregion }