Beispiel #1
0
        /// <summary>
        /// 创建查询语句
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public QueryParam CreateQueryParam(QueryParam qp, BasePage Context)
        {
            qp.Where.Add(new SearchParam("Status", (Int32)EnumStatus.Published, SearchType.Equal));
            qp.Where.Add(new SearchParam("PortalId", Context.PortalId, SearchType.Equal));
            qp.Where.Add(new SearchParam("IncludeRoadmap", 0, SearchType.Equal));

            //开始时间
            qp.Where.Add(new SearchParam("ReleaseDate", Context.ViewSettingT <DateTime>("Roadmap_StartTime", xUserTime.UtcTime().AddDays(-30)), SearchType.GtEqual));
            //结束时间
            qp.Where.Add(new SearchParam("ReleaseDate", Context.ViewSettingT <DateTime>("Roadmap_EndTime", xUserTime.UtcTime()).AddDays(30), SearchType.LtEqual));

            //未到开始时间的不显示数据
            qp.Where.Add(new SearchParam("StartTime", xUserTime.UtcTime(), SearchType.LtEqual));

            return(qp);
        }
Beispiel #2
0
        /// <summary>
        /// 创建查询语句(权限)
        /// </summary>
        /// <param name="qp"></param>
        /// <returns></returns>
        public static QueryParam CreateQueryByRoles(QueryParam qp, BaseModule Context)
        {
            if (Context.UserId > 0)
            {
                if (!Context.UserInfo.IsSuperUser)//超级管理员不限制
                {
                    qp.WhereSql.Append(" ( ");
                    //公开的
                    qp.WhereSql.Append(new SearchParam(_.Per_AllUsers, 0, SearchType.Equal).ToSql());

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

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

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

                            qp.WhereSql.Append(" OR ");

                            qp.WhereSql.Append(new SearchParam(_.Per_Roles, r, SearchType.Like).ToSql());


                            RoleIndex++;
                        }
                        qp.WhereSql.Append(" ) ");
                    }


                    qp.WhereSql.Append(" ) ");
                }
            }
            else
            {
                qp.Where.Add(new SearchParam(_.Per_AllUsers, 0, SearchType.Equal));
            }
            return(qp);
        }
Beispiel #3
0
        /// <summary>
        /// 查找标题和URL是否存在
        /// </summary>
        /// <param name="CampaignItem"></param>
        /// <returns></returns>
        public static Boolean FindExists(Playngo_ClientZone_Campaign CampaignItem)
        {
            QueryParam qp = new QueryParam();



            qp.WhereSql.Append(new SearchParam(_.UrlSlug, CampaignItem.UrlSlug, SearchType.Equal).ToSql());

            qp.WhereSql.Append(" OR ");


            qp.WhereSql.Append(new SearchParam(_.Title, CampaignItem.Title, SearchType.Equal).ToSql());



            return(FindCount(qp) > 0);
        }
        /// <summary>
        /// 查找关联项的编号集合
        /// </summary>
        /// <param name="ItemID"></param>
        /// <param name="PageType"></param>
        /// <returns></returns>
        public static List <String> FindFileIds(Int32 ItemID, Int32 PageType)
        {
            var        Ids = new List <String>();
            QueryParam qp  = new QueryParam();

            qp.ReturnFields = String.Format("{0},{1}", _.DownloadID, _.Sort);
            var Relations = FindListByItem(ItemID, PageType, qp);

            if (Relations != null && Relations.Count > 0)
            {
                foreach (var Relation in Relations)
                {
                    Ids.Add(Relation.DownloadID.ToString());
                }
            }
            return(Ids);
        }
Beispiel #5
0
        /// <summary>
        /// 根据状态统计数量
        /// </summary>
        /// <param name="ModuleId"></param>
        /// <param name="Status"></param>
        /// <returns></returns>
        public static Int32 FindCountByStatus(Int32 ModuleId, Int32 Status, Boolean IsAdmin, Int32 UserId)
        {
            QueryParam qp = new QueryParam();

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

            //不是超级管理员也不是普通管理员时,只能看到自己发布的文章
            if (IsAdmin)
            {
                qp.Where.Add(new SearchParam(_.CreateUser, UserId, SearchType.Equal));
            }
            return(FindCount(qp));
        }
