private void StoreLoad()
    {
        var data = (from r in dc.ParResult
                    from k in dc.ParKind
                    from d in dc.Department
                    from d2 in dc.Department
                    from p in dc.Person
                    where r.Pkindid == k.Pkindid && r.Checkdept == d.Deptnumber && r.Checkfordept == d2.Deptnumber && r.Bkhperson == p.Personnumber &&
                    r.Checkdate >= System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day) && r.Checkdate <= System.DateTime.Today &&
                    k.Usingdept == SessionBox.GetUserSession().DeptNumber
                    select new
        {
            p.Personnumber,
            p.Name,
            d2.Deptnumber,
            d2.Deptname,
            r.Total
        }).ToList();

        if (cbbforcheckDept.SelectedIndex > -1)
        {
            data = data.Where(p => p.Deptnumber == cbbforcheckDept.SelectedItem.Value).ToList();
        }

        if (fb_zrr.SelectedIndex > -1)
        {
            data = data.Where(p => p.Personnumber == fb_zrr.SelectedItem.Value).ToList();
        }
        var group1 = from p in data
                     group p by new
        {
            p.Name,
            p.Deptname,
        }
        into g
            select new
        {
            g.Key.Deptname,
            g.Key.Name,
            Yx    = g.Count(p => p.Total >= 90),
            Hg    = g.Count(p => p.Total >= 70 && p.Total < 90),
            Bhg   = g.Count(p => p.Total < 70),
            Total = g.Count()
        };
        var group = from g in group1
                    select new
        {
            g.Deptname,
            g.Name,
            g.Yx,
            g.Hg,
            g.Bhg,
            Yxrate = ((int)(g.Yx * 10000 / g.Total)) / 100,
            Hgrate = ((int)((g.Hg + g.Yx) * 10000 / g.Total)) / 100
        };

        SWStore.DataSource = group;
        SWStore.DataBind();
    }
    private void StoreLoad()
    {
        var data = (from sw in dc.Nswinput
                    from per in dc.Person
                    from dep in dc.Department
                    where sw.Pcpersonid == per.Personnumber && per.Areadeptid == dep.Deptnumber &&
                    sw.Pctime >= System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day) && sw.Pctime <= System.DateTime.Today &&
                    sw.Maindeptid == SessionBox.GetUserSession().DeptNumber&& sw.Isend == 1
                    select new
        {
            per.Personnumber,
            per.Name,
            dep.Deptnumber,
            dep.Deptname,
        }).ToList();

        if (cbbforcheckDept.SelectedIndex > -1)
        {
            data = data.Where(p => p.Deptnumber == cbbforcheckDept.SelectedItem.Value).ToList();
        }
        if (fb_zrr.SelectedIndex > -1)
        {
            data = data.Where(p => p.Personnumber == fb_zrr.SelectedItem.Value).ToList();
        }
        var fsw = (from per in dc.Person
                   join f in dc.Positionfswset.Where(p => p.Maindeptid == SessionBox.GetUserSession().DeptNumber) on per.Posid equals f.Positionid into gg
                   where per.Maindeptid == SessionBox.GetUserSession().DeptNumber
                   from g in gg.DefaultIfEmpty()
                   select new
        {
            per.Personnumber,
            Fsw = g == null ? "未设定" : (g.Count + "/" + g.Month)
        }).ToList();

        var group1 = from p in data
                     group p by new
        {
            p.Deptname,
            p.Personnumber,
            p.Name
        }
        into g
            select new
        {
            g.Key.Deptname,
            g.Key.Name,
            g.Key.Personnumber,
            Count = g.Count()
        };

        var pf = from p in group1
                 from f in fsw
                 where p.Personnumber == f.Personnumber
                 select new
        {
            p.Personnumber,
            p.Name,
            p.Deptname,
            p.Count,
            f.Fsw
        };

        if (cbb_kind.SelectedIndex == 1)
        {
            pf = pf.Where(p => p.Fsw != "未设定");//过滤掉所有未设定人员--111012
        }
        SWStore.DataSource = pf;
        SWStore.DataBind();
    }
Exemple #3
0
    private void StoreLoad()
    {
        //var data = from sw in dc.Nswinput
        //           from per in dc.Person
        //           from dep in dc.Department
        //           from sb in dc.Swbase
        //           from s in dc.Swscore
        //           where sw.Swpersonid == per.Personnumber && per.Areadeptid == dep.Deptnumber && sw.Swid == sb.Swid && sb.Levelid == s.Levelid
        //           && sw.Pctime >= DateTime.Parse(System.DateTime.Today.Year + "-01-01") && sw.Pctime <= DateTime.Parse(System.DateTime.Today.Year + "-12-31")
        //           && sw.Maindeptid == SessionBox.GetUserSession().DeptNumber && sw.Isend==1
        //           select new
        //           {
        //               per.Personnumber,
        //               per.Name,
        //               dep.Deptnumber,
        //               dep.Deptname,
        //               s.Kcscore
        //           };
        //if (cbbforcheckDept.SelectedIndex > -1)
        //{
        //    data = data.Where(p => p.Deptnumber == cbbforcheckDept.SelectedItem.Value);
        //}
        //if (fb_zrr.SelectedIndex > -1)
        //{
        //    data = data.Where(p => p.Personnumber == fb_zrr.SelectedItem.Value);
        //}
        //var group = from p in data
        //            group p by new
        //            {
        //                p.Deptname,
        //                p.Name
        //            }
        //                into g
        //                select new
        //                {
        //                    g.Key.Deptname,
        //                    g.Key.Name,
        //                    Score = g.Sum(p => p.Kcscore),
        //                    Count = g.Count()
        //                };
        //SWStore.DataSource = group.Where(p => p.Score > 11 || p.Count > 1);
        //SWStore.DataBind();

        DataSet ds = GetKaoHeInfo.GetPersonSWPoint(DateTime.Parse(System.DateTime.Today.Year + "-01-01"), DateTime.Parse(System.DateTime.Today.Year + "-12-31"), SessionBox.GetUserSession().DeptNumber, "");

        System.Data.DataView dv = new System.Data.DataView(ds.Tables[0]);
        string filter           = "";

        if (cbbforcheckDept.SelectedIndex > -1)
        {
            filter += "DEPTNUMBER='" + cbbforcheckDept.SelectedItem.Value + "'";
        }
        if (fb_zrr.SelectedItem.Value != "")
        {
            if (filter != "")
            {
                filter += " and ";
            }
            filter += "PERSONNUMBER='" + fb_zrr.SelectedItem.Value + "'";
        }
        dv.RowFilter = filter;
        ds.Tables.Clear();
        ds.Tables.Add(dv.ToTable());
        SWStore.DataSource = ds;
        SWStore.DataBind();
    }