/// <summary>
        /// 删除相关的的层
        /// </summary>
        /// <param name="SliderItem"></param>
        /// <returns></returns>
        public static Int32 Deletes(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            QueryParam qp = new QueryParam();

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Layer._.SliderID, SliderItem.ID, SearchType.Equal));

            Int32 RecordCount = 0;
            List <DNNGo_DNNGalleryProGame_Layer> ListLayer = DNNGo_DNNGalleryProGame_Layer.FindAll(qp, out RecordCount);

            foreach (var Layer in ListLayer)
            {
                Layer.Delete();
            }


            return(RecordCount);
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

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

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


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


            #endregion

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

            List <DNNGo_DNNGalleryProGame_Files> Articles = DNNGo_DNNGalleryProGame_Files.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"));



            //ctlPagingControl.TotalRecords = RecordCount;

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

            //}

            gvArticleList.DataSource = Articles;
            gvArticleList.DataBind();
            BindGridViewEmpty <DNNGo_DNNGalleryProGame_Files>(gvArticleList, new DNNGo_DNNGalleryProGame_Files());
        }
        /// <summary>
        /// 根据方案编号查询该方案下所有的字段
        /// </summary>
        /// <param name="ProjectID">方案编号</param>
        /// <returns></returns>
        public static List <DNNGo_DNNGalleryProGame_Slider> FindAllByModuleID(object ModuleID, Int32 Status = -1)
        {
            QueryParam qp          = new QueryParam();
            int        RecordCount = 0;

            qp.Orderfld  = _.Sort;
            qp.OrderType = 0;
            qp.Where.Add(new SearchParam(_.ModuleId, ModuleID, SearchType.Equal));
            if (Status > -1)
            {
                qp.Where.Add(new SearchParam(_.Status, Status, SearchType.Equal));
            }


            //  qp.Where.Add(new SearchParam(DNNGo_xForm_ExtendField._.IsDelete.ColumnName, (Int32)EnumIsDelete.Normal, SearchType.Equal));
            return(FindAll(qp, out RecordCount));
        }
        /// <summary>
        /// 设置数据项
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryProGame_Layer SetDataItem()
        {
            Int32 LayerResult = 0;

            DNNGo_DNNGalleryProGame_Layer Layer = LayerItem;

            Layer.Options = SetItemSettings();


            Layer.LastIP   = WebHelper.UserHost;
            Layer.LastTime = xUserTime.UtcTime();
            Layer.LastUser = UserId;

            if (Layer.ID > 0)
            {
                LayerResult = Layer.Update();
            }
            else
            {
                Layer.CreateTime = xUserTime.UtcTime();
                Layer.CreateUser = UserId;

                Layer.ModuleId = ModuleId;
                Layer.PortalId = PortalId;

                Layer.SliderID = SliderID;

                Layer.Status = (Int32)EnumStatus.Activated;


                QueryParam Sqp = new QueryParam();
                Sqp.ReturnFields = Sqp.Orderfld = DNNGo_DNNGalleryProGame_Layer._.Sort;
                Sqp.OrderType    = 1;
                Sqp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Layer._.ModuleId, ModuleId, SearchType.Equal));
                Layer.Sort = Convert.ToInt32(DNNGo_DNNGalleryProGame_Layer.FindScalar(Sqp)) + 2;


                Layer.ID = Layer.Insert();
            }



            return(Layer);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 插入单项
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <param name="GroupName"></param>
        /// <returns></returns>
        public static Int32 InsertItem(DNNGo_DNNGalleryProGame_Slider ContentItem, String GroupName)
        {
            int RecordCount = 0;

            if (!String.IsNullOrEmpty(GroupName))
            {
                List <String> GroupNames = Common.GetList(GroupName);

                if (GroupNames != null && GroupNames.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (String GroupString in GroupNames)
                    {
                        sb.AppendFormat("'{0}',", GroupString);
                    }

                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ContentItem.ModuleId, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.Name, sb.ToString().Trim(','), SearchType.In));

                    List <DNNGo_DNNGalleryProGame_Group> Groups = DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount);

                    if (Groups != null && Groups.Count > 0)
                    {
                        RecordCount = 0;
                        foreach (DNNGo_DNNGalleryProGame_Group GroupItem in Groups)
                        {
                            DNNGo_DNNGalleryProGame_Slider_Group Content_Group = new DNNGo_DNNGalleryProGame_Slider_Group();
                            Content_Group.GroupID  = GroupItem.ID;
                            Content_Group.SliderID = ContentItem.ID;
                            if (Content_Group.Insert() > 0)
                            {
                                RecordCount++;
                            }
                        }
                    }
                }
            }
            return(RecordCount);
        }