Beispiel #6
0
        /// <summary>
        /// 获取模板信息
        /// </summary>
        /// <param name="__ModuleId">模块编号</param>
        /// <param name="__Name">模板名称</param>
        /// <param name="__language">模板语言</param>
        /// <returns></returns>
        public static Playngo_ClientZone_MailSetting FindByModuleId(Int32 __ModuleId, String __Name, String __language = "en-US")
        {
            Int32      RecordCount = 0;
            QueryParam qp          = new QueryParam();

            qp.Where.Add(new SearchParam(_.ModuleId, __ModuleId, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.Name, __Name, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.language, __language, SearchType.Equal));

            Playngo_ClientZone_MailSetting entity = FindItem(qp, out RecordCount);

            if (entity == null)
            {
                entity = new Playngo_ClientZone_MailSetting();
            }
            return(entity);
        }
        /// <summary>
        /// 查找最大排序
        /// </summary>
        /// <param name="DownloadRelation"></param>
        /// <returns></returns>
        public static Int32 FindMaxSrot(Int32 DownloadID, Int32 PageType)
        {
            Int32 Sort = 1;

            QueryParam qp = new QueryParam();

            qp.ReturnFields = qp.Orderfld = _.Sort;
            qp.OrderType    = 1;

            qp.Where.Add(new SearchParam(_.DownloadID, DownloadID, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.PageType, PageType, SearchType.Equal));

            var Scalar = FindScalar(qp);

            int.TryParse(Convert.ToString(Scalar), out Sort);

            return(Sort);
        }
        /// <summary>
        /// 批量改名
        /// 由于之前导入文件会把多加一个.zip的名称
        /// 暂时不删除
        /// </summary>
        public void BatchReNames()
        {
            Int32 ReName = WebHelper.GetIntParam(Request, "rename", 0);

            if (ReName > 0)
            {
                Int32      RecordCount = 0;
                QueryParam qp          = new QueryParam();
                if (Visibility >= 0)
                {
                    qp.Where.Add(new SearchParam(Playngo_ClientZone_Files._.Extension1, Visibility, SearchType.Equal));
                }

                qp.Where.Add(new SearchParam(Playngo_ClientZone_Files._.FileName, ".zip.zip", SearchType.Like));


                List <Playngo_ClientZone_Files> Files = Playngo_ClientZone_Files.FindAll(qp, out RecordCount);
                if (Files != null && Files.Count > 0)
                {
                    foreach (var file in Files)
                    {
                        //得到新的文件名称和路径
                        String NewFileName = Common.ReplaceNoCase(file.FileName, ".zip.zip", ".zip");
                        String NewFilePath = Common.ReplaceNoCase(file.FilePath, ".zip.zip", ".zip");
                        var    NewFileInfo = new FileInfo(MapPath(String.Format("{0}{1}", PortalSettings.HomeDirectory, NewFilePath)));

                        //得到老的文件路径
                        var OldFileInfo = new FileInfo(MapPath(String.Format("{0}{1}", PortalSettings.HomeDirectory, file.FilePath)));

                        //需要将存储的文件更名
                        OldFileInfo.MoveTo(NewFileInfo.FullName);

                        //需要移除掉重复的文件名
                        file.FileName = NewFileName;

                        //需要移除掉路径中重复的文件名
                        file.FilePath = NewFilePath;

                        //保存当前的修改
                        file.Update();
                    }
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// 创建查询语句
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public QueryParam CreateQueryParam(QueryParam qp, BasePage Context)
        {
            qp.Where.Add(new SearchParam(Playngo_ClientZone_GameSheet._.Status, (Int32)EnumStatus.Published, SearchType.Equal));
            qp.Where.Add(new SearchParam(Playngo_ClientZone_GameSheet._.PortalId, Context.PortalId, SearchType.Equal));
            //未到开始时间的不显示数据
            qp.Where.Add(new SearchParam(Playngo_ClientZone_GameSheet._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual));

            //搜索标题
            String Search = WebHelper.GetStringParam(Context.Request, "Search", "");

            if (!String.IsNullOrEmpty(Search))
            {
                qp.Where.Add(new SearchParam("Title", Common.ReplaceEscape(Search), SearchType.Like));
            }



            return(qp);
        }
Beispiel #10
0
        public QueryParam SqlQueryTable(TemplateFormat xf, BasePage Context)
        {
            //4组数据的角标(根据Cookie传过来的时间计算)
            QueryParam qp = new QueryParam();

            qp.Where.Add(new SearchParam("Status", (Int32)EnumStatus.Published, SearchType.Equal));
            qp.Where.Add(new SearchParam("PortalId", Context.PortalId, SearchType.Equal));
            qp.Where.Add(new SearchParam("NotifyInclude", 1, SearchType.Equal));
            //qp.Where.Add(new SearchParam("StartTime", xUserTime.UtcTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7)), SearchType.GtEqual));

            //未到开始时间的不显示数据
            qp.Where.Add(new SearchParam("StartTime", xUserTime.UtcTime(), SearchType.LtEqual));


            //权限筛选
            qp = CreateQueryByRoles(qp, Context);


            return(qp);
        }
Beispiel #11
0
        /// <summary>
        /// 创建查询语句(区域)
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public QueryParam CreateQueryByJurisdictions(QueryParam qp, BasePage Context)
        {
            String Jurisdictions = WebHelper.GetStringParam(Context.Request, "Jurisdictions", "");

            if (!String.IsNullOrEmpty(Jurisdictions))
            {
                if (qp.WhereSql.Length > 0)
                {
                    qp.WhereSql.Append(" AND ");
                }

                qp.WhereSql.Append(" ( ");

                qp.WhereSql.Append(new SearchParam("Per_AllJurisdictions", 0, SearchType.Equal).ToSql());


                var RegionIds = Common.GetList(Jurisdictions);
                if (RegionIds != null && RegionIds.Count > 0)
                {
                    foreach (var RegionId in RegionIds)
                    {
                        qp.WhereSql.Append(" OR ");

                        qp.WhereSql.Append(new SearchParam("Per_Jurisdictions", String.Format(",{0},", RegionId), SearchType.Like).ToSql());
                    }
                }


                qp.WhereSql.Append(" ) ");
            }
            else
            {
                //所有区域可见
                //qp.Where.Add(new SearchParam("Per_AllJurisdictions", 0, SearchType.Equal));

                //没有勾选分类时,不能显示任何数据
                qp.Where.Add(new SearchParam("Per_AllJurisdictions", -1, SearchType.Equal));
            }

            return(qp);
        }
        /// <summary>
        /// 根据状态统计数量
        /// </summary>
        /// <param name="PortalId"></param>
        /// <param name="Status"></param>
        /// <returns></returns>
        public static Int32 FindCountByType(Int32 PortalId, Int32 Visibility, Int32 type, Boolean IsAdmin, Int32 UserId)
        {
            QueryParam qp = new QueryParam();

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

            qp.Where = ByType(qp.Where, type);

            //不是超级管理员也不是普通管理员时,只能看到自己发布的文章
            if (IsAdmin)
            {
                qp.Where.Add(new SearchParam(_.LastUser, UserId, SearchType.Equal));
            }

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

            return(FindCount(qp));
        }
Beispiel #13
0
        /// <summary>
        /// 创建查询语句(文件类型)
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public QueryParam CreateQueryByFileTypes(QueryParam qp, BasePage Context)
        {
            String FileTypes = WebHelper.GetStringParam(Context.Request, "FileTypes", "");

            if (!String.IsNullOrEmpty(FileTypes))
            {
                var FileTypeList = Common.GetList(FileTypes);
                if (FileTypeList != null && FileTypeList.Count > 0)
                {
                    if (!FileTypeList.Exists(r => r == "0"))
                    {
                        System.Text.StringBuilder WhereSql = new System.Text.StringBuilder();
                        foreach (var FileTypeItem in FileTypeList)
                        {
                            if (!String.IsNullOrEmpty(FileTypeItem))
                            {
                                if (WhereSql.Length > 0)
                                {
                                    WhereSql.Append(" OR ");
                                }

                                WhereSql.Append(new SearchParam(Playngo_ClientZone_DownloadFile._.FileTypes, String.Format(",{0},", FileTypeItem), SearchType.Like).ToSql());
                            }
                        }

                        if (WhereSql.Length > 0)
                        {
                            qp.WhereSql.AppendFormat(" {0} ( {1} )", qp.WhereSql.Length > 0 ? "AND" : "", WhereSql);
                        }
                    }
                }
            }
            else
            {
                //不勾选的时候不出现任何数据
                qp.Where.Add(new SearchParam("FileTypes", "0", SearchType.Equal));
            }

            return(qp);
        }
Beispiel #14
0
        /// <summary>
        /// 创建查询语句(游戏分类)
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public QueryParam CreateQueryByGameGategorys(QueryParam qp, BasePage Context)
        {
            String GameGategorys = WebHelper.GetStringParam(Context.Request, "GameGategorys", "");

            if (!String.IsNullOrEmpty(GameGategorys))
            {
                var GameGategoryList = Common.GetList(GameGategorys);
                if (GameGategoryList != null && GameGategoryList.Count > 0)
                {
                    if (!GameGategoryList.Exists(r => r == "0"))
                    {
                        System.Text.StringBuilder WhereSql = new System.Text.StringBuilder();
                        foreach (var GameGategoryItem in GameGategoryList)
                        {
                            if (!String.IsNullOrEmpty(GameGategoryItem))
                            {
                                if (WhereSql.Length > 0)
                                {
                                    WhereSql.Append(" OR ");
                                }

                                WhereSql.Append(new SearchParam("GameCategories", String.Format(",{0},", GameGategoryItem), SearchType.Like).ToSql());
                            }
                        }

                        if (WhereSql.Length > 0)
                        {
                            qp.WhereSql.AppendFormat(" {0} ( {1} )", qp.WhereSql.Length > 0 ? "AND" : "", WhereSql);
                        }
                    }
                }
            }
            else
            {
                //不勾选的时候不出现任何数据
                qp.Where.Add(new SearchParam("GameCategories", "-1", SearchType.Equal));
            }

            return(qp);
        }
Beispiel #15
0
        public void Execute(BasePage Context)
        {
            Dictionary <String, Object> jsonDicts = new Dictionary <String, Object>();


            Int32 RelationId = WebHelper.GetIntParam(Context.Request, "ID", 0);

            QueryParam qp = new QueryParam();

            qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.ID, RelationId, SearchType.Equal));

            Int32 DeleteCount = Playngo_ClientZone_DownloadRelation.Delete(qp);

            jsonDicts.Add("DeleteCount", DeleteCount);



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

            ResponseString = jsSerializer.Serialize(jsonDicts);
        }
Beispiel #16
0
        /// <summary>
        /// 单表联表查询
        /// </summary>
        /// <param name="Name">表名的别名</param>
        /// <param name="TableName">表名</param>
        /// <param name="IsGameGategorys">是否开启分类筛选</param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public String SqlQueryTable(String Name, String TableName, Boolean IsGameGategorys, BasePage Context)
        {
            QueryParam qp = new QueryParam();

            //普通查询语句
            qp = CreateQueryParam(qp, Context);


            //权限筛选
            qp = CreateQueryByRoles(qp, Context);

            //区域筛选
            qp = CreateQueryByJurisdictions(qp, Context);

            if (IsGameGategorys)
            {
                //游戏分类筛选
                qp = CreateQueryByGameGategorys(qp, Context);
            }

            return(String.Format(" ( Select ID,ReleaseDate,StartTime,('{0}') as [TableName] From {1} Where {2} )", Name, TableName, qp.ToSql()));
        }
Beispiel #17
0
        /// <summary>
        /// 删除数据所关联的所有动态模块项
        /// </summary>
        /// <param name="LinkID"></param>
        /// <param name="ModuleId"></param>
        /// <param name="DynamicType"></param>
        /// <returns></returns>
        public static Int32 DeleteAll(Int32 LinkID, Int32 ModuleId, Int32 DynamicType)
        {
            int RecordCount    = 0;
            var DynamicModules = FindListByFilter(LinkID, DynamicType, ModuleId);

            if (DynamicModules != null && DynamicModules.Count > 0)
            {
                foreach (var DynamicModule in DynamicModules)
                {
                    if (DynamicModule.Delete() > 0)
                    {
                        RecordCount++;


                        QueryParam qp = new QueryParam();
                        qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicItem._.DynamicID, DynamicModule.ID, SearchType.Equal));
                        qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicItem._.ModuleId, ModuleId, SearchType.Equal));
                        RecordCount += Playngo_ClientZone_DynamicItem.Delete(qp);
                    }
                }
            }
            return(RecordCount);
        }
        private void BindDataListByEvents()
        {
            QueryParam qp = new QueryParam();

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

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


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


            #endregion

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

            List <Playngo_ClientZone_Event> Events = Playngo_ClientZone_Event.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"));

            gvList.DataSource = Events;
            gvList.DataBind();
            BindGridViewEmpty <Playngo_ClientZone_Event>(gvList, new Playngo_ClientZone_Event());
        }
        /// <summary>
        /// 绑定区域数据
        /// </summary>
        private void BindNavJurisdictions()
        {
            var            XMLDB = GetTemplateDB("NavJurisdictions");
            TemplateFormat xf    = new TemplateFormat(this);
            Hashtable      Puts  = new Hashtable();

            Int32      RecordCount = 0;
            QueryParam qp          = new QueryParam();

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

            qp.Where.Add(new SearchParam(Playngo_ClientZone_Jurisdiction._.PortalId, PortalId, SearchType.Equal));

            //权限筛选
            qp = CreateQueryByRoles(qp);

            var Jurisdictions = new List <Playngo_ClientZone_Jurisdiction>();

            Jurisdictions.Add(new Playngo_ClientZone_Jurisdiction()
            {
                ID = 0, Name = "All"
            });

            var items = Playngo_ClientZone_Jurisdiction.FindAll(qp, out RecordCount);

            if (items != null && items.Count > 0)
            {
                Jurisdictions.AddRange(items);
            }
            Puts.Add("Jurisdictions", Jurisdictions);



            liNavJurisdictions.Text = ViewTemplate(XMLDB, "View_Template.html", Puts, xf);
        }
