private void GolfClock_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var checkDate = ViewModel.SelectedDate; var time = e.AddedItems[0].ToString(); int hours = Convert.ToInt32(time.Substring(0, 2)); int minutes = Convert.ToInt32(time.Substring(3, 2)); var dateTime = new DateTime(checkDate.Year, checkDate.Month, checkDate.Day, hours, minutes, 0); var roomName = (string)(sender as RadClock).Header; var bookingsService = new BookingsService() { BookedRooms = ViewModel.RoomBookings, BookedCaterings = ViewModel.CateringsBookings, BookedGolfs = ViewModel.GolfBookings }; var _event = bookingsService.GetModelByGolf(roomName, dateTime); if (_event != null) { this.IsEnabled = false; var view = new EventDetailsView(new EventModel(_event)); view.ShowDialog(); this.IsEnabled = true; // ViewModel.Refresh(); } }
private void DetailsItemCommandExecuted(EventModel item) { RaisePropertyChanged("DisableParentWindow"); var view = new EventDetailsView(item); view.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); }
public EventDetailsViewController(EventItem eventItem) { AutomaticallyAdjustsScrollViewInsets = false; EventItem currentEvent = eventItem ?? EventItem.NullEvent(); _contentView = new EventDetailsView(this) { Image = Converters.FromBase64(currentEvent.LargeImage), Name = currentEvent.Name, LocationDescription = "Стадион школы №1037", Date = currentEvent.Date.ToString("dd.MM"), Time = "в " + currentEvent.Date.ToString("hh:mm"), ParticipantsCount = 2.ToString(), ParticipantCountWord = "участника", DescriptionText = currentEvent.Description }; }
private void RoomClock_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var checkDate = ViewModel.SelectedDate; var time = e.AddedItems[0].ToString(); int hours = Convert.ToInt32(time.Substring(0, 2)); int minutes = Convert.ToInt32(time.Substring(3, 2)); var dateTime = new DateTime(checkDate.Year, checkDate.Month, checkDate.Day, hours, minutes, 0); var roomName = (string)(sender as RadClock).Header; var bookingsService = new BookingsService() { BookedRooms = ViewModel.RoomBookings, BookedCaterings = ViewModel.CateringsBookings, BookedGolfs = ViewModel.GolfBookings }; var events = bookingsService.GetModelsByRoom(roomName, dateTime).Distinct().ToList(); if (events.Any()) { this.IsEnabled = false; // TODO: If current date has several events ? //Done if (events.Count == 1) { var view = new EventDetailsView(new EventModel(events.First())); view.ShowDialog(); } else { var view = new EventsBookedView(new ObservableCollection <EventModel>(events.Select(p => new EventModel(p)))); view.ShowDialog(); } this.IsEnabled = true; //ViewModel.Refresh(); } }
private async void OpenEventCommandExecute(EventEnquiryModel model) { RaisePropertyChanged("DisableParentWindow"); if (model.Event != null) { var window = new EventDetailsView(model.Event); window.ShowDialog(); } else { var enquiries = await _crmDataUnit.EnquiriesRepository.GetLightEnquiriesAsync(x => x.ID == model.Enquiry.Enquiry.ID); var enquiryModel = new EnquiryModel(enquiries.FirstOrDefault()); var window = new NewEnquiryView(enquiryModel); window.ShowDialog(); } RaisePropertyChanged("EnableParentWindow"); }
private void RoomClock_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var checkDate = ViewModel.SelectedDate; var time = e.AddedItems[0].ToString(); int hours = Convert.ToInt32(time.Substring(0, 2)); int minutes = Convert.ToInt32(time.Substring(3, 2)); var dateTime = new DateTime(checkDate.Year, checkDate.Month, checkDate.Day, hours, minutes, 0); var roomName = (string)(sender as RadClock).Header; var bookingsService = new BookingsService() { BookedRooms = ViewModel.RoomBookings, BookedCaterings = ViewModel.CateringsBookings, BookedGolfs = ViewModel.GolfBookings }; var events = bookingsService.GetModelsByRoom(roomName, dateTime).Distinct().ToList(); if (events.Any()) { this.IsEnabled = false; // TODO: If current date has several events ? //Done if (events.Count == 1) { var view = new EventDetailsView(new EventModel(events.First())); view.ShowDialog(); } else { var view = new EventsBookedView(new ObservableCollection<EventModel>(events.Select(p => new EventModel(p)))); view.ShowDialog(); } this.IsEnabled = true; //ViewModel.Refresh(); } }