Exemplo n.º 6
0
        /// <Description>
        /// 绑定树分类
        /// </Description>
        private void BindTreeGroups(DNNGo_DNNGalleryProGame_Slider Article)
        {
            List <Int32>  SelectList = new List <Int32>();
            StringBuilder select     = new StringBuilder();

            if (Article != null && Article.ID > 0)
            {
                //填充分类的关系
                List <DNNGo_DNNGalleryProGame_Slider_Group> Relationships = DNNGo_DNNGalleryProGame_Slider_Group.FindAllByArticleID(Article.ID);
                foreach (DNNGo_DNNGalleryProGame_Slider_Group Groups in Relationships)
                {
                    SelectList.Add(Groups.GroupID);
                    select.AppendFormat("{0},", Groups.GroupID);
                }
            }

            //绑定所有分类到页面
            QueryParam qp = new QueryParam();

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

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ModuleId, SearchType.Equal));
            List <DNNGo_DNNGalleryProGame_Group> lst = DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount);


            //拼接顶级分类的方法
            StringBuilder sb = new StringBuilder();

            sb.Append("<div id=\"Groups-all\" class=\"tabs-panel\">");
            String ttString = CreateGroupsJson(lst, 0, SelectList);

            if (!String.IsNullOrEmpty(ttString))
            {
                sb.Append(ttString);
            }
            sb.Append("</div>");
            liGroups.Text = sb.ToString();
        }
        public String ConvertLayers(DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_Layer._.SliderID, SliderItem.ID, SearchType.Equal));
                List <DNNGo_DNNGalleryProGame_Layer> list = DNNGo_DNNGalleryProGame_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);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 绑定右边列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.PageSize  = 10;
            qp.PageIndex = PageIndex;
            qp.Orderfld  = Orderfld;
            qp.OrderType = OrderType;
            int RecordCount = 0;


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

            List <DNNGo_DNNGalleryProGame_Group> lst = DNNGo_DNNGalleryProGame_Group.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"));

            gvArticleList.DataSource = lst;
            gvArticleList.DataBind();
        }
Exemplo n.º 9
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);
        }
        /// <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_DNNGalleryProGame_Group._.ModuleId, ModuleID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.Name, XmlGroupItem.Name, SearchType.Equal));
                    if (DNNGo_DNNGalleryProGame_Group.FindCount(qp) == 0)
                    {
                        DNNGo_DNNGalleryProGame_Group ContentItem = new DNNGo_DNNGalleryProGame_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 = DNNGalleryProGame_PortalSettings.PortalId;
                        ContentItem.Insert();
                    }
                }


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


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



                //移除掉部分设置
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_CopyOfOtherModule");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_CopyOfPortal");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_TabID");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_ModuleID");

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

            return(InsertResult);
        }
