示例#1
0
        private void button11_Click_1(object sender, EventArgs e)
        {
            if (!ValidateCombobox(comboBox5))
            {
                MessageBox.Show("Please Select Semester Name");
            }
            else
            {
                using (var Contex = new tafesystemEntities())
                {
                    var result = (from c in Contex.coursesemesters
                                  where c.semestername.Equals(comboBox5.Text)

                                  select new
                    {
                        c.semesterId,
                        c.semestername
                    });
                    if (result != null)
                    {
                        dataGridView8.DataSource = result.ToList();
                        dataGridView8.Refresh();
                    }
                }
            }
        }
示例#2
0
        //admin can add the cluster infromation in the system
        private void button1_Click(object sender, EventArgs e)
        {
            if (!ValidateForEmptiness(textBox2.Text))
            {
                MessageBox.Show("Enter Cluster Name");
            }
            if (!ValidateForEmptiness(textBox3.Text))
            {
                MessageBox.Show("Enter Teacher ID");
            }
            else
            {
                int clId = Convert.ToInt32(textBox1.Text);
                model.clusterId   = clId;
                model.clustername = textBox2.Text;

                int tId = Convert.ToInt32(textBox3.Text);
                model.teacherId = tId;

                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    tf.clusters.Add(model);

                    tf.SaveChanges();
                }
                ClearFields();
                MessageBox.Show("Data submitted successsfully");
                PopulateGridView();
            }
        }
示例#3
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (!ValidateCombobox(comboBox4))
            {
                MessageBox.Show("Please Select Location Name");
            }
            else
            {
                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    var loadteacher = (from t in tf.teachers
                                       join tc in tf.teachercourses on t.teacherId equals tc.teacherId
                                       where tc.locationname.Equals(comboBox4.Text)
                                       join c in tf.courses on tc.courseId equals c.courseId

                                       select new
                    {
                        t.teacherId,
                        c.courseId,
                        c.coursename,
                        t.firstname,
                        t.lastname,
                        t.email,
                        t.phone,
                        t.address,
                        tc.locationname,
                        tc.semestername
                    });
                    dataGridView7.DataSource = loadteacher.ToList();
                }
            }
        }
示例#4
0
        //this will search the paid fee of the students
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (!ValidateForEmptiness(textBox1.Text))
            {
                MessageBox.Show("Enter the Amount of fee");
            }
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                var loadfee = (from f in tf.fees
                               join s in tf.students on f.studentId equals s.studentId
                               where (f.paidfee.Equals(textBox1.Text))
                               join en in tf.enrollments on s.studentId equals en.studentId
                               where en.studentId == s.studentId

                               //orderby od.OrderID
                               select new
                {
                    f.feeId,
                    f.paidfee,
                    s.studentId,
                    s.firstname,
                    s.lastname,
                    s.address,
                    s.email,
                    s.phone,
                    en.coursename,
                    en.courseId,
                    en.locationname,
                    en.semestername
                });
                dataGridView1.DataSource = loadfee.ToList();
            }
        }
示例#5
0
//this will display all the part time teachers
        private void checkBox3_CheckedChanged_1(object sender, EventArgs e)
        {
            using (var Contex = new tafesystemEntities())
            {
                var result = (from tc in Contex.teachercourses
                              join t in Contex.teachers
                              on tc.teacherId equals t.teacherId
                              where tc.mode == "Part-Time"
                              select new
                {
                    t.teacherId,
                    t.firstname,
                    t.lastname,
                    tc.status,
                    tc.semestername,
                    tc.locationname,
                    tc.clustername,
                }).ToList();
                if (result != null)
                {
                    dataGridView4.DataSource = result.ToList();
                    dataGridView4.Refresh();
                }
            }
        }
示例#6
0
        //this will save the enetered data into the system
        private void button6_Click(object sender, EventArgs e)
        {
            int eId = Convert.ToInt32(textBox8.Text);

            model1.enrollmentId = eId;
            model1.coursename   = comboBox10.Text.Trim();
            model1.semestername = comboBox9.Text.Trim();
            model1.locationname = comboBox2.Text.Trim();
            model1.mode         = comboBox3.Text.Trim();
            model1.status       = comboBox6.Text.Trim();
            model1.fee          = comboBox4.Text.Trim();
            model1.result       = comboBox5.Text.Trim();
            int studId = Convert.ToInt32(textBox9.Text);

            model1.studentId = studId;
            int courId = Convert.ToInt32(textBox10.Text);

            model1.courseId = courId;
            int locId = Convert.ToInt32(textBox11.Text);

            model1.locationId = locId;
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                tf.enrollments.Add(model1);

                tf.SaveChanges();
            }
            ClearFields2();
            MessageBox.Show("Data submitted successsfully");
            PopulateGridView2();
        }
