private void lblContinueOffline_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { BSAFMDIParent mdi = new BSAFMDIParent(); Form frm = (Form)this.MdiParent; MenuStrip ms = (MenuStrip)frm.Controls["menuStrip"]; ms.Enabled = true; this.Dispose(); }
private async void btnLogin_Click(object sender, EventArgs e) { dbContext db = new dbContext(); this.pbLoginProcess.Visible = true; if (!string.IsNullOrWhiteSpace(this.txtUserName.Text) && !string.IsNullOrWhiteSpace(this.txtPassword.Text)) { var username = this.txtUserName.Text; var password = this.txtPassword.Text; try { var reponse = UserController.AuthenticateUser(username, password); if (reponse) { BSAFMDIParent mdi = new BSAFMDIParent(); Form frm = (Form)this.MdiParent; MenuStrip ms = (MenuStrip)frm.Controls["menuStrip"]; ms.Enabled = true; this.Dispose(); } else { this.pbLoginProcess.Visible = false; lblLoginMessage.Text = "Can not process user login please try again or continue offline."; lblLoginMessage.Visible = true; return; } } catch (Exception ex) { this.pbLoginProcess.Visible = false; lblLoginMessage.Text = "Can not process user login please try again or continue offline."; lblLoginMessage.Visible = true; return; } } else { lblLoginMessage.Visible = true; this.lblLoginMessage.Text = "Please enter username and password."; this.pbLoginProcess.Visible = false; } }