Пример #1
0
        /// <summary>
        /// 导出
        /// </summary>
        public String Export()
        {
            String PostContent = String.Empty;

            //查询字段的数据,填充待导出的XML实体
            QueryParam qp = new QueryParam();

            qp.OrderType = 0;
            Int32 RecordCount = 0;

            qp.Where.Add(new SearchParam("ModuleId", ModuleID, SearchType.Equal));
            List <DNNGo_DNNGalleryPro_Slider> ArticleList = DNNGo_DNNGalleryPro_Slider.FindAll(qp, out RecordCount);

            if (ArticleList != null && ArticleList.Count > 0)
            {
                List <XmlSliserEntity>       xmlContentList = new List <XmlSliserEntity>();
                List <GallerySettingsEntity> xmlSettingList = new List <GallerySettingsEntity>();
                List <GalleryGroupEntity>    xmlGroupList   = new List <GalleryGroupEntity>();


                //查询出所有的配置项
                List <SettingEntity> EffectSettingDB = Setting_EffectSettingDB;
                if (EffectSettingDB != null && EffectSettingDB.Count > 0)
                {
                    foreach (SettingEntity SettingItem in EffectSettingDB)
                    {
                        String SettingValue = ViewXmlSetting(SettingItem.Name, SettingItem.DefaultValue).ToString();
                        xmlSettingList.Add(new GallerySettingsEntity(EffectSettingsFormat(Settings_EffectName, SettingItem.Name), SettingValue));
                    }

                    foreach (String key in DNNGalleryPro_Settings.Keys)
                    {
                        if (!xmlSettingList.Exists(r1 => r1.SettingName == key) && key.IndexOf("Gallery") != 0)
                        {
                            xmlSettingList.Add(new GallerySettingsEntity(key, Convert.ToString(DNNGalleryPro_Settings[key])));
                        }
                    }
                }



                foreach (DNNGo_DNNGalleryPro_Slider ContentItem in ArticleList)
                {
                    xmlContentList.Add(EntityToXml(ContentItem));
                }

                foreach (DNNGo_DNNGalleryPro_Group GroupItem in DNNGo_DNNGalleryPro_Group.FindAllByModuleID(ModuleID))
                {
                    xmlGroupList.Add(new GalleryGroupEntity(GroupItem));
                }

                XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/SliderEntity.xml", ModulePath)));
                //将字段列表转换成XML的实体
                PostContent = xf.ToXml <XmlSliserEntity>(xmlContentList, xmlSettingList, xmlGroupList);
            }

            return(PostContent);
        }
Пример #2
0
        public String ConvertLayers(DNNGo_DNNGalleryPro_Slider SliderItem)
        {
            String Layers_XML = String.Empty;

            if (SliderItem != null && SliderItem.ID > 0)
            {
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderItem.ID, SearchType.Equal));
                List <DNNGo_DNNGalleryPro_Layer> list = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);
                if (list != null && list.Count > 0)
                {
                    List <XmlLayerEntity> LayerList = new List <XmlLayerEntity>();
                    foreach (var item in list)
                    {
                        LayerList.Add(EntityToXml(item));
                    }
                    XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/LayerEntity.xml", ModulePath)));
                    Layers_XML = xf.ToXml <XmlLayerEntity>(LayerList);
                }
            }
            return(Layers_XML);
        }