示例#7
0
 //this will update the enrollemnt enrties
 private void button7_Click(object sender, EventArgs e)
 {
     using (tafesystemEntities tf = new tafesystemEntities())
     {
         int eId     = Convert.ToInt32(textBox8.Text);
         var update2 = tf.enrollments.First(a => a.enrollmentId == eId);
         update2.coursename   = comboBox10.Text;
         update2.semestername = comboBox9.Text;
         update2.locationname = comboBox2.Text;
         update2.mode         = comboBox3.Text;
         update2.status       = comboBox6.Text;
         update2.fee          = comboBox4.Text;
         update2.result       = comboBox5.Text;
         int studId = Convert.ToInt32(textBox9.Text);
         update2.studentId = studId;
         int courId = Convert.ToInt32(textBox10.Text);
         update2.courseId = courId;
         int locId = Convert.ToInt32(textBox11.Text);
         update2.locationId = locId;
         tf.SaveChanges();
     }
     MessageBox.Show("Record Updated sucessfully");
     PopulateGridView2();
     ClearFields2();
 }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!ValidateForEmptiness(textBox2.Text))
            {
                MessageBox.Show("Unit Code is Required");
            }
            else if (!ValidateForEmptiness(textBox3.Text))
            {
                MessageBox.Show("Unit Title is Required");
            }

            else if (!ValidateCombobox(comboBox1))
            {
                MessageBox.Show("Essential is Required");
            }
            else
            {
                int uId = Convert.ToInt32(textBox1.Text);
                model.unitId    = uId;
                model.unitCode  = textBox2.Text;
                model.unitTitle = textBox3.Text;
                model.essential = comboBox1.Text.Trim();

                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    tf.units.Add(model);

                    tf.SaveChanges();
                }
                ClearFields();
                MessageBox.Show("Data submitted successsfully");
                PopulateGridView();
            }
        }
示例#9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!ValidateCombobox(comboBox1))
            {
                MessageBox.Show("Enter Amount of Paid fee");
            }

            else if (!ValidateForEmptiness(textBox2.Text))
            {
                MessageBox.Show("Student ID is Required");
            }

            else
            {
                int fId = Convert.ToInt32(textBox1.Text);
                model3.feeId   = fId;
                model3.paidfee = comboBox1.Text;

                int stuId = Convert.ToInt32(textBox2.Text);
                model3.studentId = stuId;

                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    tf.fees.Add(model3);

                    tf.SaveChanges();
                }

                MessageBox.Show("Payment made successsfully");
                PopulateGridView();
            }
        }
示例#10
0
        //add a recrod
        private void button10_Click(object sender, EventArgs e)
        {
            int tcId = Convert.ToInt32(textBox8.Text);

            model5.teachercourseId = tcId;
            model5.coursename      = comboBox11.Text;
            model5.clustername     = comboBox2.Text;
            model5.semestername    = comboBox12.Text;
            model5.locationname    = comboBox8.Text;
            model5.mode            = comboBox3.Text;
            model5.status          = comboBox4.Text;
            int tId = Convert.ToInt32(textBox9.Text);

            model5.teacherId = tId;
            int cId = Convert.ToInt32(textBox10.Text);

            model5.courseId = cId;
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                tf.teachercourses.Add(model5);

                tf.SaveChanges();
            }

            MessageBox.Show("Data submitted successsfully");
            PopulateGridView2();
            ClearFields2();
        }
示例#11
0
        private void button18_Click(object sender, EventArgs e)
        {
            if (!ValidateCombobox(comboBox7))
            {
                MessageBox.Show("Please Select Location Name");
            }
            else
            {
                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    int locId = Convert.ToInt32(comboBox7.Text);
                    var loadsemesterlocation = (from cs in tf.Incoursesemesters
                                                // join tc in tf.teachercourses on t.teacherId equals tc.teacherId
                                                join cl in tf.Inlocationcourses on cs.courseId equals cl.courseId
                                                where cl.locationId == locId


                                                select new
                    {
                        cs.semesterId,
                        cl.locationId
                    });;;;
                    dataGridView8.DataSource = loadsemesterlocation.ToList();
                }
            }
        }
示例#12
0
        //it will show all the current cluster the teacher is teaching in a course
        public void CurrentClusterDetails()
        {
            using (var Contex = new tafesystemEntities())
            {
                var result = (from tc in Contex.teachercourses
                              join t in Contex.teachers

                              on tc.teacherId equals t.teacherId
                              where tc.teacherId == teacherId
                              join c in Contex.courses
                              on tc.courseId equals c.courseId
                              where tc.courseId == c.courseId

                              select new
                {
                    c.courseId,
                    t.teacherId,
                    t.firstname,
                    t.lastname,
                    tc.coursename,
                    tc.clustername,
                    tc.status,

                    tc.locationname,
                    tc.semestername,
                }).ToList();
                if (result != null)
                {
                    dataGridView1.DataSource = result.ToList();
                    dataGridView1.Refresh();
                }
            }
        }
