private void DoSelect() { IList <EasyDictionary> dics = new List <EasyDictionary>(); sql = "select distinct Year from BJKY_Examine..ExamYearResult order by Year asc"; IList <EasyDictionary> yearDics = DataHelper.QueryDictList(sql); foreach (EasyDictionary yearDic in yearDics) { EasyDictionary dic = new EasyDictionary(); dic.Add("Year", yearDic.Get <string>("Year")); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where ApproveLevel is not null and Year='" + yearDic.Get <string>("Year") + "'"; decimal t = DataHelper.QueryValue <int>(sql); dic.Add("Total", t); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and (ApproveLevel='优秀' or AppealLevel='优秀')"; decimal q1 = DataHelper.QueryValue <int>(sql); dic.Add("优秀", q1); dic.Add("优秀占比", Math.Round(q1 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and (ApproveLevel='良好' or AppealLevel='良好')"; decimal q2 = DataHelper.QueryValue <int>(sql); dic.Add("良好", q2); dic.Add("良好占比", Math.Round(q2 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and (ApproveLevel='称职' or AppealLevel='称职')"; decimal q3 = DataHelper.QueryValue <int>(sql); dic.Add("称职", q3); dic.Add("称职占比", Math.Round(q3 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and (ApproveLevel='不称职' or AppealLevel='不称职')"; decimal q4 = DataHelper.QueryValue <int>(sql); dic.Add("不称职", q4); dic.Add("不称职占比", Math.Round(q4 * 100 / t, 2)); dics.Add(dic); } PageState.Add("DataList", dics); }
protected void Page_Load(object sender, EventArgs e) { switch (RequestActionString) { case "GetResultByUserId": string userId = RequestData.Get <string>("userId"); IList <ExamYearResult> eyrEnts = ExamYearResult.FindAllByProperty("Year", "UserId", userId); IList <EasyDictionary> dics = new List <EasyDictionary>(); foreach (ExamYearResult eyrEnt in eyrEnts) { EasyDictionary dic = new EasyDictionary(); dic.Add("YearQuarter", eyrEnt.Year + "-1"); dic.Add("Score", eyrEnt.FirstQuarterScore); dics.Add(dic); dic = new EasyDictionary(); dic.Add("YearQuarter", eyrEnt.Year + "-2"); dic.Add("Score", eyrEnt.SecondQuarterScore); dics.Add(dic); dic = new EasyDictionary(); dic.Add("YearQuarter", eyrEnt.Year + "-3"); dic.Add("Score", eyrEnt.ThirdQuarterScore); dics.Add(dic); dic = new EasyDictionary(); dic.Add("YearQuarter", eyrEnt.Year + "-4"); dic.Add("Score", eyrEnt.FourthQuarterScore); dics.Add(dic); } PageState.Add("Result", dics); break; default: DoSelect(); break; } }
/// <summary> /// 查询 /// </summary> private void DoSelect() { EasyDictionary dic = SysEnumeration.GetEnumDict("EmpAppeal"); dic.Add("%%", "请选择..."); PageState.Add("AppealTypeName", dic); //问卷角色或管理员 CommPowerSplit Role = new CommPowerSplit(); if (Role.IsAppealRole(UserInfo.UserID, UserInfo.LoginName)) { ents = UsrAppealList.FindAll(SearchCriterion); this.PageState.Add("UsrAppealListList", ents); } else { StringBuilder strb = new StringBuilder(); if (Session["CompanyId"] != null) //判断公司登陆 { SearchCriterion.SetSearch(UsrAppealList.Prop_CompanyId, Session["CompanyId"]); ents = UsrAppealList.FindAll(SearchCriterion); this.PageState.Add("UsrAppealListList", ents); } else { var UsrEnt = SysUser.Find(UserInfo.UserID); SearchCriterion.SetSearch(UsrAppealList.Prop_CompanyId, UsrEnt.Pk_corp); ents = UsrAppealList.FindAll(SearchCriterion); this.PageState.Add("UsrAppealListList", ents); } } }
/// <summary> /// 查询 /// </summary> private void DoSelect() { SearchCriterion.SetSearch(UsrAppealList.Prop_UserId, UserInfo.UserID); ents = UsrAppealList.FindAll(SearchCriterion); this.PageState.Add("UsrAppealListList", ents); EasyDictionary dic = SysEnumeration.GetEnumDict("EmpAppeal"); dic.Add("%%", "请选择..."); PageState.Add("AppealTypeName", dic); }
/// <summary> /// Compares the values of all the properties for the given /// <paramref name="left"/> and <paramref name="right"/> and returns the variance. /// </summary> public bool Compare <T>(T left, T right, bool inherit, bool includePrivate, out IEasyDictionary <PropertyInfo, Variance> variances) { var type = typeof(T); var key = new CacheKey(type, inherit, includePrivate); var cache = _cache.GetOrAdd(key, () => { return(type.GetInstanceProperties(inherit, includePrivate) .Select(p => new KeyValuePair <PropertyInfo, object>(p, AccessorBuilder.BuildGetter <T>(p, includePrivate)))); }); var bothMatch = true; var result = new EasyDictionary <PropertyInfo, Variance>(variance => variance.Property); foreach (var pair in cache) { var p = pair.Key; var getter = (Func <T, object>)pair.Value; var leftVal = getter(left); var rightVal = getter(right); var variance = new Variance(p, leftVal, rightVal); result.Add(variance); if (!bothMatch) { continue; } if (variance.Varies) { bothMatch = false; } } variances = result; return(bothMatch); }
public void When_using_as_collection() { var p1 = new Person("A", 1); var p2 = new Person("B", 2); var comparer = StringComparer.OrdinalIgnoreCase; Func <Person, string> selector = p => p.Id; ICollection <Person> dic = new EasyDictionary <string, Person>( selector, 10, comparer) { p1, p2 }; dic.ShouldNotBeNull(); dic.Count.ShouldBe(2); dic.Contains(p1).ShouldBeTrue(); dic.Contains(p2).ShouldBeTrue(); var p3 = new Person("C", 3); dic.Add(p3); dic.Contains(p3).ShouldBeTrue(); dic.Remove(p1).ShouldBeTrue(); dic.Count.ShouldBe(2); dic.Contains(p1).ShouldBeFalse(); dic.Clear(); dic.Count.ShouldBe(0); }
private void DoSelect() { if (ent != null) { SetFormData(ent); IList <EasyDictionary> dics = new List <EasyDictionary>(); if (!string.IsNullOrEmpty(ent.FamilyNames)) { string[] fns = ent.FamilyNames.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string[] fgs = ent.FamilyGenders.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string[] fis = ent.FamilyIdentities.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < fns.Length; i++) { EasyDictionary dic = new EasyDictionary(); dic.Add("FamilyName", fns[i]); dic.Add("FamilyGender", fgs[i]); dic.Add("FamilyIdentity", fis[i]); dics.Add(dic); } PageState.Add("DataList", dics); } } // if (op == "c" || op == "create") //创建生成编号 // { // var Ent = SysUser.FindFirstByProperties("UserID", UserInfo.UserID); // //用来获取配置的审批人 // string SQL = "select top 1 * from FL_Culture..SysApproveConfig where CompanyId='{0}' and len(ChildWelfareId)>0 "; // SQL = string.Format(SQL, Ent.Pk_corp); // DataTable Dt = DataHelper.QueryDataTable(SQL); // //公司与部门 // SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName // from sysuser As A // left join sysgroup As B // on A.pk_corp=B.groupID // left join sysgroup As C // on C.GroupID=A.pk_deptdoc // where A.UserID='{0}'"; // SQL = string.Format(SQL, UserInfo.UserID); // DataTable Dt1 = DataHelper.QueryDataTable(SQL); // string CompanyName = string.Empty, CompanyId = string.Empty; // string DeptName = string.Empty, DeptId = string.Empty; // if (Dt1.Rows.Count > 0) // { // CompanyName = Dt1.Rows[0]["CompanyName"].ToString(); // CompanyId = Dt1.Rows[0]["CompanyId"].ToString(); // DeptId = Dt1.Rows[0]["DeptId"].ToString(); // DeptName = Dt1.Rows[0]["DeptName"].ToString(); // } // if (Ent != null) // { // var Obj = new // { // UserId = Ent.UserID, // UserName = Ent.Name, // Sex = Ent.Sex, // Age = Ent.Wage, // WorkNo = Ent.WorkNo, // IndutyData = Ent.Indutydate, // CompanyName = CompanyName, // CompanyId = CompanyId, // DeptId = DeptId, // DeptName = DeptName, // ApproveName = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["ChildWelfareName"].ToString() : "", // ApproveUserId = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["ChildWelfareId"].ToString() : "" // }; // this.SetFormData(Obj); // } // } }
public void When_adding_and_removing_items_with_comparer() { var comparer = StringComparer.OrdinalIgnoreCase; Func <Person, string> selector = p => p.Id; EasyDictionary <string, Person> dic = new EasyDictionary <string, Person>( selector, comparer: comparer); var p1 = new Person("A", 1); var p2 = new Person("B", 2); dic.Contains(p1).ShouldBeFalse(); dic.ContainsKey("A").ShouldBeFalse(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeFalse(); dic.ContainsKey("B").ShouldBeFalse(); dic.ContainsKey("b").ShouldBeFalse(); dic.Add(p1); dic.Count.ShouldBe(1); dic.Keys.Count.ShouldBe(1); dic.Values.Count.ShouldBe(1); dic.Contains(p1).ShouldBeTrue(); dic.ContainsKey("A").ShouldBeTrue(); dic.ContainsKey("a").ShouldBeTrue(); dic.TryGetValue("A", out var pA).ShouldBeTrue(); pA.ShouldBe(pA); dic["A"].ShouldBe(pA); dic["a"].ShouldBe(pA); dic.Contains(p2).ShouldBeFalse(); dic.ContainsKey("B").ShouldBeFalse(); dic.ContainsKey("b").ShouldBeFalse(); dic.TryGetValue("B", out var pB).ShouldBeFalse(); dic.Add(p2); dic.Count.ShouldBe(2); dic.Keys.Count.ShouldBe(2); dic.Values.Count.ShouldBe(2); dic.Contains(p1).ShouldBeTrue(); dic.ContainsKey("A").ShouldBeTrue(); dic.ContainsKey("a").ShouldBeTrue(); dic.Contains(p2).ShouldBeTrue(); dic.ContainsKey("B").ShouldBeTrue(); dic.ContainsKey("b").ShouldBeTrue(); dic.TryGetValue("B", out pB).ShouldBeTrue(); pB.ShouldBe(p2); dic["B"].ShouldBe(pB); dic["b"].ShouldBe(pB); dic.Remove("C").ShouldBeFalse(); dic.Remove("c").ShouldBeFalse(); dic.Remove(new Person("C", 3)).ShouldBeFalse(); dic.Keys.Count.ShouldBe(2); dic.Values.Count.ShouldBe(2); dic.Remove("a").ShouldBeTrue(); dic.Keys.Count.ShouldBe(1); dic.Values.Count.ShouldBe(1); dic.Contains(p1).ShouldBeFalse(); dic.ContainsKey("A").ShouldBeFalse(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeTrue(); dic.ContainsKey("B").ShouldBeTrue(); dic.ContainsKey("b").ShouldBeTrue(); dic.Remove(p2).ShouldBeTrue(); dic.Keys.Count.ShouldBe(0); dic.Values.Count.ShouldBe(0); dic.Contains(p1).ShouldBeFalse(); dic.ContainsKey("A").ShouldBeFalse(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeFalse(); dic.ContainsKey("B").ShouldBeFalse(); dic.ContainsKey("b").ShouldBeFalse(); }
public void When_adding_and_removing_items() { Func <Person, string> selector = p => p.Id; EasyDictionary <string, Person> dic = new EasyDictionary <string, Person>(selector); var p1 = new Person("A", 1); var p2 = new Person("B", 2); dic.Contains(p1).ShouldBeFalse(); dic.ContainsKey("A").ShouldBeFalse(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeFalse(); dic.ContainsKey("B").ShouldBeFalse(); dic.ContainsKey("b").ShouldBeFalse(); dic.Add(p1); dic.Count.ShouldBe(1); dic.Keys.Count.ShouldBe(1); dic.Values.Count.ShouldBe(1); dic.Contains(p1).ShouldBeTrue(); dic.ContainsKey("A").ShouldBeTrue(); dic.ContainsKey("a").ShouldBeFalse(); dic.TryGetValue("A", out var pA).ShouldBeTrue(); pA.ShouldBe(pA); dic["A"].ShouldBe(pA); Should.Throw <KeyNotFoundException>(() => dic["a"].ToString()); dic.Contains(p2).ShouldBeFalse(); dic.ContainsKey("B").ShouldBeFalse(); dic.ContainsKey("b").ShouldBeFalse(); dic.TryGetValue("B", out var pB).ShouldBeFalse(); dic.Add(p2); dic.Count.ShouldBe(2); dic.Keys.Count.ShouldBe(2); dic.Values.Count.ShouldBe(2); dic.Contains(p1).ShouldBeTrue(); dic.ContainsKey("A").ShouldBeTrue(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeTrue(); dic.ContainsKey("B").ShouldBeTrue(); dic.ContainsKey("b").ShouldBeFalse(); dic.TryGetValue("B", out pB).ShouldBeTrue(); pB.ShouldBe(p2); dic["B"].ShouldBe(pB); Should.Throw <KeyNotFoundException>(() => dic["b"].ToString()); dic.Remove("C").ShouldBeFalse(); dic.Remove("c").ShouldBeFalse(); dic.Remove(new Person("C", 3)).ShouldBeFalse(); dic.Keys.Count.ShouldBe(2); dic.Values.Count.ShouldBe(2); dic.Remove("a").ShouldBeFalse(); dic.Remove("A").ShouldBeTrue(); dic.Keys.Count.ShouldBe(1); dic.Values.Count.ShouldBe(1); dic.Contains(p1).ShouldBeFalse(); dic.ContainsKey("A").ShouldBeFalse(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeTrue(); dic.ContainsKey("B").ShouldBeTrue(); dic.ContainsKey("b").ShouldBeFalse(); dic.Remove(p2).ShouldBeTrue(); dic.Keys.Count.ShouldBe(0); dic.Values.Count.ShouldBe(0); dic.Contains(p1).ShouldBeFalse(); dic.ContainsKey("A").ShouldBeFalse(); dic.ContainsKey("a").ShouldBeFalse(); dic.Contains(p2).ShouldBeFalse(); dic.ContainsKey("B").ShouldBeFalse(); dic.ContainsKey("b").ShouldBeFalse(); }
//权限判定专用 private ICriterion CheckProperty(ICriterion ic) { string sql = ""; EasyDictionary dic = new EasyDictionary(); DataTable dt = new DataTable(); string DeptName = this.RequestData.Get <string>("DeptName"); //能看到全部的角色 /*if (this.UserContext.Roles.Where(ent => ent.Name == "全部目标查看").Count() > 0) * { * sql = @"select v.Name,isnull(s.sort,v.Type) Type from (select replace(Name,'院经营处','经营处') Name,2 Type from SysGroup as ent WHERE PathLevel=2 and (Type = 2) and Name not in ('院领导','内部退休','副总工程师','临时工') * union * select UserName Name,Type from dbo.View_SysUserGroup where ChildDeptName='主管院长' * union select UserName Name,'4' Type from dbo.View_SysUserGroup where ChildDeptName='副总工程师') v left join {0}..A_SortSetting s on v.Name=s.PName * order by isnull(s.sort,case when v.Type='2' then 200 when v.Type='3' then 100 when v.Type='4' then 400 end) asc * "; * dt = DataHelper.QueryDataTable(string.Format(sql, db)); * this.PageState.Add("CurrentDept", dt.Rows[0][0]); * ICriterion ich = null; * if (string.IsNullOrEmpty(DeptName)) * { * ich = Expression.Sql(" (DutyName ='" + dt.Rows[0][0].ToString() + "' or Ext2 in (select Flag from " + db + "..A_TaskWBS where DutyName ='" + this.UserInfo.Name + "' or DeptName like '%" + this.UserInfo.Name + "%')) and Flag is null"); * } * else * { * //主管院长能看自己的和从主管所获取过来的 * ich = Expression.Sql(" (DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%' or Ext2 in (select Flag from " + db + "..A_TaskWBS where DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%')) and Flag is null"); * } * ic = SearchHelper.IntersectCriterions(ic, ich); * isLeader = "T"; * } * //只是主管院长 * else if (this.UserContext.Groups.Where(ent => ent.Name == "主管院长").Count() > 0) * { * sql = @"select distinct ParentDeptName from View_SysUserGroup where ChildDeptName='主管院长' and UserId ='{0}' * union select '{1}'"; * sql = string.Format(sql, this.UserInfo.UserID, this.UserInfo.Name); * dt = DataHelper.QueryDataTable(sql); * this.PageState.Add("CurrentDept", this.UserInfo.Name); * ICriterion ich = null; * if (string.IsNullOrEmpty(DeptName)) * { * ich = Expression.Sql(" (DutyName ='" + this.UserInfo.Name + "' or Ext2 in (select Flag from " + db + "..A_TaskWBS where DutyName ='" + this.UserInfo.Name + "' or DeptName like '%" + this.UserInfo.Name + "%') or Ext2 in (select Id from " + db + "..A_AimLeaders where CreateId='" + this.UserInfo.UserID + "')) and Flag is null"); * if (this.RequestData.Get<string>("IsShowAll") != null && this.RequestData.Get<string>("IsShowAll").ToLower() == "true") * { * ich = Expression.Sql(" (DutyName ='" + this.UserInfo.Name + "' or Ext2 in (select Flag from " + db + "..A_TaskWBS where DutyName ='" + this.UserInfo.Name + "' or DeptName like '%" + this.UserInfo.Name + "%') or Ext2 in (select Id from " + db + "..A_AimLeaders where CreateId='" + this.UserInfo.UserID + "'))"); * } * } * else * { * //主管院长能看自己的和从主管所获取过来的 * ich = Expression.Sql(" (DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%' or Ext2 in (select Flag from " + db + "..A_TaskWBS where DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%') or Ext2 in (select Id from " + db + "..A_AimLeaders where CreateName='" + DeptName + "')) and Flag is null"); * if (this.RequestData.Get<string>("IsShowAll") != null && this.RequestData.Get<string>("IsShowAll").ToLower() == "true") * { * ich = Expression.Sql(" (DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%' or Ext2 in (select Flag from " + db + "..A_TaskWBS where DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%') or Ext2 in (select Id from " + db + "..A_AimLeaders where CreateName='" + DeptName + "'))"); * } * } * ic = SearchHelper.IntersectCriterions(ic, ich); * isLeader = "T"; * isLeaderCompany = "T"; * } * //只是部门长 * else if (this.UserContext.Groups.Where(ent => ent.Name == "所(处、部)长").Count() > 0) * { * sql = @"select distinct case when ChildDeptName='所(处、部)长' then ParentDeptName else ChildDeptName end from dbo.View_SysUserGroup where UserId like '%" + this.UserInfo.UserID + "%' and ChildDeptName not in ('副总工程师','院办主任','副院长')"; * dt = DataHelper.QueryDataTable(sql); * this.PageState.Add("CurrentDept", dt.Rows[0][0]); * ICriterion ich = null; * if (string.IsNullOrEmpty(DeptName)) * ich = Expression.Sql("( DutyName ='" + dt.Rows[0][0].ToString() + "' or DeptName like '%" + dt.Rows[0][0].ToString() + "%') and Flag is null and DutyName not in ( select UserName from " + db + "..A_DeptLeaderRelation where GroupName='" + dt.Rows[0][0].ToString() + "')"); * else * ich = Expression.Sql("( DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%') and Flag is null and DutyName not in ( select UserName from " + db + "..A_DeptLeaderRelation where GroupName='" + DeptName + "')"); * ic = SearchHelper.IntersectCriterions(ic, ich); * isLeader = "T"; * } * //普通责任人,能看到自己的责任任务 * else * {*/ //sql = @"select distinct case when ChildDeptName='所(处、部)长' then ParentDeptName else ChildDeptName end from dbo.View_SysUserGroup where UserId like '%" + this.UserInfo.UserID + "%' and Type=2"; //dt = DataHelper.QueryDataTable(sql); //this.PageState.Add("CurrentDept", dt.Rows[0][0]); //责任领导不是部门长,是自己的也能看到(非责任人) string sqlC = " Id in (select distinct SUBSTRING(isnull(Path,Id),0,37) from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%' or UserIds like '%" + this.UserInfo.UserID + "%'"; sqlC += " union select Id from " + db + "..A_TaskWBS where Ext2 in (select Id from A_Aims where DutyLeaderId ='" + this.UserInfo.UserID + "') "; sqlC += ")"; ic = SearchHelper.IntersectCriterions(ic, Expression.Sql(sqlC)); //ICriterion ich = Expression.Sql(" ( DutyName ='" + dt.Rows[0][0].ToString() + "' or DeptName like '%" + dt.Rows[0][0].ToString() + "%')"); //ic = SearchHelper.IntersectCriterions(ic, ich); //} foreach (DataRow row in dt.Rows) { dic.Add(row[0].ToString(), row[0]); } this.PageState.Add("Depts", dic); return(ic); }
private void DoSelect() { IList <EasyDictionary> dics = new List <EasyDictionary>(); sql = "select distinct Year from BJKY_Examine..ExamYearResult order by Year asc"; IList <EasyDictionary> yearDics = DataHelper.QueryDictList(sql); foreach (EasyDictionary yearDic in yearDics) { EasyDictionary dic = new EasyDictionary(); dic.Add("Year", yearDic.Get <string>("Year")); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "'"; decimal t = DataHelper.QueryValue <int>(sql); dic.Add("Total", t); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=95"; decimal q1 = DataHelper.QueryValue <int>(sql); dic.Add("95->100", q1); dic.Add("95->100占比", Math.Round(q1 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=90 and IntegrationScore < 95"; decimal q2 = DataHelper.QueryValue <int>(sql); dic.Add("90->94", q2); dic.Add("90->94占比", Math.Round(q2 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=85 and IntegrationScore < 90"; decimal q3 = DataHelper.QueryValue <int>(sql); dic.Add("85->89", q3); dic.Add("85->89占比", Math.Round(q3 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=80 and IntegrationScore < 85"; decimal q4 = DataHelper.QueryValue <int>(sql); dic.Add("80->84", q4); dic.Add("80->84占比", Math.Round(q4 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=75 and IntegrationScore < 80"; decimal q5 = DataHelper.QueryValue <int>(sql); dic.Add("75->79", q5); dic.Add("75->79占比", Math.Round(q5 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=70 and IntegrationScore < 75"; decimal q6 = DataHelper.QueryValue <int>(sql); dic.Add("70->74", q6); dic.Add("70->74占比", Math.Round(q6 * 100 / t, 2)); sql = @"select count(Id) from BJKY_Examine..ExamYearResult where Year='" + yearDic.Get <string>("Year") + "' and IntegrationScore>=0 and IntegrationScore < 70"; decimal q7 = DataHelper.QueryValue <int>(sql); dic.Add("0->69", q7); dic.Add("0->69占比", Math.Round(q7 * 100 / t, 2)); dics.Add(dic); } PageState.Add("DataList", dics); }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); typeid = RequestData.Get <string>("TypeId"); ImgNews ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.SaveAndFlush(); SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.CreateId = UserInfo.UserID; ent.CreateName = UserInfo.Name; ent.CreateTime = DateTime.Now; ent.State = "1"; if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.CreateAndFlush(); SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Delete: ent = this.GetTargetData <ImgNews>(); ent.DeleteAndFlush(); this.SetMessage("删除成功!"); return; break; } if (RequestActionString == "ImportFile") { string fileIds = RequestData.Get <string>("fileIds"); if (!string.IsNullOrEmpty(fileIds)) { string sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0"; sql = string.Format(sql, fileIds); PageState.Add("Result", DataHelper.QueryDictList(sql)); } } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = ImgNews.Find(id); typeid = ent.TypeId; //详细列表数据 PageState.Add("DetailList", ImgNewDetail.FindAllByProperty("PId", ent.Id)); } this.SetFormData(ent); } else { string sql = "select DeptId,ChildDeptName,ParentId,ParentDeptName,len(Path) LenPath from dbo.View_SysUserGroup where UserId='" + UserInfo.UserID + "' and Type=2"; DataTable dtt = DataHelper.QueryDataTable(sql); if (dtt.Rows.Count > 0) { var DeptInfo = new { groupId = dtt.Rows[0]["DeptId"] + "", groupName = dtt.Rows[0]["ChildDeptName"] + "", deptId = dtt.Rows[0]["ParentId"] + "", deptName = dtt.Rows[0]["ParentDeptName"] + "" }; PageState.Add("DeptInfo", DeptInfo); } } if (!String.IsNullOrEmpty(typeid)) { NewsType newsType = NewsType.TryFind(typeid); PageState.Add("NewsType", newsType); } EasyDictionary es = new EasyDictionary(); DataTable dt = DataHelper.QueryDataTable("select Id,TypeName from NewsType where IsEfficient='1'"); foreach (DataRow row in dt.Rows) { es.Add(row["Id"].ToString(), row["TypeName"].ToString()); } PageState.Add("NewsTypeEnum", es); }
//权限判定专用 private ICriterion CheckProperty(ICriterion ic) { string sql = ""; EasyDictionary dic = new EasyDictionary(); DataTable dt = new DataTable(); string DeptName = this.RequestData.Get <string>("DeptName"); //能看到全部的角色 if (this.UserContext.Roles.Where(ent => ent.Name == "全部目标查看").Count() > 0) { sql = @"select v.Name,isnull(s.sort,v.Type) Type from (select Name,10000 Type from SysGroup as ent WHERE PathLevel=2 and (Type = 2) and Name not in ('院领导','内部退休','副总工程师','临时工') union select UserName Name,Type from dbo.View_SysUserGroup where ChildDeptName='主管院长') v left join {0}..A_SortSetting s on v.Name=s.PName order by isnull(s.sort,v.Type) asc "; dt = DataHelper.QueryDataTable(string.Format(sql, db)); this.PageState.Add("CurrentDept", dt.Rows[0][0]); ICriterion ich = null; if (string.IsNullOrEmpty(DeptName)) { ich = Expression.Sql(" DutyName ='" + dt.Rows[0][0].ToString() + "'"); } else { ich = Expression.Sql(" (DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%')"); } ic = SearchHelper.IntersectCriterions(ic, ich); } //只是主管院长 else if (this.UserContext.Groups.Where(ent => ent.Name == "主管院长").Count() > 0) { sql = @"select distinct ParentDeptName from View_SysUserGroup where ChildDeptName='主管院长' and UserId ='{0}' union select '{1}'"; sql = string.Format(sql, this.UserInfo.UserID, this.UserInfo.Name); dt = DataHelper.QueryDataTable(sql); this.PageState.Add("CurrentDept", this.UserInfo.Name); ICriterion ich = null; if (string.IsNullOrEmpty(DeptName)) { ich = Expression.Sql(" DutyName ='" + this.UserInfo.Name + "'"); } else { ich = Expression.Sql(" (DutyName ='" + DeptName + "' or DeptName like '%" + DeptName + "%')"); } ic = SearchHelper.IntersectCriterions(ic, ich); } //只是部门长 else if (this.UserContext.Groups.Where(ent => ent.Name == "所(处、部)长").Count() > 0) { sql = @"select distinct case when ChildDeptName='所(处、部)长' then ParentDeptName else ChildDeptName end from dbo.View_SysUserGroup where UserId like '%" + this.UserInfo.UserID + "%'"; dt = DataHelper.QueryDataTable(sql); this.PageState.Add("CurrentDept", dt.Rows[0][0]); ICriterion ich = Expression.Sql("( DutyName ='" + dt.Rows[0][0].ToString() + "' or DeptName like '%" + dt.Rows[0][0].ToString() + "%')"); ic = SearchHelper.IntersectCriterions(ic, ich); } //普通责任人,能看到自己的责任任务 else { sql = @"select distinct case when ChildDeptName='所(处、部)长' then ParentDeptName else ChildDeptName end from dbo.View_SysUserGroup where UserId like '%" + this.UserInfo.UserID + "%' and Type=2"; dt = DataHelper.QueryDataTable(sql); this.PageState.Add("CurrentDept", dt.Rows[0][0]); ICriterion ich = Expression.Sql(" ( DutyName ='" + dt.Rows[0][0].ToString() + "' or DeptName like '%" + dt.Rows[0][0].ToString() + "%')"); ic = SearchHelper.IntersectCriterions(ic, ich); } foreach (DataRow row in dt.Rows) { dic.Add(row[0].ToString(), row[0]); } this.PageState.Add("Depts", dic); return(ic); }
private void DoSelect() { sql = @"select * from BJKY_Examine..PersonConfig where (PatIndex('%{0}%',FirstLeaderIds)>0 or PatIndex('%{0}%',SecondLeaderIds)>0 or PatIndex('%{0}%',ClerkIds)>0) and (GroupType='职能服务部门' or GroupType='经营目标单位')"; sql = string.Format(sql, UserInfo.UserID); EasyDictionary dic = DataHelper.QueryDict(sql, "Id", "GroupName"); IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) { PageState.Add("GroupID", dics[0].Get <string>("GroupID"));//把这个送到前台方便选人 } PageState.Add("GroupEnum", dic); if (op == "c") { var Obj = new { GroupID = dic.Keys.First(), GroupName = dic.Values.First() }; SetFormData(Obj); } else { string[] ids = new string[] { }; string[] names = new string[] { }; IList <EasyDictionary> beDics = new List <EasyDictionary>(); if (!string.IsNullOrEmpty(ent.BeUserIds)) { ids = ent.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); names = ent.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ids.Length; i++) { EasyDictionary beDic = new EasyDictionary(); beDic.Add("Id", ids[i]); beDic.Add("Name", names[i]); beDics.Add(beDic); } PageState.Add("DataList1", beDics); } IList <EasyDictionary> upDics = new List <EasyDictionary>(); if (!string.IsNullOrEmpty(ent.UpLevelUserIds)) { ids = ent.UpLevelUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); names = ent.UpLevelUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ids.Length; i++) { EasyDictionary upDic = new EasyDictionary(); upDic.Add("Id", ids[i]); upDic.Add("Name", names[i]); sql = "select top 1 Balance from BJKY_Examine..UserBalance where ExamineRelationId='" + ent.Id + "' and ToUserId='" + ids[i] + "' and ToRoleCode='UpLevel'"; upDic.Add("Weight", DataHelper.QueryValue <int>(sql) > 0 ? DataHelper.QueryValue <int>(sql) + "" : null); upDics.Add(upDic); } PageState.Add("DataList2", upDics); } IList <EasyDictionary> sameDics = new List <EasyDictionary>(); if (!string.IsNullOrEmpty(ent.SameLevelUserIds)) { ids = ent.SameLevelUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); names = ent.SameLevelUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ids.Length; i++) { EasyDictionary sameDic = new EasyDictionary(); sameDic.Add("Id", ids[i]); sameDic.Add("Name", names[i]); sql = "select top 1 Balance from BJKY_Examine..UserBalance where ExamineRelationId='" + ent.Id + "' and ToUserId='" + ids[i] + "' and ToRoleCode='SameLevel'"; sameDic.Add("Weight", DataHelper.QueryValue <int>(sql) > 0 ? DataHelper.QueryValue <int>(sql) + "" : null); sameDics.Add(sameDic); } PageState.Add("DataList3", sameDics); } IList <EasyDictionary> downDics = new List <EasyDictionary>(); if (!string.IsNullOrEmpty(ent.DownLevelUserIds)) { ids = ent.DownLevelUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); names = ent.DownLevelUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ids.Length; i++) { EasyDictionary downDic = new EasyDictionary(); downDic.Add("Id", ids[i]); downDic.Add("Name", names[i]); sql = "select top 1 Balance from BJKY_Examine..UserBalance where ExamineRelationId='" + ent.Id + "' and ToUserId='" + ids[i] + "' and ToRoleCode='DownLevel'"; downDic.Add("Weight", DataHelper.QueryValue <int>(sql) > 0 ? DataHelper.QueryValue <int>(sql) + "" : null); downDics.Add(downDic); } PageState.Add("DataList4", downDics); } SetFormData(ent); } //找到登录人所在的部门 有可能一个人多部门的情形 }
protected void Page_Load(object sender, EventArgs e) { switch (RequestActionString) { case "unreadmessage": GetUserTasks(); try { GoodwaySSO.Sso.Singletion.RefreshUserState(Session["PassCode"].ToString()); } catch { } break; default: if (Request.QueryString["tag"] != null && Request.QueryString["tag"] == "Refresh") { Response.Write(""); Response.End(); } if (Session["PassCode"] == null) { SqlDataAdapter sda = new SqlDataAdapter("select Id,WorkNo,UserName,SystemName from OgUser where SystemName='" + this.UserInfo.LoginName + "' ", System.Configuration.ConfigurationManager.ConnectionStrings["BJKY_BeAdmin"].ConnectionString); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; string template = "<Form Name='" + row["Id"] + "'><Id>" + row["Id"] + "</Id><WorkNo>" + row["WorkNo"] + "</WorkNo><UserName>" + row["UserName"] + "</UserName><SystemName>" + row["SystemName"] + "</SystemName><Password></Password><Field></Field></Form>"; string passCode = ""; try { passCode = GoodwaySSO.Sso.LoginGW(template, row["Id"].ToString(), row["UserName"].ToString()); } catch { } this.PageState.Add("PassCode", passCode); Session["PassCode"] = passCode; } else { Session["PassCode"] = ""; } } IEnumerable <SysModule> topAuthExamMdls = new List <SysModule>(); if (UserContext.AccessibleApplications.Count > 0) { SysApplication examApp = UserContext.AccessibleApplications.FirstOrDefault(tent => tent.Code == EXAMINING_APP_CODE); if (examApp != null && UserContext.AccessibleModules.Count > 0) { topAuthExamMdls = UserContext.AccessibleModules.Where(tent => tent.ApplicationID == examApp.ApplicationID && String.IsNullOrEmpty(tent.ParentID)); topAuthExamMdls = topAuthExamMdls.OrderBy(tent => tent.SortIndex); } } DataTable dtps = DataHelper.QueryDataTable("select distinct DeptId,DeptName from WebPart where isnull(DeptId,'')<>''"); List <EasyDictionary> ess = new List <EasyDictionary>(); foreach (DataRow row in dtps.Rows) { try { string[] deptIds = row["DeptId"].ToString().Split(','); string[] deptNames = row["DeptName"].ToString().Split(','); for (var i = 0; i < deptIds.Length; i++) { EasyDictionary es = new EasyDictionary(); es.Add("DeptId", deptIds[i]); es.Add("DeptName", deptNames[i]); if (!ess.Exists(ens => ens.Get("DeptId").ToString() == deptIds[i])) { ess.Add(es); } } } catch { continue; } } this.PageState.Add("Depts", ess); this.PageState.Add("Modules", topAuthExamMdls); GetUserTasks(); break; } //string IsPrompt = "False"; //IList<EasyDictionary> dicAssConfig = DataHelper.QueryDictList("select * from " + db + "..P_AssConfig where CloseState='1'"); //if (dicAssConfig.Count > 0) //{ // string assConfigId = dicAssConfig[0].Get<String>("Id"); // IList<EasyDictionary> dicList = DataHelper.QueryDictList("select * from " + db + "..P_StageSubmitUser where UserId='" + WebPortalService.CurrentUserInfo.UserID + "' and P_AssConfigId='" + assConfigId + "'"); // if (dicList.Count == 0) // { // IsPrompt = "True"; // } //} //this.PageState.Add("Prompt", IsPrompt); }
private void DoSelect() { sql = @"select A.Id,A.PersonFirstIndicatorId, A.PersonSecondIndicatorName,A.Weight,A.SortIndex, A.ToolTip,A.SelfRemark, B.IndicatorType,B.PersonFirstIndicatorName, B.Weight as FirstWeight, B.SortIndex as FirstIndex ,C.Summary, (select top 1 CustomScore from BJKY_Examine..CustomFirstIndicatorScore where ExamineTaskId='{5}' and PersonFirstIndicatorId=B.Id) as Score from BJKY_Examine..PersonSecondIndicator as A left join BJKY_Examine..PersonFirstIndicator as B on A.PersonFirstIndicatorId=B.Id left join BJKY_Examine..CustomIndicator as C on B.CustomIndicatorId=C.Id where C.CreateId='{0}' and C.Year='{1}' and C.StageType='{2}' and C.DeptId='{3}' and C.IndicatorSecondId='{4}' and C.Result='同意' order by B.IndicatorType desc ,B.Id asc,A.SortIndex asc"; ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); ExamineStage esEnt = ExamineStage.Find(etEnt.ExamineStageId); sql = string.Format(sql, etEnt.BeUserId, esEnt.Year, esEnt.StageType, esEnt.LaunchDeptId, IndicatorSecondId, ExamineTaskId); IList <EasyDictionary> dics0 = DataHelper.QueryDictList(sql); IList <EasyDictionary> dics1 = new List <EasyDictionary>(); string temp = ""; foreach (EasyDictionary dic0 in dics0) { EasyDictionary dic1 = new EasyDictionary(); if (temp != dic0.Get <string>("PersonFirstIndicatorId")) { temp = dic0.Get <string>("PersonFirstIndicatorId"); dic1.Add("PersonFirstIndicatorId", dic0.Get <string>("PersonFirstIndicatorId")); dic1.Add("IndicatorType", dic0.Get <string>("IndicatorType")); dic1.Add("PersonFirstIndicatorName", dic0.Get <string>("PersonFirstIndicatorName")); dic1.Add("FirstWeight", dic0.Get <string>("FirstWeight")); dic1.Add("Id", dic0.Get <string>("Id")); dic1.Add("PersonSecondIndicatorName", dic0.Get <string>("PersonSecondIndicatorName")); dic1.Add("Weight", dic0.Get <string>("Weight")); dic1.Add("ToolTip", dic0.Get <string>("ToolTip")); dic1.Add("SelfRemark", dic0.Get <string>("SelfRemark")); dic1.Add("Score", dic0.Get <string>("Score")); dic1.Add("Summary", dic0.Get <string>("Summary")); } else { dic1.Add("PersonFirstIndicatorId", ""); dic1.Add("IndicatorType", ""); dic1.Add("PersonFirstIndicatorName", ""); dic1.Add("FirstWeight", ""); dic1.Add("Id", dic0.Get <string>("Id")); dic1.Add("PersonSecondIndicatorName", dic0.Get <string>("PersonSecondIndicatorName")); dic1.Add("Weight", dic0.Get <string>("Weight")); dic1.Add("ToolTip", dic0.Get <string>("ToolTip")); dic1.Add("SelfRemark", dic0.Get <string>("SelfRemark")); dic1.Add("Score", ""); dic1.Add("Summary", dic0.Get <string>("Summary")); } dics1.Add(dic1); } PageState.Add("DataList", dics1); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); var obj = new { DeptName = etEnt.BeDeptName, IndicatorSecondName = isEnt.IndicatorSecondName, MaxScore = isEnt.MaxScore, BeUserName = etEnt.BeUserName }; PageState.Add("BaseInfo", obj); }
private void DoSelect() { if (op != "c") { SetFormData(ent); IList <EasyDictionary> leaderList = null; if (!string.IsNullOrEmpty(ent.FirstLeaderIds)) { leaderList = new List <EasyDictionary>(); string[] ids = ent.FirstLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] names = ent.FirstLeaderNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ids.Length; i++) { EasyDictionary lDic = new EasyDictionary(); lDic.Add("Id", ids[i]); lDic.Add("Name", names[i]); leaderList.Add(lDic); } PageState.Add("DataList", leaderList); } IList <EasyDictionary> secondList = null; if (!string.IsNullOrEmpty(ent.SecondLeaderIds)) { secondList = new List <EasyDictionary>(); string[] secondId = ent.SecondLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] secondName = ent.SecondLeaderNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < secondId.Length; i++) { EasyDictionary fDic = new EasyDictionary(); fDic.Add("Id", secondId[i]); fDic.Add("Name", secondName[i]); secondList.Add(fDic); } PageState.Add("DataList1", secondList); } IList <EasyDictionary> secondList_two = null; if (!string.IsNullOrEmpty(ent.ChargeSecondLeaderIds)) { secondList_two = new List <EasyDictionary>(); string[] secondId_two = ent.ChargeSecondLeaderIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] secondName_two = ent.ChargeSecondLeaderNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < secondId_two.Length; i++) { EasyDictionary fDic = new EasyDictionary(); fDic.Add("Id", secondId_two[i]); fDic.Add("Name", secondName_two[i]); secondList_two.Add(fDic); } PageState.Add("DataList2", secondList_two); } IList <EasyDictionary> third1 = null; if (!string.IsNullOrEmpty(ent.InstituteClerkDelegateIds)) { third1 = new List <EasyDictionary>(); string[] third1_Id = ent.InstituteClerkDelegateIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] third1_Name = ent.InstituteClerkDelegateNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < third1_Id.Length; i++) { EasyDictionary fDic = new EasyDictionary(); fDic.Add("Id", third1_Id[i]); fDic.Add("Name", third1_Name[i]); third1.Add(fDic); } PageState.Add("DataList3", third1); } IList <EasyDictionary> third2 = null; if (!string.IsNullOrEmpty(ent.DeptClerkDelegateIds)) { third2 = new List <EasyDictionary>(); string[] third2_Id = ent.DeptClerkDelegateIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] third2_Name = ent.DeptClerkDelegateNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < third2_Id.Length; i++) { EasyDictionary fDic = new EasyDictionary(); fDic.Add("Id", third2_Id[i]); fDic.Add("Name", third2_Name[i]); third2.Add(fDic); } PageState.Add("DataList4", third2); } IList <EasyDictionary> fourth = null; if (!string.IsNullOrEmpty(ent.ClerkIds)) { fourth = new List <EasyDictionary>(); string[] fourth_Id = ent.ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] fourth_Name = ent.ClerkNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < fourth_Id.Length; i++) { EasyDictionary fDic = new EasyDictionary(); fDic.Add("Id", fourth_Id[i]); fDic.Add("Name", fourth_Name[i]); fourth.Add(fDic); } PageState.Add("DataList5", fourth); } } }