Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var club = ClubLogic.GetClubInfo(ClubID);

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

            #region SetControlProperty

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

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

            ctrlMenuTabBar.CurrentMenu = ClubMenuItem.ClubStrip;
            ctrlMenuTabBar.ClubID      = ClubID;

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

            #endregion

            BindStripHistory();

            ltlClubBingoStrip.Text =
                $"<span title=\"抽取装备计数\">今天(累计)尝试:<em>{PlayerStrip.GetClubBingoPlayCountToday(ClubID)}({PlayerStrip.GetClubBingoPlayCount(ClubID).ToString("N0")})</em>次 | 库存:<em>{PlayerStrip.GetClubRemainingEquipment(ClubID)}/{ConfigGlobal.DailyClubEquipmentCount}</em>件装备</span>";
            ltlClubStripCount.Text =
                $"<span class=\"ClubSys_Strip SHIRT\">球衣:</span><em>{ShirtCount}</em><span class=\"ClubSys_Strip SHORTS\">球裤:</span><em>{ShortsCount}</em><span class=\"ClubSys_Strip SOCK\">球袜:</span><em>{SockCount}</em><span class=\"ClubSys_Strip CARD\">球星卡:</span><em>{CardCount}</em><span class=\"ClubSys_Strip VIDEO\">视频卡:</span><em>{VideoCount}</em>";
        }
Example #2
0
        private void BindData()
        {
            var list = PlayerStrip.GetPlayers();

            ;

            gvPlayer.DataSource = list;
            gvPlayer.DataBind();
        }
Example #3
0
        private void BindStripHistory()
        {
            if (_list == null)
            {
                _list = PlayerStrip.GetAllBingoHistory();
            }

            gvClubStrip.DataSource = _list;
            gvClubStrip.DataBind();
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (ConfigGlobal.PluginActive && ConfigGlobal.PluginContainerActive && ProfileUserID != -1)
            {
                //Generator the Style and Javascript
                Response.Write(
                    "document.write('<link href=\"../../App_Themes/Arsenalcn/clubsys.css\" type=\"text/css\" rel=\"stylesheet\" />');");
                Response.Write(
                    "document.write('<script type=\"text/javascript\" src=\"plugin/AcnClub/scripts/ClubSys.js\"></script>');");

                var clubs = ClubLogic.GetActiveUserClubs(ProfileUserID);
                if (clubs.Count != 0)
                {
                    var club = clubs[0];

                    var cClubCSS   = string.Empty;
                    var cClubTitle = string.Empty;
                    if (ConfigGlobal.ChampionsClubID > 0 && club.ID == ConfigGlobal.ChampionsClubID)
                    {
                        cClubCSS   = "ClubSys_ShowTopicCrown";
                        cClubTitle = ConfigGlobal.ChampionsTitle;
                    }
                    else
                    {
                        cClubCSS = "ClubSys_ShowTopic";
                    }

                    var strClub =
                        string.Format(
                            "<div class=\"{4}\" title=\"{5}\"><a href=\"plugin/AcnClub/ClubView.aspx?clubID={0}\" target=\"_blank\">{1}</a><em>LV:{2} | RPos:{3}</em></div>",
                            club.ID.Value, club.FullName, club.RankLevel.Value, club.RankScore.Value, cClubCSS,
                            cClubTitle);
                    Response.Write($"document.write('{strClub}');");
                }

                var player = PlayerStrip.GetPlayerInfo(ProfileUserID);

                if (player != null && player.CurrentGuid != null)
                {
                    var strPlayer =
                        $"GenSwfObject('UserStrip', 'plugin/acnclub/swf/UserStrip.swf?XMLURL=plugin/acnclub/ServerXml.aspx%3FUserID={ProfileUserID}', '180', '120');";
                    //Response.Write(string.Format("document.write('<div style=\"text-align: center;\">');{0};document.write('</div>');", strPlayer.ToString()));
                    Response.Write(strPlayer);
                }

                //if (player != null && UserVideo.GetUserPublicVideo(ProfileUserID).Count > 0)
                //{
                //    string strVideo = string.Format("GenSwfObject('UserVideo', 'plugin/acnclub/swf/UserVideo.swf?XMLURL=plugin/acnclub/ServerXml.aspx%3FUserID={0}', '180', '200');", ProfileUserID.ToString());
                //    //Response.Write(string.Format("document.write('<div style=\"text-align: center;\">');{0};document.write('</div>');", strVideo.ToString()));
                //    Response.Write(strVideo);
                //}
            }

            Response.End();
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var clubs = ClubLogic.GetActiveUserClubs(ProfileUserID);

            if (clubs.Count == 0)
            {
                btnClub.Visible       = false;
                btnGetStrip.Visible   = false;
                btnCardFusion.Visible = false;
            }
            else
            {
                var club = clubs[0];

                btnClub.Text        = club.FullName;
                btnClub.PostBackUrl = $"../ClubView.aspx?ClubID={club.ID.Value}";

                if (ProfileUserID != UserID)
                {
                    btnGetStrip.Visible   = false;
                    btnCardFusion.Visible = false;
                }
            }

            var _playerInfo = PlayerStrip.GetPlayerInfo(ProfileUserID);

            if (_playerInfo == null)
            {
                pnlSwf.Visible = false;
            }
            else
            {
                pnlSwf.Visible = true;

                shirtLv  = _playerInfo.Shirt;
                shortsLv = _playerInfo.Shorts;
                sockLv   = _playerInfo.Sock;
            }

            var TotalCount = PlayerStrip.GetUserBingoPlayCount(ProfileUserID);

            if (TotalCount <= 0)
            {
                ltrlRP.Text = "0%";
            }
            else
            {
                ltrlRP.Text = (PlayerStrip.GetUserBingoGainCount(ProfileUserID) * 100 / TotalCount) + "%";
            }

            var _playerLV = Math.Min(PlayerLv, ConfigGlobal.PlayerMaxLv);

            ltrlPlayerLV.Text =
                $"<div class=\"ClubSys_PlayerLV\" style=\"width: {(_playerLV*20)}px;\" title=\"球员等级\"></div>";
        }
Example #6
0
        private void BindPlayers()
        {
            if (_list == null)
            {
                _list = PlayerStrip.GetClubPlayers(ClubID);

                foreach (var player in _list)
                {
                    if (player.CurrentGuid != null)
                    {
                        FormalPlayerCount++;
                    }

                    var playerLv = player.Shirt;

                    if (player.Shorts < playerLv)
                    {
                        playerLv = player.Shorts;
                    }

                    if (player.Sock < playerLv)
                    {
                        playerLv = player.Sock;
                    }

                    if (playerLv <= ConfigGlobal.PlayerMaxLv)
                    {
                        player.AdditionalData2 = playerLv;
                        player.AdditionalData  = playerLv * 20;
                    }
                    else
                    {
                        player.AdditionalData2 = ConfigGlobal.PlayerMaxLv;
                        player.AdditionalData  = ConfigGlobal.PlayerMaxLv * 20;
                        playerLv = ConfigGlobal.PlayerMaxLv + 1;
                    }

                    if (ClubPlayerLvCount.ContainsKey(playerLv))
                    {
                        ClubPlayerLvCount[playerLv]++;
                    }
                    else
                    {
                        ClubPlayerLvCount[playerLv] = 0;
                    }
                }
            }

            _list.Sort(new PlayerComparer());

            gvPlayers.DataSource = _list;
            gvPlayers.DataBind();
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ProfileUserID > 0)
            {
                _playerInfo = PlayerStrip.GetPlayerInfo(ProfileUserID);

                var items = PlayerStrip.GetMyNumbers(ProfileUserID);
                items.RemoveAll(delegate(Card un) { return(un.IsActive); });
                items.RemoveAll(delegate(Card un) { return(!un.ArsenalPlayerGuid.HasValue); });

                rptCard.DataSource = items;
                rptCard.DataBind();
            }
        }
