/// <summary> /// 绑定数据 /// </summary> private void BindDataToPage() { cbCopyOfOtherModule.Checked = Settings["DNNGalleryPro_CopyOfOtherModule"] != null && !string.IsNullOrEmpty(Settings["DNNGalleryPro_CopyOfOtherModule"].ToString()) ? Convert.ToBoolean(Settings["DNNGalleryPro_CopyOfOtherModule"]) : false; //绑定当前站点列表 DotNetNuke.Entities.Portals.PortalController portalController = new DotNetNuke.Entities.Portals.PortalController(); WebHelper.BindList <PortalInfo>(ddlPortals, Common.Split <PortalInfo>(portalController.GetPortals(), 1, int.MaxValue), "PortalName", "PortalID"); WebHelper.SelectedListByValue(ddlPortals, Settings["DNNGalleryPro_CopyOfPortal"] != null && !string.IsNullOrEmpty(Settings["DNNGalleryPro_CopyOfPortal"].ToString()) ? Convert.ToInt32(Settings["DNNGalleryPro_CopyOfPortal"]) : PortalId); BindModuleList(); WebHelper.SelectedListByValue(ddlTabModule, String.Format("{0}-{1}", Settings_TabID, Settings_ModuleID)); WebHelper.BindList(ddlSortby, typeof(EnumSortby)); WebHelper.SelectedListByValue(ddlSortby, Settings["DNNGalleryPro_Sortby"] != null && !string.IsNullOrEmpty(Settings["DNNGalleryPro_Sortby"].ToString()) ? Convert.ToInt32(Settings["DNNGalleryPro_Sortby"]) : 0); divSortbyHelp.Visible = !Setting_SliderSettingDB.Exists(r => r.Name == "Title"); cbFilterStartTime.Checked = Settings["DNNGalleryPro_FilterStartTime"] != null?Convert.ToBoolean(Settings["DNNGalleryPro_FilterStartTime"]) : true; cbFilterEndTime.Checked = Settings["DNNGalleryPro_FilterEndTime"] != null?Convert.ToBoolean(Settings["DNNGalleryPro_FilterEndTime"]) : true; cbCompressionEnable.Checked = Settings["DNNGalleryPro_CompressionEnable"] != null?Convert.ToBoolean(Settings["DNNGalleryPro_CompressionEnable"]) : false; txtCompressionQuality.Text = Settings["DNNGalleryPro_CompressionQuality"] != null?Convert.ToString(Settings["DNNGalleryPro_CompressionQuality"]) : "90"; }
/// <summary> /// 绑定数据 /// </summary> private void BindDataToPage() { //构造效果存放路径 String EffectDirPath = String.Format("{0}Effects/", Server.MapPath(ModulePath)); DirectoryInfo EffectDir = new DirectoryInfo(EffectDirPath); if (!EffectDir.Exists) { EffectDir.Create(); //不存在就创建 } //获取当前所有的目录 DirectoryInfo[] EffectDirs = EffectDir.GetDirectories(); //如果模块名称不是DNNGo.DNNGalleryPro,则默认只加载第一个主题 if (!(BaseModuleName.IndexOf("DNNGo.DNNGalleryPro", StringComparison.CurrentCultureIgnoreCase) >= 0)) { gvEffectList.DataSource = Common.Split <DirectoryInfo>(EffectDirs, 1, 1); full_version_title.Visible = true; } else { gvEffectList.DataSource = EffectDirs; } //绑定数据 gvEffectList.DataBind(); }
/// <summary> /// 设置属性值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="t"></param> /// <param name="PropertyName"></param> /// <param name="PropertyValue"></param> /// <returns></returns> public T SetPropertyValue <T>(T t, String PropertyName, object PropertyValue) { if (t != null) { Type typeT = typeof(T); List <System.Reflection.PropertyInfo> Propertys = Common.Split <System.Reflection.PropertyInfo>(typeT.GetProperties(), 0, 999); if (Propertys.Exists(r => r.Name == PropertyName)) { System.Reflection.PropertyInfo Property = Propertys.Find(r => r.Name == PropertyName); if (Property != null && Property.Name == PropertyName) { typeT.GetProperty(PropertyName).SetValue(t, Convert.ChangeType(PropertyValue, Property.PropertyType), null); } } } return(t); }
/// <summary> /// 同步所有的文件 /// </summary> public Int32 SynchronizeAllFiles() { Int32 SynchronizeFileCount = 0; String WebPath = String.Format("{0}DNNGalleryPro/SynchronizeFiles/", PortalSettings.HomeDirectory); String ServerPath = MapPath(WebPath); DirectoryInfo dir = new DirectoryInfo(ServerPath); if (!dir.Exists) { dir.Create(); } List <System.IO.FileInfo> SynchronizeFiles = Common.Split <System.IO.FileInfo>(dir.GetFiles(), 1, int.MaxValue); foreach (System.IO.FileInfo SynchronizeFile in SynchronizeFiles) { SynchronizeFileCount += SynchronizeAllFiles(SynchronizeFile); } return(SynchronizeFileCount); }