Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string        yearStudent;
            List <string> listOfCourses   = new List <string>();
            List <string> listShow        = new List <string>();
            List <string> sameCoursesName = new List <string>();

            string id = textBox1.Text;

            if (checkSize(id) == false || checkId(id) == false)
            {
                MessageBox.Show("Unlegal Input ,the id have to be 9 numbers and no latters");
            }
            else if (studentdb.chackId(id) == false)
            {
                MessageBox.Show("Id not exist");
            }

            else
            {
                textBox1.Enabled = false;
                button1.Enabled  = false;

                yearStudent = studentdb.returnYearOfStu(id);

                listOfCourses = studentToCoursedb.chackYearToStu(yearStudent);

                List <string> Lcourses = new List <string>();
                //foreach (string Item in listOfCourses)
                for (int i = 0; i < listOfCourses.Count; i++)
                {
                    Lcourses = studentToCoursedb.returnCoursesWithSameName(listOfCourses[i]);
                    if (Lcourses.Count > 0)
                    {
                        foreach (string Item in Lcourses)
                        {
                            lb_course.Items.Add(Item);
                        }
                    }
                }

                //listOfCourses = studentToCoursedb.chackYearToStu(yearStudent);
                //foreach (string Item in listOfCourses)
                //    lb_course.Items.Add(Item);

                //foreach (string Item in listOfCourses)
                //    lb_course.Items.Add(Item);
            }
        }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string id   = tb_id.Text;
            string type = cb_type.SelectedItem.ToString();
            bool   flag = true;
            string name;

            if (type == "סטודנט")
            {
                if (studentdb.chackId(id) == true)
                {
                    name = studentdb.returnNameOfStu(id);
                    new viewShStu(name, id).ShowDialog();
                }
                else
                {
                    MessageBox.Show("Id not exist");
                }
            }
            if (type == "מרצה")
            {
                if (lecturersdb.chackIdLecturer(id) == true)
                {
                    name = lecturersdb.returnNameOfLec(id);
                    new viewShL(name, id).ShowDialog();
                }
                else
                {
                    MessageBox.Show("Id not exist");
                }
            }
            if (type == "מתרגל")
            {
                if (tutorsdb.chackIdTutor(id) == true)
                {
                    name = tutorsdb.returnNameOfTutor(id);
                    new viewShT(name, id).ShowDialog();
                }
                else
                {
                    MessageBox.Show("Id not exist");
                }
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            string id = tb_id.Text;

            if (checkSize(id) == false || checkId(id) == false)
            {
                MessageBox.Show("Unlegal Input ,the id have to be 9 numbers and no latters");
            }
            else if (studentdb.chackId(id) == false)
            {
                MessageBox.Show("Id not exist");
            }

            else
            {
                tb_id.Enabled        = false;
                cb_course.DataSource = studentdb.CheckCoursesToStudent(id);
                cb_course.Enabled    = true;
                button2.Enabled      = true;
            }
        }