示例#1
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindDataToPage()
        {
            cbCopyOfOtherModule.Checked = Settings["LayerGallery_CopyOfOtherModule"] != null && !string.IsNullOrEmpty(Settings["LayerGallery_CopyOfOtherModule"].ToString()) ? Convert.ToBoolean(Settings["LayerGallery_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["LayerGallery_CopyOfPortal"] != null && !string.IsNullOrEmpty(Settings["LayerGallery_CopyOfPortal"].ToString()) ? Convert.ToInt32(Settings["LayerGallery_CopyOfPortal"]) : PortalId);


            BindModuleList();
            WebHelper.SelectedListByValue(ddlTabModule, String.Format("{0}-{1}", Settings_TabID, Settings_ModuleID));
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindDataToPage()
        {
            EffectDBEntity XmlDB = Setting_EffectDB;

            if (!(XmlDB != null && String.IsNullOrEmpty(XmlDB.Name)))
            {
                lblEffectName.Text        = XmlDB.Name;
                lblEffectDescription.Text = XmlDB.Description;

                //绑定效果的主题
                String        EffectDirPath = String.Format("{0}Effects/{1}/Themes/", Server.MapPath(ModulePath), XmlDB.Name);
                DirectoryInfo EffectDir     = new DirectoryInfo(EffectDirPath);
                if (!EffectDir.Exists)
                {
                    EffectDir.Create();
                }
                DirectoryInfo[]       ThemeDirs = EffectDir.GetDirectories();
                List <KeyValueEntity> dirs      = new List <KeyValueEntity>();
                if (ThemeDirs != null && ThemeDirs.Length > 0)
                {
                    foreach (DirectoryInfo dir in ThemeDirs)
                    {
                        KeyValueEntity dirEntity = new KeyValueEntity();
                        dirEntity.Key = dir.Name;

                        FileInfo imgFile = new FileInfo(MapPath(String.Format("{0}Effects/{1}/Themes/{2}/image.jpg", ModulePath, XmlDB.Name, dir.Name)));
                        if (imgFile.Exists)
                        {
                            dirEntity.Value = String.Format("{0}Effects/{1}/Themes/{2}/image.jpg", ModulePath, XmlDB.Name, dir.Name);
                        }
                        else
                        {
                            dirEntity.Value = String.Format("http://www.dnngo.net/DesktopModules/DNNGo_LayerGallery/Effects/{0}/Themes/{1}/image.jpg", XmlDB.Name, dir.Name);
                        }


                        dirs.Add(dirEntity);
                    }
                    WebHelper.BindList <KeyValueEntity>(ddlThemeName, dirs, "Key", "Value");
                }
                WebHelper.SelectedListByText(ddlThemeName, Settings_EffectThemeName);


                // hfThemeThumbnails.Value = String.Format("{0}Effects/{1}/Themes/[EffectThemeName]/image.jpg", ModulePath, XmlDB.Name);
                if (!String.IsNullOrEmpty(Settings_EffectThemeName))
                {
                    imgThemeThumbnails.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/no_image.png'", ModulePath));
                    imgThemeThumbnails.ToolTip = Settings_EffectThemeName;
                    KeyValueEntity dirEntity = dirs.Find(r1 => r1.Key.IndexOf(Settings_EffectThemeName, StringComparison.CurrentCultureIgnoreCase) >= 0);
                    imgThemeThumbnails.ImageUrl = dirEntity != null?dirEntity.Value.ToString() : "";

                    imgThemeThumbnails.Visible = true;
                }
            }


            ////获取效果参数
            //List<SettingEntity> EffectSettingDB = Setting_SkinEffectSettingDB;

            //if (EffectSettingDB != null && EffectSettingDB.Count > 0)
            //{
            //    //绑定参数项
            //    RepeaterTheme.DataSource = EffectSettingDB;
            //    RepeaterTheme.DataBind();
            //}
        }