Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
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();
            }
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
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();
            }
        }
Ejemplo n.º 8
0
        //user can update the location info
        private void button2_Click(object sender, EventArgs e)
        {
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                int clId   = Convert.ToInt32(textBox1.Text);
                var update = tf.courselocations.First(a => a.locationId == clId);
                update.locationname = textBox2.Text;



                tf.SaveChanges();
            }
            MessageBox.Show("Record Updated sucessfully");
            PopulateGridView();
            ClearFields();
        }
Ejemplo n.º 9
0
        private void button3_Click(object sender, EventArgs e)
        {
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                int fId     = Convert.ToInt32(textBox1.Text);
                var update2 = tf.fees.First(a => a.feeId == fId);
                update2.paidfee = comboBox1.Text;

                int studId = Convert.ToInt32(textBox2.Text);

                tf.SaveChanges();
            }
            MessageBox.Show("Record Updated sucessfully");
            PopulateGridView();
            ClearField();
        }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
0
        //user can add a location
        private void button1_Click(object sender, EventArgs e)
        {
            int clId = Convert.ToInt32(textBox1.Text);

            model.locationId   = clId;
            model.locationname = textBox2.Text;


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

                tf.SaveChanges();
            }
            ClearFields();
            MessageBox.Show("Data submitted successsfully");
            PopulateGridView();
        }
Ejemplo n.º 12
0
        //dele a signin info

        private void button11_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure to delete this record", "Message box", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    var entry = tf.Entry(model2);
                    if (entry.State == System.Data.Entity.EntityState.Detached)
                    {
                        tf.tusers.Attach(model2);
                    }
                    tf.tusers.Remove(model2);
                    tf.SaveChanges();
                    PopulateGridView3();
                    ClearFields3();
                    MessageBox.Show("Deleted Sucessfully");
                }
            }
        }
Ejemplo n.º 13
0
        //login updation
        private void button13_Click(object sender, EventArgs e)
        {
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                int uId     = Convert.ToInt32(textBox14.Text);
                var update1 = tf.tusers.First(a => a.userId == uId);
                update1.username = textBox13.Text;
                update1.password = textBox12.Text;
                update1.userType = comboBox5.Text;


                int teacId = Convert.ToInt32(textBox11.Text);

                tf.SaveChanges();
            }
            MessageBox.Show("Signin Updated sucessfully");
            PopulateGridView3();
            ClearFields3();
        }
Ejemplo n.º 14
0
        private void button5_Click(object sender, EventArgs e)
        {
            using (tafesystemEntities tf = new tafesystemEntities())
            {
                int uId    = Convert.ToInt32(textBox3.Text);
                var update = tf.susers.First(a => a.userId == uId);
                update.username = textBox4.Text;
                update.password = textBox5.Text;
                update.userType = comboBox2.Text;


                int studId = Convert.ToInt32(textBox6.Text);
                update.studentId = studId;
                tf.SaveChanges();
            }
            MessageBox.Show("SignUp Updated sucessfully");
            PopulateGridView2();
            ClearField2();
        }
Ejemplo n.º 15
0
 //update the record
 private void button3_Click(object sender, EventArgs e)
 {
     using (tafesystemEntities tf = new tafesystemEntities())
     {
         int tId    = Convert.ToInt32(textBox2.Text);
         var update = tf.teachers.First(a => a.teacherId == tId);
         update.firstname  = textBox4.Text;
         update.middlename = textBox1.Text;
         update.lastname   = textBox3.Text;
         update.dob        = dateTimePicker1.Value.Date;
         update.gender     = comboBox1.Text;
         update.email      = textBox6.Text;
         update.address    = textBox7.Text;
         update.phone      = textBox5.Text;
         tf.SaveChanges();
     }
     MessageBox.Show("Record Updated sucessfully");
     PopulateGridView();
     ClearFields();
 }
Ejemplo n.º 16
0
 //update a record
 private void button8_Click(object sender, EventArgs e)
 {
     using (tafesystemEntities tf = new tafesystemEntities())
     {
         int tcourId = Convert.ToInt32(textBox8.Text);
         var update2 = tf.teachercourses.First(a => a.teachercourseId == tcourId);
         update2.coursename   = comboBox11.Text;
         update2.clustername  = comboBox2.Text;
         update2.semestername = comboBox12.Text;
         update2.locationname = comboBox8.Text;
         update2.mode         = comboBox3.Text;
         update2.status       = comboBox4.Text;
         int teachId = Convert.ToInt32(textBox9.Text);
         update2.teacherId = teachId;
         int corId = Convert.ToInt32(textBox10.Text);
         update2.courseId = corId;
         tf.SaveChanges();
     }
     MessageBox.Show("Record Updated sucessfully");
     PopulateGridView2();
     ClearFields2();
 }
