Ejemplo n.º 1
0
        public void CalculateDegreeTestStrong(double firstValue, double secondValue, double expected)
        {
            ITwoArgumentCalculator calculator = new degree();
            double result = calculator.Calculate(firstValue, secondValue);

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Change the datagrid content with the content specified in the filter boxes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilterResults(object sender, RoutedEventArgs e)
        {
            string f_name, f_surname;

            f_name    = this.fil_name.Text;
            f_surname = this.fil_surname.Text;
            degree f_degree = (degree)this.fil_degree.SelectedItem;

            this.dg_students.ItemsSource  = students.Where(x => filterStudent(x, f_name, f_surname, f_degree));
            this.fil_degree.SelectedIndex = -1;
        }
Ejemplo n.º 3
0
        public ActionResult AddDegree(degree model)
        {
            if (ModelState.IsValid)
            {
                CMSEntities db = new CMSEntities();

                db.degrees.Add(model);
                db.SaveChanges();

                return(JavaScript("New Degree Added Successfully!"));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 4
0
        //update the degree in the database
        private bool updateDegree(student std, degree new_degree)
        {
            long?id_new_deg;

            if (new_degree.isEmpty())
            {
                id_new_deg = null;
            }
            else
            {
                id_new_deg = new_degree.id;
            }

            using (var db = new lppDB())
            {
                db.students.Where(st => st.id == std.id).Set(p => p.degree_id, id_new_deg).Update();
                db.Close();
            }

            return(true);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            // 5.Run the same code in Program.cs from Module 5 to create instances of your classes so that you can setup a single course that is part of a program and a degree path. Be sure to include at least one Teacher and an array of Students.
            student student1 = new student();
            student1.Firstname = "Tony";
            student1.Lastname = "Stark";
            student1.Dateofbirth = "1st Jan 1969";
            student1.Grades.Push(90);
            student1.Grades.Push(100);
            student1.Grades.Push(90);
            student1.Grades.Push(75);
            student1.Grades.Push(60);

            student student2 = new student();
            student2.Firstname = "Steve";
            student2.Lastname = "Rodgers";
            student2.Dateofbirth = "1st Feb 1920";
            student2.Grades.Push(90);
            student2.Grades.Push(100);
            student2.Grades.Push(90);
            student2.Grades.Push(75);
            student2.Grades.Push(60);

            student student3 = new student();
            student3.Firstname = "Bruce";
            student3.Lastname = "Banner";
            student3.Dateofbirth = "1st April 1975";
            student3.Grades.Push(90);
            student3.Grades.Push(100);
            student3.Grades.Push(90);
            student3.Grades.Push(75);
            student3.Grades.Push(60);

            //2.Instantiate a Course object called Programming with C#.
            course ProgrammingCourses = new course();
            ProgrammingCourses.CourseTitle = "Programming with C#";
            ProgrammingCourses.CourseLength = 3;
            ProgrammingCourses.CourseCredits = 90;

            //3.Add your three students to this Course object
            ProgrammingCourses.students.Add(student1);
            ProgrammingCourses.students.Add(student2);
            ProgrammingCourses.students.Add(student3);

            //4.Instantiate at least one Teacher object.
            teacher teacher1 = new teacher();
            teacher1.Firstname = "Stan";
            teacher1.Lastname = "Winston";
            teacher1.Dateofbirth = "1st Dec 1919";

            //5.Add that Teacher object to your Course object
            ProgrammingCourses.teachers[0] = teacher1;

            //6.Instantiate a Degree object, such as Bachelor.
            degree degree1 = new degree();
            degree1.DegreeName = "Bachelor";

            //7.Add your Course object to the Degree object.
            degree1.degreecourse = ProgrammingCourses;

            //8.Instantiate a UProgram object called Information Technology.
            uprogram uprogram1 = new uprogram();
            uprogram1.Programtitle = "Information Technology";

            //9.Add the Degree object to the UProgram object.
            uprogram1.Programdegree = degree1;

            //10.Using Console.WriteLine statements, output
            //Console.WriteLine("The {0} program contains the {1} degree", uprogram1.Programtitle, degree1.DegreeName);
            //Console.WriteLine("The {0} degree contains the course {1}", degree1.DegreeName, ProgrammingCourses.CourseTitle);
            //Console.WriteLine("The {0} course contains {1} students(s)", ProgrammingCourses.CourseTitle, ProgrammingCourses.CourseTitle);

            ProgrammingCourses.ListStudents();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Function called when you finish to edit a datagrid cell
        /// Is the function that update the database with the new value
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Dg_students_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            TextBox t = e.EditingElement as TextBox;  // Assumes columns are all TextBoxes

            Student_item st_edit = (Student_item)dg_students.SelectedValue;

            switch (e.Column.DisplayIndex)
            {
            case COL_ID:
                MessageBox.Show("Are not allowed to change the id!");
                break;

            case COL_NAME:
                if (t.Text.Equals(st_edit.St.name))
                {
                    MessageBox.Show("No changes");
                    return;
                }

                using (var db = new lppDB())
                {
                    db.students.Where(st => st.id == st_edit.St.id).Set(p => p.name, t.Text).Update();
                    db.Close();
                }
                MessageBox.Show("The name has been changed from " +
                                st_edit.St.name + " to " + t.Text);

                break;

            case COL_SURNAME:
                if (t.Text.Equals(st_edit.St.surname))
                {
                    MessageBox.Show("No changes");
                    return;
                }
                using (var db = new lppDB())
                {
                    db.students.Where(st => st.id == st_edit.St.id).Set(p => p.surname, t.Text).Update();
                    db.Close();
                }

                MessageBox.Show("The surname has been changed from " +
                                st_edit.St.surname + " to " + t.Text);
                break;

            case COL_DEGREE:
                ComboBox cb_deg     = e.EditingElement as ComboBox;
                degree   d_selected = (degree)cb_deg.SelectedItem;
                if (cb_deg.SelectedIndex == -1 || d_selected.Equals(st_edit.St.degree))
                {
                    MessageBox.Show("No changes");
                    return;
                }

                this.updateDegree(st_edit.St, d_selected);

                MessageBox.Show("The degree has been changed from " +
                                st_edit.St.degree + " to " + cb_deg.SelectedItem);
                break;

            case COL_GID:
                if (t.Text.Equals(st_edit.St.govern_identifier))
                {
                    MessageBox.Show("No changes");
                    return;
                }
                using (var db = new lppDB())
                {
                    db.students.Where(st => st.id == st_edit.St.id).Set(p => p.govern_identifier, t.Text).Update();
                    db.Close();
                }

                MessageBox.Show("The govern id has been changed from " +
                                st_edit.St.govern_identifier + " to " + t.Text);
                break;

            default:
                MessageBox.Show("Wrong action");
                break;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Check if the student specified has to be chown in the datagrid
        /// </summary>
        /// <param name="st">student to check</param>
        /// <param name="f_name"></param>
        /// <param name="f_surname"></param>
        /// <param name="f_degree"></param>
        /// <returns></returns>
        private Boolean filterStudent(Student_item st, string f_name, string f_surname, degree f_degree)
        {
            if (f_name.Length != 0)
            {
                if (!st.St.name.Contains(f_name))
                {
                    return(false);
                }
            }

            if (f_surname.Length != 0)
            {
                if (!st.St.surname.Contains(f_surname))
                {
                    return(false);
                }
            }

            if (f_degree != null)
            {
                if (f_degree.isEmpty())
                {
                    return(st.Deg == null);
                }

                if (st.Deg == null)
                {
                    return(false);
                }

                if (!st.Deg.name.Equals(f_degree.name) || !st.Deg.code.Equals(f_degree.code))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 8
0
 return(v = GetVector2(degree, scalar));
Ejemplo n.º 9
0
        public ActionResult AddDegree()
        {
            degree deg = new degree();

            return(View(deg));
        }
Ejemplo n.º 10
0
 : this(degree, new KnotVector(degree, points !.Count), points.Select(p => new Point4(p)).ToList())
Ejemplo n.º 11
0
 public Student_item(student st, degree d)
 {
     St  = st;
     Deg = d;
 }