Beispiel #20
0
        public void Execute(BasePage Context)
        {
            Dictionary <String, Object> jsonDatas = new Dictionary <string, Object>();

            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
            TemplateFormat       xf           = new TemplateFormat(Context);


            QueryParam qp = new QueryParam();


            qp.Orderfld  = WebHelper.GetStringParam(Context.Request, "Orderfld", "ID");
            qp.OrderType = WebHelper.GetIntParam(Context.Request, "OrderType", 1);


            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.Downloads.Pagings", 10));


            //查询语句
            qp = CreateQueryParam(qp, Context);

            //权限筛选
            qp = CreateQueryByRoles(qp, Context);

            //区域筛选
            qp = CreateQueryByJurisdictions(qp, Context);

            //文件类型筛选
            qp = CreateQueryByFileTypes(qp, Context);

            //游戏分类筛选
            qp = CreateQueryByGameGategorys(qp, Context);



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


            //配置值
            XmlFormat xmlFormat      = new XmlFormat(Context.Server.MapPath(String.Format("{0}Resource/xml/Config.Setting.Downloads.xml", Context.ModulePath)));
            var       XmlItemSetting = xmlFormat.ToList <SettingEntity>();


            List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >();

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

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



                //循环输出所有的固定项
                foreach (var Field in Playngo_ClientZone_DownloadFile.Meta.Fields)
                {
                    jsonDict.Add(Field.ColumnName, fileItem[Field.ColumnName]);
                }


                if (XmlItemSetting != null && XmlItemSetting.Count > 0)
                {
                    var ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(fileItem.Options);
                    foreach (var ItemSetting in XmlItemSetting)
                    {
                        jsonDict = Common.UpdateDictionary(jsonDict, ItemSetting.Name, xf.ViewItemSetting(fileItem, ItemSetting.Name, ItemSetting.DefaultValue));
                    }
                }


                //下载地址
                String DownloadUrl = String.Format("{0}Resource_Service.aspx?ModuleId={1}&Token={2}&TabId={3}&PortalId={4}&language={5}&FileId={6}",
                                                   Context.ModulePath,
                                                   Context.Settings_ModuleID,
                                                   "DownloadFile",
                                                   Context.Settings_TabID,
                                                   Context.PortalId,
                                                   Context.language,
                                                   fileItem.ID);
                jsonDict = Common.UpdateDictionary(jsonDict, "DownloadUrl", DownloadUrl);

                jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", fileItem.ReleaseDate.ToShortDateString());

                //文件类型转换
                jsonDict = Common.UpdateDictionary(jsonDict, "FileTypesString", Playngo_ClientZone_FileType.ConvertFileTypes(fileItem.FileTypes));

                //订阅状态等
                Int32 NotifyStatus = (Int32)EnumNotificationStatus.None;
                if (fileItem.NotifyInclude == 1) //&& fileItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7)))
                {
                    NotifyStatus = fileItem.NotifyStatus;
                }


                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatus", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)));
                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatusClass", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)).ToLower());
                //未来日期出现Coming Soon
                jsonDict = Common.UpdateDictionary(jsonDict, "ComingSoonDisplay", fileItem.ReleaseDate > xUserTime.LocalTime());

                DictFiles.Add(jsonDict);
            }

            jsonDatas.Add("data", DictFiles);
            jsonDatas.Add("Pages", qp.Pages);
            jsonDatas.Add("RecordCount", RecordCount);

            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonDatas);
        }
