//Changes a field of a product depending on the parameters of the method private void ChangeProductBoolField(string commandName, string[] args, ProductBoolField field, bool newValue) { Product product; int id; if (IsValidArgs(commandName, args, 1)) { if (int.TryParse(args[0], out id)) { product = LineSystem.GetProduct(id); if (product != null) { switch (field) { case ProductBoolField.Active: product.Active = newValue; break; case ProductBoolField.CanBeBoughtOnCredit: product.CanBeBoughtOnCredit = newValue; break; default: break; } UI.DisplayGeneralMessage(product.Name + "'s " + field.ToString() + " field was set to " + newValue.ToString()); } else { UI.DisplayProductNotFound(args[0]); } } else { UI.DisplayGeneralError(args[0] + " is not a invalid productID"); } } }