示例#1
0
        private void metroButton4_Click(object sender, EventArgs e)
        {
            StudentsForm students = new StudentsForm();

            // combobox holding the class names
            students.ClassID   = (int)metroComboBox1.SelectedValue;
            students.ClassName = metroComboBox1.Text;
            students.ShowDialog();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            var ff = new StudentsForm(new Students {
                Birthday = DateTime.Now
            });

            if (ff.ShowDialog(this) == DialogResult.OK)
            {
                listBox1.Items.Add(ff.Students);
            }
        }
示例#3
0
        private void Login()
        {
            string userName = txtUserName.Text.Trim() ?? "";
            string password = txtPassword.Text.Trim() ?? "";

            if (userName == "" || password == "")
            {
                MessageBox.Show("Username or password is invalid", "Error");
                return;
            }
            Student student = Database.GetInstance().Login(userName, password);

            if (student == null)
            {
                MessageBox.Show("Cannot login to the system", "Error");
                return;
            }
            studentsForm = studentsForm == null ? new StudentsForm(this) : studentsForm;

            studentsForm.Show();
        }