Ejemplo n.º 17
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (!ValidateForEmptiness(textBox4.Text))
            {
                MessageBox.Show("Username is Required");
            }
            else if (!ValidateForEmptiness(textBox5.Text))
            {
                MessageBox.Show("Password is Required");
            }
            else if (!ValidateCombobox(comboBox2))
            {
                MessageBox.Show("User Type is Required");
            }
            else if (!ValidateForEmptiness(textBox6.Text))
            {
                MessageBox.Show("Student ID is Required");
            }
            int uId = Convert.ToInt32(textBox3.Text);

            model4.userId   = uId;
            model4.username = textBox4.Text;
            model4.password = textBox5.Text;
            model4.userType = comboBox2.Text;
            int stuId = Convert.ToInt32(textBox6.Text);

            model4.studentId = stuId;

            using (tafesystemEntities tf = new tafesystemEntities())
            {
                tf.susers.Add(model4);

                tf.SaveChanges();
            }

            MessageBox.Show("SignUp successsful");
            PopulateGridView2();
            ClearField2();
        }
Ejemplo n.º 18
0
 //Teachers can edit their perosnal details from here
 private void button2_Click(object sender, EventArgs e)
 {
     using (var Context = new tafesystemEntities())
     {
         var Record = (from t in Context.teachers
                       where t.teacherId == teacherId
                       select t).FirstOrDefault();
         if (Record != null)
         {
             Record.address = textBox6.Text;
             Record.phone   = textBox7.Text;
             Record.email   = textBox5.Text;
             Context.SaveChanges();
             MessageBox.Show("Updated Successfully");
             TeacherPersonalDetails();
         }
         else
         {
             MessageBox.Show("Error in Updating Details Try again later!");
         }
     }
 }
Ejemplo n.º 19
0
        //login for teacher
        private void button14_Click(object sender, EventArgs e)
        {
            int uId = Convert.ToInt32(textBox14.Text);

            model2.userId   = uId;
            model2.username = textBox13.Text;
            model2.password = textBox12.Text;
            model2.userType = comboBox5.Text;
            int teacId = Convert.ToInt32(textBox11.Text);

            model2.teacherId = teacId;

            using (tafesystemEntities tf = new tafesystemEntities())
            {
                tf.tusers.Add(model2);

                tf.SaveChanges();
            }

            MessageBox.Show("SignUp successsful");
            PopulateGridView3();
            ClearFields3();
        }
Ejemplo n.º 20
0
        //from here user can add a course in the system
        private void button1_Click(object sender, EventArgs e)
        {
            //perform validation on the entered data
            if (!ValidateCombobox(comboBox1))
            {
                MessageBox.Show("Course Name is Required");
            }

            else if (!ValidateCombobox(comboBox2))
            {
                MessageBox.Show("Course Mode is Required");
            }

            else if (!ValidateCombobox(comboBox3))
            {
                MessageBox.Show("Course Fee is Required");
            }

            else
            {
                int cId = Convert.ToInt32(textBox1.Text);
                model.courseId   = cId;
                model.coursename = comboBox1.Text;
                model.mode       = comboBox2.Text;
                model.fee        = comboBox3.Text.Trim();

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

                    tf.SaveChanges();
                }
                ClearFields();
                MessageBox.Show("Data submitted successsfully");
                PopulateGridView();
            }
        }
Ejemplo n.º 21
0
        //add the teacher info
        private void button1_Click(object sender, EventArgs e)
        {
            if (!ValidateForEmptiness(textBox4.Text))
            {
                MessageBox.Show("First Name is required");
            }
            else if (!ValidateForEmptiness(textBox1.Text))
            {
                MessageBox.Show("Middle Name is required");
            }
            else if (!ValidateForEmptiness(textBox3.Text))
            {
                MessageBox.Show("Last Name is required");
            }
            else if (!ValidateCombobox(comboBox1))
            {
                MessageBox.Show("Gender is Required");
            }
            else if (!ValidateForEmptiness(textBox6.Text))
            {
                MessageBox.Show(" Email is required");
            }
            else if (!ValidEmail(textBox6.Text))
            {
                MessageBox.Show("Enter email correctly");
            }

            else if (!ValidateForEmptiness(textBox5.Text))
            {
                MessageBox.Show(" Address is required");
            }
            else if (!ValidateForEmptiness(textBox7.Text))
            {
                MessageBox.Show(" Phone Number is required");
            }
            else if (!ValidateForNumeric(textBox7.Text))
            {
                MessageBox.Show("Phone should be in numbers");
            }

            else if (ValidateForLength(textBox7.Text, 11) == false)
            {
                MessageBox.Show("Enter a valid phone number");
            }
            else
            {
                int tId = Convert.ToInt32(textBox2.Text);
                model.teacherId  = tId;
                model.firstname  = textBox4.Text.Trim();
                model.middlename = textBox1.Text.Trim();
                model.lastname   = textBox3.Text.Trim();
                model.dob        = dateTimePicker1.Value.Date;
                model.gender     = comboBox1.Text.Trim();
                model.email      = textBox6.Text.Trim();
                model.address    = textBox7.Text.Trim();
                model.phone      = textBox5.Text.Trim();
                using (tafesystemEntities tf = new tafesystemEntities())
                {
                    tf.teachers.Add(model);

                    tf.SaveChanges();
                }
                ClearFields();
                MessageBox.Show("Data submitted successsfully");
                PopulateGridView();
            }
        }