private void tabControl1_SelectedIndexChanged_1(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 0)
     {
         Dashboard dashboard = Dashboard.GetInstance();
         dashboard.Show();
         this.Hide();
     }
     if (tabControl1.SelectedIndex == 2)
     {
         ManageStudent f = ManageStudent.GetInstance();
         f.Show();
         this.Hide();
     }
     if (tabControl1.SelectedIndex == 3)
     {
         ManageAdvisors f = ManageAdvisors.GetInstance();
         f.Show();
         this.Hide();
     }
     if (tabControl1.SelectedIndex == 4)
     {
         CreateGroup createGroup = CreateGroup.GetInstance();
         createGroup.Show();
         this.Hide();
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            ManageStudent m = ManageStudent.GetInstance();

            m.Show();
            this.Hide();
        }
        private void btnBack_Click(object sender, EventArgs e)
        {
            ManageStudent manage = ManageStudent.GetInstance();

            manage.Show();
            this.Hide();
        }
Exemplo n.º 4
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ManageStudent m = ManageStudent.GetInstance();

            m.Show();
            this.Hide();
        }
 public static ManageStudent GetInstance()
 {
     if (Instance == null)
     {
         ManageStudent new_Instance = new ManageStudent();
         return(new_Instance);
     }
     return(Instance);
 }
        private void button2_Click(object sender, EventArgs e)
        {
            DatabaseConnection.createStatement("update Person set FirstName = '" + txtFirstName.Text + "' , LastName = '" + txtLastName.Text + "', Contact = '" + txtContactNo.Text + "', Email = '" + txtEmail.Text + "'" +
                                               " where Id = " + TempData.CurrentStudent.PersonId);
            DatabaseConnection.performAction();
            MessageBox.Show("Changes are saved");
            ManageStudent manageStudent = ManageStudent.GetInstance();

            manageStudent.Show();
            this.Hide();
        }
Exemplo n.º 7
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (!IsAnyTextBoxEmpty())
            {
                bool IsConnnected = DatabaseConnection.start();

                bool ISValidStudent = true;

                Student student = new Student();
                try
                {
                    student.FirstName = txtFirstName.Text;
                }
                catch (ArgumentException)
                {
                    ISValidStudent          = false;
                    lblFNameWarning.Visible = true;
                }
                try
                {
                    student.LastName = txtLastName.Text;
                }
                catch (ArgumentException)
                {
                    ISValidStudent          = false;
                    lblLNameWarning.Visible = true;
                }
                try
                {
                    student.RegistrationNo = txtRegNo.Text;
                }
                catch (ArgumentException)
                {
                    ISValidStudent        = false;
                    lblRegWarning.Visible = true;
                }
                try
                {
                    student.Email = txtEmail.Text;
                }
                catch (ArgumentException)
                {
                    ISValidStudent          = false;
                    lblEmailWarning.Visible = true;
                }
                if (ISValidStudent)
                {
                    string StudentGender = "0";
                    if (cmbGender.Text == "Male")
                    {
                        StudentGender = "1";
                    }

                    string day        = cmbDay.Text;
                    string month      = cmbMonth.SelectedIndex.ToString();
                    string year       = cmbYear.Text;
                    string studentDOB = year + " - " + month + " - " + day;

                    bool IsException = false;

                    DatabaseConnection.createStatement("select * from Student where RegistrationNo = '" + txtRegNo.Text + " '");
                    SqlDataReader r = DatabaseConnection.getData();
                    if (r.Read())
                    {
                        IsException = true;
                        MessageBox.Show("This Registration Number already exists");
                    }

                    if (!IsException)
                    {
                        try
                        {
                            DatabaseConnection.createStatement("INSERT INTO Person ( FirstName, LastName, Contact, Email, DateOfBirth, Gender)" +
                                                               " VALUES('" + txtFirstName.Text + "' , '" + txtLastName.Text + "', '" + txtContactNo.Text + "', '" + txtEmail.Text + "', '" + studentDOB + "' ," + StudentGender + "); ");

                            DatabaseConnection.performAction();
                        }
                        catch (SqlException)
                        {
                            IsException           = true;
                            lblDOBwarning.Visible = true;
                        }
                    }
                    if (!IsException)
                    {
                        DatabaseConnection.createStatement("Select @@identity as id from Person");
                        SqlDataReader reader = DatabaseConnection.getData();
                        string        id     = "0";
                        while (reader.Read())
                        {
                            id = (reader["id"].ToString());
                        }

                        DatabaseConnection.createStatement("INSERT INTO Student (Id, RegistrationNo) VALUES (" + id + ", '" + txtRegNo.Text + "') ");
                        DatabaseConnection.performAction();

                        if (!IsException)
                        {
                            MessageBox.Show("Student added");
                            ManageStudent manageStudent = ManageStudent.GetInstance();
                            manageStudent.Show();
                            this.Hide();
                        }
                    }
                }
            }
        }