public static PageSetting GetBlogDetailSetting(Maticsoft.Model.SNS.UserBlog userblog, string pageName = "BlogDetail", ApplicationKeyType applicationType = 2) { if (userblog == null) { userblog = new Maticsoft.Model.SNS.UserBlog(); } PageSetting setting = new PageSetting(pageName, applicationType); if (!string.IsNullOrWhiteSpace(userblog.Meta_Title)) { setting._title = userblog.Meta_Title; } else { setting._title = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache(setting.KeyTitle, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._title)) { setting._title = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("Title", ApplicationKeyType.System); } } if (!string.IsNullOrWhiteSpace(userblog.Meta_Keywords)) { setting._keywords = userblog.Meta_Keywords; } else { setting._keywords = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache(setting.KeyKeywords, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._keywords)) { setting._keywords = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } } if (!string.IsNullOrWhiteSpace(userblog.Meta_Description)) { setting._description = userblog.Meta_Description; } else { setting._description = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache(setting.KeyDescription, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._description)) { setting._description = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("Description", ApplicationKeyType.System); } } if (setting._title.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._title = PageSettingBase.ReplaceHostName(setting._title); } if (setting._keywords.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._keywords = PageSettingBase.ReplaceHostName(setting._keywords); } if (setting._description.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._description = PageSettingBase.ReplaceHostName(setting._description); } setting.Replace(new string[][] { new string[] { "{cname}", userblog.Title }, new string[] { "{cid}", userblog.BlogID.ToString() } }); return setting; }
public static bool UploadExecute(byte[] buffer, string FileName, ApplicationKeyType applicationKeyType, out string imageUrl) { imageUrl = UploadExecute(buffer, FileName, applicationKeyType); if (string.IsNullOrEmpty(imageUrl)) { return false; } return true; }
public static string GetKeywords(string pageName, ApplicationKeyType applicationType = 1) { string valueByCache = ConfigSystem.GetValueByCache(string.Format("{0}_{1}_{2}", applicationType, pageName, "Keywords"), applicationType); if (string.IsNullOrWhiteSpace(valueByCache)) { valueByCache = ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } if (valueByCache.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { return ReplaceHostName(valueByCache); } return valueByCache; }
/// <summary> /// Get an object entity,From cache /// </summary> /// <param name="Keyname"></param> /// <returns></returns> public static string GetValueByCache(string Keyname, ApplicationKeyType KeyType) { #pragma warning disable CS0612 // “DataCacheCore.GetCache(string)”已过时 string cache = dataCache.GetCache(Keyname); #pragma warning restore CS0612 // “DataCacheCore.GetCache(string)”已过时 if (cache != null) { return(cache); } cache = GetValue(Keyname); int cacheTime = Globals.SafeInt(GetValueByCache("CacheTime"), 30); dataCache.SetCache(Keyname, cache, DateTime.Now.AddMinutes(cacheTime), TimeSpan.Zero); return(cache); }
public static bool DeleteImage(string path, ApplicationKeyType applicationKeyType) { string valueByCache = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiYunOperaterName"); string password = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiOperaterPassword"); string bucketname = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiSpaceName"); string oldValue = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiPhotoDomain"); UpYun yun = new UpYun(bucketname, valueByCache, password); if (path.Contains("http://")) { path = path.Replace(oldValue, ""); path = path.StartsWith("/") ? path : ("/" + path); } return yun.deleteFile(path); }
public static string UploadExecute(byte[] buffer, string FileName, ApplicationKeyType applicationKeyType) { string valueByCache = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiYunOperaterName"); string password = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiOperaterPassword"); string bucketname = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiSpaceName"); string str4 = ConfigSystem.GetValueByCache(applicationKeyType + "_YouPaiPhotoDomain"); UpYun yun = new UpYun(bucketname, valueByCache, password); byte[] data = buffer; string path = "/" + DateTime.Now.ToString("yyyyMMdd") + "/" + FileName; if (yun.writeFile(path, data, true)) { return (str4 + path); } return ""; }
public static bool ClearCacheByKeyAndType(ApplicationKeyType keyType, string key) { try { Hashtable hashListByCache = GetHashListByCache(keyType); if (((hashListByCache != null) && hashListByCache.ContainsKey(key)) && (hashListByCache[key] != null)) { hashListByCache.Remove(key); } return true; } catch (Exception) { return false; } }
public static IPageSetting GetPageSetting(string pageName, ApplicationKeyType applicationType = 1) { PageSetting setting = new PageSetting(pageName, applicationType); if (setting._title.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._title = PageSettingBase.ReplaceHostName(setting._title); } if (setting._keywords.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._keywords = PageSettingBase.ReplaceHostName(setting._keywords); } if (setting._description.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._description = PageSettingBase.ReplaceHostName(setting._description); } return setting; }
public int Add(string Keyname, string Value, string Description, ApplicationKeyType KeyType) { StringBuilder builder = new StringBuilder(); builder.Append("insert into SA_Config_System("); builder.Append("Keyname,Value,Description,KeyType)"); builder.Append(" values ("); builder.Append("@Keyname,@Value,@Description,@KeyType)"); builder.Append(";select @@IDENTITY"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@Keyname", SqlDbType.NVarChar, 50), new SqlParameter("@Value", SqlDbType.NVarChar, -1), new SqlParameter("@Description", SqlDbType.NVarChar, 200), new SqlParameter("@KeyType", SqlDbType.Int) }; cmdParms[0].Value = Keyname; cmdParms[1].Value = Value; cmdParms[2].Value = Description; cmdParms[3].Value = (int) KeyType; object single = DbHelperSQL.GetSingle(builder.ToString(), cmdParms); if (single == null) { return 1; } return Convert.ToInt32(single); }
public PageSettingBase(string pageName, ApplicationKeyType applicationType = 1) { this._applicationType = applicationType; this.KeyTitle = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Title"); this.KeyKeywords = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Keywords"); this.KeyDescription = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Description"); this._title = ConfigSystem.GetValueByCache(this.KeyTitle, this._applicationType); if (string.IsNullOrWhiteSpace(this._title)) { this._title = ConfigSystem.GetValueByCache("Title", ApplicationKeyType.System); } this._keywords = ConfigSystem.GetValueByCache(this.KeyKeywords, this._applicationType); if (string.IsNullOrWhiteSpace(this._keywords)) { this._keywords = ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } this._description = ConfigSystem.GetValueByCache(this.KeyDescription, this._applicationType); if (string.IsNullOrWhiteSpace(this._description)) { this._description = ConfigSystem.GetValueByCache("Description", ApplicationKeyType.System); } }
public bool Update(string Keyname, string Value, ApplicationKeyType KeyType) { StringBuilder builder = new StringBuilder(); builder.Append("UPDATE SA_Config_System SET "); builder.Append("Value=@Value"); builder.Append(" WHERE Keyname=@Keyname AND KeyType=@KeyType"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@Keyname", SqlDbType.NVarChar, 50), new SqlParameter("@Value", SqlDbType.NVarChar, -1), new SqlParameter("@KeyType", SqlDbType.Int) }; cmdParms[0].Value = Keyname; cmdParms[1].Value = Value; cmdParms[2].Value = (int) KeyType; return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public static Hashtable GetHashListByCache(ApplicationKeyType keyType) { string cacheKey = "ConfigSystemHashList_" + keyType; object cache = DataCache.GetCache(cacheKey); if (cache == null) { try { cache = GetHashList(keyType); if (cache != null) { int num = Globals.SafeInt(GetValue("CacheTime"), 30); DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero); } } catch { } } return (Hashtable) cache; }
public static bool Modify(string keyname, string value, string description = "", ApplicationKeyType keyType = -1) { if (string.IsNullOrWhiteSpace(description)) { description = keyname; } if (keyType == ApplicationKeyType.None) { if (Exists(keyname)) { return Update(keyname, value, description); } return (Add(keyname, value, description) > 0); } if (Exists(keyname)) { return Update(keyname, value); } return (Add(keyname, value, description, keyType) > 0); }
public static Hashtable GetHashList(ApplicationKeyType KeyType) { DataSet list = dal.GetList(" KeyType=" + ((int) KeyType)); Hashtable hashtable = new Hashtable(); if (((list != null) && (list.Tables.Count > 0)) && (list.Tables[0] != null)) { foreach (DataRow row in list.Tables[0].Rows) { string key = row["Keyname"].ToString(); string str2 = row["Value"].ToString(); hashtable.Add(key, str2); } } return hashtable; }
public TaoBaoConfig(ApplicationKeyType keyType) { this.applicationKeyType = keyType; }
public static string GetCMSUrl(int NewId, string pageName = "CMS", ApplicationKeyType applicationType = 4) { Maticsoft.BLL.CMS.Content content = new Maticsoft.BLL.CMS.Content(); Maticsoft.Model.CMS.Content modelByCache = content.GetModelByCache(NewId); Maticsoft.BLL.CMS.ContentClass class2 = new Maticsoft.BLL.CMS.ContentClass(); if (modelByCache != null) { string str = content.GetContentUrl(modelByCache) + ".html"; string valueByCache = ConfigSystem.GetValueByCache("ArticleStaticRoot"); valueByCache = (valueByCache.LastIndexOf("/") > -1) ? valueByCache : (valueByCache + "/"); return (valueByCache + class2.GetClassUrl(modelByCache.ClassID) + "/" + str).Replace("--", "-").ToLower(); } return ""; }
public static IPageSetting GetPhotoListSetting(int cid, ApplicationKeyType applicationType = 1) { Maticsoft.Model.SNS.Categories modelByCache = new Maticsoft.BLL.SNS.Categories().GetModelByCache(cid); PageSetting setting = new PageSetting("PhotoList", applicationType); if (setting._title.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._title = PageSettingBase.ReplaceHostName(setting._title); } if ((modelByCache != null) && !string.IsNullOrWhiteSpace(modelByCache.Meta_Title)) { setting._title = PageSettingBase.ReplaceHostName(modelByCache.Meta_Title); } if (setting._keywords.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._keywords = PageSettingBase.ReplaceHostName(setting._keywords); } if ((modelByCache != null) && !string.IsNullOrWhiteSpace(modelByCache.Meta_Keywords)) { setting._keywords = PageSettingBase.ReplaceHostName(modelByCache.Meta_Keywords); } if (setting._description.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._description = PageSettingBase.ReplaceHostName(setting._description); } if ((modelByCache != null) && !string.IsNullOrWhiteSpace(modelByCache.Meta_Description)) { setting._description = PageSettingBase.ReplaceHostName(modelByCache.Meta_Description); } return setting; }
public static int Add(string Keyname, string Value, string Description, ApplicationKeyType KeyType) { return dal.Add(Keyname, Value, Description, KeyType); }
public PageSetting(string pageName, ApplicationKeyType applicationType = 1) : base(pageName, applicationType) { }
public static bool Update(string Keyname, string Value, ApplicationKeyType KeyType) { return dal.Update(Keyname, Value, KeyType); }
public UploadHandlerBase(bool isLocalSave = true, ApplicationKeyType applicationKeyType = ApplicationKeyType.None) { IsLocalSave = isLocalSave; ApplicationKeyType = applicationKeyType; }
private int UpdateConfigSystem(string key, string description, string value, ApplicationKeyType type = 3) { try { ConfigSystem.Modify(key, value, description, type); if (this.ht != null) { this.ht[key] = value; } return 0; } catch (Exception) { return 1; } }
public static string GetHostName(ApplicationKeyType applicationType = 1) { return ConfigSystem.GetValueByCache("WebName", applicationType); }
public WebSiteSet(ApplicationKeyType key) { this.applicationKeyType = key; }
/// <summary> /// Update a record /// </summary> public static bool Update(string Keyname, string Value, ApplicationKeyType KeyType) { SetValueByCache(Keyname, Value); return(dal.Update(Keyname, Value, KeyType)); }
/// <summary> /// 智能进行新增或更新操作 /// </summary> /// <remarks>当KeyType为None时, 将Update Description字段</remarks> public static bool Modify(string keyname, string value, string description = "", ApplicationKeyType keyType = ApplicationKeyType.None) { if (string.IsNullOrWhiteSpace(description)) { description = keyname; } if (keyType == ApplicationKeyType.None) { if (Exists(keyname)) { return(Update(keyname, value, description)); } return(Add(keyname, value, description) > 0); } if (Exists(keyname)) { return(Update(keyname, value)); } return(Add(keyname, value, description, keyType) > 0); }
public static string GetValueByCache(string Keyname, ApplicationKeyType KeyType) { Hashtable hashListByCache = GetHashListByCache(KeyType); if (((hashListByCache != null) && hashListByCache.ContainsKey(Keyname)) && (hashListByCache[Keyname] != null)) { return hashListByCache[Keyname].ToString(); } return GetValue(Keyname); }
public static PageSetting GetContentClassSetting(Maticsoft.Model.CMS.ContentClass classModel, string pageName = "CMSSelf", ApplicationKeyType applicationType = 4) { if (classModel == null) { classModel = new Maticsoft.Model.CMS.ContentClass(); } PageSetting setting = new PageSetting(pageName, applicationType, "Base"); if (!string.IsNullOrWhiteSpace(classModel.Meta_Title)) { setting._title = classModel.Meta_Title; } else { setting._title = ConfigSystem.GetValueByCache(setting.KeyTitle, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._title)) { setting._title = ConfigSystem.GetValueByCache("Title", ApplicationKeyType.System); } } if (!string.IsNullOrWhiteSpace(classModel.Meta_Keywords)) { setting._keywords = classModel.Meta_Keywords; } else { setting._keywords = ConfigSystem.GetValueByCache(setting.KeyKeywords, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._keywords)) { setting._keywords = ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } } if (!string.IsNullOrWhiteSpace(classModel.Meta_Description)) { setting._description = classModel.Meta_Description; } else { setting._description = ConfigSystem.GetValueByCache(setting.KeyDescription, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._description)) { setting._description = ConfigSystem.GetValueByCache("Description", ApplicationKeyType.System); } } if (setting._title.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._title = ReplaceHostName(setting._title); } if (setting._keywords.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._keywords = ReplaceHostName(setting._keywords); } if (setting._description.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._description = ReplaceHostName(setting._description); } setting.Replace(new string[][] { new string[] { "{ctname}", classModel.ClassName }, new string[] { "{cateid}", classModel.ClassID.ToString() } }); return setting; }
/// <summary> /// Add a record /// </summary> public static int Add(string Keyname, string Value, string Description, ApplicationKeyType KeyType) { return(dal.Add(Keyname, Value, Description, KeyType)); }
public PageSetting(string pageName, ApplicationKeyType applicationType = 1, string type = "Base") { this._applicationType = applicationType; if (type == "Base") { this.KeyTitle = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Title"); this.KeyKeywords = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Keywords"); this.KeyDescription = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Description"); this._title = ConfigSystem.GetValueByCache(this.KeyTitle, this._applicationType); if (string.IsNullOrWhiteSpace(this._title)) { this._title = ConfigSystem.GetValueByCache("Title", ApplicationKeyType.System); } this._keywords = ConfigSystem.GetValueByCache(this.KeyKeywords, this._applicationType); if (string.IsNullOrWhiteSpace(this._keywords)) { this._keywords = ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } this._description = ConfigSystem.GetValueByCache(this.KeyDescription, this._applicationType); if (string.IsNullOrWhiteSpace(this._description)) { this._description = ConfigSystem.GetValueByCache("Description", ApplicationKeyType.System); } this._isimage = false; } if (type == "Url") { this.KeyTitle = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Title"); this.KeyKeywords = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Keywords"); this.KeyDescription = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "Description"); this.KeyUrl = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "KeyUrl"); this._title = ConfigSystem.GetValueByCache(this.KeyTitle, this._applicationType); if (string.IsNullOrWhiteSpace(this._title)) { this._title = ConfigSystem.GetValueByCache("Title", ApplicationKeyType.System); } this._url = ConfigSystem.GetValueByCache(this.KeyUrl, this._applicationType); if (string.IsNullOrWhiteSpace(this._url)) { this._url = ConfigSystem.GetValueByCache("KeyUrl", ApplicationKeyType.System); } this._keywords = ConfigSystem.GetValueByCache(this.KeyKeywords, this._applicationType); if (string.IsNullOrWhiteSpace(this._keywords)) { this._keywords = ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } this._description = ConfigSystem.GetValueByCache(this.KeyDescription, this._applicationType); if (string.IsNullOrWhiteSpace(this._description)) { this._description = ConfigSystem.GetValueByCache("Description", ApplicationKeyType.System); } this._isimage = false; } if (type == "Image") { this._isimage = true; this.KeyAlt = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "KeyAlt"); this.KeyImageTitle = string.Format("{0}_{1}_{2}", this._applicationType, pageName, "ImageTitle"); this._alt = ConfigSystem.GetValueByCache(this.KeyAlt, this._applicationType); if (string.IsNullOrWhiteSpace(this._alt)) { this._alt = ConfigSystem.GetValueByCache("KeyAlt", ApplicationKeyType.System); } this._imagetitle = ConfigSystem.GetValueByCache(this.KeyImageTitle, this._applicationType); if (string.IsNullOrWhiteSpace(this._imagetitle)) { this._imagetitle = ConfigSystem.GetValueByCache("ImageTitle", ApplicationKeyType.System); } } }
public UploadImageHandlerBase(MakeThumbnailMode mode = MakeThumbnailMode.None, bool isLocalSave = true, ApplicationKeyType applicationKeyType = ApplicationKeyType.None) : base(isLocalSave, applicationKeyType) { ThumbnailMode = mode == MakeThumbnailMode.None ? MakeThumbnailMode.W : mode; }