private void PushToSingleton() { BookingSingleton singleton = BookingSingleton.Instance; string myDate = SelectedDate.ToString("dd/MM/yyyy"); DateTimePeriod date = DateTimePeriodConverter.ToDate(myDate); singleton.SelectedDate = date; }
public BookingDescriptionToCancelVM() { NavigateToMenuPageCommand = new RelayCommand(NavigateToMenuPage); NavigateBackCommand = new RelayCommand(NavigateBack); CancelRoomCommand = new RelayCommand(CancelRoom); AttendeesCancelSingleton singleton = AttendeesCancelSingleton.Instance; //Initialize the properties with the data from singleton (previous page) MeetingName = singleton.SelectedBooking.BookingTitle; Date = DateTimePeriodConverter.ToDate(singleton.SelectedBooking.StartTime); Length = singleton.SelectedBooking.Length; RoomNumber = singleton.SelectedBooking.RoomID; Description = singleton.SelectedBooking.Description; GoingStudents = singleton.StudentsOnBooking; StatetThatGoing = singleton.StudentsOnBookingGoing; }
private void SendData() { BookingSingleton singleton = BookingSingleton.Instance; LoggedInSingleton singletonLoggedIn = LoggedInSingleton.Instance; DateTimePeriod date = singleton.SelectedDate; int starttimeH = singleton.StartTimeHour; int starttimeM = singleton.StartTimeMinute; date = DateTimePeriodConverter.AppendToDate(date, starttimeH, starttimeM); string mydate = DateTimePeriodConverter.ToString(date); Room room = singleton.SelectedRoom; int length = singleton.Length; int loggedstudentID = singletonLoggedIn.LoggedStudentID; Persistance.AddNewBooking(loggedstudentID, mydate, length, room.RommID, MeetingName, MeetingDescription); }
private void GetTimePeriods() //Go to persistance and get the time periods for this room on this date - if it's already booked or not { BookingSingleton sing = BookingSingleton.Instance; int roomID = sing.SelectedRoom.RommID; DateTimePeriod date = sing.SelectedDate; TimePeriods = Persistance.GetBookingsOnRoom(roomID); int usedLabel = 0; foreach (Booking timePeriod in TimePeriods) { if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Day == date.Day) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Month == date.Month) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Year == date.Year)) { if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 8) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 20)) { usedLabel = 0; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 9) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 10)) { usedLabel = 1; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 10) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 5)) { usedLabel = 2; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 10) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 55)) { usedLabel = 3; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 12) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 15)) { usedLabel = 4; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 13) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 5)) { usedLabel = 5; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 14) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 0)) { usedLabel = 6; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 14) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 50)) { usedLabel = 7; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 15) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 50)) { usedLabel = 8; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 16) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 50)) { usedLabel = 9; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 17) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 50)) { usedLabel = 10; } else if ((DateTimePeriodConverter.ToDate(timePeriod.StartTime).Hour == 18) && (DateTimePeriodConverter.ToDate(timePeriod.StartTime).Minute == 50)) { usedLabel = 11; } else { MessageDialog msg = new MessageDialog("There was some error. Go back and select another room."); msg.ShowAsync(); } FillList(); int length = timePeriod.Length; for (int i = usedLabel; i <= (usedLabel + length) - 1; i++) { switch (i) { case 0: textBox1 = true; break; case 1: textBox2 = true; break; case 2: textBox3 = true; break; case 3: textBox4 = true; break; case 4: textBox5 = true; break; case 5: textBox6 = true; break; case 6: textBox7 = true; break; case 7: textBox8 = true; break; case 8: textBox9 = true; break; case 9: textBox10 = true; break; case 10: textBox11 = true; break; case 11: textBox12 = true; break; } } } } }
public void TestMethod2() { Assert.AreEqual(5, DateTimePeriodConverter.MakeMonth("05")); }
public void TestMethod1() { DateTimePeriod date = DateTimePeriodConverter.ToDate("1/9/2012"); Assert.AreEqual("1/9/2012 0:0", DateTimePeriodConverter.ToString(date)); }
public static IEnumerable <Message> GetMessages(int StudentID) { Messages = new List <Message>(); HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:15320"); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("api/Attendees").Result; if (response.IsSuccessStatusCode) { var attendees = response.Content.ReadAsAsync <IEnumerable <Attendee> >().Result; foreach (var att in attendees) { if (att.StudentID == StudentID) { HttpResponseMessage response2 = client.GetAsync("api/Bookings").Result; if (response2.IsSuccessStatusCode) { var bookings = response2.Content.ReadAsAsync <IEnumerable <Booking> >().Result; foreach (var b in bookings) { if (b.BookingID == att.BookingID) { Messages.Add(new Message() { BookingTitle = b.BookingTitle, MeetingDescription = b.Description, MeetingDate = DateTimePeriodConverter.ToDate(b.StartTime), BookingID = b.BookingID, MeetingLength = b.Length, RoomID = b.RoomID }); } } } else { MessageDialog message = new MessageDialog("There were some errors during the proccess. Try again."); message.ShowAsync(); return(null); } } } return(Messages); } else { MessageDialog message = new MessageDialog("There were some errors during the proccess. Try again."); message.ShowAsync(); return(null); } }