public Form_004_002(Form_004 objForm_004) { InitializeComponent(); ObjForm_004 = objForm_004; KeyPreview = true; }
private void btnLogIn_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; if (!string.IsNullOrEmpty(txtUser.Text) && !string.IsNullOrEmpty(txtPassword.Text)) { var vUser = BUser.FindAndValidateByUserNameOrEmailOrCellphone(txtUser.Text, txtPassword.Text); if (vUser != null) { var vSession = BSession.CreateSession(vUser); if (vSession != null) { Hide(); objForm_004 = new Form_004(this, vUser, vSession); objForm_004.Show(); } else { Cursor = Cursors.Default; MessageBox.Show("There was an unknown error, try to exit this application and then entry again.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { Cursor = Cursors.Default; MessageBox.Show("Didn't find any user with these data.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUser.Focus(); } } else { Cursor = Cursors.Default; MessageBox.Show("The user's data aren't incorrect.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUser.Focus(); } Cursor = Cursors.Default; }