コード例 #1
0
ファイル: WFHelper.cs プロジェクト: daowzq/SurveyProject
        /// <summary>
        /// 递归获取到公司级全路径
        /// </summary>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        public static string getCzlxDG1(string ParentId, ref string result)
        {
            //SysGroup group = SysGroup.TryFind(ParentId);

            //Modify By WGM 8/9
            string SQL = "select * from  FL_PortalHR..SysGroup where GroupID='" + ParentId + "'";

            SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB);
            //SysGroup group = JsonHelper.GetObject<SysGroup>(JsonHelper.GetJsonString(DataHelper.QueryDictList(SQL).FirstOrDefault()));
            EasyDictionary group = DataHelper.QueryDictList(SQL).FirstOrDefault();

            if (group == null)
            {
                return("");
            }
            else if (group["ParentID"] + "" != "" && !(group["Name"] + "").Contains("公司"))
            {
                result = (group["Name"] + "") + '/' + result;
                return(getCzlxDG1(group["ParentID"] + "", ref result));
            }
            else
            {
                result = (group["Name"] + "") + "/" + result;
                return(result.TrimEnd('/'));
            }
        }
コード例 #2
0
        public void When_creating_easy_dictionary_with_key_selector_comparer_and_collection()
        {
            var collection = Enumerable.Range(1, 5).Select(n => new Person(n.ToString(), n)).ToList();
            var comparer   = StringComparer.OrdinalIgnoreCase;
            Func <Person, string>           selector = p => p.Id;
            EasyDictionary <string, Person> dic      = new EasyDictionary <string, Person>(
                selector, collection, comparer);

            dic.ShouldNotBeNull();
            dic.KeySelector.ShouldBe(selector);
            dic.Count.ShouldBe(5);
            dic.Keys.ShouldNotBeEmpty();
            dic.Values.ShouldNotBeEmpty();
            dic.IsReadOnly.ShouldBeFalse();
            dic.Comparer.ShouldNotBe(EqualityComparer <string> .Default);
            dic.Comparer.ShouldBe(comparer);

            dic.Keys.ShouldBe(new[] { "1", "2", "3", "4", "5" });
            dic.Values.ShouldBe(collection);

            dic.ContainsKey("1").ShouldBeTrue();
            dic.Contains(collection[0]).ShouldBeTrue();

            dic["1"].Age.ShouldBe(1);

            dic.ContainsKey("0").ShouldBeFalse();
        }
コード例 #3
0
        /// <summary>
        /// 由枚举编码获取Enum字典
        /// </summary>
        /// <param name="enums"></param>
        /// <returns></returns>
        public static EasyDictionary GetEnumDict(string code)
        {
            SysEnumeration tent = SysEnumeration.Get(code);
            EasyDictionary dict = tent.GetDict();

            return(dict);
        }
コード例 #4
0
        public void When_getting_enumerator_as_easy_dictionary()
        {
            var p1 = new Person("A", 1);
            var p2 = new Person("B", 2);

            EasyDictionary <string, Person> dic = new EasyDictionary <string, Person>(p => p.Id)
            {
                p1,
                p2
            };

            using (var enumerator = dic.GetEnumerator())
            {
                enumerator.ShouldNotBeNull();

                enumerator.MoveNext().ShouldBeTrue();

                enumerator.Current.ShouldBe(p1);

                enumerator.MoveNext().ShouldBeTrue();

                enumerator.Current.ShouldBe(p2);

                enumerator.MoveNext().ShouldBeFalse();
            }
        }