Example #8
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;

            ctrlPlayerHeader.UserID        = userid;
            ctrlPlayerHeader.ProfileUserID = ProfileUserID;

            #endregion

            lblClubTip.Text = $"请点击下方的图片欣赏<em>{ProfileUserName}</em>的球员收藏。";

            btnVideoActive.ToolTip = $"点击进入{ProfileUserName}的集锦收藏";
            btnCardActive.ToolTip  = $"点击进入{ProfileUserName}的卡片收藏";

            var queryStrUserID = string.Empty;

            if (ProfileUserID != userid)
            {
                queryStrUserID = "&userid=" + ProfileUserID;
            }

            //btnVideoActive.OnClientClick = string.Format("window.location.href='MyCollection.aspx?type=Video{0}';", queryStrUserID);
            //btnCardActive.OnClientClick = string.Format("window.location.href='MyCollection.aspx?type=Card{0}';", queryStrUserID);
            btnVideoActive.PostBackUrl = $"MyCollection.aspx?type=Video{queryStrUserID}";
            btnCardActive.PostBackUrl  = $"MyCollection.aspx?type=Card{queryStrUserID}";

            //DataTable dtVideo = Service.UserVideo.GetUserVideo(ProfileUserID);
            lblVideoActiveCount.Text = UserVideo.GetUserVideosByUserID(ProfileUserID).Count.ToString();

            var items = PlayerStrip.GetMyNumbers(ProfileUserID);
            items.RemoveAll(delegate(Card un) { return(un.ArsenalPlayerGuid.HasValue); });
            lblVideoCount.Text = items.Count.ToString();

            items = PlayerStrip.GetMyNumbers(ProfileUserID);
            items.RemoveAll(delegate(Card un) { return(!un.IsActive); });
            lblCardActiveCount.Text = items.Count.ToString();

            items = PlayerStrip.GetMyNumbers(ProfileUserID);
            items.RemoveAll(delegate(Card un) { return(un.IsActive || !un.ArsenalPlayerGuid.HasValue); });
            lblCardCount.Text = items.Count.ToString();
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var club = ClubLogic.GetClubInfo(ClubID);

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

            #region SetControlProperty

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

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

            ctrlMenuTabBar.CurrentMenu = ClubMenuItem.ClubPlayer;
            ctrlMenuTabBar.ClubID      = ClubID;

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

            #endregion

            ClubPlayerLvCount = new Dictionary <int, int>();

            for (var i = 0; i <= (ConfigGlobal.PlayerMaxLv + 1); i++)
            {
                ClubPlayerLvCount[i] = 0;
            }
            BindPlayers();

            ltlPlayerCount.Text =
                $"<span>本球会正式/总球员数:<em>{FormalPlayerCount}/{PlayerStrip.GetClubPlayerCount(ClubID)}</em></span>";
            ltlPlayerLv.Text = $"<span>&gt;LV5:{ClubPlayerLvCount[ConfigGlobal.PlayerMaxLv + 1]}</span>";

            for (var j = ConfigGlobal.PlayerMaxLv; j > 0; j--)
            {
                ltlPlayerLv.Text += string.Format(" <span class=\"ClubSys_PlayerLV{0}\">LV{0}:{1}</span>", j,
                                                  ClubPlayerLvCount[j]);
            }
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ProfileUserID > 0)
            {
                _playerInfo = PlayerStrip.GetPlayerInfo(ProfileUserID);

                var list =
                    PlayerStrip.GetMyCards(ProfileUserID)
                    .FindAll(
                        delegate(Card un)
                {
                    return(un.IsActive && un.ArsenalPlayerGuid.HasValue && un.ActiveDate.HasValue);
                });

                list = SortUserNumberListByOrderClause(list, OrderClause);

                rptCard.DataSource = list;
                rptCard.DataBind();
            }
        }
Example #11
0
        protected void rptCard_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "SetCurrent")
            {
                var userNumID = int.Parse(e.CommandArgument.ToString());

                var un = PlayerStrip.GetUserNumber(userNumID);

                if (un.UserID == CurrentUserID && un.IsActive && !un.IsInUse)
                {
                    PlayerStrip.UpdatePlayerCurrentNum(CurrentUserID, userNumID);

                    var script = "alert('球衣已被换上'); window.location.href = window.location.href;";
                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "SetCurrentSucceed", script, true);
                }
                else
                {
                    var script = "alert('您不能换上该球衣');";
                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "SetCurrentFailed", script, true);
                }
            }
            else if (e.CommandName == "CancelCurrent")
            {
                var userNumID = int.Parse(e.CommandArgument.ToString());

                var un = PlayerStrip.GetUserNumber(userNumID);

                if (un.UserID == CurrentUserID && un.IsActive && un.IsInUse)
                {
                    PlayerStrip.RemovePlayerCurrentNum(CurrentUserID, userNumID);

                    var script = "alert('球衣已被换下'); window.location.href = window.location.href;";
                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "SetCurrentSucceed", script, true);
                }
                else
                {
                    var script = "alert('您不能换下该球衣');";
                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "SetCurrentFailed", script, true);
                }
            }
        }
Example #12
0
        protected void gvPlayer_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            var tbShirt     = gvPlayer.Rows[gvPlayer.EditIndex].FindControl("tbShirt") as TextBox;
            var tbShorts    = gvPlayer.Rows[gvPlayer.EditIndex].FindControl("tbShorts") as TextBox;
            var tbSock      = gvPlayer.Rows[gvPlayer.EditIndex].FindControl("tbSock") as TextBox;
            var ddlIsActive = gvPlayer.Rows[gvPlayer.EditIndex].FindControl("ddlIsActive") as DropDownList;

            if (tbShirt != null && tbShorts != null && tbSock != null && ddlIsActive != null)
            {
                try
                {
                    var pid = (int)gvPlayer.DataKeys[gvPlayer.EditIndex].Value;

                    int _shirt;
                    int _shorts;
                    int _sock;

                    if (int.TryParse(tbShirt.Text.Trim(), out _shirt) &&
                        int.TryParse(tbShorts.Text.Trim(), out _shorts) &&
                        int.TryParse(tbSock.Text.Trim(), out _sock) &&
                        !string.IsNullOrEmpty(ddlIsActive.SelectedValue))
                    {
                        PlayerStrip.UpdatePlayerInfo(pid, _shirt, _shorts, _sock,
                                                     Convert.ToBoolean(ddlIsActive.SelectedValue));
                    }
                    else
                    {
                        throw new Exception("请正确填写会员信息");
                    }
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterClientScriptBlock(typeof(string), "failed",
                                                           $"alert('{ex.Message}');", true);
                }
            }

            gvPlayer.EditIndex = -1;

            BindData();
        }
