private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            DashboardForm dashboardForm = new DashboardForm();

            dashboardForm.Show();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username = UsernameTextBox.Text;
            string password = PasswordTextBox.Text;

            if (username == loginClass.getusername())
            {
                if (password == loginClass.getpassword())
                {
                    date_time = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
                    writer    = file.AppendText();
                    writer.WriteLine("Logged in at " + date_time);
                    writer.Close();
                    MessageBox.Show("Logged in Successfully");
                    this.Hide();
                    DashboardForm dashboardForm = new DashboardForm();
                    dashboardForm.Show();
                }
                else
                {
                    date_time = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
                    writer    = file.AppendText();
                    writer.WriteLine("Invalid Password Attempt is made on " + date_time);
                    writer.Close();
                    MessageBox.Show("Invalid Password");
                    PasswordTextBox.Clear();
                }
            }
            else
            {
                date_time = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
                writer    = file.AppendText();
                writer.WriteLine("Invalid Username Attempt is made on " + date_time);
                writer.Close();
                MessageBox.Show("Invalid username");
                UsernameTextBox.Clear();
            }
        }