Beispiel #1
0
        /// <summary>
        /// 相册XML转数据实体
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryPro_Slider XmlToEntity(XmlSliserEntity ContentXml)
        {
            DNNGo_DNNGalleryPro_Slider ContentItem = new DNNGo_DNNGalleryPro_Slider();


            ContentItem.Sort   = ContentXml.Sort;
            ContentItem.Status = ContentXml.Status;



            ContentItem.Options = ConvertOptions_XML(Common.XmlDecode(ContentXml.Options), Setting_SliderSettingDB);

            ContentItem.Extension  = ContentXml.Extension;
            ContentItem.CreateTime = ContentXml.CreateTime;
            ContentItem.StartTime  = ContentXml.StartTime;
            ContentItem.EndTime    = ContentXml.EndTime;

            ContentItem.ModuleId = ModuleID;
            ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;

            ContentItem.LastIP   = WebHelper.UserHost;
            ContentItem.LastTime = xUserTime.UtcTime();
            ContentItem.LastUser = UserId;
            return(ContentItem);
        }
Beispiel #2
0
        /// <summary>
        /// 相册XML转数据实体
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryPro_Layer XmlToEntity(XmlLayerEntity ContentXml)
        {
            DNNGo_DNNGalleryPro_Layer ContentItem = new DNNGo_DNNGalleryPro_Layer();


            ContentItem.Sort       = ContentXml.Sort;
            ContentItem.Status     = ContentXml.Status;
            ContentItem.CreateTime = ContentXml.CreateTime;


            ContentItem.Options = Common.XmlDecode(ContentXml.Options);


            ContentItem.ModuleId = ModuleID;
            ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;

            ContentItem.LastIP   = WebHelper.UserHost;
            ContentItem.LastTime = xUserTime.UtcTime();
            ContentItem.LastUser = UserId;
            return(ContentItem);
        }
Beispiel #3
0
        /// <summary>
        /// 导入项
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="ContentEntity"></param>
        /// <returns></returns>
        public Int32 ImportLayers(DNNGo_DNNGalleryPro_Slider Content, String ItemList)
        {
            Int32 Result = 0;

            if (Content != null && Content.ID > 0 && !String.IsNullOrEmpty(ItemList))
            {
                //还原出项的列表
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.LoadXml(Common.XmlDecode(ItemList));

                List <XmlLayerEntity> list = xf.ToList <XmlLayerEntity>();

                foreach (XmlLayerEntity itemEntity in list)
                {
                    DNNGo_DNNGalleryPro_Layer item = new DNNGo_DNNGalleryPro_Layer();

                    item.Options = ConvertOptions_XML(Common.XmlDecode(itemEntity.Options), Setting_LayerSettingDB);
                    item.Status  = itemEntity.Status;
                    item.Sort    = itemEntity.Sort;

                    item.CreateTime = itemEntity.CreateTime;

                    item.ModuleId = Content.ModuleId;
                    item.PortalId = Content.PortalId;
                    item.LastTime = Content.LastTime;
                    item.LastUser = Content.LastUser;
                    item.LastIP   = Content.LastIP;
                    item.SliderID = Content.ID;

                    //添加项
                    if (item.Insert() > 0)
                    {
                        Result++;
                    }
                }
            }
            return(Result);
        }
Beispiel #4
0
        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="XmlContent"></param>
        /// <returns></returns>
        public Int32 Import(Stream XmlContent)
        {
            //插入成功的数量
            Int32 InsertResult = 0;


            if (XmlContent != null && XmlContent.Length > 0)
            {
                //将XML转换为实体
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.Load(XmlContent);
                List <XmlSliserEntity>       XmlContentList = xf.ToList <XmlSliserEntity>();
                List <GallerySettingsEntity> XmlSettingList = xf.ToList <GallerySettingsEntity>();
                List <GalleryGroupEntity>    XmlGroupList   = xf.ToList <GalleryGroupEntity>();


                //插入分组的记录
                foreach (GalleryGroupEntity XmlGroupItem in XmlGroupList)
                {
                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ModuleID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.Name, XmlGroupItem.Name, SearchType.Equal));
                    if (DNNGo_DNNGalleryPro_Group.FindCount(qp) == 0)
                    {
                        DNNGo_DNNGalleryPro_Group ContentItem = new DNNGo_DNNGalleryPro_Group();
                        ContentItem.Name        = XmlGroupItem.Name;
                        ContentItem.Description = XmlGroupItem.Description;
                        ContentItem.QuoteCount  = Convert.ToInt32(XmlGroupItem.QuoteCount);
                        ContentItem.Sort        = Convert.ToInt32(XmlGroupItem.Sort);

                        ContentItem.ModuleId = ModuleID;
                        ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;
                        ContentItem.Insert();
                    }
                }


                //插入内容的记录
                foreach (XmlSliserEntity XmlContentItem in XmlContentList)
                {
                    DNNGo_DNNGalleryPro_Slider ContentItem = XmlToEntity(XmlContentItem);
                    ContentItem.ID = ContentItem.Insert();
                    if (ContentItem.ID > 0)
                    {
                        InsertResult++;
                        ImportLayers(ContentItem, Common.XmlDecode(XmlContentItem.Layers));


                        //插入分组
                        DNNGo_DNNGalleryPro_Slider_Group.InsertItem(ContentItem, XmlContentItem.Groups);
                    }
                }



                //移除掉部分设置
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_CopyOfOtherModule");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_CopyOfPortal");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_TabID");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_ModuleID");

                //插入设置的记录
                foreach (GallerySettingsEntity XmlSettingItem in XmlSettingList)
                {
                    UpdateModuleSetting(ModuleID, XmlSettingItem.SettingName, XmlSettingItem.SettingValue);
                }
            }

            return(InsertResult);
        }