private void tabControl1_Click(object sender, EventArgs e)
        {
            session lec = new session();

            lecturerbox.DataSource = lec.getLectures();

            subjectBox.DataSource = lec.getSubjects();

            GroupBox.DataSource = lec.getGroupID();

            sessionList.DataSource = lec.getSessiondatatoTable();

            findSessionList.DataSource = lec.getSessiondatatoTable();
        }
        public CreateSession()
        {
            InitializeComponent();



            session lecturer = new session();

            for (int i = 0; i < lecturer.getSessiondatatoTable().Rows.Count; i++)
            {
                show_data(lecturer.getSessiondatatoTable(), i);
            }
            lecturerlist.DataSource = lecturer.getLectures();

            subNamelist.DataSource = lecturer.getSubjects();


            sessionList.DataSource = lecturer.getSessiondatatoTable();

            findSessionList.DataSource = lecturer.getSessiondatatoTable();
        }
        private void Createsessions_Click(object sender, EventArgs e)
        {
            if (type.Text != "" && Gid.Text != "" && Scount.Text != "" && subNamelist.Text != "" && subcodeList.Text != "" && lecList.Items.Count != 0)
            {
                foreach (DataGridViewRow row in sessionList.Rows)
                {
                    if (row.Cells[1].Value.ToString().Equals(subcodeList.Text) && row.Cells[2].Value.ToString().Equals(type.Text) && row.Cells[3].Value.ToString().Equals(Gid.Text))
                    {
                        if (type.Text == "Practical")
                        {
                            if (row.Cells[4].Value.ToString().Equals(subBox.Text))
                            {
                                System.Windows.Forms.MessageBox.Show("This session already added !", "Warning").ToString();
                                return;
                            }
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("This session already added !", "Warning").ToString();
                            return;
                        }
                    }
                }

                sessionModel sessionmodel = new sessionModel();
                sessionmodel.SubName = subNamelist.Text;
                sessionmodel.subCode = subcodeList.Text;
                sessionmodel.Type    = type.Text;
                sessionmodel.groupId = Int32.Parse(Gid.Text);

                sessionmodel.subgId       = subBox.Text;
                sessionmodel.studentcount = Int32.Parse(Scount.Text);

                sessionmodel.lec = "";

                for (int i = 0; i < lecList.Items.Count; i++)
                {
                    sessionmodel.lec = sessionmodel.lec + lecList.Items[i].Text + ",";
                }

                sessionmodel.lecturers = lec;
                session session = new session();
                session.insertSessions(sessionmodel);

                lecList.Items.Clear();
                lecturerlist.Text = "";
                subNamelist.Text  = "";
                subcodeList.Text  = "";

                lecturerbox.DataSource = session.getLectures();

                subjectBox.DataSource = session.getSubjects();

                GroupBox.DataSource = session.getGroupID();

                //sessionList.DataSource = session.getSessiondatatoTable();


                sessionList.DataSource = session.getSessiondatatoTable();

                flowLayoutPanel1.Controls.Clear();

                for (int i = 0; i < session.getSessiondatatoTable().Rows.Count; i++)
                {
                    show_data(session.getSessiondatatoTable(), i);
                }
            }
            else
            {
                string ans = System.Windows.Forms.MessageBox.Show("Please fill all the require fields !", "Warning").ToString();
            }
        }