private void AutoAuth() { string sqlString = String.Format("SELECT * FROM SystemTable"); string[] readText = new string[2]; using (SqlConnection connection = new SqlConnection(Strings.ConStr)) { connection.Open(); SqlCommand sql = new SqlCommand(sqlString, connection); SqlDataReader reader = sql.ExecuteReader(); if (reader.HasRows) { reader.Read(); readText[0] = Convert.ToString(reader.GetInt32(1)); readText[1] = reader.GetString(2); } } if (readText[0] != "0" && readText[1] != "") { AuthUserCookie.CookieAuth(readText[0], readText[1]); } else { Auth auth = new Auth(); auth.ShowDialog(); } }
private void Main_FormClosed(object sender, FormClosedEventArgs e) { AuthUserCookie.UserOut(); }
protected void UserExitToolStripMenuItem_Click(object sender, EventArgs e) { AuthUserCookie.UserLogOut(); Application.Restart(); }