コード例 #5
0
ファイル: ComUtility.cs プロジェクト: daowzq/SurveyProject
        /// <summary>
        ///  基本津贴
        /// </summary>
        /// <param name="workno">工号</param>
        /// <returns></returns>
        public string GetTravelBaseMoney(string workno)
        {
            EasyDictionary DicBase       = SysEnumeration.GetEnumDict("WorkYearMoney");
            string         BaseMoney_One = DicBase["<1年"] + "";
            string         BaseMoney_two = DicBase[">1年"] + "";

            string sql = @"select  WorkMoney As Total
		                    from
		                    (
			                    select  top 1
				                case 
					                when  charindex('正式工',psnclassname)>0 and year(Indutydate)>1 then {2}
					               else {1}
				                end As WorkMoney ,
                                psnclassname
			                    from FL_PortalHR..sysuser As A  
				                    left join HR_OA_MiddleDB..fld_rylb As B
				                on B.pk_fld_rylb=A.Pk_rylb 
			                    where workno='{0}'
		                    ) As T"        ;

            sql = string.Format(sql, workno, BaseMoney_One.Replace("NULL", "0"), BaseMoney_two);
            sql = sql.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);
            return(DataHelper.QueryValue(sql) + "");
        }
コード例 #6
0
        public void When_adding_or_replacing_items()
        {
            var p1 = new Person("A", 1);
            var p2 = new Person("A", 11);

            EasyDictionary <string, Person> dic = new EasyDictionary <string, Person>(p => p.Id);

            dic.Count.ShouldBe(0);

            dic.AddOrReplace(p1).ShouldBeTrue();

            dic.Count.ShouldBe(1);
            dic["A"].ShouldBe(p1);

            dic.AddOrReplace(p1).ShouldBeFalse();

            dic.Count.ShouldBe(1);
            dic["A"].ShouldBe(p1);

            dic.AddOrReplace(p2).ShouldBeTrue();

            dic.Count.ShouldBe(1);
            dic["A"].ShouldNotBe(p1);
            dic["A"].ShouldBe(p2);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = ExamineStage.Find(id);
                }
                SetFormData(ent);
                sql = @"select A.*,B.BeUserNames,B.UpLevelUserNames,B.SameLevelUserNames,B.DownLevelUserNames,B.RelationName,
                C.IndicatorName from BJKY_Examine..ExamineStageDetail as A 
                left join BJKY_Examine..DeptExamineRelation as B on A.ExamineRelationId=B.Id
                left join BJKY_Examine..ExamineIndicator as C on C.Id=A.ExamineIndicatorId
                where A.ExamineStageId='" + id + "'";
                PageState.Add("DataList", DataHelper.QueryDictList(sql));
            }
            if (op == "c")
            {
                var obj = new
                {
                    ExamineType    = ExamineType,
                    LaunchUserName = UserInfo.Name,
                    LaunchUserId   = UserInfo.UserID
                };
                SetFormData(obj);
            }
            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);
            EasyDictionary dic1 = DataHelper.QueryDict(sql, "Id", "GroupName");

            PageState.Add("enumDept", dic1);
            PageState.Add("EnumYear", SysEnumeration.GetEnumDict("Year"));
        }
コード例 #9
0
        public void When_creating_easy_dictionary_with_key_selector_comparer_and_dictionary()
        {
            var comparer   = StringComparer.OrdinalIgnoreCase;
            var somePerson = new Person("A", 1);
            var someDic    = new Dictionary <string, Person> {
                ["B"] = somePerson
            };

            Func <Person, string>           selector = p => p.Id;
            EasyDictionary <string, Person> dic      = new EasyDictionary <string, Person>(
                selector, someDic, comparer);

            dic.ShouldNotBeNull();
            dic.KeySelector.ShouldBe(selector);
            dic.Count.ShouldBe(1);
            dic.Keys.ShouldNotBeEmpty();
            dic.Values.ShouldNotBeEmpty();
            dic.IsReadOnly.ShouldBeFalse();
            dic.Comparer.ShouldNotBe(EqualityComparer <string> .Default);
            dic.Comparer.ShouldBe(comparer);

            dic.Keys.ShouldBe(new[] { "A" });
            dic.Values.ShouldBe(new[] { somePerson });

            dic.ContainsKey("A").ShouldBeTrue();
            dic.Contains(somePerson).ShouldBeTrue();

            dic.ContainsKey("B").ShouldBeFalse();

            dic["A"].Age.ShouldBe(1);
        }
