public WelcomToTcoPage ClickLogin(string userName, string userPassword) { UserNameTxtBox.SendKeys(userName); PasswordTxtBox.SendKeys(userPassword); LoginButton.Click(); return(new WelcomToTcoPage(Driver)); }
private void AddUserBtn_Click(object sender, EventArgs e) { try { if (Validators.TxtBoxNotEmpty(UserNameTxtBox.Text) && Validators.TxtBoxNotEmpty(PasswordTxtBox.Text)) { if (!UsersMgmt.IsUserExist(UserNameTxtBox.Text)) { Users aUser = new Users(); aUser.User_Name = NameTxtBox.Text; aUser.User_Address = AddressTxtBox.Text; aUser.User_Phone1 = Phone1TxtBox.Text; aUser.User_Phone2 = Phone2TxtBox.Text; aUser.User_Password = PasswordTxtBox.Text; aUser.User_Description = DescriptionTxtBox.Text; aUser.User_UserName = UserNameTxtBox.Text; if (UsersMgmt.AddUser(aUser)) { MessageBox.Show(MsgTxt.AddedSuccessfully, MsgTxt.AddedSuccessfully, MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult ret; ret = MessageBox.Show(MsgTxt.AddAnotherItemTxt, MsgTxt.InformationCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); if (ret == DialogResult.Yes) { foreach (TextBox aTextBox in this.UserInfoGB.Controls.OfType <TextBox>()) { aTextBox.Text = ""; } } else { this.Close(); } } else { MessageBox.Show(MsgTxt.UnexpectedError + " \n[DataBase Error]:IN [AddUserBtn_Click]" + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } } else { MessageBox.Show(MsgTxt.UserTxt + " [ " + UserNameTxtBox.Text + " ] " + MsgTxt.AlreadyUsedTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show(MsgTxt.PleaseAddAllRequiredFields, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); if (!Validators.TxtBoxNotEmpty(PasswordTxtBox.Text)) { PasswordTxtBox.BackColor = SharedVariables.TxtBoxRequiredColor; PasswordTxtBox.Focus(); } else { PasswordTxtBox.BackColor = PasswordBGColor; } if (!Validators.TxtBoxNotEmpty(UserNameTxtBox.Text)) { UserNameTxtBox.BackColor = SharedVariables.TxtBoxRequiredColor; UserNameTxtBox.Focus(); } else { UserNameTxtBox.BackColor = NameBGColor; } } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + " \n[Exception]:IN [AddUserBtn_Click]" + "\n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }