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); }
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>"; }
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 } }
//#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(); } } }
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>"; } }