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 } } } }
//#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(); } } }
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 User Info & Responsibility var ltrlUserInfoResponsibility = e.Row.FindControl("ltrlUserInfoResponsibility") as Literal; var _strUserInfo = $"<a href=\"MyPlayerProfile.aspx?userID={uc.Userid}\" target=\"_blank\">{uc.UserName.Trim()}</a>"; if (ltrlUserInfoResponsibility != null) { if (uc.Responsibility.HasValue && !uc.Responsibility.Value.Equals((int)Responsibility.Member)) { ltrlUserInfoResponsibility.Text = $"{_strUserInfo}<em>{ClubLogic.TranslateResponsibility(uc.Responsibility.Value)}</em>"; } else { ltrlUserInfoResponsibility.Text = _strUserInfo; } } #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; var _days = (int)((DateTime.Now - uc.JoinClubDate.Value).TotalDays); if (ltrlDays != null) { ltrlDays.Text = $"<em title=\"自{uc.FromDate.ToString("yyyy-MM-dd")}入会以来\">{_days}天</em>"; } #endregion #region contribute value var ltrlContributeValue = e.Row.FindControl("ltrlContributeValue") as Literal; try { ltrlContributeValue.Text = $"<em>{FortuneContributeAlgorithm.CalcContributeFortune(userInfo, true).ToString("N2")}</em>"; } catch { } #endregion //Literal ltrlButtonDisplay = e.Row.FindControl("ltrlButtonDisplay") as Literal; //if (ltrlButtonDisplay != null && uc.Responsibility.Value == (int)Responsibility.Manager) //{ // ltrlButtonDisplay.Text = "none"; //} var btnKick = e.Row.FindControl("btnKick") as LinkButton; if (btnKick != null && ClubID > 0) { if (uc.Responsibility.Value != (int)Responsibility.Manager && CurrUserManagedClubs.Exists(delegate(Club c) { return(c.ID.Equals(ClubID)); })) { btnKick.CommandArgument = uc.Userid.ToString(); } else { btnKick.Visible = false; } } var hlTransfer = e.Row.FindControl("hlTransfer") as HyperLink; if (hlTransfer != null) { if (uc.Userid.Value != userid) { hlTransfer.NavigateUrl = $"ManageExtcredit.aspx?clubID={ClubID}&ToUID={uc.Userid.Value}"; } else { hlTransfer.Visible = false; } } } } } }
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(); } }