コード例 #10
0
        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;
            }
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action    = Request["action"];
            string projectid = Request["ProjectId"];
            string sql       = "";
            IList <ShenChaReport_KanCha> scrkEnts = null;
            ShenChaReport_KanCha         scrkEnt  = null;

            switch (action)
            {
            case "loadform":
                sql = "select a.*,b.ProjectName from NCRL_SP..ShenChaReport_KanCha a left join NCRL_SP..Project b on a.ProjectId=b.Id where a.ProjectId='" + projectid + "'";
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    Response.Write("{success:true,data:" + JsonHelper.GetJsonString(dics[0]) + "}");
                }
                else
                {
                    Project pEnt     = Project.Find(projectid);
                    string  opinion1 = "1、勘察报告提供的数据真实可靠;2、报建手续齐全;3、按规定盖有出图章和签署;4、工程基础含软基处理安全、可靠;5、见证材料符合《关于加强全省建设工程勘察外业工作的意见》(赣建字2013-2)要求。";
                    string  opinion2 = "符合有关工程强制性标准规范";
                    string  opinion3 = "符合要求";
                    string  opinion4 = "该岩土工程勘察报告按照审查意见经回复整改后符合国家有关《工程建设标准强制性条文》及国家和本省的各种建设工程设计规范、标准要求。";
                    Response.Write("{success:true,data:{ProjectName:'" + pEnt.ProjectName + "',Opinion1:'" + opinion1 + "',Opinion2:'" + opinion2 + "',Opinion3:'" + opinion3 + "',Opinion4:'" + opinion4 + "'}}");
                }
                Response.End();
                break;

            case "update":
                try
                {
                    scrkEnts = ShenChaReport_KanCha.FindAllByProperty(ShenChaReport_KanCha.Prop_ProjectId, projectid);
                    string json = Request["json"];
                    ShenChaReport_KanCha ent_new = JsonHelper.GetObject <ShenChaReport_KanCha>(json);
                    if (scrkEnts.Count > 0)
                    {
                        scrkEnt = scrkEnts[0];
                        EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(json);
                        scrkEnt = DataHelper.MergeData <ShenChaReport_KanCha>(scrkEnt, ent_new, dic.Keys);
                        scrkEnt.DoUpdate();
                    }
                    else
                    {
                        ent_new.ProjectId  = projectid;
                        ent_new.CreateId   = Aim.Portal.Web.WebPortalService.CurrentUserInfo.UserID;
                        ent_new.CreateName = Aim.Portal.Web.WebPortalService.CurrentUserInfo.Name;
                        ent_new.CreateTime = DateTime.Now;
                        ent_new.DoCreate();
                    }
                    Response.Write("{success:true}");
                }
                catch
                {
                    Response.Write("{success:false}");
                }
                Response.End();
                break;
            }
        }
コード例 #12
0
        /// <summary>
        /// 由给出的编码列表获取枚举字典列表
        /// </summary>
        /// <returns></returns>
        public static EasyDictionary <string, EasyDictionary> GetEnumDicts(params string[] codes)
        {
            EasyDictionary <string, EasyDictionary> rtndict = new EasyDictionary <string, EasyDictionary>();

            SysEnumeration[] tents = SysEnumeration.FindAll(Expression.In(SysEnumeration.Prop_Code, codes));
            string[]         pids  = tents.Select(tent => tent.EnumerationID).ToArray();

            IEnumerable <SysEnumeration> subents = SysEnumeration.FindAll(Expression.In(SysEnumeration.Prop_ParentID, pids));

            subents = subents.OrderBy(tsubtent => tsubtent.SortIndex).ThenBy(tsubtent => tsubtent.CreatedDate);

            foreach (SysEnumeration tent in tents)
            {
                EasyDictionary dict = new EasyDictionary();

                IEnumerable <SysEnumeration> tsubents = subents.Where(ttent => ttent.ParentID == tent.EnumerationID);
                foreach (SysEnumeration tsubent in tsubents)
                {
                    dict.Set(tsubent.Value, tsubent.Name);
                }

                rtndict.Set(tent.Code, dict);
            }

            return(rtndict);
        }
