public Model_SiteInfo GetSiteInfo() { //BaseModel<Model_Setting>.PurgeCacheItems("mail_setting"); Model_SiteInfo r = null; string key = "cache_site_info"; if (BaseModel <Model_SiteInfo> .Cache[key] != null) { r = (Model_SiteInfo)BaseModel <Model_SiteInfo> .Cache[key]; } else { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("SELECT * FROM WebsiteInformation WHERE IFID=1", cn); cn.Open(); IDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { r = MappingObjectFromDataReaderByName(reader); } } BaseModel <Model_SiteInfo> .CacheData(key, r); } return(r); }
public List <Model_SiteSocialMap> GetSocialMap(byte IFID) { //BaseModel<Model_Setting>.PurgeCacheItems("mail_setting"); List <Model_SiteSocialMap> r = null; string key = "cache_site_social_s"; if (BaseModel <Model_SiteSocialMap> .Cache[key] != null) { r = (List <Model_SiteSocialMap>)BaseModel <Model_SiteSocialMap> .Cache[key]; } else { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand(@"SELECT sm.*,s.Title As STitle FROM WebSiteSocialMap sm INNER JOIN Social s ON s.SocialID= sm.SocialID WHERE sm.IFID=@IFID", cn); cmd.Parameters.Add("@IFID", SqlDbType.TinyInt).Value = IFID; cn.Open(); r = MappingObjectCollectionFromDataReaderByName(ExecuteReader(cmd)); } BaseModel <Model_SiteSocialMap> .CacheData(key, r); } return(r); }
public List <Social> GetSocialList() { //BaseModel<Model_Setting>.PurgeCacheItems("mail_setting"); List <Social> r = null; string key = "cache_site_social"; if (BaseModel <Social> .Cache[key] != null) { r = (List <Social>)BaseModel <Social> .Cache[key]; } else { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("SELECT * FROM Social WHERE Status=1", cn); cn.Open(); r = MappingObjectCollectionFromDataReaderByName(ExecuteReader(cmd)); } BaseModel <Social> .CacheData(key, r); } return(r); }