Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string type = metroComboBoxType.SelectedItem.ToString();

            metroComboBoxType.Enabled = false;
            if (txtUsername.Text == "" && txtPassword.Text == "" || type.Equals(""))
            {
                MetroMessageBox.Show(this, "Please fill all fields in order to proceed.", "Fields are Empty ! ", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand);
            }
            else
            {
                switch (type)
                {
                case "Student":
                    Student s = new Student();
                    s.setUsername(txtUsername.Text);
                    s.setPassword(txtPassword.Text);
                    if (st.Login(s) == true)
                    {
                        u = txtUsername.Text;
                        Hide();
                        StudentHome sh = new StudentHome();
                        sh.Show();
                    }
                    break;

                case "Professor":
                    Professor l = new Professor();
                    l.setUsername(txtUsername.Text);
                    l.setPassword(txtPassword.Text);
                    if (pt.Login(l) == true)
                    {
                        u = txtUsername.Text;
                        Hide();
                        ProfessorHome ph = new ProfessorHome();
                        ph.Show();
                    }
                    break;

                case "Registar":
                    Registar r = new Registar();
                    r.setUsername(txtUsername.Text);
                    r.setPassword(txtPassword.Text);
                    if (rt.Login(r) == true)
                    {
                        u = txtUsername.Text;
                        Hide();
                        RegistarHome rh = new RegistarHome();
                        rh.Show();
                    }
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
 public void RAApplicationDataTest()
 {
     try
     {
         SWProjv1.StudentHome sh = new StudentHome(new Student());
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message);
     }
 }
        public override bool Equals(object obj)
        {
            StudentHome studentHome = obj as StudentHome;

            if (studentHome == null)
            {
                return(false);
            }
            if ((studentHome.Id == this.Id) && (this.Id != -1))
            {
                return(true);
            }
            if (studentHome.Name == this.Name)
            {
                return(true);
            }
            return(false);
        }