Example #13
0
        private void BindGetStrip()
        {
            var player = PlayerStrip.GetPlayerInfo(UserID);

            if (ConfigGlobal.GoogleAdvActive && player != null)
            {
                cbGoogleAdvActive.Visible = true;
                cbGoogleAdvActive.Checked = player.IsActive;
            }
            else
            {
                cbGoogleAdvActive.Visible = false;
            }

            var totalCount = PlayerStrip.GetUserBingoPlayCount(UserID);
            var getStripRP = 0;

            if (totalCount > 0)
            {
                getStripRP = Convert.ToInt16(PlayerStrip.GetUserBingoGainCount(userid) * 100 / totalCount);
            }

            lblGetStripUserInfo.Text =
                $"<em>{UserName.Trim()}</em>今日获得/尝试:<em>{PlayerStrip.GetUserBingoGainCountToday(UserID)}({PlayerStrip.GetUserBingoPlayCountToday(UserID)})</em> | 获得率:<em>{getStripRP}%</em> | 库存:<em>{PlayerStrip.GetClubRemainingEquipment(ClubID)}/{ConfigGlobal.DailyClubEquipmentCount}</em>";

            if (ConfigGlobal.GoogleAdvActive && player != null && player.IsActive)
            {
                //ctrlGoogleAdv.DisplayAdv = string.Empty;
                DisplaySwf  = "none";
                IsGoogleAdv = "true";
                lblGetStripUserInfo.Text += " | <em title=\"抽取与获取装备均免费\">打工模式</em>";
            }
            else
            {
                //ctrlGoogleAdv.DisplayAdv = "none";
                DisplaySwf  = string.Empty;
                IsGoogleAdv = "false";
                lblGetStripUserInfo.Text +=
                    $" | 每次抽取:<em title=\"枪手币\">{ConfigGlobal.BingoCost}</em> | 每件获得:<em title=\"枪手币\">{ConfigGlobal.BingoGetCost}</em>";
            }
        }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_userId != -1)
            {
                phAnonymous.Visible    = false;
                phAthenticated.Visible = true;

                ltrlUserName.Text      = _userName;
                linkLogout.NavigateUrl = $"{linkLogout.NavigateUrl}{_userKey}";
            }
            else
            {
                phAnonymous.Visible    = true;
                phAthenticated.Visible = false;
            }

            ltrlTitle.Text =
                $"<a href=\"/index.aspx\">{"阿森纳中国官方球迷会"}</a> &raquo; <a href=\"default.aspx\">{ConfigGlobal.PluginDisplayName}</a> &raquo; <strong>{Page.Title}</strong>";

            ltrlClubCount.Text   = ClubLogic.GetActiveClubCount().ToString();
            ltrlUserCount.Text   = ClubLogic.GetActiveUserCount().ToString();
            ltrlPlayerCount.Text = PlayerStrip.GetAllPlayerCount().ToString();
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var responseMessage = "-1";
            var userMoney       = "0";
            var bingoHistoryID  = 0;
            var isGoogleAdv     = false;

            try
            {
                if (userid != -1)
                {
                    if (Request.Form["StripResult"] != null)
                    {
                        if (Request.Form["StripResult"] == "start")
                        {
                            bool.TryParse(Request.Form["IsGoogleAdv"], out isGoogleAdv);

                            #region StartGetStrip

                            var clubs = ClubLogic.GetActiveUserClubs(userid);

                            if (clubs.Count != 0)
                            {
                                var clubID = clubs[0].ID.Value;

                                //check the user last time play
                                //TimeSpan ts = PlayerStrip.GetUserBingoTimeSpan(userid);

                                var count = PlayerStrip.GetUserBingoPlayCountThisHour(userid);
                                var info  = Users.GetUserInfo(userid);

                                userMoney = ((int)info.Extcredits2).ToString();

                                if ((ConfigGlobal.BingoPlayCountPerHour > count) &&
                                    (PlayerStrip.GetClubRemainingEquipment(clubID) > 0))
                                {
                                    if (isGoogleAdv && ConfigGlobal.GoogleAdvActive)
                                    {
                                        bingoHistoryID = PlayerStrip.InsertBingoStart(userid, username, clubID);

                                        responseMessage = (ConfigGlobal.BingoPlayCountPerHour - count).ToString();
                                    }
                                    else
                                    {
                                        //play cost
                                        var bingoCost = ConfigGlobal.BingoCost;

                                        if (info.Extcredits2 >= bingoCost)
                                        {
                                            info.Extcredits2 = info.Extcredits2 - bingoCost;

                                            if (AdminUsers.UpdateUserAllInfo(info))
                                            {
                                                bingoHistoryID = PlayerStrip.InsertBingoStart(userid, username, clubID);

                                                //return a rate based on user fortune

                                                //responseResult = PlayerStrip.CalcFlashRate(userid);

                                                //return userFortune

                                                responseMessage =
                                                    (ConfigGlobal.BingoPlayCountPerHour - count).ToString();
                                            }
                                        }
                                        else
                                        {
                                            responseMessage = "-2";
                                        }
                                    }
                                }
                                else
                                {
                                    responseMessage = "0";
                                }
                            }

                            #endregion
                        }
                        else if (Request.Form["StripResult"] == "result")
                        {
                            var finalResult = Request.Form["FinalResult"];
                            var resultType  = Request.Form["ResultType"];

                            var authKey = Request.Form["AuthKey"];
                            bingoHistoryID = int.Parse(Request.Form["ID"]);
                            bool.TryParse(Request.Form["IsGoogleAdv"], out isGoogleAdv);

                            var info = Users.GetUserInfo(userid);

                            if (PlayerStrip.ValidateAuthKey(bingoHistoryID.ToString(), userid.ToString(), authKey))
                            {
                                if (PlayerStrip.ValidateBingoResult(bingoHistoryID, userid))
                                {
                                    if (isGoogleAdv && ConfigGlobal.GoogleAdvActive)
                                    {
                                        #region GetStripResult

                                        var br = BingoUtil.AnalyzeFlashResult(userid, finalResult, resultType);
                                        responseMessage = PlayerStrip.UpdateBingoResult(userid, username, br, resultType);
                                        userMoney       = ((int)info.Extcredits2).ToString("f0");

                                        #endregion
                                    }
                                    else
                                    {
                                        var bingoGetCost = ConfigGlobal.BingoGetCost;
                                        if (info.Extcredits2 >= bingoGetCost)
                                        {
                                            info.Extcredits2 = info.Extcredits2 - bingoGetCost;
                                            if (AdminUsers.UpdateUserAllInfo(info))
                                            {
                                                #region GetStripResult

                                                var br = BingoUtil.AnalyzeFlashResult(userid, finalResult, resultType);
                                                responseMessage = PlayerStrip.UpdateBingoResult(userid, username, br,
                                                                                                resultType);
                                                userMoney = ((int)info.Extcredits2).ToString("f0");

                                                #endregion
                                            }
                                        }
                                        else
                                        {
                                            responseMessage = "-2";
                                        }
                                    }
                                }
                            }
                            else
                            {
                                responseMessage = "-1";
                            }
                        }
                    }
                }
            }
            catch
            {
                responseMessage = "-1";
            }
            var responseText =
                $"ServerMessage={responseMessage}&UserMoney={userMoney}&ID={bingoHistoryID}&UserID={userid}";
            Response.Write(responseText);
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ClubID > 0)
            {
                //output club info

                var club = ClubLogic.GetClubInfo(ClubID);

                if (club != null)
                {
                    var ra = new RankAlgorithm(club);

                    var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    xmlContent.AppendFormat("<RankChart ClubID=\"{0}\" RankPoint=\"{1}\">", club.ID, club.RankScore);
                    xmlContent.AppendFormat("<RankItem name=\"会员数\" value=\"{0}\" />", ra.MemberCountRank);
                    xmlContent.AppendFormat("<RankItem name=\"总财富\" value=\"{0}\" />", ra.ClubFortuneRank);
                    xmlContent.AppendFormat("<RankItem name=\"总积分\" value=\"{0}\" />", ra.MemberCreditRank);
                    xmlContent.AppendFormat("<RankItem name=\"总RP值\" value=\"{0}\" />", ra.MemberRPRank);
                    xmlContent.AppendFormat("<RankItem name=\"装备数\" value=\"{0}\" /></RankChart>",
                                            ra.MemberEquipmentRank);
                    Response.Write(xmlContent.ToString());
                }
            }
            else if (UserID > 0)
            {
                //output player info and public video info

                var player = PlayerStrip.GetPlayerInfo(UserID);

                if (player != null)
                {
                    var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    var playerLv   = player.Shirt;

                    if (player.Shorts < playerLv)
                    {
                        playerLv = player.Shorts;
                    }

                    if (player.Sock < playerLv)
                    {
                        playerLv = player.Sock;
                    }

                    xmlContent.AppendFormat("<UserItems username=\"{0}\" userid=\"{1}\" userlv=\"{2}\" ",
                                            player.UserName, player.UserID,
                                            ((playerLv > ConfigGlobal.PlayerMaxLv) ? ConfigGlobal.PlayerMaxLv + "+" : playerLv.ToString()));
                    var CardCount     = PlayerStrip.GetMyNumbers(UserID).Count;
                    var VideoCount    = UserVideo.GetUserVideosByUserID(UserID).Count;
                    var InactiveCount =
                        PlayerStrip.GetMyNumbers(UserID)
                        .FindAll(delegate(Card c) { return(!c.ArsenalPlayerGuid.HasValue); })
                        .Count;

                    xmlContent.AppendFormat(
                        "ShirtCount=\"{0}\" ShortsCount=\"{1}\" SockCount=\"{2}\" CardCount=\"{3}\" VideoCount=\"{4}\">",
                        player.Shirt, player.Shorts, player.Sock, CardCount - InactiveCount, VideoCount + InactiveCount);

                    xmlContent.AppendFormat("<UserVideo>");

                    //DataView dv = Service.UserVideo.GetUserPublicVideo(UserID);
                    var list = UserVideo.GetUserVideosByUserID(UserID)
                               .FindAll(delegate(UserVideo uv) { return(uv.IsPublic); });

                    foreach (var uv in list)
                    {
                        object _value;

                        var v = Video.Cache.Load(uv.VideoGuid);

                        if (v != null)
                        {
                            var p = Player.Cache.Load(v.GoalPlayerGuid.Value);

                            if (p != null)
                            {
                                xmlContent.Append("<VideoItem ");

                                // build UserVideo xml info
                                foreach (
                                    var properInfo in
                                    uv.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                                {
                                    // remove the property VideoGuid of UserVideo
                                    if (!properInfo.Name.Equals("VideoGuid"))
                                    {
                                        _value = properInfo.GetValue(uv, null);
                                        if (_value == null)
                                        {
                                            _value = string.Empty;
                                        }

                                        xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                                HttpUtility.HtmlAttributeEncode(_value.ToString()));
                                    }
                                }

                                // build ArsenalVideo xml info
                                foreach (
                                    var properInfo in
                                    v.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                                {
                                    _value = properInfo.GetValue(v, null);
                                    if (_value == null)
                                    {
                                        _value = string.Empty;
                                    }

                                    xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                            HttpUtility.HtmlAttributeEncode(_value.ToString()));
                                }

                                // build ArsenalPlayer xml info
                                foreach (
                                    var properInfo in
                                    p.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                                {
                                    _value = properInfo.GetValue(p, null);
                                    if (_value == null)
                                    {
                                        _value = string.Empty;
                                    }

                                    xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                            HttpUtility.HtmlAttributeEncode(_value.ToString()));
                                }

                                xmlContent.Append("></VideoItem>");
                            }
                        }
                    }

                    xmlContent.Append("</UserVideo>");

                    xmlContent.Append("<UserCard>");
                    var cards = PlayerStrip.GetMyNumbers(UserID);
                    cards.RemoveAll(delegate(Card un) { return(!un.ArsenalPlayerGuid.HasValue); });

                    foreach (var c in cards)
                    {
                        xmlContent.Append("<CardItem ");
                        xmlContent.AppendFormat("UserNumberID=\"{0}\" IsActive=\"{1}\" ", c.ID, c.IsActive);

                        var    p = Player.Cache.Load(c.ArsenalPlayerGuid.Value);
                        object _value;

                        foreach (
                            var properInfo in p.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                        {
                            _value = properInfo.GetValue(p, null);
                            if (_value == null)
                            {
                                _value = string.Empty;
                            }

                            xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                    HttpUtility.HtmlAttributeEncode(_value.ToString()));
                        }

                        xmlContent.Append("></CardItem>");
                    }
                    xmlContent.Append("</UserCard>");

                    xmlContent.Append("</UserItems>");

                    Response.Write(xmlContent.ToString());
                }
            }
            else if (PlayerGuid != null)
            {
                //output arsenal player info

                //DataRow rowInfo = Arsenal_Player.Cache.GetInfo(new Guid(PlayerGuid));
                var    p = Player.Cache.Load(new Guid(PlayerGuid));
                object _value;

                if (p != null)
                {
                    var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    xmlContent.Append("<PlayerInfo ");

                    foreach (var properInfo in p.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                    {
                        _value = properInfo.GetValue(p, null);
                        if (_value == null)
                        {
                            _value = string.Empty;
                        }

                        xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                HttpUtility.HtmlAttributeEncode(_value.ToString()));
                    }

                    xmlContent.Append("></PlayerInfo>");

                    Response.Write(xmlContent.ToString());
                }
            }
            else if (CardID > 0)
            {
                var c = PlayerStrip.GetUserNumber(CardID);

                if (c != null)
                {
                    //output arsenal player info
                    if (c.ArsenalPlayerGuid.HasValue)
                    {
                        //DataRow rowInfo = Arsenal_Player.Cache.GetInfo(c.ArsenalPlayerGuid.Value);
                        var    p = Player.Cache.Load(c.ArsenalPlayerGuid.Value);
                        object _value;

                        if (p != null)
                        {
                            var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                            xmlContent.AppendFormat("<CardInfo CardID=\"{0}\" ", CardID);

                            foreach (
                                var properInfo in p.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                )
                            {
                                _value = properInfo.GetValue(p, null);
                                if (_value == null)
                                {
                                    _value = string.Empty;
                                }

                                xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                        HttpUtility.HtmlAttributeEncode(_value.ToString()));
                            }

                            xmlContent.Append("></CardInfo>");

                            Response.Write(xmlContent.ToString());
                        }
                    }
                    else
                    {
                        var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                        xmlContent.AppendFormat("<CardInfo CardID=\"{0}\" Legend=\"True\" />", CardID);
                        Response.Write(xmlContent.ToString());
                    }
                }
            }
            else if (UserVideoID > 0)
            {
                //output video info
                //DataRow rowInfo = Service.UserVideo.GetVideoInfoByUserVideoID(UserVideoID);
                try
                {
                    var uv = new UserVideo();
                    uv.UserVideoID = UserVideoID;
                    uv.Select();

                    object _value;

                    var v = Video.Cache.Load(uv.VideoGuid);

                    if (v != null)
                    {
                        var p = Player.Cache.Load(v.GoalPlayerGuid.Value);

                        if (p != null)
                        {
                            var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                            xmlContent.Append("<VideoInfo ");

                            // build UserVideo xml info
                            foreach (
                                var properInfo in
                                uv.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                            {
                                // remove the property VideoGuid of UserVideo
                                if (!properInfo.Name.Equals("VideoGuid"))
                                {
                                    _value = properInfo.GetValue(uv, null);
                                    if (_value == null)
                                    {
                                        _value = string.Empty;
                                    }

                                    xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                            HttpUtility.HtmlAttributeEncode(_value.ToString()));
                                }
                            }

                            // build ArsenalVideo xml info
                            foreach (
                                var properInfo in v.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                )
                            {
                                _value = properInfo.GetValue(v, null);
                                if (_value == null)
                                {
                                    _value = string.Empty;
                                }

                                xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                        HttpUtility.HtmlAttributeEncode(_value.ToString()));
                            }

                            // build ArsenalPlayer xml info
                            foreach (
                                var properInfo in p.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                )
                            {
                                _value = properInfo.GetValue(p, null);
                                if (_value == null)
                                {
                                    _value = string.Empty;
                                }

                                xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                        HttpUtility.HtmlAttributeEncode(_value.ToString()));
                            }

                            xmlContent.Append("></VideoInfo>");

                            Response.Write(xmlContent.ToString());
                        }
                    }
                }
                catch
                {
                }
            }
            else if (VideoGuid != null)
            {
                //DataRow rowInfo = Service.UserVideo.GetVideoInfoByVideoGuid(new Guid(VideoGuid));
                object _value;

                var v = Video.Cache.Load(new Guid(VideoGuid));

                if (v != null)
                {
                    var p = Player.Cache.Load(v.GoalPlayerGuid.Value);

                    if (p != null)
                    {
                        var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                        xmlContent.Append("<VideoInfo ");

                        // build ArsenalVideo xml info
                        foreach (
                            var properInfo in v.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                        {
                            _value = properInfo.GetValue(v, null);
                            if (_value == null)
                            {
                                _value = string.Empty;
                            }

                            xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                    HttpUtility.HtmlAttributeEncode(_value.ToString()));
                        }

                        // build ArsenalPlayer xml info
                        foreach (
                            var properInfo in p.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                        {
                            _value = properInfo.GetValue(p, null);
                            if (_value == null)
                            {
                                _value = string.Empty;
                            }

                            xmlContent.AppendFormat("{0}=\"{1}\" ", properInfo.Name,
                                                    HttpUtility.HtmlAttributeEncode(_value.ToString()));
                        }

                        xmlContent.Append("></VideoInfo>");

                        Response.Write(xmlContent.ToString());
                    }
                }
            }
            else if (CurrArsenalPlayer)
            {
                var list = Player.Cache.PlayerList.FindAll(p => !p.IsLegend && !p.IsLoan && p.SquadNumber >= 0);

                list.Sort((p1, p2) => p1.SquadNumber - p2.SquadNumber);

                var xmlContent = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                xmlContent.Append("<CurrArsenalPlayer>");

                foreach (var p in list)
                {
                    xmlContent.AppendFormat(
                        "<PlayerInfo Guid=\"{0}\" DisplayName=\"{1}\" SquadNumber=\"{2}\" FaceURL=\"{3}\" />", p.ID,
                        p.DisplayName, p.SquadNumber, p.FaceURL);
                }
                xmlContent.Append("</CurrArsenalPlayer>");

                Response.Write(xmlContent.ToString());
            }
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var clubs = ClubLogic.GetActiveUserClubs(userid);

            if (clubs.Count == 0)
            {
                //user without a club joined can not access this page
                var script = "alert('您尚未加入一个球会!'); window.location.href = 'ClubPortal.aspx';";

                ClientScript.RegisterClientScriptBlock(typeof(string), "redirect", script, true);
            }
            else
            {
                ClubID = clubs[0].ID.Value;
            }

            if (ClubID > 0)
            {
                if (PlayerStrip.GetClubRemainingEquipment(ClubID) <= 0)
                {
                    //ctrlGoogleAdv.DisplayAdv = "none";
                    cbGoogleAdvActive.Visible       = false;
                    pnlShowGetStrip.Visible         = false;
                    lblGetStripUserInfo.Visible     = false;
                    lblGetStripNotAvailable.Visible = true;
                    lblGetStripNotAvailable.Text    =
                        $"<em>今天本球会的装备领取已到上限。({ConfigGlobal.DailyClubEquipmentCount})</em>";
                }
                else if (PlayerStrip.GetUserBingoGainCountToday(userid) >= ConfigGlobal.DailyUserEquipmentCount)
                {
                    //ctrlGoogleAdv.DisplayAdv = "none";
                    cbGoogleAdvActive.Visible       = false;
                    pnlShowGetStrip.Visible         = false;
                    lblGetStripUserInfo.Visible     = false;
                    lblGetStripNotAvailable.Visible = true;
                    lblGetStripNotAvailable.Text    =
                        $"<em>您今天的装备领取已到上限。({ConfigGlobal.DailyUserEquipmentCount})</em>";
                }
                else
                {
                    pnlShowGetStrip.Visible         = true;
                    lblGetStripUserInfo.Visible     = true;
                    lblGetStripNotAvailable.Visible = false;

                    if (IsPostBack)
                    {
                        PlayerStrip.UpdatePlayerGoogleAdvActive(UserID, cbGoogleAdvActive.Checked);
                    }

                    BindGetStrip();
                }

                var club = ClubLogic.GetClubInfo(ClubID);

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

                #region SetControlProperty

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

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

                //ctrlMenuTabBar.CurrentMenu = Arsenalcn.ClubSys.Web.Control.ClubMenuItem.ClubStrip;
                //ctrlMenuTabBar.ClubID = _clubID;

                ctrlPlayerHeader.UserID        = userid;
                ctrlPlayerHeader.ProfileUserID = ProfileUserID;

                #endregion
            }
        }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (userid == -1)
            {
                pnlFuncLink.Visible = false;

                ltrlToolBarTip.Text = "<strong>欢迎进入,请在<a href=\"/login.aspx\" target=\"_self\">登录</a>后使用全部功能</strong>";
            }
            else
            {
                pnlFuncLink.Visible = true;

                var myClubs = ClubLogic.GetActiveUserClubs(userid);

                var leftCount = ConfigGlobal.SingleUserMaxClubCount - myClubs.Count;

                if (leftCount < 0)
                {
                    leftCount = 0;
                }

                ltrlToolBarTip.Text = $"<strong>提醒:您还可以加入<em>{leftCount}</em>个球会</strong>";

                if (ConfigAdmin.IsPluginAdmin(userid))
                {
                    phAdministrator.Visible = true;
                }
                else
                {
                    phAdministrator.Visible = false;
                }
            }

            //lucky player

            if (ConfigGlobal.LuckyPlayerActive)
            {
                phLuckPlayer.Visible = true;

                ltrlBonus.Text = LuckyPlayer.CalcTotalBonus().ToString();

                var luckyPlayerID = ConfigGlobal.LuckyPlayerID;

                var player = PlayerStrip.GetPlayerInfoByPlayerID(luckyPlayerID);
                var clubs  = ClubLogic.GetActiveUserClubs(player.UserID);
                var IsLuckyPlayerLeader =
                    clubs.Exists(
                        delegate(Club club)
                {
                    return
                    (ClubLogic.GetClubLeads(club.ID.Value)
                     .Exists(delegate(UserClub uc) { return uc.Userid == this.userid; }));
                });

                if (DateTime.Now.Hour < ConfigGlobal.LuckyPlayerDeadline)
                {
                    IsLuckyPlayerLeader = false;
                }

                if (player != null)
                {
                    ltrlLuckyPlayerName.Text = player.UserName;

                    if ((player.UserID != userid && !IsLuckyPlayerLeader) || (userid == -1))
                    {
                        if (ConfigGlobal.LuckyPlayerBonusGot)
                        {
                            btnGetBonus.Visible = true;
                            btnGetBonus.Enabled = false;
                            btnGetBonus.Text    = "已领取";
                        }
                        else
                        {
                            btnGetBonus.Visible = false;
                        }
                    }
                    else if (!ConfigGlobal.LuckyPlayerBonusGot)
                    {
                        btnGetBonus.Visible = true;
                        if ((player.UserID != userid) && IsLuckyPlayerLeader)
                        {
                            btnGetBonus.Text = "请代领";
                        }
                    }
                    else
                    {
                        btnGetBonus.Visible = true;
                        btnGetBonus.Enabled = false;
                        btnGetBonus.Text    = "已领取";
                    }
                }
                else
                {
                    btnGetBonus.Visible = false;
                }
            }
            else
            {
                phLuckPlayer.Visible = false;
            }
        }
