public static Money GetUserLimit(Member user) { var rules = TableHelper.GetListFromRawQuery <RefTiersWeeklyPayoutLimit>("SELECT * FROM RefTiersWeeklyPayoutLimits"); if (rules.Count <= 0) { return(null); } IndirectReferralsHelper iRHelper = new IndirectReferralsHelper(user); var indirectRefs = iRHelper.HowManyEverUpgradedOnEachTier; // tier 0 = no refs int maxTier = 0; for (int i = 1; i <= AppSettings.Referrals.ReferralEarningsUpToTier; i++) { if (indirectRefs[i] <= 0) { break; } maxTier = i; } var rule = rules.Where(r => r.Tier == maxTier).FirstOrDefault(); if (rule == null) { return(null); } return(rule.Amount); }
protected void InitializeData() { Member User = Member.CurrentInCache; IndirectReferralsHelper IRH = new IndirectReferralsHelper(User); int DirectReferralsCount = User.GetDirectReferralsCount(); int IndirectReferralsCount = IRH.GetIndirectReferralsCountForMember(); Nodes = new JArray(); Edges = new JArray(); UsersToAssign = new JArray(); CurrentNodes = new List <string>(); if (DirectReferralsCount + IndirectReferralsCount == 0) { ReferralsAvailablePlaceHolder.Visible = false; MatrixJavascriptPlaceHolder.Visible = false; NoReferralsAvailablePlaceHolder.Visible = true; } else { RefCount2.Text = IndirectReferralsCount.ToString(); RefCount.Text = DirectReferralsCount.ToString(); var UsersInMatrix = IRH.GetAllIndirectReferralsForGraph(); //Generate Matrix foreach (var UserInMatrix in UsersInMatrix) { TryAddNode(UserInMatrix.Key); TryAddNode(UserInMatrix.Value); JObject edge = new JObject( new JProperty("data", new JObject( new JProperty("source", UserInMatrix.Key.Name), new JProperty("target", UserInMatrix.Value.Name)) )); Edges.Add(edge); } } }