private void bLogin_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tUsername.Text) || string.IsNullOrEmpty(tPassword.Text)) { return; } DataTable dt = Sql.GetTable("GetUserData", new string[] { "@Username", tUsername.Text, "@Password", tPassword.Text }); if (dt == null || dt.Rows.Count == 0) { lFailedLogin.Visible = true; return; } this.ShowInTaskbar = false; this.Hide(); GlobalUser.ParseDataTable(dt); MainForm mainFrm = new MainForm(); mainFrm.Show(); }
private void ValidateLogin() { if (string.IsNullOrEmpty(tBoxInput1.Text) || string.IsNullOrEmpty(tBoxInput2.Text)) { EnableRows(6); row6.Text = "Neteisingas prisijungimas"; row6.ForeColor = Color.Red; row6.TextAlign = ContentAlignment.MiddleCenter; return; } DataTable dt = Sql.GetTable("GetUserData", new string[] { "@Username", tBoxInput1.Text, "@Password", tBoxInput2.Text }); if (dt == null || dt.Rows.Count == 0) { if (!row6.Visible) { EnableRows(6); } row6.Text = "Neteisingas prisijungimas"; row6.ForeColor = Color.Red; row6.TextAlign = ContentAlignment.MiddleCenter; return; } this.tBoxInput2.UseSystemPasswordChar = true; this.tBoxInput2.PasswordChar = '\0'; GlobalUser.ParseDataTable(dt); DisableInfo(); ClearLabels(); ClearInput(); HideInput(); SelectWarehouse(); }