/// <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_DNNGalleryProGame_Slider> ArticleList = DNNGo_DNNGalleryProGame_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 DNNGalleryProGame_Settings.Keys)
                    {
                        if (!xmlSettingList.Exists(r1 => r1.SettingName == key) && key.IndexOf("Gallery") != 0)
                        {
                            xmlSettingList.Add(new GallerySettingsEntity(key, Convert.ToString(DNNGalleryProGame_Settings[key])));
                        }
                    }
                }



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

                foreach (DNNGo_DNNGalleryProGame_Group GroupItem in DNNGo_DNNGalleryProGame_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);
        }
Exemple #2
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            if (!String.IsNullOrEmpty(Orderfld))
            {
                qp.Orderfld = Orderfld;
            }
            else
            {
                qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.ID;
            }

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 10;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <DNNGo_DNNGalleryProGame_Slider> Events = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));


            //Boolean is_admin = !IsAdministrator && !IsAdmin;



            //ctlPagingControl.TotalRecords = RecordCount;

            //if (RecordCount <= pagesize)
            //{
            //    ctlPagingControl.Visible = false;

            //}

            gvEventList.DataSource = Events;
            gvEventList.DataBind();
            BindGridViewEmpty <DNNGo_DNNGalleryProGame_Slider>(gvEventList, new DNNGo_DNNGalleryProGame_Slider());
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            qp.Orderfld  = Orderfld;

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 10;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <DNNGo_DNNGalleryProGame_Slider> Articles = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));



            hlAllArticle.Text        = String.Format("{1} ({0})", DNNGo_DNNGalleryProGame_Slider.FindCountByStatus(Settings_ModuleID, -1), ViewResourceText("hlAllArticle", "All"));
            hlActivatedArticle.Text  = String.Format("{1} ({0})", DNNGo_DNNGalleryProGame_Slider.FindCountByStatus(Settings_ModuleID, (Int32)EnumStatus.Activated), ViewResourceText("hlActivatedArticle", "Activated"));
            hlHiddenArticle.Text     = String.Format("{1} ({0})", DNNGo_DNNGalleryProGame_Slider.FindCountByStatus(Settings_ModuleID, (Int32)EnumStatus.Hidden), ViewResourceText("hlHiddenArticle", "Hidden"));
            hlRecycleBinArticle.Text = String.Format("{1} ({0})", DNNGo_DNNGalleryProGame_Slider.FindCountByStatus(Settings_ModuleID, (Int32)EnumStatus.RecycleBin), ViewResourceText("hlRecycleBinArticle", "Recycle Bin"));



            //ctlPagingControl.TotalRecords = RecordCount;

            //if (RecordCount <= pagesize)
            //{
            //    ctlPagingControl.Visible = false;

            //}

            //如果不需要显示图片的效果
            List <SettingEntity> ItemSettings = Setting_SliderSettingDB;
            if (ItemSettings.Exists(r => r.Name == "Title"))
            {
                gvArticleList.Columns[1].Visible = true;
            }

            if (ItemSettings.Exists(r => r.Name == "Picture" || r.Name == "Thumbnails"))
            {
                gvArticleList.Columns[2].Visible = true;
            }


            if (Setting_EffectDB.Groups)
            {
                gvArticleList.Columns[3].Visible = true;
                divGroupFilter.Visible           = true;
            }

            gvArticleList.DataSource = Articles;
            gvArticleList.DataBind();
            BindGridViewEmpty <DNNGo_DNNGalleryProGame_Slider>(gvArticleList, new DNNGo_DNNGalleryProGame_Slider());
        }
