public IFreeMinutesPolicy Create(Driver driver) { IFreeMinutesPolicy freeMinutesPolicy = new StandardPolicy(); if (driver.LicenseNumber.Contains("Pracownik") || driver.LicenseNumber.Contains("Ratownik medyczny")) { freeMinutesPolicy = new PremiumPolicy(); } return(freeMinutesPolicy); }
private void policyRadioButtons_CheckedChanged(object sender, EventArgs e) { IUserPolicy policy; switch ((sender as RadioButton)?.Text) { case "Standard": policy = new StandardPolicy(); break; case "Advanced": policy = new VariablePolicy(); break; case "Special": policy = new SpecialPolicy(); break; default: throw new ApplicationException("Unknown policy"); } _repo = new UserRepo(policy); }