コード例 #13
0
        /// <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);
                }
            }
        }
コード例 #14
0
        private void DoSelect()
        {
            sql = @"select Id as IndicatorFirstId ,IndicatorFirstName  from BJKY_Examine..IndicatorFirst 
                      where  ExamineIndicatorId = '" + ExamineIndicatorId + "' order by SortIndex asc ";
            EasyDictionary dic = DataHelper.QueryDict(sql, "IndicatorFirstId", "IndicatorFirstName");

            PageState.Add("IndictorFirstEnum", dic);//Combo数据集
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = IndicatorSecond.Find(id);
                }
                SetFormData(ent);
                SearchCriterion.AddSearch(ScoreStandard.Prop_IndicatorSecondId, id);
                SearchCriterion.SetOrder("SortIndex", true);
                ents = ScoreStandard.FindAll(SearchCriterion);
                PageState.Add("DataList", ents);
            }
            else
            {
                if (!string.IsNullOrEmpty(IndicatorFirstId))
                {
                    IndicatorFirst ifEnt = IndicatorFirst.Find(IndicatorFirstId);
                    sql = "select isnull(max(SortIndex),0) from BJKY_Examine..IndicatorSecond where IndicatorFirstId='" + IndicatorFirstId + "'";
                    var obj = new
                    {
                        SortIndex          = DataHelper.QueryValue <int>(sql) + 1,
                        ExamineIndicatorId = ExamineIndicatorId
                    };
                    SetFormData(obj);
                }
            }
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = Request["action"];

            switch (action)
            {
            case "create":
                create();
                break;

            case "update":
                obj = Request["obj"];
                ent = JsonHelper.GetObject <SupervisionJianBao>(obj);
                SupervisionJianBao oldEnt = SupervisionJianBao.Find(ent.Id);
                EasyDictionary     dic    = JsonHelper.GetObject <EasyDictionary>(obj);
                ent = DataHelper.MergeData <SupervisionJianBao>(oldEnt, ent, dic.Keys);
                ent.DoUpdate();
                break;

            case "Load":
                string Id = Request["Id"];
                ent = SupervisionJianBao.Find(Id);
                string str = JsonHelper.GetJsonString(ent);
                Response.Write("{success:  true  ,data:" + str + "}");
                Response.End();
                break;

            case "PNameCombo":
                PNameCombo();
                break;
            }
        }
コード例 #16
0
        public void When_getting_enumerator_as_ienumerable()
        {
            var p1 = new Person("A", 1);
            var p2 = new Person("B", 2);

            IEnumerable dic = new EasyDictionary <string, Person>(p => p.Id)
            {
                p1,
                p2
            };

            var enumerator = dic.GetEnumerator();

            enumerator.ShouldNotBeNull();

            enumerator.MoveNext().ShouldBeTrue();

            ((KeyValuePair <string, Person>)enumerator.Current).Key.ShouldBe("A");
            ((KeyValuePair <string, Person>)enumerator.Current).Value.ShouldBe(p1);

            enumerator.MoveNext().ShouldBeTrue();

            ((KeyValuePair <string, Person>)enumerator.Current).Key.ShouldBe("B");
            ((KeyValuePair <string, Person>)enumerator.Current).Value.ShouldBe(p2);

            enumerator.MoveNext().ShouldBeFalse();
        }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string action = Request["action"];

            Id = Request["Id"];
            switch (action)
            {
            case "Create":
                Create();
                break;

            case "Update":
                string obj = Request["json"];
                ent = JsonHelper.GetObject <DelegateInfo>(obj);
                DelegateInfo   ori_Ent = DelegateInfo.Find(Id);
                EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(obj);
                ori_Ent = DataHelper.MergeData <DelegateInfo>(ori_Ent, ent, dic.Keys);
                ori_Ent.DoUpdate();
                break;

            case "SelectEdit":
                SelectEdit();
                break;
            }
        }
