private void DoSelect() { string sql = @"select *,(select top 1 Name from SysEnumeration where Code=ExamYearResult.BeRoleCode ) as BeRoleName from BJKY_Examine..ExamYearResult where ExamineStageId='" + ExamineStageId + "' order by BeRoleCode desc"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); PageState.Add("DataList", dics); SysConfig scEnt = SysConfig.FindAll().First <SysConfig>(); decimal? ExcellentQuan = 0; decimal? GoodQuan = 0; if (esEnt.ExamineType == "院级考核") { ExcellentQuan = (int)Math.Floor(((double)dics.Count) * ((double)scEnt.FirstLeaderExcellentPercent) / 100); GoodQuan = (int)Math.Floor(((double)dics.Count) * ((double)scEnt.FirstLeaderGoodPercent) / 100); } else { PersonConfig pcEnt = PersonConfig.Find(esEnt.LaunchDeptId); ExcellentQuan = pcEnt.ExcellentQuan.GetValueOrDefault(); GoodQuan = pcEnt.GoodQuan.GetValueOrDefault(); } var obj = new { ExamineStageName = esEnt.StageName, State = esEnt.State, Year = esEnt.Year, ExcellentQuan = ExcellentQuan.Value, GoodQuan = GoodQuan.Value, ExamineType = esEnt.ExamineType }; PageState.Add("Obj", obj); }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { pcEnt = PersonConfig.Find(id); } ExamineStageId = RequestData.Get <string>("ExamineStageId"); switch (RequestActionString) { case "AutoSave": int ExcellentQuan = RequestData.Get <int>("ExcellentQuan"); int GoodQuan = RequestData.Get <int>("GoodQuan"); if (ExcellentQuan > 0 && pcEnt.PeopleQuan > 0) { pcEnt.ExcellentRate = Math.Round(((decimal)ExcellentQuan / (decimal)pcEnt.PeopleQuan) * 100, 2); pcEnt.ExcellentQuan = ExcellentQuan; PageState.Add("ExcellentRate", pcEnt.ExcellentRate); } if (GoodQuan > 0 && pcEnt.PeopleQuan > 0) { pcEnt.GoodRate = Math.Round(((decimal)GoodQuan / (decimal)pcEnt.PeopleQuan) * 100, 2); pcEnt.GoodQuan = GoodQuan; PageState.Add("GoodRate", pcEnt.GoodRate); } pcEnt.DoUpdate(); break; case "delete": IList <string> strList = RequestData.GetList <string>("ids"); foreach (string str in strList) { if (!string.IsNullOrEmpty(str)) { pcEnt = PersonConfig.Find(str); pcEnt.DoDelete(); } } break; case "CreateTaskAgain": if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, ExamineStageId); //从这个入口进来生成任务 说明考核阶段的各条件都是满足的 StartExamine(); //临时任务创建完毕以后 把该考核阶段对应的两个任务集合进行对比 AmendTask(); } break; default: DoSelect(); break; } }
private void DoSelect() { string sql = @"select * from BJKY_Examine..PersonConfig "; DataTable dt = new DataTable(); DataColumn dc = new DataColumn("UserId"); dt.Columns.Add(dc); dc = new DataColumn("UserName"); dt.Columns.Add(dc); dc = new DataColumn("DeptId"); dt.Columns.Add(dc); dc = new DataColumn("DeptName"); dt.Columns.Add(dc); dc = new DataColumn("Year"); dt.Columns.Add(dc); dc = new DataColumn("FirstScore", typeof(decimal)); dt.Columns.Add(dc); dc = new DataColumn("SecondScore", typeof(decimal)); dt.Columns.Add(dc); dc = new DataColumn("ThirdScore", typeof(decimal)); dt.Columns.Add(dc); 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, UserInfo.UserID); IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) { PersonConfig pcEnt = PersonConfig.Find(dics[0].Get <string>("Id")); SearchCriterion.RecordCount = pcEnt.PeopleQuan.HasValue ? pcEnt.PeopleQuan.Value : 0; string userIds = pcEnt.SecondLeaderIds + "," + pcEnt.ClerkIds; string userNames = pcEnt.SecondLeaderNames + "," + pcEnt.ClerkNames; if (!string.IsNullOrEmpty(userIds)) { string[] userIdArray = userIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] userNameArray = userNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < userIdArray.Length; i++) { DataRow dr = dt.NewRow(); dr["UserId"] = userIdArray[i]; dr["UserName"] = userNameArray[i]; dr["DeptId"] = pcEnt.Id; dr["DeptName"] = pcEnt.GroupName; dr["Year"] = "2013"; sql = @"select top 1 isnull(Score,0) from BJKY_Examine..ExamineStageResult where UserId='" + userIdArray[i] + "' and Year='2013' and StageType='1' "; dr["FirstScore"] = DataHelper.QueryValue <decimal>(sql); sql = @"select top 1 isnull(Score,0) from BJKY_Examine..ExamineStageResult where UserId='" + userIdArray[i] + "' and Year='2013' and StageType='2' "; dr["SecondScore"] = DataHelper.QueryValue <decimal>(sql); sql = @"select top 1 isnull(Score,0) from BJKY_Examine..ExamineStageResult where UserId='" + userIdArray[i] + "' and Year='2013' and StageType='3' "; dr["ThirdScore"] = DataHelper.QueryValue <decimal>(sql); dt.Rows.Add(dr); } } PageState.Add("DataList", dt); PageState.Add("GroupName", dics[0].Get <string>("GroupName")); } }
protected override void OnModelCreating(ModelBuilder modelBuilder) { // Geographic Entities ContinentConfig.SetEntityBuilder(modelBuilder.Entity <Continent>()); CountryConfig.SetEntityBuilder(modelBuilder.Entity <Country>()); RegionConfig.SetEntityBuilder(modelBuilder.Entity <Region>()); // Administrative Entities AdminConfig.SetEntityBuilder(modelBuilder.Entity <Admin>()); EventConfig.SetEntityBuilder(modelBuilder.Entity <Event>()); // Measures Entities SanitaryMeasureConfig.SetEntityBuilder(modelBuilder.Entity <SanitaryMeasure>()); ContainmentMeasureConfig.SetEntityBuilder(modelBuilder.Entity <ContainmentMeasure>()); CmByCountry.SetEntityBuilder(modelBuilder.Entity <CountryContainmentMeasures>()); SmByCountry.SetEntityBuilder(modelBuilder.Entity <CountrySanitaryMeasures>()); // Hospital Entities HospitalConfig.SetEntityBuilder(modelBuilder.Entity <Hospital>()); HEmployeeConfig.SetEntityBuilder(modelBuilder.Entity <HospitalEmployee>()); MedicationConfig.SetEntityBuilder(modelBuilder.Entity <Medication>()); // Person Entities PatientConfig.SetEntityBuilder(modelBuilder.Entity <Patient>()); P_MedicationConfig.SetEntityBuilder(modelBuilder.Entity <PatientMedications>()); Pt_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PatientPathologies>()); PersonConfig.SetEntityBuilder(modelBuilder.Entity <ContactedPerson>()); Ps_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PersonPathologies>()); ContactsByPatientConfig.SetEntityBuilder(modelBuilder.Entity <PersonsContactedByPatient>()); // Not related Entities PathologiesConfig.SetEntityBuilder(modelBuilder.Entity <Pathology>()); Pharm_CompanyConfig.SetEntityBuilder(modelBuilder.Entity <PharmaceuticalCompany>()); StatusConfig.SetEntityBuilder(modelBuilder.Entity <PatientStatus>()); // Views and Stored Procedures modelBuilder.Entity <PatientView>().HasNoKey().ToView(null); modelBuilder.Entity <ExportPatient>().HasNoKey().ToView(null); modelBuilder.Entity <CasesView>().HasNoKey().ToView(null); modelBuilder.Entity <ReportView>().HasNoKey().ToView(null); modelBuilder.Entity <MeasureView>().HasNoKey().ToView(null); modelBuilder.Entity <MedicationView>().HasNoKey().ToView(null); modelBuilder.Entity <PatientMedicationView>().HasNoKey().ToView(null); modelBuilder.Entity <PathologyView>().HasNoKey().ToView(null); modelBuilder.Entity <ContactView>().HasNoKey().ToView(null); }
private void DoSelect() { if (op == "c") { if (!String.IsNullOrEmpty(ExamYearResultId)) { ExamYearResult eyrEnt = ExamYearResult.Find(ExamYearResultId); ExamineStage esEnt = ExamineStage.Find(eyrEnt.ExamineStageId); IList <PersonConfig> pcEnts1 = PersonConfig.FindAllByProperty("GroupCode", "HRAppealAcceptor"); IList <PersonConfig> pcEnts2 = PersonConfig.FindAllByProperty("GroupCode", "HRAppealCharger"); IList <PersonConfig> pcEnts3 = PersonConfig.FindAllByProperty("Id", eyrEnt.DeptId); var obj = new { ExamYearResultId = ExamYearResultId, ExamineStageId = eyrEnt.ExamineStageId, ExamineType = esEnt.ExamineType, AppealUserId = eyrEnt.UserId, AppealUserName = eyrEnt.UserName, OriginalScore = eyrEnt.ApproveScore.HasValue ? eyrEnt.ApproveScore : eyrEnt.IntegrationScore, OriginalLevel = String.IsNullOrEmpty(eyrEnt.ApproveLevel) ? eyrEnt.ApproveLevel : eyrEnt.AdviceLevel, //有可能是部门级考核 没有角色编号和角色名称 BeRoleCode = !string.IsNullOrEmpty(eyrEnt.BeRoleCode) ? eyrEnt.BeRoleCode : "", BeRoleName = !string.IsNullOrEmpty(eyrEnt.BeRoleCode) ? SysEnumeration.FindAllByProperty(SysEnumeration.Prop_Code, eyrEnt.BeRoleCode).First <SysEnumeration>().Name : "", DeptId = eyrEnt.DeptId, DeptName = eyrEnt.DeptName, AppealTime = System.DateTime.Now.ToShortDateString(), AcceptUserId = pcEnts1.Count > 0 ? pcEnts1[0].ClerkIds.Replace(",", "") : "", AcceptUserName = pcEnts1.Count > 0 ? pcEnts1[0].ClerkNames : "", DeptLeaderId = pcEnts3.Count > 0 ? pcEnts3[0].FirstLeaderIds.Replace(",", "") : "", DeptLeaderName = pcEnts3.Count > 0 ? pcEnts3[0].FirstLeaderNames : "", HrUserId = pcEnts2.Count > 0 ? pcEnts2[0].ClerkIds.Replace(",", "") : "", HrUserName = pcEnts2.Count > 0 ? pcEnts2[0].ClerkNames : "" }; SetFormData(obj); } } else { if (!string.IsNullOrEmpty(id)) { ent = ExamineAppeal.Find(id); SetFormData(ent); } } PageState.Add("ExamineLevel", SysEnumeration.GetEnumDict("ExamineLevel")); }
private string[] GetBeUsersInfo(ExamineStageDetail esdEnt) { string beUserIds = string.Empty;//存储被考核对象具体的人 string beUserNames = string.Empty; string beDeptIds = string.Empty; string beDeptNames = string.Empty; if (esdEnt.BeRoleCode == "BeDeputyDirector")//副院级领导 { IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "DeputyDirector"); if (pcEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { beUserIds = pcEnts[0].ClerkIds; beUserNames = pcEnts[0].ClerkNames; beDeptIds = pcEnts[0].ClerkGroupIds; beDeptNames = pcEnts[0].ClerkGroupNames; } } } if (esdEnt.BeRoleCode == "BeExecutiveDeptLeader")//职能服务部门正职 +分管工作的副职也被当做中层干部来考核 { sql = @"select (isnull(FirstLeaderIds,null)+','+isnull(ChargeSecondLeaderIds,'')) as beUserIds, (isnull(FirstLeaderNames,'')+','+isnull(ChargeSecondLeaderNames,'')) as beUserNames, (isnull(FirstLeaderGroupIds,'')+','+isnull(ChargeSecondLeaderGroupIds,'')) as beDeptIds, (isnull(FirstLeaderGroupNames,'')+','+isnull(ChargeSecondLeaderGroupNames,'')) as beDeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and GroupId in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { beUserIds += dic.Get <string>("beUserIds") + ","; beUserNames += dic.Get <string>("beUserNames") + ","; beDeptIds += dic.Get <string>("beDeptIds") + ","; beDeptNames += dic.Get <string>("beDeptNames") + ","; } } if (esdEnt.BeRoleCode == "BeBusinessDeptLeader")//经营目标单位正职 { sql = @"select (isnull(FirstLeaderIds,'')+','+isnull(ChargeSecondLeaderIds,'')) as beUserIds, (isnull(FirstLeaderNames,'')+','+isnull(ChargeSecondLeaderNames,'')) as beUserNames, (isnull(FirstLeaderGroupIds,'')+','+isnull(ChargeSecondLeaderGroupIds,'')) as beDeptIds, (isnull(FirstLeaderGroupNames,'')+','+isnull(ChargeSecondLeaderGroupNames,'')) as beDeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and GroupId in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { beUserIds += dic.Get <string>("beUserIds") + ","; beUserNames += dic.Get <string>("beUserNames") + ","; beDeptIds += dic.Get <string>("beDeptIds") + ","; beDeptNames += dic.Get <string>("beDeptNames") + ","; } } if (esdEnt.BeRoleCode == "BeDeptSecondLeader")//部门副职 { IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); if (pcEnts.Count > 0) { beUserIds = pcEnts[0].SecondLeaderIds; beUserNames = pcEnts[0].SecondLeaderNames; beDeptIds = pcEnts[0].SecondLeaderGroupIds; beDeptNames = pcEnts[0].SecondLeaderGroupNames; } } if (esdEnt.BeRoleCode == "BeDeptClerk")//部门员工 { IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); if (pcEnts.Count > 0) { beUserIds = pcEnts[0].ClerkIds; beUserNames = pcEnts[0].ClerkNames; beDeptIds = pcEnts[0].ClerkGroupIds; beDeptNames = pcEnts[0].ClerkGroupNames; } } return(new string[] { beUserIds, beUserNames, beDeptIds, beDeptNames }); }
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])//防止一个人身兼两职。自己对自己不能打分 { TempTask etEnt = new TempTask(); 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 GroupID,Name from SysGroup where PathLevel='4' and PatIndex('%'+GroupID+'%',(select Path from SysGroup where GroupID=(select top 1 GroupID from SysUserGroup where UserID='" + toUserIdArray[j] + "') ))>0";//通过人直接找4级部门 IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql); if (dics3.Count > 0) { etEnt.ToDeptId = dics3[0].Get <string>("GroupID"); etEnt.ToDeptName = dics3[0].Get <string>("Name"); } 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 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; } } break; case "ExcutiveDeptLeader": //职能服务部门正职 sql = @"select FirstLeaderIds as UserIds,FirstLeaderNames as UserNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and GroupID in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; break; case "BusinessDeptLeader": //经营目标单位正职 sql = @"select FirstLeaderIds as UserIds, FirstLeaderNames as UserNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and GroupID in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; break; case "ExcutiveDeptClerkDelegate": //职能部门员工代表 sql = @"select InstituteClerkDelegateIds as UserIds,InstituteClerkDelegateNames as UserNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and GroupID in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; break; case "BusinessDeptClerkDelegate": //经营单位员工代表 sql = @"select InstituteClerkDelegateIds as UserIds, InstituteClerkDelegateNames as UserNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and GroupID in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; break; case "DeptFirstLeader": //部门正职 只有部门内考核的时候才会有此考核对象编号 pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); //这个时候需要取考核阶段里面的启动部门 if (pcEnts.Count > 0) { toUserIds = pcEnts[0].FirstLeaderIds; toUserNames = pcEnts[0].FirstLeaderNames; } break; case "DeptSecondLeader": //部门副职 pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); //这个时候需要取考核阶段里面的启动部门 if (pcEnts.Count > 0) { toUserIds = pcEnts[0].SecondLeaderIds; toUserNames = pcEnts[0].SecondLeaderNames; } break; case "DeptClerkDelegate": pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); //这个时候需要取考核阶段里面的启动部门 if (pcEnts.Count > 0) { toUserIds = pcEnts[0].DeptClerkDelegateIds; toUserNames = pcEnts[0].DeptClerkDelegateNames; } break; case "DeptClerk": pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); //这个时候需要取考核阶段里面的启动部门 if (pcEnts.Count > 0) { toUserIds = pcEnts[0].ClerkIds; toUserNames = pcEnts[0].ClerkNames; } 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[] { }; 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); } #region for (int i = 0; i < beUserIdArray.Length; i++) { for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { TempTask etEnt = new TempTask(); 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]; //考核人的部门获取有待更新 to do sql = @"select GroupID,Name from SysGroup where PathLevel='4' and PatIndex('%'+GroupID+'%',(select Path from SysGroup where GroupID=(select top 1 GroupID from SysUserGroup where UserID='" + toUserIdArray[j] + "') ))>0"; //通过人直接找4级部门 IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql); if (dics3.Count > 0) { etEnt.ToDeptId = dics3[0].Get <string>("GroupID"); etEnt.ToDeptName = dics3[0].Get <string>("Name"); } etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } #endregion }
public void setConfig(Tuple2 <XmlDocument, Texture2D> personConfig) { config = new PersonConfig(personConfig.First, personConfig.Second); // Decide person characteristics personUniqueId = config.id; personName = config.name; nationality = config.nationality; dateOfBirth = config.dob; idPhrase = config.idPhrase; photo = config.photoTexture; voice = config.voice; bodyColor = config.bodyColor; favouriteColor = config.favouriteColor; favouriteColor2 = config.favouriteColor2; if (Person.HasInstantiatedPerson) { chosenFavoriteColor = pickFavouriteColorWithBiggestDistance(favouriteColor, favouriteColor2, Person.LastPerson.getFavouriteColor()); } else { chosenFavoriteColor = favouriteColor; } Person.LastPerson = this; Person.HasInstantiatedPerson = true; books = config.personBooksConfig.books.GetRange(0, config.personBooksConfig.books.Count); /* * Dictionary<string, Dictionary<string, float>> probabilityMap = new Dictionary<string, Dictionary<string, float>>() { * {"clothing", new Dictionary<string, float>() { * {"briefs", 1f}, * {"panties", 0.1f}, * {"bras", 0.5f}, * {"shirts", 0.4f}, * {"jeans", 0.4f}, * {"dress", 0.01f}, * {"skirt", 0.01f}, * {"socks", 0.9f}, * {"hat", 0.05f}, * {"cap", 0.05f}, * {"slippers", 0.05f}, * {"shoes", 0.05f}, * {"gloves", 0.05f}, * } * }, * {"pills", new Dictionary<string, float>() { * {"allergies", 1f}, * {"moreThanOne", 0f}, * {"smuggler", 0.01f} * } * }, * {"weapons", new Dictionary<string, float>() { * {"risk", 1f}, * {"riskGun", 1f}, * {"riskKnife", 1f} * } * }, * // Computers, mobile phone material * {"displays", new Dictionary<string, float>() { * {"piracy", 0.2f}, * {"worried", 0.5f}, * {"noob", 0.3f} * } * }, * {"personality", new Dictionary<string, float>() { * {"rude", 0.2f}, * {"polite", 0.4f}, * {"impatient", 0.3f}, * } * } * }; */ // Load information on audio clips clips = Resources.LoadAll <AudioClip>("voice/" + voice).ToList(); // Greeting // Some people don't say greeting - in those cases, pretend we've already greeted // haveSaidGreeting = ItsRandom.randomBool(personRandom); // TODO haveSaidGreeting = false; }
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 }
public ConfigController(IOptions <PersonConfig> option) { _personConfig = option.Value; }
protected override void OnModelCreating(ModelBuilder builder) { builder.Entity <Person>(PersonConfig.Config()); }
protected void Page_Load(object sender, EventArgs e) { IList <string> entStrList = RequestData.GetList <string>("data"); id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { ciEnt = CustomIndicator.Find(id); } switch (RequestActionString) { case "create": ciEnt = new CustomIndicator(); ciEnt.IndicatorNo = DataHelper.QueryValue <string>("select BJKY_Examine.dbo.fun_getIndicatorNo()"); ciEnt.DeptId = RequestData.Get <string>("DeptId"); ciEnt.DeptName = RequestData.Get <string>("DeptName"); ciEnt.IndicatorSecondId = RequestData.Get <string>("IndicatorSecondId"); ciEnt.IndicatorSecondName = RequestData.Get <string>("IndicatorSecondName"); ciEnt.DeptIndicatorName = RequestData.Get <string>("DeptIndicatorName"); ciEnt.Weight = RequestData.Get <int>("Weight"); PersonConfig pcEnt = PersonConfig.Find(ciEnt.DeptId); if (pcEnt != null) { ciEnt.Remark = pcEnt.GroupID; //备注字段用来存储足够机构的ID 方便选人 } ciEnt.State = "0"; ciEnt.DoCreate(); if (!string.IsNullOrEmpty(RequestData.Get <string>("originalId"))) //如果改字段不为空 说明是复制操作 { IList <PersonFirstIndicator> pfiEnts = PersonFirstIndicator.FindAllByProperty(PersonFirstIndicator.Prop_CustomIndicatorId, RequestData.Get <string>("originalId")); foreach (PersonFirstIndicator pfiEnt in pfiEnts) { PersonFirstIndicator nEnt1 = new PersonFirstIndicator(); nEnt1.CustomIndicatorId = ciEnt.Id; nEnt1.PersonFirstIndicatorName = pfiEnt.PersonFirstIndicatorName; nEnt1.TotalWeight = pfiEnt.TotalWeight; nEnt1.Weight = pfiEnt.Weight; nEnt1.SortIndex = pfiEnt.SortIndex; nEnt1.IndicatorType = pfiEnt.IndicatorType; nEnt1.CreateId = UserInfo.UserID; nEnt1.CreateName = UserInfo.Name; nEnt1.CreateTime = DateTime.Now; nEnt1.DoCreate(); IList <PersonSecondIndicator> psiEnts = PersonSecondIndicator.FindAllByProperty(PersonSecondIndicator.Prop_PersonFirstIndicatorId, pfiEnt.Id); foreach (PersonSecondIndicator psiEnt in psiEnts) { PersonSecondIndicator NEnt2 = new PersonSecondIndicator(); NEnt2.PersonFirstIndicatorId = nEnt1.Id; NEnt2.PersonFirstIndicatorName = nEnt1.PersonFirstIndicatorName; NEnt2.PersonSecondIndicatorName = psiEnt.PersonSecondIndicatorName; NEnt2.Weight = psiEnt.Weight; NEnt2.SortIndex = psiEnt.SortIndex; NEnt2.ToolTip = psiEnt.ToolTip; NEnt2.SelfRemark = psiEnt.SelfRemark; NEnt2.CreateId = UserInfo.UserID; NEnt2.CreateName = UserInfo.Name; NEnt2.CreateTime = DateTime.Now; NEnt2.DoCreate(); } } } PageState.Add("Entity", ciEnt); break; case "AutoUpdate": string ApproveUserId = RequestData.Get <string>("ApproveUserId"); string ApproveUserName = RequestData.Get <string>("ApproveUserName"); if (!string.IsNullOrEmpty(ApproveUserId)) { ciEnt.ApproveUserId = ApproveUserId; ciEnt.ApproveUserName = ApproveUserName; } ciEnt.DoUpdate(); break; case "submit": sql = @"select isnull(sum(A.Weight),0) from BJKY_Examine..PersonSecondIndicator as A left join BJKY_Examine..PersonFirstIndicator as B on A.PersonFirstIndicatorId=B.Id where B.CustomIndicatorId='" + id + "'"; int useWeight = DataHelper.QueryValue <int>(sql); if (ciEnt.Weight == useWeight) { ciEnt.State = "1"; ciEnt.Result = "审批中"; ciEnt.DoUpdate(); PageState.Add("Result", "T"); } else { PageState.Add("Result", "F"); } break; case "delete": DoBatchDelete(); break; case "UpLoadSummary": ciEnt.Summary = RequestData.Get <string>("Summary"); ciEnt.DoUpdate(); PageState.Add("Result", ciEnt.Summary); break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { BeRoleCode = RequestData.Get <string>("BeRoleCode"); ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(BeRoleCode)) { string beUserIds = string.Empty;//存储被考核对象具体的人 string beUserNames = string.Empty; string DeptNames = string.Empty; string DeptConstraint = ""; IList <EasyDictionary> dics = null; IList <PersonConfig> pcEnts = null; if (!string.IsNullOrEmpty(ExamineStageId))//如果是新建 人员不加部门约束 { DeptConstraint = " and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + ExamineStageId + "')"; } switch (BeRoleCode) { case "BeDeputyDirector": //副院级领导 pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "DeputyDirector"); if (pcEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { beUserIds = pcEnts[0].ClerkIds; beUserNames = pcEnts[0].ClerkNames; DeptNames = pcEnts[0].ClerkGroupNames; } } break; case "BeExecutiveDeptLeader": //职能服务部门正职 +分管工作的副职也被当做中层干部来考核 sql = @"select (isnull(FirstLeaderIds,'')+','+isnull(ChargeSecondLeaderIds,'')) as beUserIds, (isnull(FirstLeaderNames,'')+','+isnull(ChargeSecondLeaderNames,'')) as beUserNames , (isnull(FirstLeaderGroupNames,'')+','+isnull(ChargeSecondLeaderGroupNames,'')) as DeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' " + DeptConstraint; dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { beUserIds += dic.Get <string>("beUserIds") + ","; beUserNames += dic.Get <string>("beUserNames") + ","; DeptNames += dic.Get <string>("DeptNames") + ","; } break; case "BeBusinessDeptLeader": //经营目标单位正职 和负责工作的副职 sql = @"select (isnull(FirstLeaderIds,'')+','+isnull(ChargeSecondLeaderIds,'')) as beUserIds, (isnull(FirstLeaderNames,'')+','+isnull(ChargeSecondLeaderNames,'')) as beUserNames, (isnull(FirstLeaderGroupNames,'')+','+isnull(ChargeSecondLeaderGroupNames,'')) as DeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' " + DeptConstraint; dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { beUserIds += dic.Get <string>("beUserIds") + ","; beUserNames += dic.Get <string>("beUserNames") + ","; DeptNames += dic.Get <string>("DeptNames") + ","; } break; //case "BeDeptSecondLeader"://部门副职 { // pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_Id, LaunchDeptId); // if (pcEnts.Count > 0) // { // beUserIds = pcEnts[0].SecondLeaderIds; // beUserNames = pcEnts[0].SecondLeaderNames; // } // break; //case "BeDeptClerk"://部门员工 // pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_Id, LaunchDeptId); // if (pcEnts.Count > 0) // { // beUserIds = pcEnts[0].ClerkIds; // beUserNames = pcEnts[0].ClerkNames; // } // break; default: break; } if (!string.IsNullOrEmpty(beUserIds)) { DataTable dt = new DataTable(); DataColumn dc = new DataColumn("Id"); dt.Columns.Add(dc); dc = new DataColumn("UserID"); dt.Columns.Add(dc); dc = new DataColumn("UserName"); dt.Columns.Add(dc); dc = new DataColumn("DeptName"); dt.Columns.Add(dc); string[] userIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] userNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] deptNameArray = DeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < userIdArray.Length; i++) { DataRow dr = dt.NewRow(); dr["Id"] = System.Guid.NewGuid(); dr["UserID"] = userIdArray[i]; dr["UserName"] = userNameArray[i]; dr["DeptName"] = deptNameArray[i]; dt.Rows.Add(dr); } PageState.Add("DataList", dt); } } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); IList <string> strList1 = null; IList <string> strList2 = null; IList <string> strList3 = null; IList <string> strList4 = null; IList <string> strList5 = null; IList <string> strList6 = null; if (!string.IsNullOrEmpty(id)) { ent = PersonConfig.Find(id); } switch (RequestActionString) { case "update": ent = GetMergedData <PersonConfig>(); strList1 = RequestData.GetList <string>("dataLeader"); SetPersonConfigEnts(strList1, "dataLeader"); //firstLeader strList2 = RequestData.GetList <string>("data1"); SetPersonConfigEnts(strList2, "data1"); //SecondLeaderIds strList3 = RequestData.GetList <string>("data2"); SetPersonConfigEnts(strList3, "data2"); //ChargeSecondLeader strList4 = RequestData.GetList <string>("data3"); SetPersonConfigEnts(strList4, "data3"); //InstituteClerkDelegate strList5 = RequestData.GetList <string>("data4"); SetPersonConfigEnts(strList5, "data4"); //DeptClerkDelegate strList6 = RequestData.GetList <string>("data5"); SetPersonConfigEnts(strList6, "data5"); //Clerk if (!string.IsNullOrEmpty(ent.FirstLeaderIds)) { array1 = ent.FirstLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(ent.SecondLeaderIds)) { array2 = ent.SecondLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(ent.ClerkIds)) { array3 = ent.ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } peopleQuan = (array1 != null ? array1.Length : 0) + (array2 != null ? array2.Length : 0) + (array3 != null ? array3.Length : 0); ent.PeopleQuan = peopleQuan; if (peopleQuan > 0) { ent.ExcellentRate = Math.Round(((decimal)(ent.ExcellentQuan.HasValue ? ent.ExcellentQuan : 0) / (decimal)peopleQuan) * 100, 2); ent.GoodRate = Math.Round(((decimal)(ent.GoodQuan.HasValue ? ent.GoodQuan : 0) / (decimal)peopleQuan) * 100, 2); } ent.DoUpdate(); break; case "create": ent = GetPostedData <PersonConfig>(); ent.DoCreate(); strList1 = RequestData.GetList <string>("dataLeader"); SetPersonConfigEnts(strList1, "dataLeader"); //firstLeader strList2 = RequestData.GetList <string>("data1"); SetPersonConfigEnts(strList2, "data1"); //SecondLeaderIds strList3 = RequestData.GetList <string>("data2"); SetPersonConfigEnts(strList3, "data2"); //ChargeSecondLeader strList4 = RequestData.GetList <string>("data3"); SetPersonConfigEnts(strList4, "data3"); //InstituteClerkDelegate strList5 = RequestData.GetList <string>("data4"); SetPersonConfigEnts(strList5, "data4"); //DeptClerkDelegate strList6 = RequestData.GetList <string>("data5"); SetPersonConfigEnts(strList6, "data5"); //Clerk //计算部门人数 if (!string.IsNullOrEmpty(ent.FirstLeaderIds)) { array1 = ent.FirstLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(ent.SecondLeaderIds)) { array2 = ent.SecondLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(ent.ClerkIds)) { array3 = ent.ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } peopleQuan = (array1 != null ? array1.Length : 0) + (array2 != null ? array2.Length : 0) + (array3 != null ? array3.Length : 0); ent.PeopleQuan = peopleQuan; //创建的时候直接把系统配置部门优秀比率 和良好比率带过来 算出良好和优秀的人数 SysConfig scEnt = SysConfig.FindAll().First <SysConfig>(); ent.ExcellentRate = scEnt.DeptExcellentPercent; ent.GoodRate = scEnt.DeptGoodPercent; ent.ExcellentQuan = (int)Math.Floor((double)((ent.ExcellentRate / 100) * peopleQuan)); ent.GoodQuan = (int)Math.Floor((double)((ent.GoodRate / 100) * peopleQuan)); ent.DoUpdate(); break; default: DoSelect(); break; } }