Exemplo n.º 1
0
        /// <summary>
        /// 绑定数据项
        /// </summary>
        private void BindDataItem()
        {
            Playngo_ClientZone_DownloadFile Event = EventItem;

            //验证文章是否存在
            if (DownloadID > 0 && (Event == null || DownloadID != Event.ID))
            {
                //需要给出提示,载入文章错误
                mTips.LoadMessage("LoadingEventError", EnumTips.Error, this, new String[] { "" });
                Response.Redirect(xUrl("Downloads"), false);
            }

            if (Event == null)
            {
                Event = new Playngo_ClientZone_DownloadFile();
            }



            //这里需要验证一下权限,当作者进入到别人的文章时,需要跳到列表页面
            if (Event != null && Event.ID > 0 && (!IsAdministrator && !IsAdmin) && Event.CreateUser != UserId)
            {
                //需要给出提示,你无权编辑其他作者的文章
                mTips.LoadMessage("NoPermissionEventAlert", EnumTips.Warning, this, new String[] { Event.Title });
                Response.Redirect(xUrl("Downloads"), false);
            }

            if (Event != null && Event.ID > 0)
            {
                liLastUpdated.Text = Event.LastTime.ToString("MM/dd/yyyy hh:mm tt", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            }



            txtTitle.Text = Common.RestoreEscape(Event.Title);
            //txtGameID.Text = Event.GameID;
            txtVersion.Text = Event.Version;


            cbIncludeNotification.Checked = Event.NotifyInclude == 1;
            WebHelper.SelectedListByValue(ddlNotificationStatus, Event.NotifyStatus);
            cbNotifySubscribers.Checked = Event.NotifySubscribers == 1;


            txtStartDate.Text = Event.StartTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtStartTime.Text = Event.StartTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtReleaseDate.Text = Event.ReleaseDate.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtReleaseTime.Text = Event.ReleaseDate.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtDisableDate.Text = Event.EndTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtDisableTime.Text = Event.EndTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);


            //角色
            DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
            WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName");
            WebHelper.SelectedListMultiByValue(cblPermissionsRoles, Event.Per_Roles);
            cbPermissionsAllUsers.Checked = Event.Per_AllUsers == 0;



            //区域
            cbAllJurisdictions.Checked = Event.Per_AllJurisdictions == 0;
            WebHelper.BindList(cblJurisdictions, Playngo_ClientZone_Jurisdiction.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblJurisdictions, Event.Per_Jurisdictions);

            //Game Categorys
            WebHelper.BindList(cblGameCategory, Playngo_ClientZone_GameCategory.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblGameCategory, Event.GameCategories);

            //File Types
            WebHelper.BindList(cblFileType, Playngo_ClientZone_FileType.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblFileType, Event.FileTypes);



            Event.CreateUser = Event.CreateUser == 0 ? UserId : Event.CreateUser;
            UserInfo CreateUserInfo = UserController.GetUserById(PortalId, Event.CreateUser);

            hfEventAuthor.Value     = Event.CreateUser.ToString();
            lbEventAuthor.Text      = CreateUserInfo != null && CreateUserInfo.UserID > 0 ? CreateUserInfo.DisplayName : "None";
            imgEventAuthor.ImageUrl = ViewUserPic(CreateUserInfo);

            WebHelper.SelectedListByValue(ddlEventStatus, Event.Status);//管理员看到的文章状态
        }
        /// <summary>
        /// 绑定数据项
        /// </summary>
        private void BindDataItem()
        {
            Playngo_ClientZone_Event Event = EventItem;
            TemplateFormat           xf    = new TemplateFormat(this);

            //验证文章是否存在
            if (EventID > 0 && (Event == null || EventID != Event.ID))
            {
                //需要给出提示,载入文章错误
                mTips.LoadMessage("LoadingEventError", EnumTips.Error, this, new String[] { "" });
                Response.Redirect(xUrl("Events"), false);
            }

            if (Event == null)
            {
                Event = new Playngo_ClientZone_Event();
            }



            //这里需要验证一下权限,当作者进入到别人的文章时,需要跳到列表页面
            if (Event != null && Event.ID > 0 && (!IsAdministrator && !IsAdmin) && Event.CreateUser != UserId)
            {
                //需要给出提示,你无权编辑其他作者的文章
                mTips.LoadMessage("NoPermissionEventAlert", EnumTips.Warning, this, new String[] { Event.Title });
                Response.Redirect(xUrl("Events"), false);
            }


            if (Event != null && Event.ID > 0)
            {
                liLastUpdated.Text = Event.LastTime.ToString("MM/dd/yyyy hh:mm tt", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            }

            //导出CSV链接
            hlExportCSV.NavigateUrl = xf.GoDownloadCSVToEventUrl(Event);


            txtTitle.Text       = Common.RestoreEscape(Event.Title);
            txtContentText.Text = HttpUtility.HtmlDecode(Event.ContentText);


            txtAddress.Text   = Event.Address;
            txtLocationX.Text = Event.LocationX;
            txtLocationY.Text = Event.LocationY;



            cbIncludeNotification.Checked = Event.NotifyInclude == 1;
            WebHelper.SelectedListByValue(ddlNotificationStatus, Event.NotifyStatus);
            cbNotifySubscribers.Checked = Event.NotifySubscribers == 1;


            txtStartDate.Text = Event.StartTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtStartTime.Text = Event.StartTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtReleaseDate.Text = Event.ReleaseDate.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtReleaseTime.Text = Event.ReleaseDate.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtDisableDate.Text = Event.EndTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtDisableTime.Text = Event.EndTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);



            //增加权限用户
            DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
            WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName");
            WebHelper.SelectedListMultiByValue(cblPermissionsRoles, Event.Per_Roles);

            cbPermissionsAllUsers.Checked = Event.Per_AllUsers == 0;



            //区域
            cbAllJurisdictions.Checked = Event.Per_AllJurisdictions == 0;
            WebHelper.BindList(cblJurisdictions, Playngo_ClientZone_Jurisdiction.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblJurisdictions, Event.Per_Jurisdictions);



            Event.CreateUser = Event.CreateUser == 0 ? UserId : Event.CreateUser;
            UserInfo CreateUserInfo = UserController.GetUserById(PortalId, Event.CreateUser);

            hfEventAuthor.Value     = Event.CreateUser.ToString();
            lbEventAuthor.Text      = CreateUserInfo != null && CreateUserInfo.UserID > 0 ? CreateUserInfo.DisplayName : "None";
            imgEventAuthor.ImageUrl = ViewUserPic(CreateUserInfo);


            WebHelper.SelectedListByValue(ddlEventStatus, Event.Status); //管理员看到的文章状态
        }