Esempio n. 1
0
    private bool DeleteItem()
    {
        ResumeInfoDataContext db = new ResumeInfoDataContext();
        string cond = "";

        foreach (int id in ObjGrid.SelectedRows)
        {
            cond += "PKID == " + id + " || ";
        }
        cond = cond.Substring(0, cond.Length - 4);
        var item = db.GetTable((Type)ViewState["enuType"]).Where(cond);

        db.GetTable((Type)ViewState["enuType"]).DeleteAllOnSubmit(item);
        db.SubmitChanges();
        return(true);
    }
Esempio n. 2
0
    private IQueryable GetRawQuery()
    {
        ResumeInfoDataContext db = new ResumeInfoDataContext();
        IQueryable            q  = db.GetTable((Type)ViewState["enuType"]).OrderBy("DisOrder");

        return(q);
    }
Esempio n. 3
0
    private IQueryable GetRawQuery()
    {
        IQueryable <int>      Query = null;
        ResumeInfoDataContext db    = new ResumeInfoDataContext();
        //sb = WebHelper.SetSqlLog(db);
        Dictionary <Type, string> querylist = (Dictionary <Type, string>)ViewState["Query"];

        foreach (Type tp in querylist.Keys)
        {
            if (Query == null)
            {
                Query = (IQueryable <int>)db.GetTable(tp).Where(querylist[tp]).Select("auid");
            }
            else
            {
                Query = Query.Intersect((IQueryable <int>)db.GetTable(tp).Where(querylist[tp]).Select("auid"));
            }
        }
        var q = from b in db.BaseInfo
                where b.ModifyTime.HasValue && (!b.zfflag.Value || !b.zfflag.HasValue)
                select new {
            b.UserID,
            b.PName,
            b.PID,
            zc = b.enuZc.Label,
            b.ModifyTime,
            byyx    = b.Jiaoybj.Where(o => o.UserID == b.UserID).OrderByDescending(o => o.enuJyjd.DisOrder).First().byyx,
            xl      = b.Jiaoybj.Where(o => o.UserID == b.UserID).OrderByDescending(o => o.enuJyjd.DisOrder).First().enuJyjd.Label,
            zy      = b.Jiaoybj.Where(o => o.UserID == b.UserID).OrderByDescending(o => o.enuJyjd.DisOrder).First().sxzy,
            ztLabel = b.enuZt.Label,
        };

        if (Query != null)
        {
            q = q.Where(o => Query.Contains(o.UserID));
        }
        return(q);
    }
Esempio n. 4
0
    private IQueryable GetRawQuery()
    {
        IQueryable <int>      Query = null;
        ResumeInfoDataContext db    = new ResumeInfoDataContext();
        //sb = WebHelper.SetSqlLog(db);
        Dictionary <Type, string> querylist = (Dictionary <Type, string>)ViewState["Query"];

        foreach (Type tp in querylist.Keys)
        {
            if (Query == null)
            {
                if (tp == typeof(Jiaoybj))
                {
                    IQueryable p = from m in db.Jiaoybj
                                   group new { m.UserID, m.byyx, m.sxzy, m.jyjd } by m.UserID into g
                    orderby g.FirstOrDefault().jyjd
                    select new
                    {
                        UserID = g.FirstOrDefault().UserID,
                        byyx   = g.FirstOrDefault().byyx,
                        sxzy   = g.FirstOrDefault().sxzy,
                        jyjd   = g.FirstOrDefault().jyjd
                    }
                    ;



                    Query = (IQueryable <int>)p.Where(querylist[tp]).Select("UserID");
                }
                else
                {
                    Query = (IQueryable <int>)db.GetTable(tp).Where(querylist[tp]).Select("UserID");
                }
            }
            else
            {
                if (tp == typeof(Jiaoybj))
                {
                    IQueryable p = from m in db.Jiaoybj
                                   group new { m.UserID, m.byyx, m.sxzy, m.jyjd } by m.UserID into g
                    orderby g.FirstOrDefault().jyjd
                    select new
                    {
                        UserID = g.FirstOrDefault().UserID,
                        byyx   = g.FirstOrDefault().byyx,
                        sxzy   = g.FirstOrDefault().sxzy,
                        jyjd   = g.FirstOrDefault().jyjd
                    }
                    ;

                    Query = Query.Intersect((IQueryable <int>)p.Where(querylist[tp]).Select("UserID"));
                }
                else
                {
                    Query = Query.Intersect((IQueryable <int>)db.GetTable(tp).Where(querylist[tp]).Select("UserID"));
                }
            }
        }
        var q = from b in db.BaseInfo
                where b.ModifyTime.HasValue && (!b.zfflag.Value || !b.zfflag.HasValue)
                select new {
            b.UserID,
            b.PName,
            b.PID,
            b.sj,
            b.ModifyTime,
            SexLabel = b.enuSex.Label,
            byyx     = b.Jiaoybj.Where(o => o.UserID == b.UserID).OrderByDescending(o => o.enuJyjd.DisOrder).First().byyx,
            xl       = b.Jiaoybj.Where(o => o.UserID == b.UserID).OrderByDescending(o => o.enuJyjd.DisOrder).First().enuJyjd.Label,
            zy       = b.Jiaoybj.Where(o => o.UserID == b.UserID).OrderByDescending(o => o.enuJyjd.DisOrder).First().sxzy,
            b.csd,
            ztLabel = b.enuZt.Label,
            ypzly   = b.enuLaiy.Label,
        };

        if (Query != null)
        {
            q = q.Where(o => Query.Contains(o.UserID));
        }
        return(q);
    }