예제 #1
0
        private void UpdateAvgMark(Student student, ISender sender)
        {
            var studentAndLectionsList = _studentsAndLectionsDal.GetAllStudentsAndLections();
            var resultList             = studentAndLectionsList.Where(s => s.student.studentId.Id == student.studentId.Id).Select(s => s).ToList();

            student.averageMark = CalculateAvgMark(resultList);
            if (resultList.Count != 0)
            {
                if (student.averageMark < _avgMark)
                {
                    sender.Send(_messageToSend, _universityEmail, student.email);
                }
            }
        }
예제 #2
0
        public void Report(StudentId studentId, string pathToReport)
        {
            if (String.IsNullOrEmpty(pathToReport))
            {
                _logger.Log("You put incorrect path");
            }
            var studentInformationList = _studentsAndLectionsDal.GetAllStudentsAndLections();
            var studentIdList          = studentInformationList.Where(s => s.student.studentId.Id == studentId.Id).ToList();

            using (XmlTextWriter xmlWriter = new XmlTextWriter(pathToReport, Encoding.UTF8))
            {
                xmlWriter.WriteStartElement("List of presence");
                foreach (var l in studentIdList)
                {
                    xmlWriter.WriteElementString("StudentId", l.student.studentId.Id.ToString());
                    xmlWriter.WriteElementString("LectionName", l.lection.lectionName);
                    xmlWriter.WriteElementString("First Name", l.student.firstName);
                    xmlWriter.WriteElementString("Second Name", l.student.secondName);
                    xmlWriter.WriteElementString("LectionDate", l.lection.lectionData.ToString());
                    xmlWriter.WriteElementString("Presence", l.presence.ToString());

                    xmlWriter.Flush();
                }
                xmlWriter.WriteEndElement();
            }
        }
예제 #3
0
        public void Report(StudentId studentId, string pathToReport)
        {
            if (String.IsNullOrEmpty(pathToReport))
            {
                _logger.Log("You put incorrect path");
            }
            var studentInformationList = _studentsAndLectionsDal.GetAllStudentsAndLections();
            var studentIdList          = studentInformationList.Where(s => s.student.studentId.Id == studentId.Id).ToList();

            using (StreamWriter sWriter = new StreamWriter(pathToReport))
            {
                sWriter.Write("List of presence\n");
                foreach (var l in studentIdList)
                {
                    sWriter.WriteLine(
                        "StudentId : {0} | Lection Name {1} | First Name : {2} | Second Name : {3} | Lection Date : {4} | Presence : {5}",
                        l.student.studentId.Id.ToString(), l.lection.lectionName, l.student.firstName,
                        l.student.secondName, l.lection.lectionData.ToString(), l.presence.ToString());
                }
            }
        }