private String errorDialog() { if (this.idioma == "ESPAÑOL") { String error = "Se han encontrado algunos errores: \n"; if (string.IsNullOrEmpty(txtName.Text)) { error += "\t - El campo \"Nombre\" no puede estar vacio \n"; } if (string.IsNullOrEmpty(txtSurname.Text)) { error += "\t - El campo \"Apellido\" no puede estar vacio \n"; } if (string.IsNullOrEmpty(txtDNI.Text)) { error += "\t - El campo \"DNI\" no puede estar vacio \n"; } if (!Utils.check.checkDNI(txtDNI.Text)) { error += "\t - El DNI no tiene el formato correcto \n" + " \t\t ejemplo- 00000000A \n"; } if (GestorCustomers.existDNI(txtDNI.Text)) { error += "\t - Ya existe un cliente con este DNI: " + txtDNI.Text; } return(error); } else { String error = "Some Errors has been found: \n"; if (string.IsNullOrEmpty(txtName.Text)) { error += "\t - The field \"Name\" can`t be empty \n"; } if (string.IsNullOrEmpty(txtSurname.Text)) { error += "\t - The field \"Surname\" can`t be empty \n"; } if (string.IsNullOrEmpty(txtDNI.Text)) { error += "\t - The field \"DNI\" can`t be empty \n"; } if (!Utils.check.checkDNI(txtDNI.Text)) { error += "\t - The DNI doesn't the correct format \n" + " \t\t Example- 00000000A \n"; } if (GestorCustomers.existDNI(txtDNI.Text)) { error += "\t - Already exist a User with the DNI: " + txtDNI.Text; } return(error); } }
/* * Metodo para comprobar si estan rellenos los campos obligatorios */ private bool checkAdd() { return(!(string.IsNullOrEmpty(txtName.Text) && string.IsNullOrEmpty(txtSurname.Text) && string.IsNullOrEmpty(txtDNI.Text)) && Utils.check.checkDNI(txtDNI.Text) && !GestorCustomers.existDNI(txtDNI.Text)); }