Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region SetControlProperty

            ctrlLeftPanel.UserID   = userid;
            ctrlLeftPanel.UserName = username;
            ctrlLeftPanel.UserKey  = userkey;

            ctrlFieldToolBar.UserID   = userid;
            ctrlFieldToolBar.UserName = username;

            ctrlMenuTabBar.CurrentMenu = ClubMenuItem.ClubRank;
            ctrlMenuTabBar.ClubID      = ClubID;

            ctrlClubSysHeader.UserID   = userid;
            ctrlClubSysHeader.ClubID   = ClubID;
            ctrlClubSysHeader.UserName = username;

            #endregion

            var currentClub = ClubLogic.GetClubInfo(ClubID);

            if (currentClub != null && Title.IndexOf("{0}") >= 0)
            {
                Title = string.Format(Title, currentClub.FullName);
            }

            if (currentClub != null)
            {
                var memberCount = ClubLogic.GetClubMemberCount(ClubID);
                var memberQuota = ClubLogic.GetClubMemberQuota(ClubID);

                var ra = new RankAlgorithm(currentClub);

                ltrlMemberCount.Text =
                    $"<cite class=\"RankLevel\"><a style=\"width: {(ra.MemberCountRank*2)}px\">{ra.MemberCountRank}%</a></cite><em>{memberCount}//{memberQuota}</em>";

                ltrlClubFortune.Text =
                    $"<cite class=\"RankLevel\"><a style=\"width: {(ra.ClubFortuneRank*2)}px\">{ra.ClubFortuneRank}%</a></cite><em>{Convert.ToInt32(currentClub.Fortune).ToString("N0")}</em>";

                ltrlMemberCredit.Text =
                    $"<cite class=\"RankLevel\"><a style=\"width: {(ra.MemberCreditRank*2)}px\">{ra.MemberCreditRank}%</a></cite><em>{Convert.ToInt32(currentClub.MemberCredit).ToString("N0")}</em>";

                ltrlMemberRP.Text =
                    $"<cite class=\"RankLevel\"><a style=\"width: {(ra.MemberRPRank*2)}px\">{ra.MemberRPRank}%</a></cite><em>{Convert.ToInt32(currentClub.MemberRP).ToString("N0")}</em>";

                ltrlEquipmentCount.Text =
                    $"<cite class=\"RankLevel\"><a style=\"width: {(ra.MemberEquipmentRank*2)}px\">{ra.MemberEquipmentRank}%</a></cite><em>C:{PlayerStrip.GetClubMemberCardCount(currentClub.ID.Value)}|V:{PlayerStrip.GetClubMemberVideoCount(currentClub.ID.Value)}</em>";

                ltrlRankScore.Text = currentClub.RankScore.ToString();
            }
        }
        public string GetCallbackResult()
        {
            if (applyHistoryID > 0)
            {
                var ah = ClubLogic.GetApplyHistory(applyHistoryID);
                if (ah != null && ah.IsAccepted == null)
                {
                    var count = ClubLogic.GetClubMemberCount(ClubID);
                    var quota = ClubLogic.GetClubMemberQuota(ClubID);

                    if (!approved)
                    {
                        UserClubLogic.ApproveJoinClub(ah.ID.Value, approved, username);
                        return("false");
                    }
                    if (approved && count >= quota)
                    {
                        return(string.Empty);
                    }

                    UserClubLogic.ApproveJoinClub(ah.ID.Value, approved, username);

                    //check if user joined clubs count has reached max count, if true, cancel all applications of this user
                    var myClubs = ClubLogic.GetActiveUserClubs(userid);
                    if (myClubs.Count >= ConfigGlobal.SingleUserMaxClubCount)
                    {
                        //cancel
                        var applications = ClubLogic.GetActiveUserApplications(ah.Userid);

                        foreach (var apply in applications)
                        {
                            UserClubLogic.ApproveJoinClub(apply.ID.Value, false, ClubSysPrivateMessage.ClubSysAdminName);
                        }
                    }

                    return("true");
                }
                return(string.Empty);
            }
            return(string.Empty);
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (clubID > 0)
            {
                if (aManageClub.HRef.IndexOf("{0}") >= 0)
                {
                    aManageClub.HRef = string.Format(aManageClub.HRef, clubID);
                }

                var currentClub = ClubLogic.GetClubInfo(clubID);

                if (currentClub != null)
                {
                    imgClubLogo.ImageUrl = $"../UploadFiles/{currentClub.LogoName}";
                    imgClubLogo.ToolTip  = currentClub.FullName;

                    ltrlClubFullName.Text = currentClub.FullName;

                    var clubDesc = HttpUtility.HtmlEncode(currentClub.Description);
                    if (clubDesc.Length > 80)
                    {
                        ltrlClubDesc.Text = $"<span title=\"{clubDesc}\">{clubDesc.Substring(0, 80)}...</span>";
                    }
                    else
                    {
                        ltrlClubDesc.Text = clubDesc;
                    }

                    divClubRank.Style.Add("Width", $"{currentClub.RankLevel*20}px");
                    divClubRank.Attributes.Add("Title", currentClub.RankScore.ToString());

                    if (userID == -1)
                    {
                        //anonymous user

                        aManageClub.Visible = false;

                        btnCancelApply.Visible = false;
                        btnJoinClub.Visible    = false;
                        btnLeaveClub.Visible   = false;

                        btnGetStrip.Visible = false;
                    }
                    else
                    {
                        var ucs = ClubLogic.GetUserClubStatus(userID, clubID);
                        switch (ucs)
                        {
                        case UserClubStatus.Applied:
                            btnCancelApply.Visible = true;
                            btnJoinClub.Visible    = false;
                            btnLeaveClub.Visible   = false;
                            break;

                        case UserClubStatus.Member:
                            btnCancelApply.Visible = false;
                            btnJoinClub.Visible    = false;
                            btnLeaveClub.Visible   = true;
                            break;

                        case UserClubStatus.No:
                            btnCancelApply.Visible = false;
                            btnJoinClub.Visible    = true;
                            btnLeaveClub.Visible   = false;
                            break;

                        default:
                            btnCancelApply.Visible = false;
                            btnJoinClub.Visible    = false;
                            btnLeaveClub.Visible   = false;
                            break;
                        }

                        //manager can not leave a club
                        if (currentClub.ManagerUid.Value == userID)
                        {
                            btnLeaveClub.Visible = false;
                        }

                        // the count of clubs which current user has joined exceed max quota, hide join action
                        if (ClubLogic.GetActiveUserClubs(userID).Count >= ConfigGlobal.SingleUserMaxClubCount &&
                            ucs != UserClubStatus.Member)
                        {
                            btnJoinClub.Visible    = false;
                            btnCancelApply.Visible = false;
                        }

                        if (!currentClub.IsAppliable.Value ||
                            ClubLogic.GetClubMemberCount(clubID) >= ClubLogic.GetClubMemberQuota(clubID))
                        {
                            btnJoinClub.Visible = false;
                        }

                        var userClub = ClubLogic.GetActiveUserClub(userID, clubID);

                        if (userClub != null)
                        {
                            //current user is a member of the club

                            if (userClub.Responsibility == (int)Responsibility.Manager ||
                                userClub.Responsibility == (int)Responsibility.Executor)
                            {
                                aManageClub.Visible = true;
                            }
                            else
                            {
                                aManageClub.Visible = false;
                            }
                        }
                        else
                        {
                            //user is not a member of the club
                            aManageClub.Visible = false;

                            btnGetStrip.Visible = false;
                        }
                    }
                }
                else
                {
                    Response.Redirect("ClubPortal.aspx");
                }
            }
            else
            {
                Response.Redirect("ClubPortal.aspx");
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region SetControlProperty

            ctrlLeftPanel.UserID   = userid;
            ctrlLeftPanel.UserName = username;
            ctrlLeftPanel.UserKey  = userkey;

            ctrlFieldToolBar.UserID   = userid;
            ctrlFieldToolBar.UserName = username;

            ctrlMenuTabBar.CurrentMenu = ClubMenuItem.ClubInfo;
            ctrlMenuTabBar.ClubID      = ClubID;

            ctrlClubSysHeader.UserID   = userid;
            ctrlClubSysHeader.ClubID   = ClubID;
            ctrlClubSysHeader.UserName = username;

            #endregion

            var currentClub = ClubLogic.GetClubInfo(ClubID);

            if (currentClub != null && Title.IndexOf("{0}", StringComparison.Ordinal) >= 0)
            {
                Title = string.Format(Title, currentClub.FullName);
            }

            if (currentClub != null)
            {
                ltrlShortName.Text   = currentClub.ShortName;
                ltrlCreatorName.Text =
                    $"<a href=\"MyPlayerProfile.aspx?userid={currentClub.CreatorUid.Value}\" target = \"_blank\" >{currentClub.CreatorUserName}</ a >";
                //ltrlCreatorUid.Text = currentClub.CreatorUid.Value.ToString();

                ltrlSlogan.Text        = HttpUtility.HtmlEncode(currentClub.Slogan);
                ltrlFortune.Text       = Convert.ToInt32(currentClub.Fortune).ToString("N0");
                ltrlMemberCredit.Text  = Convert.ToInt32(currentClub.MemberCredit).ToString("N0");
                ltrlMemberFortune.Text = Convert.ToInt32(currentClub.MemberFortune).ToString("N0");
                //ltrlEquipmentCount.Text = Convert.ToInt32(PlayerStrip.GetClubMemberEquipmentCount(currentClub.ID.Value)).ToString("N0");
                ltrlEquipmentCount.Text =
                    $"C:{PlayerStrip.GetClubMemberCardCount(currentClub.ID.Value)} | V:{PlayerStrip.GetClubMemberVideoCount(currentClub.ID.Value)}";
                ltrlCreateDate.Text   = currentClub.CreateDate.ToString("yyyy年MM月dd日");
                ltrlDays.Text         = (DateTime.Now - currentClub.CreateDate).Days.ToString();
                ltrlMemeberCount.Text = ClubLogic.GetClubMemberCount(ClubID).ToString();
                ltrlMemberQuota.Text  = ClubLogic.GetClubMemberQuota(ClubID).ToString();

                if (currentClub.IsAppliable.Value)
                {
                    ltrlAppliable.Text = "开放中";
                }
                else
                {
                    ltrlAppliable.Text = "已关闭";
                }

                var uc = ClubLogic.GetClubLeads(ClubID);

                foreach (var userClub in uc)
                {
                    userClub.AdditionalData = ClubLogic.TranslateResponsibility(userClub.Responsibility.Value);

                    //temp usage of username for li class
                    if (userClub.Responsibility.Value == (int)Responsibility.Manager)
                    {
                        userClub.AdditionalData2 = " class=\"Manager\"";
                    }
                    else
                    {
                        userClub.AdditionalData2 = string.Empty;
                    }
                }

                rptClubLeads.DataSource = uc;
                rptClubLeads.DataBind();
            }
        }