private void LogIn_Load(object sender, EventArgs e) { dc = new DataCon(); dc.openCon(); SqlDataReader dr = dc.execSelect("SELECT * FROM tempuser"); int counter = 0; while (dr.Read()) { SignIn.setDetails((int)dr[0], (String)dr[3], (String)dr[2], (String)dr[1]); counter++; } if (counter == 1) { dc2 = new DataCon(); dc2.execInsert("DELETE FROM tempuser where lid ='" + SignIn.getLogIn() + "'"); new Dashboard().Show(); this.Hide(); } else { this.Visible = true; } }
public void CancelLoginAction(object sender, EventArgs e) { //if login cancelled, user will be redirected back to the sign-in page MainPage = new SignIn(); }
public void CancelLoginAction(object sender, EventArgs e) { //if login cancelled, user will be redirected back to the sign-in page MainPage = new SignIn (); }
private void Dashboard_FormClosing(object sender, FormClosingEventArgs e) { SignIn.logOut(); Application.Exit(); }
private void Dashboard_Load(object sender, EventArgs e) { metroLabel2.Text = SignIn.getUsername(); DataCon dc = new DataCon(); SqlDataReader dr = dc.execSelect("SELECT subject, date from notification where staff_id like '" + SignIn.getUserID() + "'"); try { while (dr.Read()) { listBox1.Items.Add((String)dr[0]); DateTime dt = (DateTime)dr[1]; String dat = dt.ToString("yyyy-MM-dd"); DateTime dt2 = DateTime.Now; String dat2 = dt2.ToString("yyyy-MM-dd"); if (dat.Equals(dat2)) { metroLabel9.Text = "You have new Notifications"; metroLabel9.BackColor = Color.Ivory; } else { metroLabel9.Text = "You have no new Notifications"; metroLabel9.BackColor = Color.White; } } }catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void listBox1_Click(object sender, EventArgs e) { DataCon dc = new DataCon(); SqlDataReader dr = dc.execSelect("SELECT message, date from notification where staff_id like '" + SignIn.getUserID() + "' AND subject like '" + listBox1.SelectedItem.ToString() + "'"); try { while (dr.Read()) { metroTextBox1.Text = (String)dr[0]; metroLabel8.Text = (String)dr[1].ToString(); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }