123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using CP.Cache;
- using CP.Model;
- using CP.Model.other;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CP.Business
- {
- public class SkillsBLL : DataConnect
- {
-
-
- static WMCache cache = WMCache.GetCacheService();
-
-
-
-
-
- public List<Skills> GetList(string typeName)
- {
- DataConnect dc = new DataConnect();
- string key = "Skills_" + typeName;
- List<Skills> list = cache.GetObject<List<Skills>>(key);
- if (list == null)
- {
-
-
-
-
-
-
- list = dc.db.Fetch<Skills>($" WHERE typename='{typeName}'");
- cache.AddObject(key, list, (int)CacheTime.System);
- }
- return list;
- }
-
-
-
-
-
- public Skills GetSkills(int id)
- {
- DataConnect dc = new DataConnect();
- string key = "Skills_" + id;
- var model = cache.GetObject<Skills>(key);
- if (model == null)
- {
- var list = dc.db.Fetch<Skills>($" WHERE id={id}");
- cache.AddObject(key, list.Count > 0 ? list[0] : new Skills(), (int)CacheTime.System);
- return list.Count > 0 ? list[0] : new Skills();
- }
- return model;
- }
-
-
-
-
- public List<string> GetTypeName()
- {
- string key = string.Format(CacheKeys.SkillsTypeNameList);
- var list = cache.GetObject<List<string>>(key);
- if (list == null)
- {
- DataConnect dc = new DataConnect();
- list = dc.db.Fetch<Skills>($" ORDER BY id asc").GroupBy(p => p.typename).Select(p => p.Key).ToList();
- cache.AddObject(key, list, (int)CacheTime.System);
- }
- return list;
- }
-
-
-
-
-
- public SkillsContent GetSkillsContent(int id)
- {
- DataConnect dc = new DataConnect();
- string key = "SkillsContent_" + id;
- List<SkillsContent> list = cache.GetObject<List<SkillsContent>>(key);
- if (list == null)
- {
-
-
-
-
-
-
- list = dc.db.Fetch<SkillsContent>($" where skillsid={id}");
- cache.AddObject(key, list, (int)CacheTime.System);
- }
- return list[0];
- }
- }
- }
|