/// <summary>
        /// Layer列表
        /// </summary>
        /// <returns></returns>
        public List <DNNGo_DNNGalleryPro_Layer> GetLayerList()
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld  = DNNGo_DNNGalleryPro_Layer._.Sort;
            qp.OrderType = 0;
            int RecordCount = 0;

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.ModuleId, Settings_ModuleID, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));
            return(DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount));
        }
Пример #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);
        }
Пример #3
0
        /// <summary>
        /// Layer列表的HTML生成
        /// </summary>
        public void PushLayerListHtml()
        {
            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                QueryParam qp = new QueryParam();
                qp.Orderfld  = DNNGo_DNNGalleryPro_Layer._.Sort;
                qp.OrderType = 0;
                qp.PageIndex = WebHelper.GetIntParam(Request, "PageIndex", 1);
                qp.PageSize  = WebHelper.GetIntParam(Request, "PageSize", Int32.MaxValue);

                Int32 LayerID = WebHelper.GetIntParam(Request, "LayerID", 0);
                if (LayerID > 0)
                {
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.ID, LayerID, SearchType.Equal));
                }

                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderID, SearchType.Equal));


                int RecordCount = 0;
                List <DNNGo_DNNGalleryPro_Layer> LayerList = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);

                Dictionary <String, Object> jsonLayers = new Dictionary <string, Object>();

                TemplateFormat xf = new TemplateFormat();


                foreach (var LayerItem in LayerList)
                {
                    int index = LayerList.IndexOf(LayerItem); //index 为索引值

                    Dictionary <String, Object> jsonLayer = new Dictionary <String, Object>();

                    jsonLayer.Add("ID", LayerItem.ID);
                    jsonLayer.Add("Sort", LayerItem.Sort);
                    jsonLayer.Add("CreateTime", LayerItem.CreateTime);
                    jsonLayer.Add("Status", LayerItem.Status == 1 ? "checked=\"checked\"" : "");
                    jsonLayer.Add("Title", WebHelper.leftx(xf.ViewLayerSettingT <String>(LayerItem, "Title", ""), 30, "..."));


                    String LayerType = xf.ViewLayerSettingT <String>(LayerItem, "LayerType", "");
                    jsonLayer.Add("LayerType", String.IsNullOrEmpty(LayerType) ? "Common" : LayerType);

                    jsonLayer.Add("Edit", String.Format("{0}Resource_Item.aspx?ModuleId={1}&PortalId={2}&TabId={3}&SliderID={4}&LayerID={5}&LayerType={6}", ModulePath, ModuleId, PortalId, TabId, SliderID, LayerItem.ID, LayerType));



                    String Thumbnail = xf.ViewLayerSettingT <String>(LayerItem, "Thumbnail", "");
                    if (String.IsNullOrEmpty(Thumbnail))
                    {
                        Thumbnail = xf.ViewLayerSettingT <String>(LayerItem, "Picture", "");
                    }

                    if (!String.IsNullOrEmpty(Thumbnail))
                    {
                        jsonLayer.Add("Thumbnail", String.Format("<img style=\"border-width:0px; max-height:60px;max-width:80px;\"  src=\"{0}\" onError=\"this.src='{1}Resource/images/no_image.png'\"  /> ", ViewLinkUrl(Thumbnail), ModulePath));
                    }
                    else
                    {
                        jsonLayer.Add("Thumbnail", "");
                    }
                    jsonLayers.Add((10000 - index).ToString(), jsonLayer);
                }

                //转换数据为json
                JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                Response.Clear();
                Response.Write(jsSerializer.Serialize(jsonLayers));
                Response.End();
            }
        }