Exemplo n.º 1
0
        /// <summary>
        /// 输出XML
        /// </summary>
        /// <returns></returns>
        public String ToXml(basePortalModule pmb)
        {
            //读取XML的模版
            XmlFormat xf = new XmlFormat(pmb.MapPath(String.Format("{0}Resource/xml/EffectDB.xml", pmb.ModulePath)));

            //将字段列表转换成XML的实体
            return(xf.ToXml <EffectDB>(this));
        }
Exemplo n.º 2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleID">The Id of the module to be exported</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------

        public string ExportModule(int ModuleID)
        {
            string strXML = String.Empty;

            ImportExportHelper ieHelper = new ImportExportHelper();

            ieHelper.ModuleID = ModuleID;

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

            qp.Orderfld  = DNNGo_PowerForms_Field._.Sort;
            qp.OrderType = 0;
            qp.Where.Add(new SearchParam("ModuleId", ModuleID, SearchType.Equal));
            List <DNNGo_PowerForms_Field> fieldList      = DNNGo_PowerForms_Field.FindAll(qp, out RecordCount);
            List <FieldEntity>            xmlFieldList   = new List <FieldEntity>();
            List <GallerySettingsEntity>  xmlSettingList = new List <GallerySettingsEntity>();

            foreach (DNNGo_PowerForms_Field fieldItem in fieldList)
            {
                xmlFieldList.Add(ieHelper.EntityToXml(fieldItem));
            }

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

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


                XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/FieldEntity.xml", "~/DesktopModules/DNNGo_PowerForms/")));
                strXML = xf.ToXml <FieldEntity>(xmlFieldList, xmlSettingList);
            }
            else
            {
            }

            return(strXML);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 导出数据到XML
        /// </summary>
        protected void cmdExportToXml_Click(object sender, EventArgs e)
        {
            ImportExportHelper ieHelper = new ImportExportHelper();

            ieHelper.ModuleID = ModuleId;

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

            qp.Orderfld  = DNNGo_PowerForms_Field._.Sort;
            qp.OrderType = 0;
            qp.Where.Add(new SearchParam("ModuleId", ModuleId, SearchType.Equal));
            List <DNNGo_PowerForms_Field> fieldList      = DNNGo_PowerForms_Field.FindAll(qp, out RecordCount);
            List <FieldEntity>            xmlFieldList   = new List <FieldEntity>();
            List <GallerySettingsEntity>  xmlSettingList = new List <GallerySettingsEntity>();

            foreach (DNNGo_PowerForms_Field fieldItem in fieldList)
            {
                xmlFieldList.Add(ieHelper.EntityToXml(fieldItem));
            }

            //查询出所有的配置项
            List <SettingEntity> EffectSettingDB = ieHelper.Setting_EffectSettingDB;

            if (EffectSettingDB != null && EffectSettingDB.Count > 0)
            {
                foreach (SettingEntity SettingItem in EffectSettingDB)
                {
                    String SettingValue = ieHelper.ViewXmlSetting(SettingItem.Name, SettingItem.DefaultValue).ToString();
                    xmlSettingList.Add(new GallerySettingsEntity(ieHelper.EffectSettingsFormat(ieHelper.Settings_EffectName, SettingItem.Name), SettingValue));
                }

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

            XmlFormat xf = new XmlFormat(MapPath(String.Format("{0}Resource/xml/FieldEntity.xml", ModulePath)));
            //将字段列表转换成XML的实体
            String XmlContent  = xf.ToXml <FieldEntity>(xmlFieldList, xmlSettingList);
            String XmlFilePath = FileSystemUtils.SaveXmlToFile(String.Format("FieldListEntity_{0}_{1}.xml", ModuleId, xUserTime.UtcTime().ToString("yyyyMMddHHmmssffff")), XmlContent, this);

            FileSystemUtils.DownloadFile(XmlFilePath, "FieldListEntity.xml");
        }