コード例 #18
0
        private void Update()
        {
            obj = Request["obj"];
            ent = JsonHelper.GetObject <SupervisionRiZhi>(obj);
            SupervisionRiZhi oldEnt = SupervisionRiZhi.Find(ent.Id);
            EasyDictionary   dic    = JsonHelper.GetObject <EasyDictionary>(obj);

            ent = DataHelper.MergeData <SupervisionRiZhi>(oldEnt, ent, dic.Keys);
            ent.DoUpdate();
        }
コード例 #19
0
        /// <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);
        }
コード例 #20
0
ファイル: ComUtility.cs プロジェクト: daowzq/SurveyProject
        /// <summary>
        /// 获取服务年限+基本津贴
        /// </summary>
        /// <param name="workno">工号</param>
        /// <returns></returns>
        public string GetTravelAllMoney(string workno)
        {
            EasyDictionary Dic = SysEnumeration.GetEnumDict("BaseMoney");

            string One   = Dic[">1<5"] + "";
            string Two   = Dic[">=5<10"] + "";
            string Three = Dic[">=10<15"] + "";
            string Four  = Dic[">=15<20"] + "";

            EasyDictionary LimitDate    = SysEnumeration.GetEnumDict("TravelLimitDate");
            string         limitDateStr = string.Empty;

            if ((LimitDate["LimitDate"] + "").ToUpper() == "2L") //2 月最后一天
            {
                limitDateStr = "'" + GetLastDayOfMonth(DateTime.Now.Year, 2).ToString("yyyy-MM-dd") + "'";
            }
            else
            {
                string prefix = LimitDate["LimitDate"] + "";
                limitDateStr = "'" + DateTime.Now.Year + "-" + prefix + "'";
            }

            EasyDictionary DicBase       = SysEnumeration.GetEnumDict("WorkYearMoney");
            string         BaseMoney_One = DicBase["<1年"] + "";
            string         BaseMoney_two = DicBase[">1年"] + "";

            string sql = @"select YearMoney + WorkMoney As Total
		                    from
		                    (
			                    select  top 1
				                case 
				                    when 1<datediff(year, Indutydate,getdate())and datediff(year,Indutydate,getdate())<5 then {1}  
				                    when 5<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<10 then {2}   
				                    when 10<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<15 then {3}   
				                    when 15<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<20 then {4} 
				                    else 0
				                end  As YearMoney,
				                case 
					                when  charindex('正式工',psnclassname)>0 and year(Indutydate)>1 then {6}
					               else {5}
				                end As WorkMoney ,
                                psnclassname
			                    from FL_PortalHR..sysuser As A  
				                    left join HR_OA_MiddleDB..fld_rylb As B
				                on B.pk_fld_rylb=A.Pk_rylb 
			                    where workno='{0}'
		                    ) As T"        ;

            sql = sql.Replace("getdate()", limitDateStr);
            sql = string.Format(sql, workno, One, Two, Three, Four, BaseMoney_One.Replace("NULL", "0"), BaseMoney_two);
            sql = sql.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);
            return(DataHelper.QueryValue(sql) + "");
        }
コード例 #21
0
        public void When_creating_easy_dictionary_with_key_selector_and_capacity()
        {
            Func <Person, string>           selector = p => p.Id;
            EasyDictionary <string, Person> dic      = new EasyDictionary <string, Person>(selector, 10);

            dic.ShouldNotBeNull();
            dic.KeySelector.ShouldBe(selector);
            dic.Count.ShouldBe(0);
            dic.Keys.ShouldBeEmpty();
            dic.Values.ShouldBeEmpty();
            dic.IsReadOnly.ShouldBeFalse();
            dic.Comparer.ShouldBe(EqualityComparer <string> .Default);
        }
