Beispiel #1
0
        static void Main()
        {
            var students = StudentsInfo.StudentsInformantion();

            var filterByMarksWeak = students.ExtensionCount();

            foreach (var st in filterByMarksWeak)
            {
                Console.WriteLine("{0} {1} {2}", st.FirstName, st.LastName, string.Join(", ", st.Marks));
            }
        }
Beispiel #2
0
        static void Main()
        {
            var students      = StudentsInfo.StudentsInformantion();
            var filterByEmail = from st in students
                                where st.Email.Contains("@abv.bg")
                                select st;

            foreach (var st in filterByEmail)
            {
                Console.WriteLine("{0} {1} {2}", st.FirstName, st.LastName, st.Email);
            }
        }
        static void Main()
        {
            var students      = StudentsInfo.StudentsInformantion();
            var filterByMarks =
                from st in students
                where st.Marks.Max() == 6
                select new { Fullname = string.Join(" ", st.FirstName, st.LastName), Marks = string.Join(", ", st.Marks) };

            foreach (var st in filterByMarks)
            {
                Console.WriteLine(st.Fullname + " " + st.Marks);
            }
        }
Beispiel #4
0
 public async Task <IActionResult> Put([FromBody] StudentsInfo value)
 {
     try
     {
         var entity = _mapper.Map <BL.StudentsInfo>(value);
         var id     = _service.SaveAsync(entity);
         return(Ok(id));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Beispiel #5
0
        static void Main()
        {
            var list = StudentsInfo.StudentsInformantion();
            var studentsInTwoGroup = from st in list
                                     where st.GroupNumber == 2
                                     orderby st.FirstName
                                     select st;

            foreach (var st in studentsInTwoGroup)
            {
                Console.WriteLine("First name = {0} Last name = {1} Age = {2} FacultyNumber = {3} Phone = {4} Email = {5} Marks = {6} Group number = {7}",
                                  st.FirstName, st.LastName, st.Age, st.FacultyNumber, st.Phone, st.Email, string.Join(", ", st.Marks), st.GroupNumber);
            }
        }
        static void Main()
        {
            var students = StudentsInfo.StudentsInformantion();

            var filterByPhone =
                from st in students
                where st.Phone.Contains("02") || st.Phone.Contains("+3592") || st.Phone.Contains("+359 2")
                select st;

            foreach (var st in filterByPhone)
            {
                Console.WriteLine("{0} {1} {2}", st.FirstName, st.LastName, st.Phone);
            }
        }
Beispiel #7
0
        static void Main()
        {
            var students = StudentsInfo.StudentsInformantion();

            var studentOrderByAlphabet =
                from st in students
                where st.FirstName.CompareTo(st.LastName) < 0
                select st;

            foreach (var st in studentOrderByAlphabet)
            {
                Console.WriteLine("First name = {0} Last name = {1} Age = {2} FacultyNumber = {3} Phone = {4} Email = {5} Marks = {6} Group number = {7}",
                                  st.FirstName, st.LastName, st.Age, st.FacultyNumber, st.Phone, st.Email, string.Join(", ", st.Marks), st.GroupNumber);
            }
        }
        static void Main()
        {
            var students = StudentsInfo.StudentsInformantion();

            var studentOrderByAlphabet =
                from st in students
                where st.Age >= 18 && st.Age <= 24
                select st;

            foreach (var st in studentOrderByAlphabet)
            {
                Console.WriteLine("First name = {0} Last name = {1} Age = {2}",
                                  st.FirstName, st.LastName, st.Age);
            }
        }
Beispiel #9
0
 private void MapForUpdateentity(StudentsInfo entity, DA.StudentsInfo daEntity)
 {
     daEntity.Id = entity.Id;
 }
Beispiel #10
0
        private void ReadExlcel(string fileName)
        {
            Excel.Application xlApp;
            Excel.Workbook    xlWorkBook;
            Excel.Worksheet   xlWorkSheet;
            Excel.Range       range;

            int    rCnt     = 0;
            int    cCnt     = 0;
            double max      = 0;
            double progress = 0;

            LoadingProggres = 10.0;

            xlApp       = new Excel.Application();
            xlWorkBook  = xlApp.Workbooks.Open(fileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

            if (xlWorkSheet == null)
            {
                LastError       = "Unable read the excel file! Worksheets missmatch.";
                LoadingProggres = 0.0;
                throw new FileFormatException();
            }

            range = xlWorkSheet.UsedRange;

            for (rCnt = 1; rCnt <= range.Rows.Count; rCnt++)
            {
                var celr = (range.Cells[rCnt, 2] as Excel.Range);
                if (celr.Value2 == null)
                {
                    max = (rCnt - 1) * range.Columns.Count;
                    break;
                }
            }

            for (rCnt = 1; rCnt <= range.Rows.Count; rCnt++)
            {
                var lineData = new List <string>();
                for (cCnt = 1; cCnt <= range.Columns.Count; cCnt++)
                {
                    var celr = (range.Cells[rCnt, cCnt] as Excel.Range);

                    // Fill disciplines
                    if (rCnt == 1 && cCnt > Properties.Settings.Default.DISCIPLINES_START_INDEX)
                    {
                        var value = GetExcelRangeValue(celr);

                        DisciplineLabels.Add(value);
                    }
                    // Collect Assessments
                    else if (rCnt > 1)
                    {
                        var value = GetExcelRangeValue(celr);

                        if (cCnt == 2 && celr.Value2 == null)
                        {
                            goto Break;
                        }

                        lineData.Add(value.ToString());
                    }

                    LoadingProggres = Helper.Lerp(10.0, PROGGRES_MAX, ++progress / max);
                }

                // Fill Assessments
                if (rCnt > 1)
                {
                    var student = new StudentInfo(lineData);
                    StudentsInfo.Add(student);

                    if (OnStudentAdded != null)
                    {
                        OnStudentAdded(student, null);
                    }
                }
            }

Break:

            LoadingProggres = PROGGRES_MAX;

            xlWorkBook.Close(true, null, null);
            xlApp.Quit();

            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            if (OnExcelLoaded != null)
            {
                OnExcelLoaded(this, DisciplineLabels, StudentsInfo);
            }
        }