Exemplo n.º 1
0
        /// <summary>
        /// 读取设置的字典信息
        /// </summary>
        /// <param name="DataItem">Layer对象</param>
        /// <returns></returns>
        public Dictionary <String, Object> ViewDicts(DNNGo_LayerGallery_Item DataItem)
        {
            Dictionary <String, Object> Layer_Options = new Dictionary <string, Object>();

            if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Options))
            {
                JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                Layer_Options = jsSerializer.DeserializeObject(DataItem.Options) as Dictionary <String, Object>;
            }
            return(Layer_Options);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gallery数据转XML实体
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <returns></returns>
        public GalleryItemEntity EntityToXml(DNNGo_LayerGallery_Item ContentItem)
        {
            GalleryItemEntity ContentXml = new GalleryItemEntity();

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

            ContentXml.Title = ContentItem.Title;

            return(ContentXml);
        }
        /// <summary>
        /// 获取所有的层列表
        /// </summary>
        /// <returns></returns>
        public List <DNNGo_LayerGallery_Item> GetLayerList()
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld  = DNNGo_LayerGallery_Item._.Sort;
            qp.OrderType = 0;

            int RecordCount = 0;

            qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Item._.ModuleId, Settings_ModuleID, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Item._.Status, (Int32)EnumStatus.Published, SearchType.Equal));
            return(DNNGo_LayerGallery_Item.FindAll(qp, out RecordCount));
        }
        public Int32 UpdateLayerItem(Dictionary <String, object> Layer_Items, Int32 SliderID, int Layer_Index)
        {
            List <KeyValueEntity> tempLayer = ConvertTo.ToList(Layer_Items);


            DNNGo_LayerGallery_Item Layer = new DNNGo_LayerGallery_Item();


            //取出编号
            Layer.ID = ConvertTo.GetValue <Int32>(tempLayer, "id", 0);
            //读取数据库中的数据
            if (Layer.ID > 0)
            {
                Layer = DNNGo_LayerGallery_Item.FindByKeyForEdit(Layer.ID);
            }

            //将Layer项的定义序列化后存储
            Layer.Options = jsSerializer.Serialize(Layer_Items);

            //取出排序编号
            Layer.Sort = ConvertTo.GetValue <Int32>(tempLayer, "sort", Layer_Index + 1);

            //取出标题
            Layer.Title = ConvertTo.GetValue <String>(tempLayer, "title", "");

            Layer.LastTime = DateTime.Now;
            Layer.LastIP   = WebHelper.UserHost;
            Layer.LastUser = UserId;


            if (Layer.ID > 0)
            {
                //更新
                Layer.Update();
            }
            else
            {
                //新增
                Layer.ModuleId = ModuleId;
                Layer.PortalId = PortalId;

                Layer.ContentID = ConvertTo.GetValue <Int32>(tempLayer, "SliderID", SliderID);
                Layer.Status    = (Int32)EnumStatus.Published;

                Layer.ID = Layer.Insert();
            }

            return(Layer.ID);
        }
        /// <summary>
        /// 删除Layer
        /// </summary>
        /// <param name="LayerID"></param>
        /// <returns></returns>
        public Int32 DeleteLayerItem(Int32 LayerID)
        {
            Int32 Result = 0;

            if (LayerID > 0)
            {
                DNNGo_LayerGallery_Item LayerItem = DNNGo_LayerGallery_Item.FindByKeyForEdit(LayerID);

                if (LayerItem != null && LayerItem.ID > 0)
                {
                    Result = LayerItem.Delete();
                }
            }


            return(Result);
        }
        /// <summary>
        /// 删除Slider
        /// </summary>
        /// <param name="SliderID"></param>
        /// <returns></returns>
        public Int32 DeleteSliderItem(Int32 SliderID)
        {
            Int32 Result = 0;

            if (SliderID > 0)
            {
                DNNGo_LayerGallery_Content SliderItem = DNNGo_LayerGallery_Content.FindByKeyForEdit(SliderID);

                if (SliderItem != null && SliderItem.ID > 0)
                {
                    Result = SliderItem.Delete();
                    if (Result > 0)
                    {
                        DNNGo_LayerGallery_Item.Delete(new String[] { DNNGo_LayerGallery_Item._.ContentID }, new object[] { SliderID });
                    }
                }
            }


            return(Result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 导入项
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="ContentEntity"></param>
        /// <returns></returns>
        public Int32 ImportItem(DNNGo_LayerGallery_Content 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 <GalleryItemEntity> list = xf.ToList <GalleryItemEntity>();

                foreach (GalleryItemEntity itemEntity in list)
                {
                    DNNGo_LayerGallery_Item item = new DNNGo_LayerGallery_Item();

                    item.Options = Common.XmlDecode(itemEntity.Options);
                    item.Status  = itemEntity.Status;
                    item.Title   = itemEntity.Title;
                    item.Sort    = itemEntity.Sort;



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

                    //添加项
                    if (item.Insert() > 0)
                    {
                        Result++;
                    }
                }
            }
            return(Result);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 项的集合转字符串
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <returns></returns>
        public String ItemEntityToString(DNNGo_LayerGallery_Content ContentItem)
        {
            String ItemXml = String.Empty;

            if (ContentItem != null && ContentItem.ID > 0)
            {
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Item._.ContentID, ContentItem.ID, SearchType.Equal));
                List <DNNGo_LayerGallery_Item> list = DNNGo_LayerGallery_Item.FindAll(qp, out RecordCount);
                if (list != null && list.Count > 0)
                {
                    List <GalleryItemEntity> ItemList = new List <GalleryItemEntity>();
                    foreach (DNNGo_LayerGallery_Item item in list)
                    {
                        ItemList.Add(EntityToXml(item));
                    }
                    XmlFormat xf = new XmlFormat(MapPath(String.Format("{0}Resource/xml/ItemEntity.xml", ModulePath)));
                    ItemXml = xf.ToXml <GalleryItemEntity>(ItemList);
                }
            }
            return(ItemXml);
        }
        /// <summary>
        /// 获取Layers
        /// </summary>
        /// <param name="Slider"></param>
        /// <returns></returns>
        public Dictionary <String, object> GetLayerItems(DNNGo_LayerGallery_Content Slider)
        {
            //查询出所有的Layers
            List <DNNGo_LayerGallery_Item> Layers = DNNGo_LayerGallery_Item.FindAll(Slider.ID);

            Dictionary <string, object> LayerItems = new Dictionary <string, object>();


            for (int i = 0; i < Layers.Count; i++)
            {
                DNNGo_LayerGallery_Item Layer = Layers[i];

                Dictionary <String, object> LayerItems_Options = jsSerializer.DeserializeObject(Layer.Options) as Dictionary <String, object>;

                if (LayerItems_Options != null && LayerItems_Options.Count > 0)
                {
                    SetDicts(ref LayerItems_Options, "id", Layer.ID);
                    SetDicts(ref LayerItems_Options, "sort", i + 1);

                    LayerItems.Add(String.Format("layer_{0}_{1}", Slider.ID, Layer.ID), LayerItems_Options);
                }
            }
            return(LayerItems);
        }