private void backButton_Click(object sender, EventArgs e)
        {
            TeacherView teacherView = new TeacherView(usernameTextBox.Text);

            this.Hide();
            teacherView.Show();
        }
Example #2
0
        private void Save_Click(object sender, EventArgs e)
        {
            string message = "";

            try
            {
                Teacher teacher = new Teacher()
                {
                    Username    = ausername,
                    Name        = nameTextBox.Text,
                    Designation = designationTextBox.Text,
                    Gender      = sexComboBox.Text,
                    Dept        = deptTextBox.Text,
                    Note        = noteTextBox.Text
                };
                message = officemanager.SaveTeacherInfo(teacher);
                MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (message == "Teacher Insert Successful.")
                {
                    TeacherView teacherView = new TeacherView(teacher.Username);
                    this.Hide();
                    teacherView.Show();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error." + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            string message = "";

            try
            {
                Account account = new Account()
                {
                    AccountType = loginComboBox.Text,
                    Username    = userNameTextBox.Text,
                    Password    = paswordTextBox.Text
                };
                message = accountManager.CheckAccountInfo(account);
                MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (message == "LogIn Successful")
                {
                    if (account.AccountType == "Student")
                    {
                        if (studentManager.GetStudentRollNumber(Convert.ToInt32(rollNumberTextBox.Text)) == Convert.ToInt32(rollNumberTextBox.Text))
                        {
                            Student_View studentView = new Student_View();
                            this.Hide();
                            Student aStudent = new Student();
                            aStudent = studentManager.GetStudentInfo(Convert.ToInt32(rollNumberTextBox.Text));
                            studentView.nameTextBox.Text    = aStudent.Name.ToString();
                            studentView.noteTextBox.Text    = aStudent.Note.ToString();
                            studentView.rollNoTextBox.Text  = aStudent.Roll.ToString();
                            studentView.sessionTextBox.Text = aStudent.Session.ToString();
                            studentView.sexTextBox.Text     = aStudent.Sex.ToString();
                            studentView.deptTextBox.Text    = aStudent.Dept.ToString();
                            studentView.Show();
                        }
                        else
                        {
                            Form1 form1 = new Form1();
                            this.Hide();
                            form1.Show();
                        }
                    }
                    else if (account.AccountType == "Teacher")
                    {
                        if (officemanager.GetTeacherUsername(account.Username) != account.Username)
                        {
                            TeacherInfoForm teacherInfoForm = new TeacherInfoForm(account.Username);
                            this.Hide();
                            teacherInfoForm.Show();
                        }
                        else
                        {
                            TeacherView teacherView = new TeacherView(account.Username);
                            this.Hide();
                            teacherView.Show();
                        }
                    }
                    else if (account.AccountType == "Chairman")
                    {
                        if (officemanager.GetChairmanUsername(account.Username) != account.Username)
                        {
                            ChairmanInfoForm chairmanInfoForm = new ChairmanInfoForm(account.Username);
                            this.Hide();
                            chairmanInfoForm.Show();
                        }
                        else
                        {
                            ChairmanView chairmanView = new ChairmanView(account.Username);
                            this.Hide();
                            chairmanView.Show();
                        }
                    }
                    else if (account.AccountType == "Office")
                    {
                        AssignStudent assignStudent = new AssignStudent();
                        this.Hide();
                        assignStudent.Show();
                    }
                    else if (account.AccountType == "Administrator")
                    {
                        if (officemanager.GetAdministrationUsername(account.Username) != account.Username)
                        {
                            AdministrationInfo administrationInfo = new AdministrationInfo(account.Username);
                            this.Hide();
                            administrationInfo.Show();
                        }
                        else
                        {
                            AdministrationView administrationView = new AdministrationView(account.Username);
                            this.Hide();
                            administrationView.Show();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error." + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }