示例#1
0
        public String GetMobileEntityGoogleObjectList(EntitySpecs eSpecs, int EntityID, String LocaleSetting, int AffiliateID, int CustomerLevelID)
        {
            String CacheName = String.Format("GetMobileEntityGoogleObjectList_{0}_{1}_{2}_{3}_{4}", eSpecs.m_EntityName, EntityID.ToString(), LocaleSetting, AffiliateID.ToString(), CustomerLevelID.ToString());

            if (AppLogic.CachingOn)
            {
                String s = (String)HttpContext.Current.Cache.Get(CacheName);
                if (s != null)
                {
                    return(s);
                }
            }

            String        StoreLoc = AppLogic.GetStoreHTTPLocation(false);
            StringBuilder tmpS     = new StringBuilder(1000);
            String        sql      = GetMobileListProductsSQL(eSpecs, EntityID, AffiliateID, CustomerLevelID, true, true, false);

            using (SqlConnection dbconn = DB.dbConn())
            {
                dbconn.Open();
                using (IDataReader rs = DB.GetRS(sql, dbconn))
                {
                    while (rs.Read())
                    {
                        tmpS.Append("<url>");
                        tmpS.Append("<loc>" + StoreLoc + SE.MakeObjectAndEntityLink(eSpecs.m_ObjectName, eSpecs.m_EntityName, DB.RSFieldInt(rs, "ObjectID"), EntityID, DB.RSField(rs, "SEName")) + "</loc> ");
                        tmpS.Append("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.ObjectChangeFreq") + "</changefreq> ");
                        tmpS.Append("<priority>" + AppLogic.AppConfig("GoogleSiteMap.ObjectPriority") + "</priority> ");
                        tmpS.Append("<mobile:mobile/></url>\n");
                    }
                }
            }

            if (AppLogic.CachingOn)
            {
                HttpContext.Current.Cache.Insert(CacheName, tmpS.ToString(), null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
            }

            return(tmpS.ToString());
        }