Exemple #4
0
        /// <summary>
        /// 获取相关联的SiderList
        /// </summary>
        /// <param name="DataItem"></param>
        /// <returns></returns>
        public List <DNNGo_DNNGalleryProGame_Slider> GetRelations(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            List <DNNGo_DNNGalleryProGame_Slider> DataList = new List <DNNGo_DNNGalleryProGame_Slider>();

            if (SliderItem != null && SliderItem.ID > 0)
            {
                if (!String.IsNullOrEmpty(SliderItem.Relations))
                {
                    List <String> Relations = Common.GetList(SliderItem.Relations);
                    if (Relations != null && Relations.Count > 0)
                    {
                        foreach (var RelationId in Relations)
                        {
                            DNNGo_DNNGalleryProGame_Slider Slider = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(RelationId);
                            if (Slider != null && Slider.ID > 0)
                            {
                                DataList.Add(Slider);
                            }
                        }
                    }
                }

                //没有数据时需要用相关分类填充
                if (!(DataList != null && DataList.Count > 0))
                {
                    Int32      RecordCount = 0;
                    QueryParam qp          = new QueryParam();
                    qp.Orderfld  = DNNGo_DNNGalleryProGame_Slider._.Sort;
                    qp.OrderType = 1;
                    qp.PageSize  = ViewXmlSettingT <Int32>("RelatedSize", 10);

                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.EndTime, xUserTime.UtcTime(), SearchType.GtEqual));

                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ModuleId, bpm.Settings_ModuleID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, DNNGo_DNNGalleryProGame_Slider_Group.BuilderSliderIDsBySliderID(SliderItem.ID), SearchType.In));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, SliderItem.ID, SearchType.NotIn));

                    //需要根据条件来查找相应的权限
                    if (bpm.UserId > 0)
                    {
                        if (!bpm.UserInfo.IsSuperUser)//超级管理员不限制
                        {
                            qp.WhereSql.Append(" ( ");
                            //公开的
                            qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_AllUsers, 0, SearchType.Equal).ToSql());

                            //有角色的
                            if (bpm.UserInfo.Roles != null && bpm.UserInfo.Roles.Length > 0)
                            {
                                qp.WhereSql.Append(" OR ");
                                qp.WhereSql.Append(" ( ");

                                Int32 RoleIndex = 0;
                                foreach (var r in bpm.UserInfo.Roles)
                                {
                                    if (RoleIndex > 0)
                                    {
                                        qp.WhereSql.Append(" OR ");
                                    }

                                    qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_Roles, String.Format(",{0},", r), SearchType.Like).ToSql());

                                    RoleIndex++;
                                }
                                qp.WhereSql.Append(" ) ");
                            }
                            qp.WhereSql.Append(" ) ");
                        }
                    }
                    else
                    {
                        qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_AllUsers, 0, SearchType.Equal));
                    }

                    DataList = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
            }
            return(DataList);
        }