コード例 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BeiAn_Project         bap_Ent  = null;
            IList <BeiAn_Project> bap_Ents = null;
            string action    = Request["action"];
            string projectid = Request["ProjectId"];
            string sql       = "";

            switch (action)
            {
            case "loadform":
                sql = "select a.*,b.ProjectName from NCRL_SP..BeiAn_Project a left join NCRL_SP..Project b on a.ProjectId=b.Id where a.ProjectId='" + projectid + "'";
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    Response.Write("{success:true,data:" + JsonHelper.GetJsonString(dics[0]) + "}");
                }
                else
                {
                    Project pEnt = Project.Find(projectid);
                    Response.Write("{success:true,data:" + JsonHelper.GetJsonString(pEnt) + "}");
                }
                Response.End();
                break;

            case "update":
                bap_Ents = BeiAn_Project.FindAllByProperty(BeiAn_Project.Prop_ProjectId, projectid);
                string        json    = Request["json"];
                BeiAn_Project ent_new = JsonHelper.GetObject <BeiAn_Project>(json);
                if (bap_Ents.Count > 0)
                {
                    bap_Ent = bap_Ents[0];
                    EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(json);
                    bap_Ent = DataHelper.MergeData <BeiAn_Project>(bap_Ent, ent_new, dic.Keys);
                    bap_Ent.DoUpdate();
                }
                else
                {
                    ent_new.ProjectId  = projectid;
                    ent_new.CreateId   = Aim.Portal.Web.WebPortalService.CurrentUserInfo.UserID;
                    ent_new.CreateName = Aim.Portal.Web.WebPortalService.CurrentUserInfo.Name;
                    ent_new.CreateTime = DateTime.Now;
                    ent_new.DoCreate();
                }
                Response.Write("{success:true}");
                Response.End();
                break;
            }
        }
コード例 #23
0
        /// <summary>
        /// 由编码获取Enumeration字典
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static EasyDictionary <string, SysEnumeration> Get(params string[] codes)
        {
            EasyDictionary <string, SysEnumeration> enums = new EasyDictionary <string, SysEnumeration>();

            IEnumerable <SysEnumeration> tents = SysEnumeration.FindAll(Expression.In(SysEnumeration.Prop_Code, codes));

            tents = tents.OrderBy(tent => tent.SortIndex).ThenBy(tent => tent.CreatedDate);

            foreach (SysEnumeration tent in tents)
            {
                enums.Set(tent.Code, tent);
            }

            return(enums);
        }
コード例 #24
0
        public static IList <EasyDictionary> DataTableToDictList(DataTable dt)
        {
            IList <EasyDictionary> list = new List <EasyDictionary>();

            foreach (DataRow row in dt.Rows)
            {
                EasyDictionary item = new EasyDictionary();
                foreach (DataColumn column in dt.Columns)
                {
                    item.Set(column.ColumnName, row[column]);
                }
                list.Add(item);
            }
            return(list);
        }
コード例 #25
0
        public void When_comparing_easy_dictionaries()
        {
            IReadOnlyDictionary <string, Person> left  = new EasyDictionary <string, Person>(p => p.Id);
            IReadOnlyDictionary <string, Person> right = new EasyDictionary <string, Person>(p => p.Id);

            DictionaryExtensions.Equals(left, right).ShouldBeTrue();

            ((IEasyDictionary <string, Person>)left).Add(new Person("A", 1));
            DictionaryExtensions.Equals(left, right).ShouldBeFalse();

            ((IEasyDictionary <string, Person>)right).Add(new Person("A", 1));
            DictionaryExtensions.Equals(left, right).ShouldBeTrue();

            DictionaryExtensions.Equals(((IDictionary <int, string>)null), null).ShouldBeTrue();
        }
コード例 #26
0
        public void When_getting_key_and_values_as_ienumerable()
        {
            var p1 = new Person("A", 1);
            var p2 = new Person("B", 2);

            IReadOnlyDictionary <string, Person> dic = new EasyDictionary <string, Person>(p => p.Id)
            {
                p1,
                p2
            };

            dic.Count.ShouldBe(2);
            dic.Keys.ShouldBe(new [] { "A", "B" });
            dic.Values.ShouldBe(new [] { p1, p2 });
        }
