Ejemplo n.º 1
0
        // This button takes the user to a form which will allow them to capture a weather forcast
        private void btnAdd_Click(object sender, EventArgs e)
        {
            this.Hide();
            WeatherCapture form = new WeatherCapture();

            form.ShowDialog();
            this.Close();
        }
Ejemplo n.º 2
0
 // A Method that validates the user's credentials and logs in a user
 public void login()
 {
     if (txtUsername.Text.Equals("") || txtPassword.Text.Equals(""))
     {
         MessageBox.Show("Please populate the empty fields");
     }
     else
     {
         for (int i = 0; i < WeatherWorker.login.Count; i++)
         {
             if (WeatherWorker.login[i].Username == txtUsername.Text && WeatherWorker.login[i].Password == EncodePasswordToBase64(txtPassword.Text))
             {
                 if (WeatherWorker.login[i].UserType.Equals("Admin"))
                 {
                     WeatherCapture form = new WeatherCapture();
                     txtUsername.Text = "";
                     txtPassword.Text = "";
                     this.Hide();
                     form.ShowDialog();
                     this.Show();
                 }
                 else if (WeatherWorker.login[i].UserType.Equals("General User"))
                 {
                     WeatherReport form = new WeatherReport();
                     txtUsername.Text = "";
                     txtPassword.Text = "";
                     this.Hide();
                     form.disableButton();
                     form.ShowDialog();
                     this.Show();
                 }
             }
         }
         MessageBox.Show("Please Enter a Valid Username and Password");
     }
 }