Exemple #5
0
        /// <summary>
        /// Layer列表的HTML生成
        /// </summary>
        public void PushAjaxSliders()
        {
            EffectDBEntity EffectDB = Setting_EffectDB;

            QueryParam qp = new QueryParam();

            qp.OrderType = 0;
            qp.PageIndex = WebHelper.GetIntParam(Request, "PageIndex", 2);

            if (qp.PageIndex <= 1)
            {
                qp.PageSize = WebHelper.GetIntParam(Request, "FirstScreen", 10);
                if (qp.PageSize <= 0)
                {
                    qp.PageSize = WebHelper.GetIntParam(Request, "LoadDisplay", 10);
                }
            }
            else
            {
                qp.PageSize    = WebHelper.GetIntParam(Request, "LoadDisplay", 10);
                qp.FirstScreen = WebHelper.GetIntParam(Request, "FirstScreen", 10);
            }



            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ModuleId, Settings_ModuleID, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));

            Int32 Search_GroupID = WebHelper.GetIntParam(HttpContext.Current.Request, "GroupID", 0);

            if (Search_GroupID > 0)
            {
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, DNNGo_DNNGalleryProGame_Slider_Group.BuilderArticleIDs(Search_GroupID), SearchType.In));
            }

            int RecordCount = 0;
            List <DNNGo_DNNGalleryProGame_Slider> SliderList = new List <DNNGo_DNNGalleryProGame_Slider>();


            Int32  Sortby    = Settings_Sortby;
            String Orderfld  = WebHelper.GetStringParam(Request, "Order", "");
            Int32  OrderType = WebHelper.GetIntParam(Request, "OrderBy", -1);

            if (!String.IsNullOrEmpty(Orderfld))
            {
                if (Orderfld.ToLower() == "title")
                {
                    Sortby = OrderType == 1 ? (Int32)EnumSortby.Title_Desc : (Int32)EnumSortby.Title;
                }
                else if (Orderfld.ToLower() == "starttime")
                {
                    Sortby = OrderType == 1 ? (Int32)EnumSortby.Time_Desc : (Int32)EnumSortby.Time;
                }
            }


            if (Sortby == (Int32)EnumSortby.Time)
            {
                qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.StartTime;
                SliderList  = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            }
            else if (Sortby == (Int32)EnumSortby.Time_Desc)
            {
                qp.OrderType = 1;
                qp.Orderfld  = DNNGo_DNNGalleryProGame_Slider._.StartTime;
                SliderList   = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            }
            else if (Sortby == (Int32)EnumSortby.Title)
            {
                qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.Title;
                SliderList  = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            }
            else if (Sortby == (Int32)EnumSortby.Title_Desc)
            {
                qp.OrderType = 1;
                qp.Orderfld  = DNNGo_DNNGalleryProGame_Slider._.Title;
                SliderList   = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            }
            else if (Sortby == (Int32)EnumSortby.Random)
            {
                qp.Orderfld = " newid() ";
                SliderList  = DNNGo_DNNGalleryProGame_Slider.FindRandomAll(qp, out RecordCount);
            }
            else
            {
                qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.Sort;
                SliderList  = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            }



            if (qp.Pages < qp.PageIndex) //索引数大于总页面数时不返回记录
            {
                SliderList = new List <DNNGo_DNNGalleryProGame_Slider>();
            }


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


            TemplateFormat xf = new TemplateFormat();



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

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



                jsonSlider.Add("ID", SliderItem.ID);
                jsonSlider.Add("Sort", SliderItem.Sort);
                jsonSlider.Add("CreateTime", SliderItem.CreateTime);
                jsonSlider.Add("StartTime", SliderItem.StartTime);
                jsonSlider.Add("EndTime", SliderItem.EndTime);

                jsonSlider.Add("CreateTimeUS", SliderItem.CreateTime.ToString("MM/dd/yyy HH:mm:ss"));
                jsonSlider.Add("StartTimeUS", SliderItem.StartTime.ToString("MM/dd/yyy HH:mm:ss"));
                jsonSlider.Add("EndTimeUS", SliderItem.EndTime.ToString("MM/dd/yyy HH:mm:ss"));

                jsonSlider.Add("Status", SliderItem.Status == 1 ? "checked=\"checked\"" : "");

                jsonSlider.Add("Pages", qp.Pages);

                foreach (var SliderSetting in Setting_SliderSettingDB)
                {
                    String SliderName  = SliderSetting.Name;
                    String SliderValue = xf.ViewSliderSettingT <String>(SliderItem, SliderName, SliderSetting.DefaultValue);

                    if (SliderSetting.ControlType == EnumControlType.Urls.ToString())
                    {
                        jsonSlider.Add(SliderName, ViewLinkUrl(SliderValue, false));
                    }
                    else
                    {
                        jsonSlider.Add(SliderName, SliderValue);
                    }
                }

                //加载分组
                if (EffectDB.Groups)
                {
                    jsonSlider.Add("Groups", xf.ToGroups(SliderItem));
                }
                //取出Layers数据
                if (EffectDB.Layers)
                {
                    Dictionary <String, Object>          jsonLayers = new Dictionary <String, Object>();
                    List <DNNGo_DNNGalleryProGame_Layer> LayerList  = SliderItem.LayerList;
                    if (LayerList != null && LayerList.Count > 0)
                    {
                        foreach (var Layer in LayerList)
                        {
                            int indexLayer = LayerList.IndexOf(Layer);
                            Dictionary <String, Object> jsonLayer = new Dictionary <String, Object>();
                            foreach (var LayerSetting in Setting_LayerSettingDB)
                            {
                                String LayerName  = LayerSetting.Name;
                                String LayerValue = xf.ViewLayerSettingT <String>(Layer, LayerName, LayerSetting.DefaultValue);

                                if (LayerSetting.ControlType == EnumControlType.Urls.ToString())
                                {
                                    jsonLayer.Add(LayerName, ViewLinkUrl(LayerValue, false));
                                }
                                else
                                {
                                    jsonLayer.Add(LayerName, LayerValue);
                                }
                            }
                            jsonLayer.Add("ID", Layer.ID);
                            jsonLayer.Add("Sort", Layer.Sort);
                            jsonLayer.Add("Clicks", Layer.Clicks);
                            jsonLayer.Add("Views", Layer.Views);
                            jsonLayer.Add("Heats", Layer.Heats);
                            jsonLayer.Add("CreateTime", Layer.CreateTime);


                            jsonLayers.Add((10000 - indexLayer).ToString(), jsonLayer);
                        }
                    }
                    jsonSlider.Add("Layers", jsonLayers);
                }

                //取出扩展项
                Dictionary <String, Object> jsonExtension = new Dictionary <String, Object>();
                if (!String.IsNullOrEmpty(SliderItem.Extension))
                {
                    List <KeyValueEntity> ExtensionSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(SliderItem.Extension);
                    foreach (KeyValueEntity kv in ExtensionSettings)
                    {
                        if (!jsonExtension.ContainsKey(kv.Key))
                        {
                            jsonExtension.Add(kv.Key, kv.Value);
                        }
                    }
                }
                jsonSlider.Add("Extensions", jsonExtension);



                jsonSliders.Add(index.ToString(), jsonSlider);
            }

            //转换数据为json
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            Response.Clear();
            Response.Write(jsSerializer.Serialize(jsonSliders));
            Response.End();
        }
        /// <summary>
        /// 绑定数据项到前台
        /// </summary>
        public void BindDataItem(EffectDBEntity EffectDB)
        {
            List <DNNGo_DNNGalleryProGame_Slider> SliderList = new List <DNNGo_DNNGalleryProGame_Slider>();
            Hashtable      Puts = new Hashtable();
            TemplateFormat xf   = new TemplateFormat(this);

            xf.PhContent = PhContent;

            //读取需要载入的参数
            QueryParam qp = new QueryParam();

            qp = BindSearch(qp);



            int RecordCount = 0;

            qp.OrderType = 0;

            if (EffectDB.Pager)//传入分页的数量
            {
                qp.PageSize  = xf.ViewXmlSettingT <Int32>("PageSize", 9999);
                qp.PageSize  = qp.PageSize <= 0 ? 9999 : qp.PageSize;
                qp.PageIndex = PageIndex;
                Puts.Add("PageIndex", PageIndex);
            }

            if (String.IsNullOrEmpty(SortName))
            {
                if (Settings_Sortby == (Int32)EnumSortby.Time)
                {
                    qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.StartTime;
                    SliderList  = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
                else if (Settings_Sortby == (Int32)EnumSortby.Time_Desc)
                {
                    qp.OrderType = 1;
                    qp.Orderfld  = DNNGo_DNNGalleryProGame_Slider._.StartTime;
                    SliderList   = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
                else if (Settings_Sortby == (Int32)EnumSortby.Title)
                {
                    qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.Title;
                    SliderList  = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
                else if (Settings_Sortby == (Int32)EnumSortby.Title_Desc)
                {
                    qp.OrderType = 1;
                    qp.Orderfld  = DNNGo_DNNGalleryProGame_Slider._.Title;
                    SliderList   = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
                else if (Settings_Sortby == (Int32)EnumSortby.Random)
                {
                    qp.Orderfld = " newid() ";
                    SliderList  = DNNGo_DNNGalleryProGame_Slider.FindRandomAll(qp, out RecordCount);
                }
                else
                {
                    qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.Sort;
                    SliderList  = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
            }
            else
            {
                qp.OrderType = SortType;
                qp.Orderfld  = SortName;
                SliderList   = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            }



            Puts.Add("ThemeName", Settings_EffectThemeName);
            Puts.Add("SliderList", SliderList);
            Puts.Add("EffectName", Settings_EffectName);

            Puts.Add("SortName", SortName);
            Puts.Add("SortType", SortType);

            if (Settings_Sortby == (Int32)EnumSortby.Random)
            {
                Puts.Add("IsRandom", true);
            }
            else
            {
                Puts.Add("IsRandom", false);
            }

            //是否开启分组
            Puts.Add("GroupList", EffectDB.Groups ? GetGroupList() : new List <DNNGo_DNNGalleryProGame_Group>());
            Puts.Add("GroupID", GroupID);

            //Puts.Add("LayerList", EffectDB.Layers ? GetLayerList() : new List<DNNGo_DNNGalleryProGame_Layer>());

            if (EffectDB.Pager && RecordCount > qp.PageSize)
            {
                Puts.Add("Pager", new Pager(qp.PageIndex, qp.PageSize, Settings_ModuleID, RecordCount, EnumPageType.DnnURL).CreateHtml());//分页
            }
            else
            {
                Puts.Add("Pager", "");
            }

            liContent.Text = ViewTemplate(EffectDB, "Effect.html", Puts, xf);
        }