Example #19
0
        protected void btnGetBonus_Click(object sender, EventArgs e)
        {
            var luckyPlayerID = ConfigGlobal.LuckyPlayerID;

            var player  = PlayerStrip.GetPlayerInfoByPlayerID(luckyPlayerID);
            var gPlayer = PlayerStrip.GetPlayerInfo(userid);

            var clubs = ClubLogic.GetActiveUserClubs(player.UserID);
            var isLuckyPlayerLeader =
                clubs.Exists(
                    delegate(Club club)
            {
                return
                (ClubLogic.GetClubLeads(club.ID.Value)
                 .Exists(delegate(UserClub uc) { return uc.Userid == this.userid; }));
            });

            var script = string.Empty;
            var CanGetLuckyPlayerBonus = false;

            if ((gPlayer.UserID == player.UserID) || isLuckyPlayerLeader)
            {
                CanGetLuckyPlayerBonus = true;
            }

            if (player != null && gPlayer != null && !ConfigGlobal.LuckyPlayerBonusGot && CanGetLuckyPlayerBonus)
            {
                var totalBonus = LuckyPlayer.CalcTotalBonus();

                var bonusToUser = (int)(totalBonus * ConfigGlobal.LuckyPlayerBonusPercentage);
                var bonusToClub = totalBonus - bonusToUser;

                var userInfo = Users.GetUserInfo(userid);
                userInfo.Extcredits2 += bonusToUser;

                AdminUsers.UpdateUserAllInfo(userInfo);

                //club update
                //List<Club> clubs = ClubLogic.GetActiveUserClubs(userid);
                var clubID = -1;

                if (clubs.Count == 0)
                {
                    bonusToClub = 0;
                }
                else
                {
                    var club = clubs[0];
                    clubID = club.ID.Value;

                    club.Fortune += bonusToClub;

                    ClubLogic.SaveClub(club);
                }

                LuckyPlayer.SetBonusGot(gPlayer.ID, bonusToClub, clubID, player.ID);

                Config.Cache.RefreshCache();

                script = $"alert('您已获得幸运球员奖金{bonusToUser}枪手币,球会获得{bonusToClub}枪手币');";

                btnGetBonus.Visible = true;
                btnGetBonus.Enabled = false;
                btnGetBonus.Text    = "已领取";
            }
            else
            {
                script = "alert('您无法领取今日的幸运球员奖金');";
            }

            Page.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", script, true);
        }
