///<summary>Returns true if the From provider is associated to the user currently logged in. ///If the user has chosen a different provider as the From provider this will prompt them to enter a password for any user associated to them. ///Loops through all users associated to the From provider until the credentials typed in match.</summary> private bool VerifyFromProvider() { if (_provCur == null) { MsgBox.Show(this, "Invalid From provider."); return(false); } //Don't require validating credentials if the user currently logged in is associated to the selected provider. if (_provUserCur != null && _provUserCur.ProvNum == _provCur.ProvNum) { return(true); } List <Userod> listUsers = Userods.GetUsersByProvNum(_provCur.ProvNum); //Get all potential users for this provider. InputBox FormIB = new InputBox(Lan.g(this, "Input a password for a User that is associated to provider:") + "\r\n" + _provCur.GetFormalName()); FormIB.textResult.PasswordChar = '*'; while (true) { //Get the password for a user that is associated to the provider chosen. FormIB.textResult.Text = ""; FormIB.ShowDialog(); if (FormIB.DialogResult == DialogResult.OK) { //Validate the password typed in against all the users associated to the selected provider. foreach (Userod user in listUsers) { if (Userods.CheckTypedPassword(FormIB.textResult.Text, user.Password)) { return(true); } } MsgBox.Show(this, "Invalid password. Please try again or Cancel."); } else //User canceled { return(false); } } }