/// <summary> /// Displays a message to the user when the customer has been added. /// When an error occurs it will give the appropricate message /// </summary> /// <param name="parameter"></param> public void Execute(object parameter) { string[] customerData = new string[] { "Fullname", "Email", "Country", "City", "Street", "Phone" }; var customerValues = (object[])parameter; string[] errorMessages = new string[10]; int counter = 0; for (int i = 0; i < customerValues.Length; i++) { if (string.IsNullOrEmpty((string)customerValues[i])) { errorMessages[counter] = $"{customerData[counter]} can not be empty"; counter++; } } if (errorMessages[0] == null) { customerViewModel.Add(); customerViewModel.OnShowDialog(); ResetCustomerFields(); } else { string errors = string.Empty; foreach (var par in errorMessages) { errors += par + "\n"; } customerViewModel.Errors = errors; customerViewModel.OnShowDialog(); ResetCustomerFields(); } }
public void Execute(object parameter) { _CM.Add(); }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { vm.Add(); }