示例#13
0
        //this will show the timetable of a course a student is doing
        private void button3_Click(object sender, EventArgs e)
        {
            using (var Contex = new tafesystemEntities())
            {
                var result = (from ct in Contex.enrollments
                              join en in Contex.coursetimetables
                              on ct.locationId equals en.locationId
                              where ct.studentId == studentId



                              select new
                {
                    en.days,
                    en.time,
                    en.room,
                    en.teachername,
                    ct.courseId,
                    ct.coursename,
                    ct.locationId,
                    ct.locationname,
                    //ct.status
                }).Take(5);
                if (result != null)
                {
                    dataGridView2.DataSource = result.ToList();
                    dataGridView2.Refresh();
                }
            }
        }
示例#14
0
 //this will show all the course information for a teacher
 private void dataGridView1_DoubleClick(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentRow.Index != -1)
     {
         int SelectedCourseId = Convert.ToInt32(dataGridView1.CurrentRow.Cells["courseId"].Value);
         using (tafesystemEntities db = new tafesystemEntities())
         {
             var result = (from c in db.courseclusterunits
                           join clust in db.clusters on c.clusterId equals clust.clusterId
                           join unit in db.units on c.unitId equals unit.unitId
                           where c.courseId == SelectedCourseId
                           select new
             {
                 c.clusterId,
                 clust.clustername,
                 unit.unitCode,
                 unit.unitTitle
             }).ToList();
             if (result != null)
             {
                 dataGridView1.Visible    = true;
                 dataGridView1.DataSource = result;
                 dataGridView1.Refresh();
             }
         }
     }
 }
示例#15
0
        public void CurrentCourseDetails()
        {
            using (var Contex = new tafesystemEntities())
            {
                var result = (from E in Contex.enrollments
                              join s in Contex.students

                              on E.studentId equals s.studentId
                              where E.studentId == studentId
                              join c in Contex.courses
                              on E.courseId equals c.courseId
                              where E.courseId == c.courseId

                              select new
                {
                    c.courseId,
                    s.studentId,
                    s.firstname,
                    s.lastname,
                    E.coursename,

                    E.locationname,
                    E.semestername,

                    E.result
                }).Take(2);
                if (result != null)
                {
                    dataGridView1.DataSource = result.ToList();
                    dataGridView1.Refresh();
                }
            }
        }
示例#16
0
        //user can add a semester
        private void button1_Click(object sender, EventArgs e)
        {
            if (!ValidateCombobox(comboBox1))
            {
                MessageBox.Show("Semester Name is Required");
            }
            else
            {
                int csId = Convert.ToInt32(textBox1.Text);
                model.semesterId   = csId;
                model.semestername = comboBox1.Text;



                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    tf.coursesemesters.Add(model);

                    tf.SaveChanges();
                }
                ClearFields();
                MessageBox.Show("Data submitted successsfully");
                PopulateGridView();
            }
        }
示例#17
0
        //this will validate the courseId and semster name and then given the infromation about a course and semester
        private void button17_Click(object sender, EventArgs e)
        {
            if (!ValidateCombobox(comboBox14))
            {
                MessageBox.Show("Please Select Course ID");
            }
            else if (!ValidateCombobox(comboBox13))
            {
                MessageBox.Show("Please Select Semester Name");
            }
            else
            {
                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    int courId    = Convert.ToInt32(comboBox14.Text);
                    var loadoffer = (from ccu in tf.courseclusterunits
                                     join c in tf.Inlocationcourses on ccu.courseId equals c.courseId

                                     where c.courseId == courId


                                     join cs in tf.Incoursesemesters on c.courseId equals cs.courseId
                                     join css in tf.coursesemesters on cs.semesterId equals css.semesterId
                                     where css.semestername.Equals(comboBox13.Text)

                                     join clu in tf.clusters on ccu.clusterId equals clu.clusterId
                                     join cl in tf.courselocations on c.locationId equals cl.locationId
                                     join u in tf.units on ccu.unitId equals u.unitId
                                     join t in tf.teachers on clu.teacherId equals t.teacherId

                                     orderby cs.semesterId
                                     orderby cl.locationname
                                     select new
                    {
                        cs.semesterId,
                        ccu.clusterId,
                        ccu.unitId,
                        c.courseId,

                        clu.clustername,
                        u.unitCode,
                        u.unitTitle,
                        u.essential,
                        t.teacherId,
                        t.firstname,
                        t.middlename,
                        t.lastname,

                        cl.locationId,
                        cl.locationname,

                        css.semestername
                    });
                    dataGridView9.DataSource = loadoffer.ToList();
                }
            }
        }