Exemplo n.º 11
0
        /// <Description>
        /// 保存文章
        /// </Description>
        /// <param name="ArticleStatus">文章状态(为-1的时候取选项的值)</param>
        private Int32 SaveDataItem(Int32 ArticleStatus, ref DNNGo_DNNGalleryProGame_Slider Article)
        {
            int ResultArticle = 0;

            Article = SliderItem;



            //数字更新
            Article.Heats  = WebHelper.GetIntParam(Request, txtHeatNumber.UniqueID, 0);
            Article.Clicks = WebHelper.GetIntParam(Request, txtDownloadNumber.UniqueID, 0);

            //权限
            Article.Per_AllUsers = cbPermissionsAllUsers.Checked ? 0 : 1;


            String textStr, idStr = String.Empty;

            WebHelper.GetSelected(cblPermissionsRoles, out textStr, out idStr);
            Article.Per_Roles = idStr;

            //文章的发布状态
            Article.Status = Convert.ToInt32(ddlArticleStatus.Items[ddlArticleStatus.SelectedIndex].Value);

            //设置属性
            SetItemSettings(ref Article);
            Article.Extension = SetExtensionSettings();


            //关联集合
            Article.Relations = hfRelations.Value;

            //更新项
            Article.LastIP   = WebHelper.UserHost;
            Article.LastTime = xUserTime.UtcTime();
            Article.LastUser = UserId;

            //发布状态和时间
            DateTime oTime = xUserTime.LocalTime();

            string[] expectedFormats = { "G", "g", "f", "F" };
            string   StartDate       = WebHelper.GetStringParam(Request, txtStartDate.UniqueID, oTime.ToString("MM/dd/yyyy"));
            string   StartTime       = WebHelper.GetStringParam(Request, txtStartTime.UniqueID, oTime.ToString("hh:mm tt"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", StartDate, StartTime), "MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oTime))
            {
                if (oTime.Second == 0)
                {
                    oTime = oTime.AddSeconds(DateTime.Now.Second);                   //补秒
                }
                Article.StartTime = oTime;
            }
            //发布状态和时间
            DateTime EndTime     = xUserTime.LocalTime().AddYears(10);
            string   DisableDate = WebHelper.GetStringParam(Request, txtDisableDate.UniqueID, EndTime.ToString("MM/dd/yyyy"));
            string   DisableTime = WebHelper.GetStringParam(Request, txtDisableTime.UniqueID, EndTime.ToString("hh:mm tt"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", DisableDate, DisableTime), "MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out EndTime))
            {
                if (EndTime.Second == 0)
                {
                    EndTime = EndTime.AddSeconds(DateTime.Now.Second);                     //补秒
                }
                Article.EndTime = EndTime;
            }

            //创建用户改为可以选择
            //Article.CreateUser = WebHelper.GetIntParam(Request, txtCreateUser.UniqueID, UserId);


            if (ArticleStatus == -1)//如果没有指定状态就取控件的
            {
                Article.Status = WebHelper.GetIntParam(Request, ddlArticleStatus.UniqueID, (Int32)EnumStatus.Activated);
            }
            else
            {
                Article.Status = ArticleStatus;
            }


            if (Article.ID > 0)
            {
                //更新
                ResultArticle = Article.Update();
            }
            else
            {
                //新增
                Article.CreateTime = xUserTime.UtcTime();
                Article.CreateUser = UserId;

                Article.ModuleId = ModuleId;
                Article.PortalId = PortalId;

                QueryParam Sqp = new QueryParam();
                Sqp.ReturnFields = Sqp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.Sort;
                Sqp.OrderType    = 1;
                Sqp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ModuleId, ModuleId, SearchType.Equal));
                Article.Sort = Convert.ToInt32(DNNGo_DNNGalleryProGame_Slider.FindScalar(Sqp)) + 2;

                Article.ID = ResultArticle = Article.Insert();
            }



            if (ResultArticle > 0)
            {
                if (divGroups.Visible)
                {
                    //更新分类项
                    String Categorys = WebHelper.GetStringParam(Request, String.Format("post$groups${0}", ModuleId), "");
                    ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadUpdateGroups), new KeyValueEntity(Article.ID.ToString(), Categorys));
                }



                ////操作成功
                //mTips.LoadMessage("SaveArticleSuccess", EnumTips.Success, this, new String[] { Article.Title });

                ////操作成功需要跳转到首页
                //Response.Redirect(xUrl("Posts"));
            }
            else
            {
                //mTips.IsPostBack = false;

                ////操作失败
                //mTips.LoadMessage("SaveArticleError", EnumTips.Success, this, new String[] { Article.Title });

                ////操作失败就留在本页面
            }
            return(ResultArticle);
        }