Example #20
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();
            }
        }
Example #21
0
        protected void gvClubMemberList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var uc = e.Row.DataItem as UserClub;
                if (uc != null)
                {
                    var userInfo = Users.GetUserInfo(uc.Userid.Value);
                    if (userInfo != null)
                    {
                        #region set avatar

                        var imgAvatar = e.Row.FindControl("imgAvatar") as Image;

                        if (imgAvatar != null)
                        {
                            //if (userInfo.Avatar == string.Empty)
                            //{
                            //    imgAvatar.ImageUrl = "/avatars/common/0.gif";
                            //}
                            //else if (userInfo.Avatar.ToLower().IndexOf(@"/") == 0)
                            //{
                            //    imgAvatar.ImageUrl = userInfo.Avatar;
                            //}
                            //else if (userInfo.Avatar.ToLower().IndexOf("http") >= 0)
                            //{
                            //    imgAvatar.ImageUrl = userInfo.Avatar;
                            //}
                            //else
                            //{
                            //    imgAvatar.ImageUrl = string.Format("/{0}", userInfo.Avatar);
                            //}

                            var myAvatar = Avatars.GetAvatarUrl(uc.Userid.Value, AvatarSize.Small);
                            imgAvatar.ImageUrl = myAvatar;

                            imgAvatar.AlternateText = userInfo.Username.Trim();
                        }

                        #endregion

                        #region set responsibility

                        var ltrlResponsibility = e.Row.FindControl("ltrlResponsibility") as Literal;
                        if (ltrlResponsibility != null)
                        {
                            if (uc.Responsibility.Value == (int)Responsibility.Member)
                            {
                                ltrlResponsibility.Text = string.Empty;
                            }
                            else
                            {
                                ltrlResponsibility.Text =
                                    $"<em>({ClubLogic.TranslateResponsibility(uc.Responsibility.Value)})</em>";
                            }
                        }

                        #endregion

                        #region set user group

                        var ltrlUserGroup = e.Row.FindControl("ltrlUserGroup") as Literal;
                        if (ltrlUserGroup != null)
                        {
                            var groupInfo = UserGroups.GetUserGroupInfo(userInfo.Groupid);

                            if (groupInfo != null)
                            {
                                ltrlUserGroup.Text =
                                    $"<span title=\"积分:{userInfo.Credits.ToString("N0")}\">{groupInfo.Grouptitle}</span>";
                            }
                        }

                        #endregion

                        #region set user fortune

                        var ltrlUserFortune = e.Row.FindControl("ltrlUserFortune") as Literal;
                        if (ltrlUserFortune != null)
                        {
                            ltrlUserFortune.Text = userInfo.Extcredits2.ToString("N2");
                        }

                        #endregion

                        #region set user posts

                        var ltrlUserPosts = e.Row.FindControl("ltrlUserPosts") as Literal;
                        if (ltrlUserPosts != null)
                        {
                            ltrlUserPosts.Text = userInfo.Posts.ToString("N0");
                        }

                        #endregion

                        #region set user days

                        var ltrlDays = e.Row.FindControl("ltrlDays") as Literal;
                        if (ltrlDays != null)
                        {
                            ltrlDays.Text = ((int)((DateTime.Now - uc.JoinClubDate.Value).TotalDays)).ToString();
                        }

                        #endregion

                        #region contribute value

                        var ltrlContributeValue = e.Row.FindControl("ltrlContributeValue") as Literal;

                        try
                        {
                            var contribution = FortuneContributeAlgorithm.CalcContributeFortune(userInfo, false);

                            var bonusRate = PlayerStrip.CalcPlayerContributionBonusRate(uc.Userid.Value);

                            if (bonusRate != 0)
                            {
                                ltrlContributeValue.Text = $"<em>{contribution}(*{1 + bonusRate}) 枪手币</em>";
                            }
                            else
                            {
                                ltrlContributeValue.Text = $"<em>{contribution} 枪手币</em>";
                            }

                            _totalContribution += (int)(contribution * (1 + bonusRate));
                        }
                        catch
                        {
                        }

                        #endregion
                    }
                }
            }
        }
