合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
``` string type = context.Request["type"]; DataContext db = new DataContext(SqlEasy.connString); Table<FlowInstanceModel> fi = db.GetTable<FlowInstanceModel>(); Table<FlowInstanceOperationHistoryModel> fo = db.GetTable<FlowInstanceOperationHistoryModel>(); int t = 0; IQueryable list = null; switch (type) { case "my"://创建人是我 t = fi.Count(u => u.CreateUserId == int.Parse(SysVisitor.Instance.cookiesUserId)); list = from u in fi where u.CreateUserId == int.Parse(SysVisitor.Instance.cookiesUserId) orderby u.KeyId descending select u; break; case "wait"://执行人等于1或者执行人是我 t = fi.Count(u => u.MakerList == "1" || u.MakerList.Contains(SysVisitor.Instance.cookiesUserId)); list = from u in fi where u.MakerList == "1" || u.MakerList.Contains(SysVisitor.Instance.cookiesUserId) orderby u.KeyId descending select u; break; case "disposed": var instances = (from u in fo where u.CreateUserId == int.Parse(SysVisitor.Instance.cookiesUserId) select u.InstanceId).Distinct(); var query = from ti in instances join ct in fi on ti equals ct.KeyId into tmp from ct in tmp.DefaultIfEmpty() orderby ct.KeyId descending select ct; list = query.OrderByDescending(u => u.CreateDate);//还差分页语句 t = query.Count(); break; default: t = fi.Count();//统计总条数 list = from u in fi orderby u.KeyId descending select u; break; } context.Response.Write(JSONhelper.ToJson((new { total = t, rows = list })));//返回EasyUI格式 db.Dispose(); break; ```