public static List <User> Get() { List <User> list = UnicornCache.Get <List <User> >(CacheKey.User); if (list == null) { list = new List <User>(); string sql = "select Id,UserName,Password,RealName,RoleType,Status,LeaveTime,bugzillaid from Users"; DataTable dt = ProjectDB.GetDt(sql); foreach (DataRow row in dt.Rows) { User o = new User(); o.Id = St.ToInt32(row["Id"], 0); o.UserName = row["UserName"].ToString(); o.Password = row["Password"].ToString(); o.RealName = row["RealName"].ToString(); o.RoleType = St.ToInt32(row["RoleType"], 0); o.Status = St.ToInt32(row["Status"], 0); o.LeaveTime = St.ToDateTime(row["LeaveTime"].ToString()); o.BugzillaId = St.ToInt32(row["bugzillaid"], 0); list.Add(o); } UnicornCache.Add(CacheKey.User, list); } return(list); }
public static List <Project> Get() { List <Project> list = UnicornCache.Get <List <Project> >(CacheKey.Project); if (list == null) { list = new List <Project>(); string sql = "select Id,Name,ParentId,Url,TestUrl,SiteFileName,DatabaseName,TestUserName,TestPassword,Remark,IsShow from Projects order by Id desc"; DataTable dt = ProjectDB.GetDt(sql); foreach (DataRow row in dt.Rows) { Project o = new Project(); o.Id = St.ToInt32(row["Id"], 0); o.Name = row["Name"].ToString(); o.Url = row["Url"].ToString(); o.ParentId = St.ToInt32(row["ParentId"], 0); o.TestUrl = row["TestUrl"].ToString(); o.SiteFileName = row["SiteFileName"].ToString(); o.DatabaseName = row["DatabaseName"].ToString(); o.TestUserName = row["TestUserName"].ToString(); o.TestPassword = row["TestPassword"].ToString(); o.Remark = row["Remark"].ToString(); o.IsShow = St.ToInt32(row["IsShow"], 0); list.Add(o); } UnicornCache.Add(CacheKey.Project, list); } return(list); }
public static List <Dic> Get() { List <Dic> list = UnicornCache.Get <List <Dic> >(CacheKey.Dic); if (list == null) { list = new List <Dic>(); string sql = "select Id,Code,Name,Type,Remark,AddTime from Dics"; DataTable dt = ProjectDB.GetDt(sql); foreach (DataRow row in dt.Rows) { Dic o = new Dic(); o.Id = St.ToInt32(row["Id"], 0); o.Code = row["Code"].ToString(); o.Name = row["Name"].ToString(); o.Type = St.ToInt32(row["Type"].ToString(), 0); o.Remark = row["Remark"].ToString(); o.AddTime = St.ToDateTime(row["AddTime"].ToString()); list.Add(o); } UnicornCache.Add(CacheKey.Dic, list); } return(list); }
protected string GetBugzillaUserName(int id) { Dictionary <int, string> dic = UnicornCache.Get <Dictionary <int, string> >(CacheKey.BugzillaUsers); if (dic == null) { dic = new Dictionary <int, string>(); var ll = DAL.UserRule.Get(); foreach (var o in ll) { dic.Add(o.BugzillaId, o.RealName); } UnicornCache.Add(CacheKey.BugzillaUsers, dic); } if (dic.ContainsKey(id)) { return(dic[id]); } else { return(""); } }