Example #22
0
        private void BindClubHistory()
        {
            if (history == null)
            {
                history = ClubLogic.GetUserClubHistory(username);

                foreach (var ch in history)
                {
                    var actionType = (ClubHistoryActionType)Enum.Parse(typeof(ClubHistoryActionType), ch.ActionType);
                    switch (actionType)
                    {
                    case ClubHistoryActionType.JoinClub:
                        ch.AdditionalData = "ClubSys_Agree";
                        break;

                    case ClubHistoryActionType.RejectJoinClub:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.LeaveClub:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.MandatoryLeaveClub:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.Nominated:
                        ch.AdditionalData = "ClubSys_Agree";
                        break;

                    case ClubHistoryActionType.Dismiss:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.LuckyPlayer:
                        ch.AdditionalData    = "ClubSys_Agree";
                        ch.ActionDescription = $"<em>{ch.ActionDescription}</em>";
                        break;

                    case ClubHistoryActionType.TransferExtcredit:
                        ch.AdditionalData    = "ClubSys_Agree";
                        ch.ActionDescription = $"<em>{ch.ActionDescription}</em>";
                        break;

                    default:
                        ch.AdditionalData = "ClubSys_Agree";
                        break;
                    }

                    ch.AdditionalData2 = ClubLogic.TranslateClubHistoryActionType(actionType);
                }

                var bingoHistory = PlayerStrip.GetUserBingoHistory(userid);

                foreach (var bh in bingoHistory)
                {
                    var current = new Entity.ClubHistory();

                    var br = new BingoResult(bh.Result, bh.ResultDetail);

                    current.OperatorUserName = username;
                    current.ClubID           = bh.ClubID;
                    current.AdditionalData2  = string.Empty;
                    current.ActionDate       = bh.ActionDate;

                    switch (br.Result)
                    {
                    case BingoResultType.Strip:
                        current.AdditionalData = "ClubSys_Agree";
                        if (br.ResultDetail == "strip")
                        {
                            current.ActionDescription = "获得一套球衣装备";
                        }
                        else if (br.ResultDetail == "strips")
                        {
                            current.ActionDescription = "获得五套球衣装备";
                        }
                        else
                        {
                            current.ActionDescription = BingoUtil.ShowBothBingoDetail("获得一件{0}", br);
                        }
                        break;

                    case BingoResultType.Card:
                        current.AdditionalData = "ClubSys_Agree";
                        if (br.ResultDetail == "legend")
                        {
                            current.ActionDescription = "获得一张视频卡";
                        }
                        else
                        {
                            current.ActionDescription =
                                $"获得球员卡: {Player.Cache.Load(new Guid(br.ResultDetail)).DisplayName}";
                        }
                        break;

                    case BingoResultType.Cash:
                        current.AdditionalData    = "ClubSys_Agree";
                        current.ActionDescription = "获得枪手币: " + br.ResultDetail;
                        break;

                    case BingoResultType.Both:
                        current.AdditionalData    = "ClubSys_Agree";
                        current.ActionDescription = BingoUtil.ShowBothBingoDetail("获得一件{0}和枪手币: {1}", br);
                        break;

                    default:
                        current.AdditionalData    = "ClubSys_Disagree";
                        current.ActionDescription = "什么都没获得";
                        break;
                    }

                    if (br.Result != BingoResultType.Null)
                    {
                        current.ActionDescription = $"<em>{current.ActionDescription}</em>";
                    }

                    history.Add(current);
                }

                var playerHistory = PlayerLog.GetUserPlayerHistory(userid);

                foreach (var ph in playerHistory)
                {
                    var current = new Entity.ClubHistory();

                    current.OperatorUserName  = username;
                    current.ClubID            = ClubLogic.GetActiveUserClubs(userid)[0].ID.Value;
                    current.AdditionalData    = "ClubSys_Star";
                    current.ActionDescription = $"<em>{ph.TypeDesc}</em>";
                    current.ActionDate        = ph.ActionDate;

                    history.Add(current);
                }

                history.Sort(new ClubHistoryComparer());
            }

            gvHistoryLog.DataSource = history;
            gvHistoryLog.DataBind();
        }
Example #23
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();
            }
        }
