Ejemplo n.º 1
0
    private void storeload()
    {
        string person = "";

        if (txtName.Text.Trim() != "")
        {
            string[] ss = System.Text.RegularExpressions.Regex.Split(txtName.Text.Trim(), "\\s+|[,,]");

            foreach (var s in ss)
            {
                person = string.Format("'{0}',", s);
            }
            person = person.Substring(0, person.Length - 1);
        }
        HBBLL hb          = new HBBLL();
        var   vp          = hb.GetVP(cbbDept.SelectedItem.Value, cboPost.SelectedItem.Value, person);
        var   minetotal   = hb.GetMineTotal(person, string.Format("{0}-{1}", cboYear.SelectedItem.Value, cboMonth.SelectedItem.Value.PadLeft(2, '0')));
        var   daibantotal = hb.GetDaiBanTotal(person, string.Format("{0}-{1}", cboYear.SelectedItem.Value, cboMonth.SelectedItem.Value.PadLeft(2, '0')));
        var   data        = from v in vp
                            join m in minetotal on v.PersonNumber equals m.PersonId into x
                            from v_m  in x.DefaultIfEmpty()
                            join d in daibantotal on v.PersonNumber equals d.PersonNumber into y
                            from v_d in y.DefaultIfEmpty()
                            select new LeaderDownMine
        {
            MainDeptNumber = v.DeptNumber,
            MainDeptName   = v.DeptName,
            PersonNumber   = v.PersonNumber,
            PersonName     = v.Name,
            PostID         = v.PosId,
            PostName       = v.PosName,
            DownMineTotal  = v_m == null?0:v_m.Count.Value,
            DaiBanZao      = v_d == null?0:v_d.Zao.Value,
            DaiBanZhong    = v_d == null?0:v_d.Zhong.Value,
            DaiBanYe       = v_d == null?0:v_d.Ye.Value,
            DaiBanTotal    = (v_d == null ? 0 : v_d.Zao.Value) + (v_d == null ? 0 : v_d.Zhong.Value) + (v_d == null ? 0 : v_d.Ye.Value),
            About          = ""
        };

        ldm = data.ToList <LeaderDownMine>();
        Store1.DataSource = data;
        Store1.DataBind();
    }