Beispiel #21
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)
                {
                    //To verify that if the suffix name of the uploaded files meets the DNN HOST requirements
                    Boolean retValue = FileSystemUtils.CheckValidFileName(file.FileName);
                    if (retValue)
                    {
                        Playngo_ClientZone_Files PhotoItem = new Playngo_ClientZone_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;
                        PhotoItem.Extension1 = Visibility;

                        String SaveDirPath = "uploads";

                        if (Visibility == 1)
                        {
                            SaveDirPath = "downloads";
                        }

                        //将文件存储的路径整理好
                        String fileName = System.IO.Path.GetFileName(file.FileName).Replace("." + PhotoItem.FileExtension, ""); //文件名称
                        String WebPath  = String.Format("ClientZone/{0}/{1}/{2}/{3}/", SaveDirPath, DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day);
                        //检测文件存储路径是否有相关的文件
                        FileInfo fInfo = new 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}", PhotoItem.Name, j);
                                fInfo    = new 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}Playngo_PhotoAlbums/{0}/{1}/"), String.Format("{0}Playngo_PhotoAlbums/{0}/{1}/"), (int)DotNetNuke.Services.FileSystem.FolderController.StorageLocationTypes.InsecureFileSystem);
                            }

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

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



                        statuses.Add(new Resource_FilesStatus(PhotoItem, PortalSettings, ModulePath));
                    }
                }
            }
        }