Exemplo n.º 12
0
        // Upload entire file
        private void UploadWholeFile(HttpContext context, List <Resource_FilesStatus> statuses)
        {
            for (int i = 0; i < context.Request.Files.Count; i++)
            {
                var file = context.Request.Files[i];

                if (file != null && !String.IsNullOrEmpty(file.FileName) && file.ContentLength > 0)
                {
                    //验证后缀名是否符合
                    bool Valid = FileSystemUtils.CheckValidFileName(file.FileName);
                    if (Valid)
                    {
                        DNNGo_DNNGalleryProGame_Files PhotoItem = new DNNGo_DNNGalleryProGame_Files();

                        PhotoItem.ModuleId = WebHelper.GetIntParam(context.Request, "ModuleId", 0);
                        PhotoItem.PortalId = WebHelper.GetIntParam(context.Request, "PortalId", 0);


                        PhotoItem.FileName = file.FileName;
                        PhotoItem.FileSize = file.ContentLength / 1024;
                        PhotoItem.FileMate = WebHelper.leftx(FileSystemUtils.GetContentType(Path.GetExtension(PhotoItem.FileName).Replace(".", "")), 30);

                        PhotoItem.FileExtension = System.IO.Path.GetExtension(PhotoItem.FileName).Replace(".", "");
                        PhotoItem.Name          = System.IO.Path.GetFileName(file.FileName).Replace(Path.GetExtension(PhotoItem.FileName), "");
                        PhotoItem.Status        = (Int32)EnumFileStatus.Approved;

                        try
                        {
                            if (("png,gif,jpg,jpeg,bmp").IndexOf(PhotoItem.FileExtension) >= 0)
                            {
                                //图片的流
                                Image image = Image.FromStream(file.InputStream);
                                PhotoItem.ImageWidth  = image.Width;
                                PhotoItem.ImageHeight = image.Height;

                                PhotoItem.Exif = Common.Serialize <EXIFMetaData.Metadata>(new EXIFMetaData().GetEXIFMetaData(image));
                            }
                        }
                        catch
                        {
                        }

                        PhotoItem.LastTime = xUserTime.UtcTime();
                        PhotoItem.LastIP   = WebHelper.UserHost;
                        PhotoItem.LastUser = UserInfo.UserID;


                        //将文件存储的路径整理好
                        String fileName = FileSystemUtils.HandleFileName(System.IO.Path.GetFileName(file.FileName).Replace("." + PhotoItem.FileExtension, ""));  //文件名称
                        String WebPath  = String.Format("DNNGalleryProGame/uploads/{0}/{1}/{2}/", PhotoItem.LastTime.Year, PhotoItem.LastTime.Month, PhotoItem.LastTime.Day);
                        //检测文件存储路径是否有相关的文件
                        System.IO.FileInfo fInfo = new System.IO.FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));

                        //检测文件夹是否存在
                        if (!System.IO.Directory.Exists(fInfo.Directory.FullName))
                        {
                            System.IO.Directory.CreateDirectory(fInfo.Directory.FullName);
                        }
                        else
                        {
                            Int32 j = 1;
                            while (fInfo.Exists)
                            {
                                //文件已经存在了
                                fileName = String.Format("{0}_{1}", FileSystemUtils.HandleFileName(PhotoItem.Name), j);
                                fInfo    = new System.IO.FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));
                                j++;
                            }
                        }

                        PhotoItem.FilePath = String.Format("{0}{1}.{2}", WebPath, fileName, PhotoItem.FileExtension);
                        PhotoItem.FileName = String.Format("{0}.{1}", fileName, PhotoItem.FileExtension);
                        try
                        {
                            if (!fInfo.Directory.Exists)
                            {
                                fInfo.Directory.Create();

                                // FileSystemUtils.AddFolder(PortalSettings, String.Format("{0}DNNGo_PhotoAlbums/{0}/{1}/"), String.Format("{0}DNNGo_PhotoAlbums/{0}/{1}/"), (int)DotNetNuke.Services.FileSystem.FolderController.StorageLocationTypes.InsecureFileSystem);
                            }

                            //构造指定存储路径
                            file.SaveAs(fInfo.FullName);
                            //FileSystemUtils.AddFile(PhotoItem.FileName, PhotoItem.PortalId, String.Format("DNNGo_PhotoAlbums\\{0}\\{1}\\", PhotoItem.ModuleId, PhotoItem.AlbumID), PortalSettings.HomeDirectoryMapPath, PhotoItem.FileMeta);
                        }
                        catch (Exception ex)
                        {
                        }

                        //给上传的相片设置初始的顺序
                        QueryParam qp = new QueryParam();
                        qp.ReturnFields = qp.Orderfld = DNNGo_DNNGalleryProGame_Files._.Sort;
                        qp.OrderType    = 1;
                        qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Files._.PortalId, PhotoItem.PortalId, SearchType.Equal));
                        PhotoItem.Sort = Convert.ToInt32(DNNGo_DNNGalleryProGame_Files.FindScalar(qp)) + 2;
                        Int32 PhotoId = PhotoItem.Insert();



                        statuses.Add(new Resource_FilesStatus(PhotoItem, PortalSettings, ModulePath));
                    }
                    else
                    {
                        throw new HttpRequestValidationException("Following file was imported/uploaded, but is not an authorized filetype: " + file.FileName);
                    }
                }
            }
        }
        /// <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());
        }
        /// <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);
        }
        public Int32 SynchronizeAllFiles(System.IO.FileInfo SynchronizeFile)
        {
            Int32 SynchronizeFileCount = 0;


            DNNGo_DNNGalleryProGame_Files PhotoItem = new DNNGo_DNNGalleryProGame_Files();

            PhotoItem.ModuleId = ModuleId;
            PhotoItem.PortalId = PortalId;


            PhotoItem.FileName = SynchronizeFile.Name;
            PhotoItem.FileSize = Convert.ToInt32(SynchronizeFile.Length / 1024);
            PhotoItem.FileMate = new FileManager().GetContentType(Path.GetExtension(PhotoItem.FileName).Replace(".", ""));

            PhotoItem.FileExtension = System.IO.Path.GetExtension(PhotoItem.FileName).Replace(".", "");
            PhotoItem.Name          = System.IO.Path.GetFileName(PhotoItem.FileName).Replace(Path.GetExtension(PhotoItem.FileName), "");

            PhotoItem.Status = (Int32)EnumFileStatus.Approved;

            try
            {
                if (("png,gif,jpg,jpeg,bmp").IndexOf(PhotoItem.FileExtension) >= 0)
                {
                    //图片的流
                    System.Drawing.Image image = System.Drawing.Image.FromFile(SynchronizeFile.FullName);
                    PhotoItem.ImageWidth  = image.Width;
                    PhotoItem.ImageHeight = image.Height;

                    PhotoItem.Exif = Common.Serialize <EXIFMetaData.Metadata>(new EXIFMetaData().GetEXIFMetaData(image));
                }
            }
            catch
            {
            }

            PhotoItem.LastTime = xUserTime.UtcTime();
            PhotoItem.LastIP   = WebHelper.UserHost;
            PhotoItem.LastUser = UserInfo.UserID;

            //将文件存储的路径整理好
            String fileName = FileSystemUtils.HandleFileName(PhotoItem.Name); //文件名称
            String WebPath  = String.Format("DNNGalleryProGame/uploads/{0}/{1}/{2}/", PhotoItem.LastTime.Year, PhotoItem.LastTime.Month, PhotoItem.LastTime.Day);

            //检测文件存储路径是否有相关的文件
            System.IO.FileInfo fInfo = new System.IO.FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));

            //检测文件夹是否存在
            if (!System.IO.Directory.Exists(fInfo.Directory.FullName))
            {
                System.IO.Directory.CreateDirectory(fInfo.Directory.FullName);
            }
            else
            {
                Int32 j = 1;
                while (fInfo.Exists)
                {
                    //文件已经存在了
                    fileName = String.Format("{0}_{1}", FileSystemUtils.HandleFileName(PhotoItem.Name), j);
                    fInfo    = new System.IO.FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));
                    j++;
                }
            }

            PhotoItem.FilePath = String.Format("{0}{1}.{2}", WebPath, fileName, PhotoItem.FileExtension);
            PhotoItem.FileName = String.Format("{0}.{1}", fileName, PhotoItem.FileExtension);

            try
            {
                if (!fInfo.Directory.Exists)
                {
                    fInfo.Directory.Create();
                }
                //异步移动文件到文件夹中
                List <String> SynchronizeFileQueue = new List <string>();
                SynchronizeFileQueue.Add(SynchronizeFile.FullName);
                SynchronizeFileQueue.Add(fInfo.FullName);
                ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadMoveTo), SynchronizeFileQueue);
            }
            catch (Exception ex)
            {
            }

            //给上传的相片设置初始的顺序
            QueryParam qp = new QueryParam();

            qp.ReturnFields = qp.Orderfld = DNNGo_DNNGalleryProGame_Files._.Sort;
            qp.OrderType    = 1;
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Files._.PortalId, PhotoItem.PortalId, SearchType.Equal));
            PhotoItem.Sort = Convert.ToInt32(DNNGo_DNNGalleryProGame_Files.FindScalar(qp)) + 2;
            Int32 PhotoId = PhotoItem.Insert();

            if (PhotoId > 0)
            {
                SynchronizeFileCount++;
            }


            return(SynchronizeFileCount);
        }
