Exemplo n.º 1
0
        public static RequestObject GetLessons(string studentId, string password, int periodCode, int periodYearCode)
        {
            var requestObject = new RequestObject();

            requestObject.Type = RequestType.GetLessons;

            var periodObject = new PeriodObject();

            periodObject.StudentId = studentId;
            periodObject.Password  = password;
            periodObject.Code      = periodCode;
            periodObject.YearCode  = periodYearCode;

            requestObject.Period = periodObject;
            return(requestObject);
        }
Exemplo n.º 2
0
        internal static List <Lesson> GetLessons(PeriodObject periodObject)
        {
            var student = new Student();

            student.Id       = periodObject.StudentId;
            student.Password = periodObject.Password;

            /*
             * var period = new Period();
             * period.Code = periodObject.Code;
             * period.YearCode = periodObject.YearCode;
             * period.ProgramCode = periodObject.ProgramCode == 0 ? 1 : periodObject.ProgramCode;
             *
             * return period.GetLessons(student);*/

            var programObject = new ProgramObject()
            {
                StudentId = periodObject.StudentId,
                Password  = periodObject.Password,
                Code      = periodObject.ProgramCode
            };

            if (periodObject.ProgramCode == 0)
            {
                programObject.Code = 1;
            }
            var periods = GetPeriods(programObject);
            var period  = periods.FirstOrDefault(x => x.Code == periodObject.Code && x.YearCode == periodObject.YearCode);
            var lessons = period.Lessons;

            /*if (programObject.StudentId == "1030515866")
             * {
             *  lessons.ForEach(x => {
             *      x.FirstMidterm = new Exam() { Mark = (new Random().Next() % 100) + 1, Date = DateTime.Now };
             *  });
             * }*/
            return(lessons);
        }