Beispiel #22
0
        public Int32 SynchronizeAllFiles(FileInfo SynchronizeFile)
        {
            Int32 SynchronizeFileCount = 0;


            Playngo_ClientZone_Files PhotoItem = new Playngo_ClientZone_Files();

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


            PhotoItem.FileName = SynchronizeFile.Name;
            PhotoItem.FileSize = Convert.ToInt32(SynchronizeFile.Length / 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(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;


            PhotoItem.Extension1 = Visibility;


            //根据菜单来选择导入的文件夹
            String SaveDirPath = "uploads";

            if (Visibility == 1)
            {
                SaveDirPath = "downloads";
            }



            //将文件存储的路径整理好
            String fileName = PhotoItem.Name; //文件名称
            String WebPath  = String.Format("ClientZone/{0}/{1}/{2}/{3}/", SaveDirPath, PhotoItem.LastTime.Year, PhotoItem.LastTime.Month, PhotoItem.LastTime.Day);
            //检测文件存储路径是否有相关的文件
            FileInfo fInfo = new 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}", PhotoItem.Name, j);
                    fInfo    = new 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 = Playngo_ClientZone_Files._.Sort;
            qp.OrderType    = 1;
            qp.Where.Add(new SearchParam(Playngo_ClientZone_Files._.PortalId, PhotoItem.PortalId, SearchType.Equal));
            PhotoItem.Sort = Convert.ToInt32(Playngo_ClientZone_Files.FindScalar(qp)) + 2;
            Int32 PhotoId = PhotoItem.Insert();

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


            return(SynchronizeFileCount);
        }
Beispiel #23
0
        public void Execute(BasePage Context)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>();


            TemplateFormat xf = new TemplateFormat();
            QueryParam     qp = new QueryParam();


            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.GameSheets.Pagings", 12));

            //排序的规则
            Int32 Sort = WebHelper.GetIntParam(Context.Request, "Sort", 0);

            if (Sort == (Int32)EnumSortQueryByGame.GameName_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.Title;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.GameName_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.Title;
                qp.OrderType = 0;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.GameID_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.GameID;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.GameID_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.GameID;
                qp.OrderType = 0;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.ReleaseDate;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.ReleaseDate;
                qp.OrderType = 0;
            }
            else
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.ID;
                qp.OrderType = 1;
            }


            //查询语句
            qp = CreateQueryParam(qp, Context);

            //权限筛选
            qp = CreateQueryByRoles(qp, Context);

            //区域筛选
            qp = CreateQueryByJurisdictions(qp, Context);

            //游戏分类筛选
            qp = CreateQueryByGameGategorys(qp, Context);



            int RecordCount = 0;
            List <Playngo_ClientZone_GameSheet> GameSheetList = Playngo_ClientZone_GameSheet.FindAll(qp, out RecordCount);


            //配置值
            XmlFormat xmlFormat      = new XmlFormat(Context.Server.MapPath(String.Format("{0}Resource/xml/Config.Setting.GameSheets.xml", Context.ModulePath)));
            var       XmlItemSetting = xmlFormat.ToList <SettingEntity>();


            List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >();

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

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



                //循环输出所有的固定项
                foreach (var Field in Playngo_ClientZone_GameSheet.Meta.Fields)
                {
                    jsonDict.Add(Field.ColumnName, GameSheetItem[Field.ColumnName]);
                }


                if (XmlItemSetting != null && XmlItemSetting.Count > 0)
                {
                    var ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(GameSheetItem.Options);
                    foreach (var ItemSetting in XmlItemSetting)
                    {
                        jsonDict = Common.UpdateDictionary(jsonDict, ItemSetting.Name, xf.ViewItemSetting(GameSheetItem, ItemSetting.Name, ItemSetting.DefaultValue));
                    }
                }


                jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", GameSheetItem.ReleaseDate.ToShortDateString());
                jsonDict = Common.UpdateDictionary(jsonDict, "Image", xf.ViewLinkUrl(xf.ViewItemSettingT <string>(GameSheetItem, "Image", ""), "", Context));

                jsonDict = Common.UpdateDictionary(jsonDict, "Url", xf.GoUrl(GameSheetItem));
                //未来日期出现Coming Soon
                jsonDict = Common.UpdateDictionary(jsonDict, "ComingSoonDisplay", GameSheetItem.ReleaseDate > xUserTime.LocalTime());


                Int32 NotifyStatus = (Int32)EnumNotificationStatus.None;
                if (GameSheetItem.NotifyInclude == 1) //&& GameSheetItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7)))
                {
                    NotifyStatus = GameSheetItem.NotifyStatus;
                }


                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatus", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)));
                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatusClass", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)).ToLower());


                DictFiles.Add(jsonDict);
            }

            jsonPictures.Add("data", DictFiles);
            jsonPictures.Add("Pages", qp.Pages);
            jsonPictures.Add("RecordCount", RecordCount);

            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonPictures);
        }
        public static List <Playngo_ClientZone_DownloadRelation> FindListByItem(Int32 ItemID, Int32 PageType, QueryParam qp)
        {
            qp.OrderType = 0;
            qp.Orderfld  = _.Sort;
            Int32 RecordCount = 0;

            qp.Where.Add(new SearchParam(_.ItemID, ItemID, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.PageType, PageType, SearchType.Equal));

            return(FindAll(qp, out RecordCount));
        }
        /// <summary>
        /// 绑定查询的方法
        /// </summary>
        private QueryParam BindSearch(QueryParam qp)
        {
            List <SearchParam> Where = qp.Where;

            //文章所属模块
            Where.Add(new SearchParam(Playngo_ClientZone_Event._.ModuleId, Settings_ModuleID, SearchType.Equal));
            //文章状态
            Where.Add(new SearchParam(Playngo_ClientZone_Event._.Status, (Int32)EnumStatus.Published, SearchType.Equal));


            qp.Where = Where;


            //根据权限来筛选数据
            #region "根据权限来筛选数据"
            if (UserId > 0)
            {
                if (!UserInfo.IsSuperUser)//超级管理员不限制
                {
                    if (!String.IsNullOrEmpty(qp.WhereSql.ToString()))
                    {
                        qp.WhereSql.Append(" AND ");
                    }

                    qp.WhereSql.Append(" ( ");
                    //公开的
                    qp.WhereSql.Append(new SearchParam(Playngo_ClientZone_Event._.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(Playngo_ClientZone_Event._.Per_Roles, String.Format(",{0},", r), SearchType.Like).ToSql());

                            qp.WhereSql.Append(" OR ");

                            qp.WhereSql.Append(new SearchParam(Playngo_ClientZone_Event._.Per_Roles, r, SearchType.Like).ToSql());

                            RoleIndex++;
                        }
                        qp.WhereSql.Append(" ) ");
                    }


                    qp.WhereSql.Append(" ) ");
                }
            }
            else
            {
                qp.Where.Add(new SearchParam(Playngo_ClientZone_Event._.Per_AllUsers, 0, SearchType.Equal));
            }
            #endregion


            return(qp);
        }