Exemplo n.º 16
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_DNNGalleryProGame_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_DNNGalleryProGame_Layer._.ID, LayerID, SearchType.Equal));
                }

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


                int RecordCount = 0;
                List <DNNGo_DNNGalleryProGame_Layer> LayerList = DNNGo_DNNGalleryProGame_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();
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 推送图片列表数据
        /// </summary>
        public void PushPictureList()
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld  = DNNGo_DNNGalleryProGame_Layer._.ID;
            qp.OrderType = 1;

            qp.PageIndex = WebHelper.GetIntParam(Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Request, "PageSize", Int32.MaxValue);
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Files._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Files._.PortalId, PortalId, SearchType.Equal));


            int RecordCount = 0;
            List <DNNGo_DNNGalleryProGame_Files> fileList = DNNGo_DNNGalleryProGame_Files.FindAll(qp, out RecordCount);

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

            TemplateFormat xf = new TemplateFormat();

            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

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

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

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


                jsonLayer.Add("ID", fileItem.ID);

                jsonLayer.Add("CreateTime", fileItem.LastTime);

                jsonLayer.Add("Name", WebHelper.leftx(fileItem.Name, 20, "..."));
                jsonLayer.Add("FileName", fileItem.Name);
                jsonLayer.Add("Extension", fileItem.FileExtension);


                String ThumbnailUrl = ViewLinkUrl(String.Format("MediaID={0}", fileItem.ID));
                jsonLayer.Add("ThumbnailUrl", ThumbnailUrl);
                jsonLayer.Add("FileUrl", GetPhotoPath(fileItem.FilePath));

                jsonLayer.Add("Thumbnail", String.Format("<img style=\"border-width:0px; max-height:60px;max-width:80px;\"  src=\"{0}\"  /> ", ThumbnailUrl));

                //判断当前文件是否为图片
                if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("gif,jpg,jpeg,bmp,png").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonLayer.Add("IsPicture", true);
                }
                else
                {
                    jsonLayer.Add("IsPicture", false);
                }



                jsonLayer.Add("Json", jsSerializer.Serialize(jsonLayer));

                jsonLayers.Add(index.ToString(), jsonLayer);
            }

            //转换数据为json

            Response.Clear();
            Response.Write(jsSerializer.Serialize(jsonLayers));
            Response.End();
        }
Exemplo n.º 18
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>
        private QueryParam BindSearch(QueryParam qp)
        {
            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));


            if (FilterStartTime)
            {
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual));
            }

            if (FilterEndTime)
            {
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.EndTime, xUserTime.UtcTime(), SearchType.GtEqual));
            }


            if (GroupID > 0)
            {
                String ArticleIDs = DNNGo_DNNGalleryProGame_Slider_Group.FindArticleIDsByCategoryIDs(GroupID.ToString());
                if (!String.IsNullOrEmpty(ArticleIDs))
                {
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, ArticleIDs, SearchType.In));
                }
            }

            if (Attribute1 >= 0)
            {
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Attribute1, Attribute1, SearchType.Equal));
            }

            if (!String.IsNullOrEmpty(Attribute2))
            {
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Attribute2, Attribute2, SearchType.Equal));
            }

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

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

                        Int32 RoleIndex = 0;
                        foreach (var r in 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());

                            //qp.WhereSql.Append(" OR ");

                            //qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_Roles, 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));
            }

            return(qp);
        }