Example #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (userid != -1)
                {
                    if (Request.Form["FusionResult"] == "start")
                    {
                        responseResult = userid.ToString();
                    }
                    else
                    {
                        //get request info
                        var leftCardID   = Request.Form["LeftCardID"];
                        var rightCardID  = Request.Form["RightCardID"];
                        var fusionResult = Request.Form["FusionResult"];
                        var authKey      = Request.Form["AuthKey"];

                        if (!string.IsNullOrEmpty(leftCardID) && !string.IsNullOrEmpty(rightCardID) &&
                            !string.IsNullOrEmpty(fusionResult) && !string.IsNullOrEmpty(authKey))
                        {
                            int card1, card2, result;

                            if (int.TryParse(leftCardID, out card1) && int.TryParse(rightCardID, out card2) &&
                                int.TryParse(fusionResult, out result))
                            {
                                if (ValidateAuthKey(card1.ToString(), card2.ToString(), userid.ToString(), authKey))
                                {
                                    var un1 = PlayerStrip.GetUserNumber(card1);
                                    var un2 = PlayerStrip.GetUserNumber(card2);

                                    if (un1 != null && un2 != null && un1.UserID == userid && un2.UserID == userid)
                                    {
                                        if (!un1.IsActive && !un2.IsActive &&
                                            un1.ArsenalPlayerGuid.Value == un2.ArsenalPlayerGuid.Value)
                                        {
                                            //rule 1 -- two inactive cards of same player

                                            if (fusionResult == "1")
                                            {
                                                //remove two cards and insert 1 video

                                                UserVideo.ConsolidateCards(userid, username, card1, card2);
                                                PlayerLog.LogHistory(userid, username,
                                                                     PlayerHistoryType.ConsolidateCards,
                                                                     new ConsolidateCardsDesc(un1, un2).Generate());

                                                responseResult = "1";
                                            }
                                        }
                                        else if (un1.IsActive != un2.IsActive)
                                        {
                                            //rule 2 -- one active card and one inactive card

                                            if (fusionResult == "2")
                                            {
                                                //remove two cards and insert 1 video

                                                UserVideo.ConsolidateCards(userid, username, card1, card2);
                                                PlayerLog.LogHistory(userid, username,
                                                                     PlayerHistoryType.ConsolidateCards,
                                                                     new ConsolidateCardsDesc(un1, un2).Generate());

                                                responseResult = "1";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }

            Response.Write("ServerMessage=" + responseResult);
        }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Top Rp Player

            var rank    = 1;
            var dtTopRp = PlayerStrip.GetTopRpPlayers();

            if (dtTopRp != null)
            {
                dtTopRp.Columns.Add("Rank", typeof(int));
                foreach (DataRow dr in dtTopRp.Rows)
                {
                    dr["Rank"] = rank;
                    rank++;
                }
            }

            rptRP.DataSource = dtTopRp;
            rptRP.DataBind();

            #endregion

            #region Top Card Player

            rank = 1;
            var dtTopCard = PlayerStrip.GetTopCardPlayers();

            if (dtTopCard != null)
            {
                dtTopCard.Columns.Add("Rank", typeof(int));
                foreach (DataRow dr in dtTopCard.Rows)
                {
                    dr["Rank"] = rank;
                    rank++;
                }
            }

            rptCard.DataSource = dtTopCard;
            rptCard.DataBind();

            #endregion

            #region Top Video Player

            rank = 1;
            var dtTopVideo = PlayerStrip.GetTopVideoPlayers();

            if (dtTopVideo != null)
            {
                dtTopVideo.Columns.Add("Rank", typeof(int));
                foreach (DataRow dr in dtTopVideo.Rows)
                {
                    dr["Rank"] = rank;
                    rank++;
                }
            }

            rptVideo.DataSource = dtTopVideo;
            rptVideo.DataBind();

            #endregion
        }
Example #26
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //validate user id and user name
            var awardUserID = int.Parse(tbUserID.Text);
            var sUser       = Users.GetShortUserInfo(awardUserID);

            var awardUserName = tbUserName.Text;

            if (awardUserName == sUser.Username.Trim())
            {
                //process the award
                float cashIncrement = 0;
                float rp            = 0;
                Guid? videoGuid     = null;
                var   AwardNotes    = string.Empty;

                //precheck
                if (tbCash.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbCash.Text.Trim(), out cashIncrement))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidCash", "alert('枪手币格式无法转换!');",
                                                               true);
                        return;
                    }
                }

                if (tbRP.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbRP.Text.Trim(), out rp))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidRP", "alert('RP格式无法转换!');", true);
                        return;
                    }
                }

                if (tbVideoGuid.Text.Trim() != string.Empty)
                {
                    try
                    {
                        videoGuid = new Guid(tbVideoGuid.Text);
                    }
                    catch
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidGuid", "alert('Guid格式无法转换!');",
                                                               true);
                        return;
                    }
                }
                if (tbNotes.Text.Trim() != string.Empty)
                {
                    AwardNotes = tbNotes.Text;
                }

                //is actually something awarded?
                var realAwarded = false;

                var awardMessageBody = "您获得奖励";

                //add cash
                if (cashIncrement != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 2, cashIncrement);

                    awardMessageBody += $" 枪手币+{cashIncrement}";

                    realAwarded = true;
                }

                //add rp
                if (rp != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 4, rp);

                    awardMessageBody += $" RP+{rp}, ";

                    realAwarded = true;
                }

                //add card
                if (!string.IsNullOrEmpty(lstPlayer.SelectedValue) && lstPlayer.SelectedValue != Guid.Empty.ToString())
                {
                    PlayerStrip.AddCard(awardUserID, awardUserName, new Guid(lstPlayer.SelectedValue),
                                        cbCardActive.Checked);

                    awardMessageBody += $" 球星卡一张({(cbCardActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                //add video
                if (videoGuid != null)
                {
                    if (cbVideoActive.Checked)
                    {
                        //active
                        //UserVideo.InsertActiveVideo(awardUserID, awardUserName, videoGuid.Value);

                        var uv = new UserVideo();
                        uv.UserID     = awardUserID;
                        uv.UserName   = awardUserName;
                        uv.VideoGuid  = videoGuid.Value;
                        uv.ActiveDate = DateTime.Now;
                        uv.UserDesc   = string.Empty;
                        uv.IsPublic   = false;

                        uv.Insert();
                    }
                    else
                    {
                        //inactive
                        PlayerStrip.AddCard(awardUserID, awardUserName, null, false);
                    }

                    awardMessageBody += $" 视频卡一张({(cbVideoActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                if (!string.IsNullOrEmpty(AwardNotes))
                {
                    awardMessageBody += $" 奖励原因:{AwardNotes}";
                }

                if (realAwarded)
                {
                    PlayerLog.LogHistory(awardUserID, awardUserName, PlayerHistoryType.Award,
                                         new AwardDesc(cashIncrement, rp,
                                                       (!string.IsNullOrEmpty(lstPlayer.SelectedValue) &&
                                                        lstPlayer.SelectedValue != Guid.Empty.ToString()), videoGuid != null).Generate());

                    var pm = new PrivateMessageInfo();

                    pm.Msgfrom   = ClubSysPrivateMessage.ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder       = 0;
                    pm.Message      = awardMessageBody;
                    pm.Msgto        = awardUserName;
                    pm.Msgtoid      = awardUserID;
                    pm.New          = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject      = "ACN球会系统奖励(请勿回复此系统信息)";

                    PrivateMessages.CreatePrivateMessage(pm, 0);

                    ClientScript.RegisterClientScriptBlock(typeof(string), "succeed", "alert('成功颁奖!');", true);
                }
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "alert('用户ID与用户名不匹配!');", true);
            }

            InitDropDownList();
        }