Beispiel #26
0
        /// <summary>
        /// 获取当前需要显示的动态模块
        /// </summary>
        /// <param name="LinkID"></param>
        /// <param name="DynamicType"></param>
        /// <param name="ModuleId"></param>
        /// <returns></returns>
        public static List <Playngo_ClientZone_DynamicModule> FindViewAllByFilter(Int32 LinkID, Int32 DynamicType, Int32 ModuleId, BaseModule mo)
        {
            int        RecordCount = 0;
            QueryParam qp          = new QueryParam();

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


            qp.Where.Add(new SearchParam(_.LinkID, LinkID, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.Type, DynamicType, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.ModuleId, ModuleId, SearchType.Equal));


            qp.Where.Add(new SearchParam(_.IncludeTabLink, 1, SearchType.Equal));


            #region "根据权限来筛选数据"
            if (mo.UserId > 0)
            {
                if (!mo.UserInfo.IsSuperUser)//超级管理员不限制
                {
                    if (qp.WhereSql.Length > 0)
                    {
                        qp.WhereSql.Append(" AND ");
                    }


                    qp.WhereSql.Append(" ( ");
                    //公开的
                    qp.WhereSql.Append(new SearchParam(_.Per_AllUsers, 0, SearchType.Equal).ToSql());

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

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

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


                            qp.WhereSql.Append(" OR ");

                            qp.WhereSql.Append(new SearchParam(_.Per_Roles, r, SearchType.Like).ToSql());

                            RoleIndex++;
                        }
                        qp.WhereSql.Append(" ) ");
                    }


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


            return(FindAll(qp, out RecordCount));
        }
        /// <summary>
        /// 更新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Dictionary <String, Object> DynamicModuleJsons = new Dictionary <String, Object>();

                Playngo_ClientZone_DynamicModule Dynamic = DynamicModule;


                Dynamic.Title = txtTitle.Text;

                Dynamic.IncludeTabLink = cbIncludeTabLink.Checked ? 1 : 0;
                Dynamic.PDFGenerator   = cbPDFGenerator.Checked ? 1 : 0;


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

                String textStr, idStr = String.Empty;
                WebHelper.GetSelected(cblPermissionsRoles, out textStr, out idStr);
                Dynamic.Per_Roles = idStr;

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


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

                    Dynamic.LinkID = LinkID;
                    Dynamic.Type   = DynamicType;

                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicModule._.ModuleId, ModuleId, SearchType.Equal));
                    qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicModule._.LinkID, LinkID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicModule._.Type, DynamicType, SearchType.Equal));


                    Dynamic.Sort = Playngo_ClientZone_DynamicModule.FindCount(qp) + 10;
                }


                int ResultEvent = 0;

                if (Dynamic.ID > 0)
                {
                    ResultEvent = Dynamic.Update();
                    DynamicModuleJsons.Add("Action", "Update");
                }
                else
                {
                    ResultEvent = Dynamic.ID = Dynamic.Insert();
                    DynamicModuleJsons.Add("Action", "Insert");
                }



                foreach (var Field in Playngo_ClientZone_DynamicModule.Meta.Fields)
                {
                    DynamicModuleJsons.Add(Field.ColumnName, Dynamic[Field.ColumnName]);
                }

                //DynamicItemJsons.Add("TypeText", EnumHelper.GetEnumTextVal(Dynamic.Type, typeof(EnumDynamicItemType)));

                DynamicModuleJsons.Add("EditUrl", DynamicModule_IframeUrl(Dynamic.ID));


                DynamicModuleJsons.Add("AddUrlText", DynamicItem_IframeUrl(0, Dynamic.ID, "Text"));
                DynamicModuleJsons.Add("AddUrlImage", DynamicItem_IframeUrl(0, Dynamic.ID, "Image"));
                DynamicModuleJsons.Add("AddUrlImageText", DynamicItem_IframeUrl(0, Dynamic.ID, "ImageText"));
                DynamicModuleJsons.Add("AddUrlVideo", DynamicItem_IframeUrl(0, Dynamic.ID, "Video"));
                DynamicModuleJsons.Add("AddUrliFrame", DynamicItem_IframeUrl(0, Dynamic.ID, "xFrame"));



                JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                jsSerializer.MaxJsonLength = Int32.MaxValue;
                String JsonString = jsSerializer.Serialize(DynamicModuleJsons);

                Response.Write(String.Format("<script>window.parent.EditDynamicModules({0});</script>", JsonString));
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        public void Execute(BasePage Context)
        {
            TemplateFormat xf = new TemplateFormat(Context);

            QueryParam qp = new QueryParam();

            qp.ReturnFields = "ID,Title";


            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.Search.Size", 10));

            //排序的规则
            qp.OrderType = WebHelper.GetIntParam(Context.Request, "OrderType", 1);
            qp.Orderfld  = "ID"; //WebHelper.GetStringParam(Context.Request, "Orderfld", "ID");


            //查询语句
            qp = CreateQueryParam(qp, Context);

            //权限筛选
            qp = CreateQueryByRoles(qp, Context);

            //区域筛选
            qp = CreateQueryByJurisdictions(qp, Context);



            int RecordCount = 0;

            var    UserList   = new List <UserInfo>();
            String SearchText = WebHelper.GetStringParam(Context.Request, "search", "");

            if (!String.IsNullOrEmpty(SearchText))
            {
                //UserList = UserController.Instance.GetUsersAdvancedSearch(Context.PortalId, 0, -1, -1, -1, false, 0, 10, "USERID", false, "Username,DisplayName", "%" + SearchText  ).ToList<UserInfo>();
                UserList = Common.Split <UserInfo>(UserController.GetUsersByUserName(Context.PortalId, "%" + SearchText + "%", 0, 10, ref RecordCount, false, false), 1, 100); //  "USERID", false, "Username", ).ToList<UserInfo>();
            }
            else
            {
                UserList = Common.Split <UserInfo>(UserController.GetUsers(Context.PortalId, 0, 10, ref RecordCount), 1, 100);   //.GetUsersBasicSearch(Context.PortalId, 1, 10, "USERID", false, "", "").ToList<UserInfo>();
            }



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


            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            List <Dictionary <String, Object> > DictItems = new List <Dictionary <string, object> >();

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

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

                jsonDict.Add("id", UserItem.UserID);
                jsonDict.Add("text", String.Format("{0} - {1}", UserItem.Username, UserItem.DisplayName));
                jsonDict.Add("roles", Common.GetStringByList(UserItem.Roles));
                DictItems.Add(jsonDict);
            }

            jsonPictures.Add("Items", DictItems);
            jsonPictures.Add("Pages", qp.Pages);
            jsonPictures.Add("RecordCount", RecordCount);

            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonPictures);
        }
