public static object GetRequirmentProgress(int userId, RestrictionKind restrictionKind)
        {
            switch (restrictionKind)
            {
            case RestrictionKind.ActiveAdPacks:
                return(GetActiveAdPacks(userId));

            case RestrictionKind.ActiveAdPacksPrice:
                return(GetActiveAdPacksPrice(userId));

            case RestrictionKind.DirectReferralsActiveAdPacks:
                return(GetDirectReferrallsActiveAdPacks(userId));

            case RestrictionKind.DirectReferralsActiveAdPacksPrice:
                return(GetDirectReferrallsActiveAdPacksPrice(userId));

            case RestrictionKind.DirectReferralsCount:
                return(GetDirectReferrallsCount(userId));

            case RestrictionKind.Points:
                return(GetPoints(userId));

            case RestrictionKind.DirectReferralsTotalPaidIn:
                return(GetDirectReferralsTotalPaidIn(userId));

            case RestrictionKind.InvestedMoney:
                return(GetInvestedMoneyIntoPlans(userId));

            case RestrictionKind.InvestedMoneyStructure:
                return(GetInvestedMoneyStructure(userId));
            }
            return(null);
        }
 public LeadershipRankRequirements(int rank, RestrictionKind restriction, int value) : this()
 {
     Rank             = rank;
     RestrictionKind  = restriction;
     RestrictionValue = value;
     this.Save();
 }
        public static bool IsRestrictionKindUsed(RestrictionKind restrictionKind)
        {
            var query = string.Format(@"SELECT Count(1) FROM LeadershipRanksRequirements WHERE RestrictionKind = {0}", (int)restrictionKind);

            try
            {
                return((int)TableHelper.SelectScalar(query) > 0);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
示例#4
0
        public static bool IsRestrictionOfThisKindExist(RestrictionKind kind)
        {
            var list = LeadershipRankRequirements.RequirementsList;

            foreach (var item in list)
            {
                if (item.RestrictionKind == kind)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#5
0
        public static bool IsMoneyRestriction(RestrictionKind kind)
        {
            switch (kind)
            {
            case RestrictionKind.ActiveAdPacksPrice:
            case RestrictionKind.DirectReferralsActiveAdPacksPrice:
            case RestrictionKind.DirectReferralsTotalPaidIn:
            case RestrictionKind.InvestedMoney:
            case RestrictionKind.InvestedMoneyStructure:
                return(true);

            default:
                return(false);
            }
        }
示例#6
0
    private string GetProgress(int max, RestrictionKind restriction)
    {
        if (restriction == RestrictionKind.RequiredMembership)
        {
            return("");
        }

        StringBuilder result = new StringBuilder();

        result.Append(string.Format(" ({0}: ", U6006.REMAINING));

        try
        {
            result.Append(max - (int)LeadershipRankRequirements.GetRequirmentProgress(Member.CurrentId, restriction));
        }
        catch (Exception ex)
        {
            result.Append((Money)max - (Money)LeadershipRankRequirements.GetRequirmentProgress(Member.CurrentId, restriction));
        }

        result.Append(")");
        return(result.ToString());
    }
示例#7
0
        public static string ReturnName(RestrictionKind prizeKind)
        {
            switch (prizeKind)
            {
            case RestrictionKind.DirectReferralsCount:
                return(U6005.DIRECTREFERRALSCOUNT);

            case RestrictionKind.ActiveAdPacks:
                return(string.Format("{0} {1} {2}", U5003.ACTIVE, AppSettings.RevShare.AdPack.AdPackNamePlural, U6005.COUNT));

            case RestrictionKind.ActiveAdPacksPrice:
                return(string.Format("{0} {1} {2}", U5003.ACTIVE, AppSettings.RevShare.AdPack.AdPackNamePlural, L1.PRICE));

            case RestrictionKind.DirectReferralsActiveAdPacks:
                return(string.Format("{0} {1} {2}", U6005.DIRECTREFERRALSACTIVE, AppSettings.RevShare.AdPack.AdPackNamePlural, U6005.COUNT));

            case RestrictionKind.DirectReferralsActiveAdPacksPrice:
                return(string.Format("{0} {1} {2}", U6005.DIRECTREFERRALSACTIVE, AppSettings.RevShare.AdPack.AdPackNamePlural, L1.AMOUNT));

            case RestrictionKind.Points:
                return(AppSettings.PointsName);

            case RestrictionKind.RequiredMembership:
                return(L1.MEMBERSHIP);

            case RestrictionKind.DirectReferralsTotalPaidIn:
                return(U6006.DIRECTREFERRALSTOTALPAIDIN);

            case RestrictionKind.InvestedMoney:
                return(U6012.INVESTEDMONEYINTOPLANS);

            case RestrictionKind.InvestedMoneyStructure:
                return(U6012.INVESTEDMONEYINTOPLANSSTRUCTURE);
            }
            return(null);
        }
 internal Restriction(Expression expression) {
     _kind = RestrictionKind.Custom;
     _expression = expression;
 }
 internal Restriction(Expression parameter, object instance) {
     _kind = RestrictionKind.Instance;
     _expression = parameter;
     _instance = instance;
 }
示例#10
0
 internal Restriction(Expression parameter, Type type) {
     _kind = RestrictionKind.Type;
     _expression = parameter;
     _type = type;
 }
 public void Update(RestrictionKind restriction, int value)
 {
     RestrictionKind  = restriction;
     RestrictionValue = value;
     this.Save();
 }
示例#12
0
 internal Restriction(Expression expression)
 {
     _kind       = RestrictionKind.Custom;
     _expression = expression;
 }
示例#13
0
 internal Restriction(Expression parameter, object instance)
 {
     _kind       = RestrictionKind.Instance;
     _expression = parameter;
     _instance   = instance;
 }
示例#14
0
 internal Restriction(Expression parameter, Type type)
 {
     _kind       = RestrictionKind.Type;
     _expression = parameter;
     _type       = type;
 }
示例#15
0
 public void AddRestriction(int rank, RestrictionKind restriction, int value)
 {
     var newRestriction = new LeadershipRankRequirements(rank, restriction, value);
 }