protected void usernameExistsValidator_ServerValidate(object source, ServerValidateEventArgs args) //Check if username already exists in database { if (childDAO.childExists(args.Value) || parentDAO.parentExists(args.Value) || administratorDAO.administratorExists(args.Value)) //Check if username already exists in DB and if so the field is not valid { args.IsValid = false; } else { args.IsValid = true; } }
protected void usernameExistsValidator_ServerValidate(object source, ServerValidateEventArgs args) //Check if username is already used in database { if (childDAO.childExists(args.Value) || parentDAO.parentExists(args.Value) || administratorDAO.administratorExists(args.Value)) { args.IsValid = false; } else { args.IsValid = true; } }
protected void usernameExistsValidator_ServerValidate(object source, ServerValidateEventArgs args) //Check if username already exists in database { if (childEdit != null && args.Value == childEdit.Username || parentEdit != null && args.Value == parentEdit.Username || administratorEdit != null && args.Value == administratorEdit.Username) //Check if user entered exactly the same username he already had { args.IsValid = true; } else if (childDAO.childExists(args.Value) || parentDAO.parentExists(args.Value) || administratorDAO.administratorExists(args.Value)) //Check if username already exists in DB and if so the field is not valid { args.IsValid = false; } else { args.IsValid = true; } }