private void changePass() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand modify = new SqlCommand("[ChangePW]", sqlcon.con); modify.CommandType = System.Data.CommandType.StoredProcedure; modify.Parameters.AddWithValue("@passkey", metroTextBox4.Text); modify.Parameters.AddWithValue("@newpass", metroTextBox5.Text); modify.Parameters.AddWithValue("@userID", globalVar.x.ToString()); modify.Parameters.AddWithValue("@name", globalVar.name.ToString()); modify.ExecuteNonQuery(); userConnect.dbOut(); DesktopAlert.Show("Password has been changed, please Log IN"); this.FormClosing -= new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Close(); loginForm lF = new loginForm(); lF.ShowDialog(); }
private void metroTile1_Click(object sender, EventArgs e) { Form1 fm1 = new Form1(); fm1.Hide(); sqlcon userOUT = new sqlcon(); userOUT.dbIn(); SqlCommand logOut = new SqlCommand("[timeLogoUT] '" + globalVar.x + "','" + globalVar.name + "'", sqlcon.con); SqlDataReader lO = logOut.ExecuteReader(); while (lO.Read()) { } this.Hide(); userOUT.dbOut(); fm1.Close(); Application.Exit(); loginForm lF = new loginForm(); lF.Show(); }