private async void LoadTasksQuery() { m_Query.nav = this.NavigationBarControl; ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); CObject o = await m_ComosWeb.GetObjectBySystemFullName(projectdata.SelectedLayer, "@Q|@M|MyTasks"); //ToolbarItems.Add(new ToolbarItem("Lista", "", async () => //{ // m_Query.ViewMode = controls.QueryControl.QueryViewMode.Accordion; // await m_Query.ShowListQuery(); //})); //ToolbarItems.Add(new ToolbarItem("Tabela", "", async () => //{ // m_Query.ViewMode = controls.QueryControl.QueryViewMode.List; // await m_Query.ShowTableQuery(); //})); m_Query.StartQuery(projectdata.SelectedDB.Key, o); this.NavigationBarControl.OnFiltered += m_Query.Nav_OnFiltered; }
private async Task <bool> LoadWorkPackages() { bool result = true; try { ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); IDatabase db = Services.XServices.Instance.GetService <IDatabase>(); //this.ShowToast($"Finding CObject on DB"); CObject o = db.GetCObjectByFullName(projectdata.SelectedLayer.UID, Constants.QueryWorkPackagesAnFailureSystemFullName); if (o == null) { try { o = await m_ComosWeb.GetObjectBySystemFullName(projectdata.SelectedLayer, Constants.QueryWorkPackagesAnFailureSystemFullName); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } db.InsertCObject(o, projectdata.SelectedLayer.UID); } if (o == null) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), Services.TranslateExtension.TranslateText("my_wp_not_found"), "OK"); return(false); } if (!keepElements) { try { m_QueryResult = await m_ComosWeb.GetqueriesResult( projectdata.SelectedDB.Key, o.ProjectUID, o.OverlayUID, projectdata.SelectedLanguage.LCID, o.UID, null); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } } else { keepElements = false; } if (m_QueryResult != null) { if (m_QueryResult.Rows.Count() > 0) { List <WorkPackageViewModel> tasks = new List <WorkPackageViewModel>(); foreach (var row in m_QueryResult.Rows) { tasks.Add(new WorkPackageViewModel(m_QueryResult.Columns, row)); } this.TasksCollection = tasks.ToArray(); OnPropertyChanged("TasksCollection"); OnPropertyChanged("TasksAttributeNames"); UpdateSortingAndGrouping(); OnPropertyChanged("SelectedIndex"); } else { ShowToast(Services.TranslateExtension.TranslateText("no_wp_found")); } ListViewTasks.EndRefresh(); } else { //page not loaded at comosweboffline ShowToast(Services.TranslateExtension.TranslateText("no_wp_found")); ListViewTasks.EndRefresh(); } } catch (Exception e) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), e.Message, "OK"); return(false); } return(result); }
public static async Task <bool> LoadLogBookForm() { CQuerieResult m_QueryResult; try { ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); IDatabase db = Services.XServices.Instance.GetService <IDatabase>(); CObject o = db.GetCObjectByFullName(projectdata.SelectedLayer.UID, Constants.QueryLogBookTypesFullName); if (o == null) { try { o = await m_ComosWeb.GetObjectBySystemFullName(projectdata.SelectedLayer, Constants.QueryLogBookTypesFullName); } catch (TaskCanceledException) { return(false); } // If there is a Logout Request catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } db.InsertCObject(o, projectdata.SelectedLayer.UID); } if (o == null) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), Services.TranslateExtension.TranslateText("no_logbook_types_found"), "OK"); return(false); } try { m_QueryResult = await m_ComosWeb.GetqueriesResult( projectdata.SelectedDB.Key, o.ProjectUID, o.OverlayUID, projectdata.SelectedLanguage.LCID, o.UID, null); } catch (TaskCanceledException) { return(false); } // If there is a Logout Request catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } if (m_QueryResult != null) { Converters.IsQueryCachedValue cachehandler = new Converters.IsQueryCachedValue(); cachehandler.GetQueryCachedValues(m_QueryResult); if (m_QueryResult.Rows.Length > 0) { logBook = new ViewModel(m_QueryResult.Columns, m_QueryResult.Rows[0]); return(true); } else { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), Services.TranslateExtension.TranslateText("no_logbook_types_found"), "OK"); return(false); } } else { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), Services.TranslateExtension.TranslateText("no_logbook_types_found"), "OK"); return(false); } } catch (Exception e) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), e.Message, "OK"); return(false); } }
private async Task <bool> LoadDevices() { bool result = false; try { ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); IDatabase db = Services.XServices.Instance.GetService <IDatabase>(); CObject o = db.GetCObjectByFullName(projectdata.SelectedLayer.UID, GetQueryFullName()); if (o == null) { try { o = await m_ComosWeb.GetObjectBySystemFullName(projectdata.SelectedLayer, GetQueryFullName()); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } db.InsertCObject(o, projectdata.SelectedLayer.UID); } if (o == null) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), Services.TranslateExtension.TranslateText("event_container_not_found"), "OK"); return(false); } try { m_QueryResult = await m_ComosWeb.GetqueriesResult( projectdata.SelectedDB.Key, o.ProjectUID, o.OverlayUID, projectdata.SelectedLanguage.LCID, o.UID, null); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } if (m_QueryResult != null) { Converters.IsQueryCachedValue cachehandler = new Converters.IsQueryCachedValue(); cachehandler.GetQueryCachedValues(m_QueryResult); if (m_QueryResult.Rows.Length > 0) { List <ViewModel> unassignedEventsList = new List <ViewModel>(); foreach (var row in m_QueryResult.Rows) { unassignedEventsList.Add(new ViewModel(m_QueryResult.Columns, row)); } this.DeviceContainerCollection = unassignedEventsList.ToArray(); OnPropertyChanged("EventContainerCollection"); /*OnPropertyChanged("TasksAttributeNames"); * UpdateSortingAndGrouping();*/ result = true; } else { ShowToast("No hay resultados"); result = false; } } else { //page not loaded at comosweboffline ShowToast("No hay resultados"); } ((ListView)ListViewDevices_).EndRefresh(); } catch (Exception e) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), e.Message, "OK"); return(false); } return(result); }
public async Task <bool> LoadIncidentTypes() { bool result = false; try { ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); IDatabase db = Services.XServices.Instance.GetService <IDatabase>(); //this.ShowToast($"Finding CObject on DB"); CObject o = db.GetCObjectByFullName(projectdata.SelectedLayer.UID, Constants.QueryIncidentTypesFullName); if (o == null) { try { o = await m_ComosWeb.GetObjectBySystemFullName(projectdata.SelectedLayer, Constants.QueryIncidentTypesFullName); } catch (TaskCanceledException) { return(false); } // If there is a Logout Request catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } db.InsertCObject(o, projectdata.SelectedLayer.UID); } if (o == null) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), Services.TranslateExtension.TranslateText("my_incidents_not_found"), "OK"); return(false); } try { m_QueryResult = await m_ComosWeb.GetqueriesResult( projectdata.SelectedDB.Key, o.ProjectUID, o.OverlayUID, projectdata.SelectedLanguage.LCID, o.UID, null); } catch (TaskCanceledException) { return(false); } // If there is a Logout Request catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar query: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } if (m_QueryResult != null) { Converters.IsQueryCachedValue cachehandler = new Converters.IsQueryCachedValue(); cachehandler.GetQueryCachedValues(m_QueryResult); if (m_QueryResult.Rows.Length > 0) { List <ViewModel> incidentTypes = new List <ViewModel>(); foreach (var row in m_QueryResult.Rows) { incidentTypes.Add(new ViewModel(m_QueryResult.Columns, row)); } this.IncidentTypesCollection = incidentTypes.ToArray(); OnPropertyChanged("IncidentTypesCollection"); /*OnPropertyChanged("TasksAttributeNames"); * UpdateSortingAndGrouping();*/ } else { ShowToast(Services.TranslateExtension.TranslateText("no_incidents_types_found")); } result = true; } else { //page not loaded at comosweboffline ShowToast(Services.TranslateExtension.TranslateText("no_incidents_types_found")); } ListViewIncidents.EndRefresh(); } catch (Exception e) { await App.Current.MainPage.DisplayAlert(Services.TranslateExtension.TranslateText("error"), e.Message, "OK"); return(false); } return(result); }