Example #27
0
        //#region ICallbackEventHandler Members

        //public string GetCallbackResult()
        //{
        //    if (_clubID > 0 && _clientStatus >= 0)
        //    {
        //        UserClubStatus uct = (UserClubStatus)_clientStatus;
        //        UserClubStatus resultStatus = UserClubStatus.No;

        //        if ((int)ClubLogic.GetUserClubStatus(this.userid, _clubID) == _clientStatus)
        //        {
        //            //action = apply, check if club appliable flag
        //            if (uct == UserClubStatus.No)
        //            {
        //                Arsenalcn.ClubSys.Entity.Club club = ClubLogic.GetClubInfo(_clubID);
        //                if (club != null)
        //                {
        //                    if (!club.IsAppliable.Value)
        //                    {
        //                        return "Not Appliable";
        //                    }
        //                }
        //                else
        //                {
        //                    return string.Empty;
        //                }
        //            }

        //            if (UserClubLogic.UserClubAction(this.userid, this.username, _clubID, uct))
        //            {
        //                switch (uct)
        //                {
        //                    case UserClubStatus.Applied:
        //                        resultStatus = UserClubStatus.No;
        //                        break;
        //                    case UserClubStatus.Member:
        //                        resultStatus = UserClubStatus.No;
        //                        break;
        //                    case UserClubStatus.No:
        //                        resultStatus = UserClubStatus.Applied;
        //                        break;
        //                    default:
        //                        break;
        //                }

        //                return string.Format("{0};{1}", _clubID, (int)resultStatus);
        //            }
        //            else
        //                return string.Empty;
        //        }
        //        else
        //            return string.Empty;
        //    }
        //    else
        //        return string.Empty;
        //}

        //private int _clubID = -1;
        //private int _clientStatus = -1;
        //public void RaiseCallbackEvent(string eventArgument)
        //{
        //    string[] param = eventArgument.Split(';');

        //    if (param.Length == 2)
        //    {
        //        _clubID = int.Parse(param[0]);
        //        _clientStatus = int.Parse(param[1]);
        //    }
        //}

        //#endregion

        protected void gvClubList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var club = (Club)e.Row.DataItem;

                var count = ClubLogic.GetClubMembers(club.ID.Value).Count;

                var ltrlMemberCount = e.Row.FindControl("ltrlMemberCount") as Literal;
                ltrlMemberCount.Text = count.ToString();

                var ltrlClubLogo = e.Row.FindControl("ltrlClubLogo") as Literal;
                var ltrlClubName = e.Row.FindControl("ltrlClubName") as Literal;
                var ltrlClubRank = e.Row.FindControl("ltrlClubRank") as Literal;

                var ltrlActionText = e.Row.FindControl("ltrlActionText") as Literal;
                var ltrlStatus     = e.Row.FindControl("ltrlStatus") as Literal;
                //Literal ltrlButtonDisplay = e.Row.FindControl("ltrlButtonDisplay") as Literal;
                var ltrlIsAppliable = e.Row.FindControl("ltrlIsAppliable") as Literal;

                var ltrlEquipmentCount = e.Row.FindControl("ltrlEquipmentCount") as Literal;

                ltrlClubLogo.Text =
                    string.Format(
                        "<a href=\"ClubView.aspx?ClubID={0}\" title=\"{2}\"><img src=\"UploadFiles/{1}\" alt=\"{2}\" width=\"80\" height=\"80\" /></a>",
                        club.ID, club.LogoName, club.FullName);
                ltrlClubName.Text =
                    $"<a href=\"ClubView.aspx?ClubID={club.ID}\" class=\"StrongLink\" title=\"{HttpUtility.HtmlEncode(club.Slogan).Replace("'", "\"")}\">{club.FullName}</a>";
                ltrlClubRank.Text =
                    $"<a href=\"ClubRank.aspx?ClubID={club.ID}\" class=\"StrongLink\">RPos:{club.RankScore}</a><div class=\"ClubSys_Rank\" style=\"width: {(club.RankLevel*20)}px;\"></div>";

                ltrlEquipmentCount.Text =
                    $"<em title=\"卡片数C|视频数V(今日库存)\">{PlayerStrip.GetClubMemberCardCount(club.ID.Value)}|{PlayerStrip.GetClubMemberVideoCount(club.ID.Value)}({PlayerStrip.GetClubRemainingEquipment(club.ID.Value)})</em>";

                if (!club.IsAppliable.Value)
                {
                    ltrlIsAppliable.Visible = true;
                }
                else
                {
                    ltrlIsAppliable.Visible = false;
                }

                if (ConfigGlobal.ChampionsClubID > 0 && club.ID == ConfigGlobal.ChampionsClubID)
                {
                    ltrlClubName.Text =
                        $"<div class=\"ClubSys_Crown\" title=\"{ConfigGlobal.ChampionsTitle}\"></div><div>{ltrlClubName.Text}</div>";
                }

                //if (userid == -1 || club.ManagerUid == userid)
                //{
                //    ltrlButtonDisplay.Text = "none";
                //}
                //else
                //{
                //    ltrlButtonDisplay.Text = "inline";
                //}

                // the count of clubs which current user has joined exceed max quota, hide join action
                //if (ClubLogic.GetActiveUserClubs(userid).Count >= Config.SingleUserMaxClubCount && uct != UserClubStatus.Member)
                //{
                //    ltrlButtonDisplay.Text = "none";
                //}

                //hide join btn if club is set to not appliable to join
                //if (uct == UserClubStatus.No && (!club.IsAppliable.Value || count >= ClubLogic.GetClubMemberQuota(club.ID.Value)))
                //{
                //    ltrlButtonDisplay.Text = "none";
                //}

                //ltrlStatus.Text = ((int)uct).ToString();

                //switch (uct)
                //{
                //    case UserClubStatus.Applied:
                //        ltrlActionText.Text = "取消申请";
                //        break;
                //    case UserClubStatus.Member:
                //        ltrlActionText.Text = "退出球会";
                //        break;
                //    case UserClubStatus.No:
                //        ltrlActionText.Text = "申请加入";
                //        break;
                //    default:
                //        ltrlActionText.Text = "申请加入";
                //        break;
                //}

                var rptLeader = e.Row.FindControl("rptClubLeads") as Repeater;
                if (rptLeader != null)
                {
                    var uc = ClubLogic.GetClubLeads(club.ID.Value);

                    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;
                        }
                    }

                    rptLeader.DataSource = uc;
                    rptLeader.DataBind();
                }
            }
        }
Example #28
0
        private void BindStripHistory()
        {
            if (_list == null)
            {
                _list = PlayerStrip.GetClubBingoHistory(ClubID);

                foreach (var bh in _list)
                {
                    var br = new BingoResult(bh.Result, bh.ResultDetail);
                    switch (br.Result)
                    {
                    case BingoResultType.Strip:
                        if (br.ResultDetail == "strip")
                        {
                            bh.AdditionalData =
                                "<span class=\"ClubSys_Strip SHIRT\">球衣</span><span class=\"ClubSys_Strip SHORTS\">球裤</span><span class=\"ClubSys_Strip SOCK\">球袜</span>";
                        }
                        else if (br.ResultDetail.Contains("strips"))
                        {
                            bh.AdditionalData =
                                "<span class=\"ClubSys_Strip SHIRT\">球衣</span><span class=\"ClubSys_Strip SHORTS\">球裤</span><span class=\"ClubSys_Strip SOCK\">球袜</span><span class=\"ClubSys_Strip RATE\">×5</span>";
                        }
                        else
                        {
                            bh.AdditionalData =
                                BingoUtil.ShowBothBingoDetail(
                                    ("<span class=\"ClubSys_Strip " + br.ResultDetail.ToUpper() + "\">{0}</span>"),
                                    br);
                        }
                        break;

                    case BingoResultType.Card:
                        if (br.ResultDetail == "legend")
                        {
                            bh.AdditionalData = "<span class=\"ClubSys_Strip VIDEO\">视频</span>";
                        }
                        else
                        {
                            bh.AdditionalData =
                                $"<span class=\"ClubSys_Strip CARD\">{Player.Cache.Load(new Guid(br.ResultDetail)).DisplayName}</span>";
                        }
                        break;

                    case BingoResultType.Cash:
                        bh.AdditionalData = "<span class=\"ClubSys_Strip CASH\">枪手币: " + br.ResultDetail + "</span>";
                        break;

                    case BingoResultType.Both:
                        bh.AdditionalData =
                            BingoUtil.ShowBothBingoDetail(
                                "<span class=\"ClubSys_Strip " +
                                br.ResultDetail.Substring(0, br.ResultDetail.IndexOf("+")).ToUpper() +
                                "\">{0}</span><span class=\"ClubSys_Strip CASH\">枪手币: {1}</span>", br);
                        break;
                    }
                }
            }

            gvClubStrip.DataSource = _list;
            gvClubStrip.DataBind();
        }
Example #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var result       = "false";
            var returnURL    = string.Empty;
            var responseText = string.Empty;

            using (var conn = ConfigGlobal.SQLConnectionStrings)
            {
                conn.Open();
                var trans = conn.BeginTransaction();

                try
                {
                    if (userid != -1)
                    {
                        if (Request.Form["CardID"] != null)
                        {
                            var unID    = -1;
                            var authKey = Request.Form["AuthKey"];

                            if (int.TryParse(Request.Form["CardID"], out unID))
                            {
                                if (PlayerStrip.ValidateAuthKey(unID.ToString(), string.Empty, authKey))
                                {
                                    if (PlayerStrip.CheckUserNumActiveCondition(userid, unID))
                                    {
                                        var un = PlayerStrip.GetUserNumber(unID);

                                        if (un.ArsenalPlayerGuid.HasValue)
                                        {
                                            //normal player card
                                            PlayerStrip.SetCardAcitve(userid, unID);

                                            PlayerLog.LogHistory(userid, username, PlayerHistoryType.ActivateCard,
                                                                 new ActivateCardDesc(un).Generate());

                                            result = "true";
                                        }
                                        else
                                        {
                                            //video card
                                            var guid = UserVideo.GetRandomVideo(userid, 1, 3, true);

                                            if (!guid.HasValue)
                                            {
                                                throw new Exception("No Video Available.");
                                            }

                                            var uv = new Entity.UserVideo();

                                            uv.UserID     = userid;
                                            uv.UserName   = username;
                                            uv.VideoGuid  = guid.Value;
                                            uv.ActiveDate = DateTime.Now;
                                            uv.UserDesc   = string.Empty;
                                            uv.IsPublic   = false;

                                            uv.Insert(trans);

                                            trans.Commit();

                                            PlayerStrip.ActiveVideoCost(userid, unID);

                                            returnURL = Player.Cache.Load(
                                                Video.Cache.Load(guid.Value).GoalPlayerGuid.Value).PhotoURL;

                                            PlayerLog.LogHistory(userid, username, PlayerHistoryType.ActivateVideo,
                                                                 new ActivateVideoDesc(un).Generate());

                                            if (string.IsNullOrEmpty(returnURL))
                                            {
                                                result = "full";
                                            }
                                            else
                                            {
                                                result = "video";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                    trans.Rollback();

                    result = "error";
                }

                //conn.Close();
            }

            if (!string.IsNullOrEmpty(returnURL))
            {
                responseText = $"ServerMessage={result}&PhotoURL={returnURL}";
            }
            else
            {
                responseText = $"ServerMessage={result}";
            }

            Response.Write(responseText);
        }