Esempio n. 1
0
 public DateTime CalculateDue()
 {
     return(DateContract.AddMonths(NumberInstallment));
 }
Esempio n. 2
0
        //VorlesungsAPI

        /// <summary>
        /// Abfrage des persönlichen Stundenplans für eine Woche
        /// </summary>
        /// <param name="UserId">Die UserId des Accounts in der Datenbank</param>
        /// <returns>Liste nach Wochentagen mit den persönlichen/gebuchten Kursterminen</returns>
        public PersonalPlanResponse GetPersonalDates(string UserId)
        {
            //Da hier Abfrage der persönlichen Termine nur für kommende Woche, Festlegung der Variablen des Zeitraums
            //Alle eigenen Termine von jetzt bis zur nächsten Woche
            var from  = DateTime.Now;
            var until = from.AddDays(7);

            var userService = new UserInfoService();
            var user        = userService.GetUser(UserId);

            if (user != null && user.UserName.Equals("*****@*****.**"))
            {
                // Demodaten
                var dateList     = new List <OwnDatesContract>();
                var courseList   = new List <DateContract>();
                var roomList     = new List <DateRoomContract>();
                var lecturerList = new List <DateLecturerContract>();

                var demoRoom = new DateRoomContract
                {
                    RoomId     = Guid.NewGuid().ToString(),
                    RoomNumber = "R 1.083"
                };
                roomList.Add(demoRoom);

                var demoLecturer = new DateLecturerContract
                {
                    LecturerId   = Guid.NewGuid().ToString(),
                    LecturerName = "Demo Dozent"
                };
                lecturerList.Add(demoLecturer);

                var demoCourse = new DateContract
                {
                    StartTime  = "10:00",
                    EndTime    = "11:30",
                    IsCanceled = false,
                    Titel      = "Demovorlesung",
                    Rooms      = roomList,
                    Lecturers  = lecturerList
                };

                courseList.Add(demoCourse);

                var today = DateTime.Today;

                var demoDate = new OwnDatesContract
                {
                    StatedDate = today.ToString("dd.MM.yyyy"),
                    InfoString = null,
                    Dates      = courseList
                };
                dateList.Add(demoDate);

                var date      = today;
                var endOfWeek = today.AddDays(7);
                while (date <= endOfWeek)
                {
                    demoDate = new OwnDatesContract
                    {
                        StatedDate = date.ToString("dd.MM.yyyy"),
                        InfoString = null,
                        Dates      = new List <DateContract>()
                    };
                    dateList.Add(demoDate);

                    date = date.AddDays(1);
                }


                var demoResponse = new PersonalPlanResponse
                {
                    Courses = dateList,
                };
                //Rückgabe der Response
                return(demoResponse);
            }

            //Initialisierung des ActivityInfoService
            var activityService = new ActivityInfoService();

            //Abfrage der persönlichen Termine mit Hilfe des ActivityInfoService und den Parametern
            var activityList = activityService.GetPersonalDates(UserId, from, until);

            //Erstellen des Response mit Hilfe der activityList
            var response = new PersonalPlanResponse
            {
                Courses = activityList,
            };

            //Rückgabe der Response
            return(response);
        }