protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { if (TitanFeatures.IsTrafficThunder) { e.Row.Cells[17].Text = "Comission"; e.Row.Cells[20].Visible = false; for (int i = 0; i < 27; i++) { e.Row.Cells[i].Style.Add("color", "#f15f79"); } } else { e.Row.Cells[17].Text = U4000.MONEY; } if (!AppSettings.TitanFeatures.UpgradeEnabled) { e.Row.Cells[21].Visible = false; } if (!AppSettings.Ethereum.ERC20TokenEnabled) { e.Row.Cells[18].Visible = false; } } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[0].Text = ""; var chbox = ((HtmlInputCheckBox)e.Row.FindControl("chkSelect")); chbox.Attributes.Add("onclick", SelectedPanel.ClientID + ".style.display = 'block';hideIfUnchecked('" + SelectedPanel.ClientID + "');"); //Create an instance of the datarow var userName = e.Row.Cells[19].Text; Member User = new Member(userName); //Lets generate avatar + colored login OR encrypt if (AppSettings.DirectReferrals.AreUsernamesEncrypted) { e.Row.Cells[2].Text = MemberAuthenticationService.ComputeHash(userName).Substring(0, 16); } else { e.Row.Cells[2].Text = HtmlCreator.CreateAvatarPlusUsername(User); } if (TitanFeatures.isAri) { e.Row.Cells[6].Text = User.ActiveAdPacks.ToString(); } //Count the AVG [] Clicks[] RegDate[] int clicks = Int32.Parse(e.Row.Cells[10].Text); DateTime registered = Convert.ToDateTime(e.Row.Cells[7].Text); if (registered < AppSettings.ServerTime.AddYears(-100)) { e.Row.Cells[7].Text = Member.CurrentInCache.Registered.ToShortDateString(); } e.Row.Cells[11].Text = HtmlCreator.GetColoredAVGValue(RentReferralsSystem.GetAVG(clicks, registered)); //Last activity[5] string lastActivityString; if (string.IsNullOrEmpty(e.Row.Cells[8].Text) || e.Row.Cells[8].Text == " " || Convert.ToDateTime(e.Row.Cells[8].Text) < DateTime.Now.AddYears(-100)) { lastActivityString = "<i>" + L1.NEVER + "</i>"; } else { DateTime lastActivity = Convert.ToDateTime(e.Row.Cells[8].Text); int days = (int)Math.Ceiling(DateTime.Now.Subtract(lastActivity).TotalDays); switch (days) { case 1: lastActivityString = L1.TODAY; break; case 2: lastActivityString = L1.YESTERDAY; break; default: lastActivityString = days.ToString() + " " + L1.DAYSAGO; break; } } e.Row.Cells[8].Text = lastActivityString; e.Row.Cells[15].Text = new Money(Convert.ToDecimal(e.Row.Cells[15].Text)).ToString(); e.Row.Cells[17].Text = Money.Parse(e.Row.Cells[17].Text).ToString(); if (AppSettings.Ethereum.ERC20TokenEnabled) { e.Row.Cells[18].Text = (new CryptocurrencyMoney(CryptocurrencyType.ERC20Token, Decimal.Parse(e.Row.Cells[18].Text))).ToString(); } else { e.Row.Cells[18].Visible = false; } if (AppSettings.DirectReferrals.DirectReferralBuyingEnabled && User.ReferrerExpirationDate.HasValue) { e.Row.Cells[20].Text = GetTimeToExpiration(User.ReferrerExpirationDate.Value); } else if (AppSettings.DirectReferrals.DirectReferralExpirationEnabled) { var expirationDate = Convert.ToDateTime(e.Row.Cells[20].Text).AddDays(AppSettings.DirectReferrals.DirectReferralExpiration); e.Row.Cells[20].Text = GetTimeToExpiration(expirationDate); } else { e.Row.Cells[20].Text = "-"; } e.Row.Cells[21].Text = new Membership(Convert.ToInt32(e.Row.Cells[21].Text)).Name; if (!AppSettings.TitanFeatures.UpgradeEnabled) { e.Row.Cells[21].Visible = false; } if (TitanFeatures.IsTrafficThunder) { e.Row.Cells[20].Visible = false; } if (TitanFeatures.IsSardaryify) { // Get id of current user // Id is in the last column var id = Convert.ToInt32(e.Row.Cells[26].Text); e.Row.Cells[23].Text = AdPackManager.GetNumberOfUsersAdPacks(id, true).ToString(); e.Row.Cells[24].Text = Member.GetDirectReferralsCount(id).ToString(); var amount = TableHelper.SelectScalar(string.Format(@" SELECT SUM(Price) FROM Adpacks AS A JOIN AdPackTypes AS B ON A.AdPackTypeId = B.Id WHERE A.UserId = {0} AND BalanceBoughtType = {1} ", id, (int)PurchaseBalances.Cash)).ToString(); Money amountInMoney; if (!string.IsNullOrWhiteSpace(amount)) { amountInMoney = Money.Parse(amount); } else { amountInMoney = new Money(0); } e.Row.Cells[25].Text = amountInMoney.ToString(); } } }