Ejemplo n.º 1
0
        public void UpdateStudent(StudentWrapper studentWrapper)
        {
            var student = studentWrapper.ToDao();
            var ratings = studentWrapper.ToRatingDao();

            using (var context = new ApplicationDbContext())
            {
                UpdateStudentProperties(context, student);

                var studentsRatings = GetStudentsRatings(context, student);

                UpdateRate(student, ratings, context, studentsRatings,
                           Subject.Math);
                UpdateRate(student, ratings, context, studentsRatings,
                           Subject.ForeignLang);
                UpdateRate(student, ratings, context, studentsRatings,
                           Subject.Physics);
                UpdateRate(student, ratings, context, studentsRatings,
                           Subject.PolishLang);
                UpdateRate(student, ratings, context, studentsRatings,
                           Subject.Technology);

                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var a = new StudentWrapper();

            var b = a.RandomValue();

            var c = a.add(5.6, 6.5);
        }
Ejemplo n.º 3
0
 public static Student ToDao(this StudentWrapper model)
 {
     return(new Student
     {
         Id = model.Id,
         FirstName = model.FirstName,
         LastName = model.LastName,
         GroupId = model.Group.Id,
         Comments = model.Comments,
         Activities = model.Activities,
     });
 }
        static void Main(string[] args)
        {
            Student student = new Student();

            student.Name = "Joe";

            StudentSubClass studentSubClassed = new StudentSubClass();

            studentSubClassed.Name = "";     // THIS LINE IS DISALLOWED FOR COMPILATION.

            StudentWrapper studentWrapped = new StudentWrapper(student);

            studentWrapped.Name = "";     // THIS LINE IS DISALLOWED FOR COMPILATION.
        }
        public AddEditStudentViewModel(StudentWrapper student = null)
        {
            CloseCommand   = new RelayCommand(Close);
            ConfirmCommand = new RelayCommand(Confirm);

            if (student == null)
            {
                Student = new StudentWrapper();
            }
            else
            {
                Student  = student;
                IsUpdate = true;
            }

            InitGroups();
        }
Ejemplo n.º 6
0
        public void AddStudents(StudentWrapper studentWrapper)
        {
            var student = studentWrapper.ToDao();
            var ratings = studentWrapper.ToRatingDao();

            using (var context = new ApplicationDbContext())
            {
                var dbStudent = context.Students.Add(student);

                ratings.ForEach(x =>
                {
                    x.StudentId = dbStudent.Id;
                    context.Ratings.Add(x);
                });
                context.SaveChanges();
            }
        }
        static void Main(string[] args)
        {
            var cppManager = new CallbackManager();

            cppManager.OnEnum += HandleCpp;

            var student = new StudentWrapper("Gareth", 45);

            Console.WriteLine($"Student Name: {student.Name}");
            Console.WriteLine($"Student GPA: {student.Gpa}");

            //new FormHandler().ShowMessageBox("From C#");

            cppManager.RaiseEvent(1);

            Console.ReadLine();
        }
Ejemplo n.º 8
0
        public AddEditStudentViewModel(StudentWrapper student = null)
        {
            CloseCommand   = new RelayCommand(Close);
            ConfirmCommand = new RelayCommand(Confirm);


            if (student == null) //IsUpdate domyślnie jest false - wtedy jest dodawanie
            {
                Student = new StudentWrapper();
            }
            else
            {
                Student  = student;
                IsUpdate = true;
            }

            InitGroups();
        }
Ejemplo n.º 9
0
        public void AddStudent(StudentWrapper studentWrapper)
        {
            var student = studentWrapper.ToDao();
            var ratings = studentWrapper.ToRatingDao();

            using (var context = new ApplicationDBContext())
            {
                var dbStudents = context.Students.Add(student); //dodajemy do bazy studenta a następnie pobieramy jego id
                //zapisz każdą ocenę do bazy
                ratings.ForEach(x =>
                {
                    x.StudentId = dbStudents.Id;
                    context.Ratings.Add(x);
                });

                context.SaveChanges();
            }
        }
Ejemplo n.º 10
0
        static int Main()
        {
            StudentWrapper student01 = new StudentWrapper();

            student01.Name("foo");
            student01.Age(20);
            student01.Comment("Good!");

            student01.Print();

            StudentWrapper student02 = new StudentWrapper();

            student01.Name("bar");
            student01.Age(12);

            System.Console.WriteLine("csharp> Name = " + student02.Name());
            System.Console.WriteLine("csharp> Age = " + student02.Age());
            System.Console.WriteLine("csharp> Comment = " + student02.Comment());

            return 0;
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            Student student = new Student();

            student.Name = "Joe";

            StudentSubClass studentSubClassed = new StudentSubClass();

            studentSubClassed.Name = "";     // THIS LINE IS DISALLOWED FOR COMPILATION.

            StudentWrapper studentWrapped = new StudentWrapper(student);

            studentWrapped.Name = "";     // THIS LINE IS DISALLOWED FOR COMPILATION.

            ReadOnlyStudent studentReadOnly = student as ReadOnlyStudent;

            if (studentReadOnly != null)
            {
                studentReadOnly.Name = "";
            }
        }
Ejemplo n.º 12
0
        public void UpdateStudent(StudentWrapper studentWrapper)
        {
            var student = studentWrapper.ToDao();
            var grading = studentWrapper.ToGradingDao();

            using (var context = new ApplicationDbContext())
            {
                UpdateStudentProperties(student, context);

                var studentsGrading = GetStudentsGrading(context, student);


                UpdateGrade(student, grading, context, studentsGrading, Subject.Math);
                UpdateGrade(student, grading, context, studentsGrading, Subject.ForeignLang);
                UpdateGrade(student, grading, context, studentsGrading, Subject.Physics);
                UpdateGrade(student, grading, context, studentsGrading, Subject.PolishLang);
                UpdateGrade(student, grading, context, studentsGrading, Subject.Technology);


                context.SaveChanges();
            }
        }
Ejemplo n.º 13
0
 public AddEditStudentsView(StudentWrapper student = null)
 {
     InitializeComponent();
     DataContext = new AddEditStudentViewModel(student);
 }
Ejemplo n.º 14
0
        public static List <Rating> ToRatingDao(this StudentWrapper model)
        {
            var ratings = new List <Rating>();

            if (!string.IsNullOrWhiteSpace(model.Math))
            {
                model.Math.Split(',')
                .ToList().ForEach(x => ratings.Add(
                                      new Rating
                {
                    Rate      = int.Parse(x),
                    StudentId = model.Id,
                    SubjectId = (int)Subject.Math
                }));
            }

            if (!string.IsNullOrWhiteSpace(model.Technology))
            {
                model.Technology.Split(',')
                .ToList()
                .ForEach(x => ratings.Add(
                             new Rating
                {
                    Rate      = int.Parse(x),
                    StudentId = model.Id,
                    SubjectId = (int)Subject.Technology
                }));
            }
            if (!string.IsNullOrWhiteSpace(model.Physics))
            {
                model.Physics.Split(',')
                .ToList()
                .ForEach(x => ratings.Add(
                             new Rating
                {
                    Rate      = int.Parse(x),
                    StudentId = model.Id,
                    SubjectId = (int)Subject.Physics
                }));
            }
            if (!string.IsNullOrWhiteSpace(model.PolishLang))
            {
                model.PolishLang.Split(',')
                .ToList()
                .ForEach(x => ratings.Add(
                             new Rating
                {
                    Rate      = int.Parse(x),
                    StudentId = model.Id,
                    SubjectId = (int)Subject.PolishLang
                }));
            }
            if (!string.IsNullOrWhiteSpace(model.EnglishLang))
            {
                model.EnglishLang.Split(',')
                .ToList()
                .ForEach(x => ratings.Add(
                             new Rating
                {
                    Rate      = int.Parse(x),
                    StudentId = model.Id,
                    SubjectId = (int)Subject.EnglishLang
                }));
            }

            return(ratings);
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var wrapper = new TestWrapper();

            wrapper.DoWork();

            var wrapper2 = new StudentWrapper("Student A", 8.46);

            Console.WriteLine($"Student's name is {wrapper2.Name}");
            Console.WriteLine($"Student's gpa is {wrapper2.Gpa}");

            var display = new Display();

            display.Print("Hello world 2");

            var e = new EntityWrapper("The Wallman", 20, 35);

            e.Move(5, -10);

            var sa = new MyNamesSplitterClass("Firstname Surname");

            sa.Print();

            MyPoint point = new MyPoint();

            point.x = 1;
            point.x = 2;
            point.x = 3;

            var enum1 = SomeColors.Yellow;
            var enum2 = SomeColorsTyped.Yellow;

            sa.Arrays();
            sa.Avg("Result is", 1, 2, 3, 4, 5, 6, 7, 8, 50);

            uint clustersSize = 3;

            float[,] samples = new float[, ]
            {
                { 0.9f, 2.75f }, // g1 -> .
                { 0.9f, 2.85f }, // g1 -> g2
                { 1f, 3.1f },    // g2 -> .
                { 1.1f, 2.9f },  // g1 -> g2
                { 0.9f, 4f } // g3 -> .
            };

            uint   samplesSize  = (uint)samples.GetLength(0);
            ushort featuresSize = (ushort)samples.GetLength(1);

            float[,] centroids = new float[clustersSize, featuresSize];
            uint[] assignments = new uint[samplesSize];
            float  avgDistance = 0;

            KMCudaWrapper.Clusterize(
                init: KMCUDAInitMethodM.kmcudaInitMethodPlusPlus,
                tolerance: 0.05f,
                yinyang_t: 0.1f,
                metric: KMCUDADistanceMetricM.kmcudaDistanceMetricL2,
                samples_size: samplesSize,
                features_size: featuresSize,
                clusters_size: clustersSize,
                seed: 777,
                device: 1,
                device_ptrs: -1,
                fp16x2: false,
                verbosity: 2,
                samples: samples,
                centroids: ref centroids,
                assignments: ref assignments,
                average_distance: ref avgDistance,
                false
                );

            Console.WriteLine("End");
        }