示例#18
0
 //this will fill the textbox with the selected row in datagrid
 private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (dataGridView1.CurrentRow.Index != -1)
     {
         model.locationId = Convert.ToInt32(dataGridView1.CurrentRow.Cells["locationId"].Value);
         using (tafesystemEntities tf = new tafesystemEntities())
         {
             model         = tf.courselocations.Where(x => x.locationId == model.locationId).FirstOrDefault();
             textBox1.Text = Convert.ToInt32(model.locationId).ToString();
             textBox2.Text = model.locationname;
         }
     }
 }
示例#19
0
        public void PopulateGridView()
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from cs in Context.coursesemesters

                             select new
                {
                    cs.semesterId,
                    cs.semestername,
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#20
0
        //user can see all the loc info
        private void button4_Click(object sender, EventArgs e)
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from cl in Context.courselocations

                             select new
                {
                    cl.locationId,
                    cl.locationname,
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#21
0
        public void PopulateGridView()
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from f in Context.fees

                             select new
                {
                    f.feeId,
                    f.paidfee,
                    f.studentId
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#22
0
        private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (dataGridView1.CurrentRow.Index != -1)
            {
                model3.feeId = Convert.ToInt32(dataGridView1.CurrentRow.Cells["feeId"].Value);
                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    model3         = tf.fees.Where(x => x.feeId == model3.feeId).FirstOrDefault();
                    textBox1.Text  = Convert.ToInt32(model3.feeId).ToString();
                    comboBox1.Text = model3.paidfee;

                    textBox2.Text = Convert.ToInt32(model3.studentId).ToString();
                }
            }
        }
示例#23
0
 private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (dataGridView1.CurrentRow.Index != -1)
     {
         model.unitId = Convert.ToInt32(dataGridView1.CurrentRow.Cells["unitId"].Value);
         using (tafesystemEntities tf = new tafesystemEntities())
         {
             model          = tf.units.Where(x => x.unitId == model.unitId).FirstOrDefault();
             textBox1.Text  = Convert.ToInt32(model.unitId).ToString();
             textBox2.Text  = model.unitCode;
             textBox3.Text  = model.unitTitle;
             comboBox1.Text = model.essential;
         }
     }
 }
示例#24
0
        //this will fill the datagrid
        public void PopulateGridView()
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from cl in Context.clusters

                             select new
                {
                    cl.clusterId,
                    cl.clustername,
                    cl.teacherId
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#25
0
 //fill the fields
 private void dataGridView3_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (dataGridView3.CurrentRow.Index != -1)
     {
         model2.userId = Convert.ToInt32(dataGridView3.CurrentRow.Cells["userId"].Value);
         using (tafesystemEntities tf = new tafesystemEntities())
         {
             model2         = tf.tusers.Where(x => x.userId == model2.userId).FirstOrDefault();
             textBox14.Text = Convert.ToInt32(model2.userId).ToString();
             textBox13.Text = model2.username;
             textBox12.Text = model2.password;
             comboBox5.Text = model2.userType;
             textBox11.Text = Convert.ToInt32(model2.userId).ToString();
         }
     }
 }
示例#26
0
        public void PopulateGridView()
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from u in Context.units

                             select new
                {
                    u.unitId,
                    u.unitCode,
                    u.unitTitle,
                    u.essential
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#27
0
        private void button5_Click(object sender, EventArgs e)
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from u in Context.units

                             select new
                {
                    u.unitId,
                    u.unitCode,
                    u.unitTitle,
                    u.essential,
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#28
0
        private void button2_Click(object sender, EventArgs e)
        {
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                int uId    = Convert.ToInt32(textBox1.Text);
                var update = tf.units.First(a => a.unitId == uId);
                update.unitCode  = textBox2.Text;
                update.unitTitle = textBox3.Text;
                update.essential = comboBox1.Text;

                tf.SaveChanges();
            }
            MessageBox.Show("Record Updated sucessfully");
            PopulateGridView();
            ClearFields();
        }
示例#29
0
        public void PopulateGridView()
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from c in Context.courses

                             select new
                {
                    c.courseId,
                    c.coursename,
                    c.mode,
                    c.fee
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }
示例#30
0
        private void button3_Click(object sender, EventArgs e)
        {
            using (var Context = new tafesystemEntities())
            {
                var Record = from c in Context.courses

                             select new
                {
                    c.courseId,
                    c.coursename,
                    c.mode,
                    c.fee,
                };
                dataGridView1.DataSource = Record.ToList();
            }
        }