コード例 #27
0
        private void DoSelect()
        {
            //问题浏览项次数+1
            string UpdateSql = "update FL_Culture..EmpVoiceAskQuestion set ViewCount=ViewCount+1 where Id='{0}' ";

            UpdateSql = string.Format(UpdateSql, Question);
            DataHelper.ExecSql(UpdateSql);

            //
            if (string.IsNullOrEmpty(Question))
            {
                return;
            }
            string SQL = @"select A.Id, A.Contents,A.Anonymity,A.Category,A.AnswerCount,A.ViewCount,A.NikeName,A.IsCheck,A.CreateTime,A.AcceptAnswerId,
                            B.Id as A_Id, B.Answer,B.Anonymity As A_Anonymity,B.ParentId,B.IsLeaf,B.IsCheck As A_IsCheck,B.NikeName As A_NikeName,
                            B.ReplyCount, B.CreateTime As A_CreateTime
                          from FL_Culture..EmpVoiceAskQuestion  As A  
                            left join  FL_Culture..EmpVoiceAnswerInfo  As B 
                           on A.AcceptAnswerId=B.Id where A.Id='{0}' ";

            SQL = string.Format(SQL, Question);
            EasyDictionary EDic = DataHelper.QueryDictList(SQL).FirstOrDefault();

            this.SetFormData(EDic);

            SQL = @"select  *  from  FL_Culture..EmpVoiceAnswerInfo  where QuestionId='{0}' and ( IsCheck='1' or IsCheck is null) ";
            SQL = string.Format(SQL, Question);
            this.PageState.Add("Comment", GegPgComment(SQL, 1, 10));

            //添加用户基本信息
            string UserInfoSQL = @"select A.UserID ,A.Name As UserName,B.Nickname
                                   from  FL_PortalHR..SysUser  As A
	                                    left join  FL_Culture..EmpVoiceMyBaseInfo  As B 
                                    on A.UserID=B.UserID
	                                    where A.UserID='{0}'"    ;

            UserInfoSQL = UserInfoSQL.Replace("FL_PortalHR", Global.AimPortalDB);
            UserInfoSQL = string.Format(UserInfoSQL, UserInfo.UserID);
            var Ent = DataHelper.QueryDictList(UserInfoSQL);

            this.PageState.Add("UserInfoEnt", Ent);



            SQL = @"select * from FL_Culture..EmpVoiceAnswerInfo where id in( select AcceptAnswerId from FL_Culture..EmpVoiceAskQuestion  where id='{0}') ";
            SQL = string.Format(SQL, Question);
            this.PageState.Add("topDate", DataHelper.QueryDataTable(SQL));
        }
コード例 #28
0
        private void Update()
        {
            string obj            = Request["data"];
            string ProfessionType = Request["ProfessionType"];
            string MajorName      = Request["MajorName"];

            ent = JsonHelper.GetObject <Expert>(obj);
            Expert         ori_Ent = Expert.Find(ent.Id);
            EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(obj);

            ent                = DataHelper.MergeData <Expert>(ori_Ent, ent, dic.Keys);
            ent.MajorCode      = MajorName;
            ent.MajorName      = MajorName;
            ent.ProfessionType = ProfessionType;
            ent.DoUpdate();
        }
コード例 #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string action = Request["action"];

            UserId = Request["UserId"];
            switch (action)
            {
            case "Create":
                obj = Request["json"];
                ent = JsonHelper.GetObject <SysUser>(obj);
                MD5Encrypt encrypt = new MD5Encrypt();
                ent.Server_IAGUID = "267";
                ent.Server_Seed   = "江西瑞林工程咨询有限公司";
                ent.LoginName     = ent.IDNumber;
                ent.Status        = 1;
                ent.Password      = encrypt.GetMD5FromString(ent.LoginName);
                ent.DoCreate();
                break;

            case "Update":
                obj = Request["json"];
                ent = JsonHelper.GetObject <SysUser>(obj);
                SysUser        ori_Ent = SysUser.Find(ent.UserID);
                EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(obj);
                ent = DataHelper.MergeData <SysUser>(ori_Ent, ent, dic.Keys);
                ent.DoUpdate();
                break;

            case "SelectEdit":
                SelectEdit();
                break;

            case "check":
                Check();
                break;
            }
        }
コード例 #30
0
        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);
        }