Exemplo n.º 1
0
        public static ConnectionPlan getPlanByName(string planName)
        {
            if (!planName.Equals(" ") && Regex.IsMatch(planName, "[a-zA-Z]"))
            {
                switch (planName.ToLower())
                {
                case "platinum":
                    PREMIUM = new ConnectionPlan("PREMIUM", 500, 500, 1500, 269);
                    return(PREMIUM);

                case "gold":
                    STANDARD = new ConnectionPlan("STANDARD", 60, 100, 500, 169);
                    return(STANDARD);

                case "silver":
                    BASIC = new ConnectionPlan("BASIC", 20, 50, 500, 80);
                    return(BASIC);

                default:
                    throw new ArgumentException("Warning# invaid plan name");
                }
            }
            ConnectionPlan INVALID_PLAN = new ConnectionPlan();

            INVALID_PLAN.setName("_Invalid_Plan_");
            return(INVALID_PLAN);
        }
Exemplo n.º 2
0
 public void setConnectionPlan(string planName)
 {
     this.plan = ConnectionPlan.getPlanByName(planName);
 }