Beispiel #29
0
        public void Execute(BasePage Context)
        {
            Dictionary <String, Object> jsonDicts    = new Dictionary <String, Object>();
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();

            Common.UpdateDictionary(jsonDicts, "Message", "");
            Common.UpdateDictionary(jsonDicts, "Result", "false");

            Int32 DownloadID = WebHelper.GetIntParam(Context.Request, "DownloadID", 0);
            Int32 ItemID     = WebHelper.GetIntParam(Context.Request, "ItemID", 0);

            if (DownloadID > 0 && ItemID > 0)
            {
                var DownloadRelation = new Playngo_ClientZone_DownloadRelation();


                Int32 PageType = WebHelper.GetIntParam(Context.Request, "PageType", 0);

                Int32      RecordCount = 0;
                QueryParam qp          = new QueryParam();
                qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.DownloadID, DownloadID, SearchType.Equal));
                qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.PageType, PageType, SearchType.Equal));
                qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.ItemID, ItemID, SearchType.Equal));

                if (Playngo_ClientZone_DownloadRelation.FindCount(qp) == 0)
                {
                    DownloadRelation.PageType   = PageType;
                    DownloadRelation.DownloadID = DownloadID;
                    DownloadRelation.ItemID     = ItemID;

                    DownloadRelation.Sort = Playngo_ClientZone_DownloadRelation.FindMaxSrot(DownloadID, PageType) + 1;

                    DownloadRelation.ModuleId   = Context.ModuleId;
                    DownloadRelation.PortalId   = Context.PortalId;
                    DownloadRelation.CreateTime = xUserTime.LocalTime();
                    DownloadRelation.CreateUser = Context.UserId;
                    DownloadRelation.ID         = DownloadRelation.Insert();

                    if (DownloadRelation.ID > 0)
                    {
                        foreach (var Field in Playngo_ClientZone_DownloadRelation.Meta.Fields)
                        {
                            jsonDicts.Add(Field.ColumnName, DownloadRelation[Field.ColumnName]);
                        }

                        Common.UpdateDictionary(jsonDicts, "PageTypeText", EnumHelper.GetEnumTextVal(DownloadRelation.PageType, typeof(EnumDisplayModuleType)));
                        Common.UpdateDictionary(jsonDicts, "Title", WebHelper.GetStringParam(Context.Request, "Title", ""));

                        Common.UpdateDictionary(jsonDicts, "Result", "true");
                    }
                    else
                    {
                        Common.UpdateDictionary(jsonDicts, "Message", "添加数据不成功");
                    }
                }
                else
                {
                    //DownloadRelation = Playngo_ClientZone_DownloadRelation.FindItem(qp, out RecordCount);

                    Common.UpdateDictionary(jsonDicts, "Message", "数据已经存在忽略");
                }
            }
            else
            {
                //出入的ID数据不对
                Common.UpdateDictionary(jsonDicts, "Message", "出入的ID数据不对");
            }
            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonDicts);
        }
        public void Execute(BasePage Context)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>();
            String ImageIds = WebHelper.GetStringParam(Context.Request, "Images", "");

            if (!String.IsNullOrEmpty(ImageIds))
            {
                QueryParam qp = new QueryParam();
                qp.Orderfld = Playngo_ClientZone_Files._.ID;

                qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
                qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", Int32.MaxValue);
                qp.Where.Add(new SearchParam(Playngo_ClientZone_Files._.Status, (Int32)EnumFileStatus.Approved, SearchType.Equal));
                qp.Where.Add(new SearchParam(Playngo_ClientZone_Files._.PortalId, Context.PortalId, SearchType.Equal));
                qp.Where.Add(new SearchParam(Playngo_ClientZone_Files._.ID, ImageIds.Trim(','), SearchType.In));


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



                TemplateFormat xf = new TemplateFormat();



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

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

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


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

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

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


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

                    jsonPicture.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)
                    {
                        jsonPicture.Add("IsVideo", false);
                        jsonPicture.Add("IsPicture", true);
                    }
                    else if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("mp4,mkv,avi,ogv,webm,m4v").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                    {
                        jsonPicture.Add("IsVideo", true);
                        jsonPicture.Add("IsPicture", false);


                        switch (fileItem.FileExtension)
                        {
                        case "mp4": jsonPicture.Add("IsMp4", true); break;

                        case "m4v": jsonPicture.Add("IsM4v", true); break;

                        case "ogv": jsonPicture.Add("IsOgv", true); break;

                        case "webm": jsonPicture.Add("IsWebm", true); break;

                        default: break;
                        }
                    }
                    else if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("flv,swf").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                    {
                        jsonPicture.Add("IsFlash", true);
                        jsonPicture.Add("IsPicture", false);
                        jsonPicture.Add("Guid", Guid.NewGuid().ToString());
                    }
                    else
                    {
                        jsonPicture.Add("IsVideo", false);
                        jsonPicture.Add("IsPicture", false);
                    }

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

                    jsonPictures.Add(index.ToString(), jsonPicture);
                }

                jsonPictures.Add("ResultCount", jsonPictures.Count);
                jsonPictures.Add("Result", "success");
            }
            else
            {
                jsonPictures.Add("ResultCount", 0);
                jsonPictures.Add("Result", "error");
            }


            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonPictures);
        }