Example #1
0
        private void AddMark_Click(object sender, EventArgs e)
        {
            try
            {
                int groupAddSelectedIndex = AddMarkGroupCombobox.SelectedIndex;
                int GroupId = groupsList[groupAddSelectedIndex].GroupId;

                int StudentAddSelectedIndex = AddMarkStudentsCombobox.SelectedIndex;
                int StudentId = studentsList[StudentAddSelectedIndex].StudentId;

                int SubjectAddSelectedIndex = AddMarkSubjectCombobox.SelectedIndex;
                int SubjectId = subjectsList[SubjectAddSelectedIndex].SubjectId;

                Marks newMark = new Marks();
                newMark.StudentId = StudentId;
                newMark.SubjectId = SubjectId;
                newMark.Date      = DateTime.Now.Date;
                newMark.Mark      = int.Parse(AddMarkMarkTextbox.Text);

                //insert into database
                repository.InsertMark(newMark);
                AddMarkMarkTextbox.Clear();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }
        }
Example #2
0
        public void Mark(int Id, int id, int j, double[] arrScore)
        {
            var subjectdata = _database.Subjects.FirstOrDefault(m => m.Id == Id);
            var score       = new Mark()
            {
                Score = arrScore[j], SubjectId = subjectdata.Id, StudentId = id
            };

            _markRepository.InsertMark(score);
        }
        private void AddMarkButton_Click(object sender, EventArgs e)
        {
            int     mark        = int.Parse(MarkComboBox.SelectedItem.ToString());
            Student student     = CurrentStudent();
            int     studentId   = StudentRepository.GetIdByJmbg(student.Jmbg);
            int     courseId    = CoursesRepository.GetIdByTitle(GetCurrentCourse());
            bool    isMarkAdded = MarksRepository.InsertMark(mark, studentId, courseId);

            if (isMarkAdded)
            {
                FillStudentMarks();
            }
        }