public bool GetUserChildPackageList(int uid, int state, out List <T_UserPackage> cps, out string error) { cps = new List <T_UserPackage>(); error = string.Empty; try { wystuEntities wystu = new wystuEntities(); var ucs = wystu.T_UserPackage.Where(c => c.userId == uid && c.isTry == state); if (ucs.Any()) { cps = ucs.ToList(); return(true); } else { error = "未找到相关数据"; return(false); } } catch (Exception ex) { error = ex.Message; return(false); } }
private static void SetCourse() { wystuEntities wystu = new wystuEntities(); var courses = from c1 in wystu.T_Course join pls in wystu.T_Plate on c1.ID equals pls.CID select new { cid = c1.ID, cname = c1.Name, ctype = c1.CourseType, cimg = c1.CourseImg, pid = pls.ID, pname = pls.Name, ptype = pls.Type, pioc = pls.ico }; if (courses.Any()) { List <CoursePlate> coursePlates = new List <CoursePlate>(); List <T_Plate> tps = new List <T_Plate>(); List <int> cids = new List <int>(); foreach (var item in courses) { if (!cids.Contains(item.cid)) { CoursePlate cp = new CoursePlate(); cp.Id = item.cid; cp.Ctype = Convert.ToInt32(item.ctype); cp.Cimage = item.cimg; cp.Name = item.cname; cp.Plates = new List <T_Plate>(); coursePlates.Add(cp); } T_Plate tp = new T_Plate(); tp.ID = item.pid; tp.CID = item.cid; tp.Name = item.pname; tp.Type = item.ptype; tp.ico = item.pioc; tps.Add(tp); coursePlates.Where(c => c.Id == item.pid).FirstOrDefault().Plates.Add(tp); } } }
/// <summary> /// 获取子套餐 /// </summary> private static void SetChildPackages() { wystuEntities wystu = new wystuEntities(); var cps = wystu.T_ChildPackage.Where(c => c.Status == 1); if (cps.Any()) { RedisClient rc = new RedisClient(); rc.Set("cps", cps); } }
/// <summary> /// 获取数据库中所有套餐列表赋值与内存中 /// </summary> private static void SetPackages() { wystuEntities wystu = new wystuEntities(); var packageList = wystu.T_Package; RedisClient rc = new RedisClient(); if (packageList.Any()) { rc.Set("pks", packageList); } }