protected override async void OnViewLoaded(object view) { base.OnViewLoaded(view); RouteModel rm = RouteDataAccess.GetRouteById(RouteId); RouteName = rm.RouteName; ServiceTemplateList = new BindableCollection <ServiceTemplateModel>(ServiceTemplateDataAccess.GetServiceTemplatesPerRoute(RouteId)); ServiceList = new BindableCollection <ServiceModel>(ServicesDataAccess.GetServicesPerRoute(RouteId).OrderBy(x => x.StartTime)); NotifyOfPropertyChange(() => ServiceTemplateList); NotifyOfPropertyChange(() => ServiceList); NotifyOfPropertyChange(() => RouteName); NotifyOfPropertyChange(() => TimetableName); }
public void SaveServiceTemplate() { var newService = new ServiceTemplateModel(); newService.CalculatedDuration = CalculatedDuration; newService.ServiceTemplateAbbreviation = ServiceTemplateAbbreviation; newService.ServiceTemplateDescription = ServiceTemplateDescription; newService.ServiceTemplateName = ServiceTemplateName; newService.ServiceType = SelectedServiceClass.ServiceClassName; newService.ServiceDirectionId = ServiceDirectionId; newService.RouteId = RouteId; if (ServiceTemplateId <= 0) { ServiceTemplateDataAccess.InsertServiceTemplate(newService); } else { newService.Id = ServiceTemplateId; ServiceTemplateDataAccess.UpdateServiceTemplate(newService); } ServiceTemplateUI.ServiceTemplateList = new BindableCollection <ServiceTemplateModel>(ServiceTemplateDataAccess.GetServiceTemplatesPerRoute(RouteId)); ClearServiceTemplate(); }
protected override async void OnViewLoaded(object view) { base.OnViewLoaded(view); RouteModel rm = RouteDataAccess.GetRouteById(RouteId); ServiceTemplateUI.RouteName = rm.RouteName; RouteId = rm.Id; ServiceTemplateUI.ServiceTemplateList = new BindableCollection <ServiceTemplateModel>(ServiceTemplateDataAccess.GetServiceTemplatesPerRoute(RouteId)); ServiceDirectionList = new BindableCollection <ServiceDirectionModel>(ServiceDirectionDataAccess.GetAllServiceDirectionsPerRoute(RouteId)); ServiceClassList = ServiceClassDataAccess.GetAllServiceClasses(); TimeEventTypeList = TimeEventTypeDataAccess.GetAllTimeEventTypes(); NotifyOfPropertyChange(() => TimeEventTypeList); NotifyOfPropertyChange(() => ServiceClassList); NotifyOfPropertyChange(() => ServiceTemplateUI); NotifyOfPropertyChange(() => ServiceDirectionList); }