Esempio n. 1
0
 private async void Btnmppalc()
 {
     MainViewModel.GetInstance().OperationsLog = new OperationsLogViewModel(true);
     await Application.Current.MainPage.Navigation.PushAsync(new OperationsLogPage());
 }
Esempio n. 2
0
 private async void Btnmppala()
 {
     MainViewModel.GetInstance().StatisticalReportsMenu = new StatisticalReportsMenuViewModel();
     await Application.Current.MainPage.Navigation.PushModalAsync(new StatisticalReportsMenuPage());
 }
Esempio n. 3
0
 private async void Btnmppalb()
 {
     MainViewModel.GetInstance().MonitoringAndExecutionMenu = new MonitoringAndExecutionMenuViewModel();
     await Application.Current.MainPage.Navigation.PushModalAsync(new MonitoringAndExecutionMenuPage());
 }
Esempio n. 4
0
 private async void About()
 {
     MainViewModel.GetInstance().About = new AboutViewModel();
     await Application.Current.MainPage.Navigation.PushModalAsync(new AboutPage());
 }
Esempio n. 5
0
 private async void Btnmppald()
 {
     MainViewModel.GetInstance().PlannerMenu = new PlannerMenuViewModel();
     await Application.Current.MainPage.Navigation.PushModalAsync(new PlannerMenuPage());
 }
        private async void Graph()
        {
            if (this.TemplateSelected == null)
            {
                Alert.Show("Debe seleccionar una plantilla!");
                return;
            }
            if (this.LotSelected == null)
            {
                Alert.Show("Debe seleccionar un lote!");
                return;
            }

            try
            {
                UserDialogs.Instance.ShowLoading("Obteniendo datos del reporte...", MaskType.Black);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!TokenValidator.IsValid(TokenGet))
                    {
                        if (!await ApiIsOnline())
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            if (!await GetTokenSuccess())
                            {
                                UserDialogs.Instance.HideLoading();
                                Toast.ShowError(AlertMessages.Error);
                                return;
                            }
                        }
                    }
                    LogExecutionDelayResultQueryValues logExecutionDelayResultQueryValues = new LogExecutionDelayResultQueryValues()
                    {
                        IdTemplate = this.TemplateSelected.IdTemplate,
                        IdLog      = 0,
                        IdLot      = (this.LotSelected != null ? this.LotSelected.IdLot : 0),
                        IdCommand  = (this.CommandSelected != null ? this.CommandSelected.IdCommand : 0),
                        IdEvent    = (this.EventSelected != null ? this.EventSelected.IdEvent : 0),
                        StartDate  = (this.StartDateValue == null ? DateTime.Now : this.StartDateValue.SelectedDate),
                        EndDate    = (this.EndDateValue == null ? DateTime.Now : this.EndDateValue.SelectedDate),
                        Monday     = this.WeekDays.Monday,
                        Tuesday    = this.WeekDays.Tuesday,
                        Wednesday  = this.WeekDays.Wednesday,
                        Thursday   = this.WeekDays.Thursday,
                        Friday     = this.WeekDays.Friday,
                        Saturday   = this.WeekDays.Saturday,
                        Sunday     = this.WeekDays.Sunday
                    };
                    Response resultGetResults = await ApiSrv.LogExecutionDelayGetResults(TokenGet.Key, logExecutionDelayResultQueryValues);

                    if (!resultGetResults.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        LogExecutionDelayResults = JsonConvert.DeserializeObject <List <LogExecutionDelayResult> >(Crypto.DecodeString(resultGetResults.Data));
                        if (LogExecutionDelayResults.Count == 0)
                        {
                            UserDialogs.Instance.HideLoading();
                            Alert.Show("No hay datos para mostrar!");
                            return;
                        }
                        UserDialogs.Instance.HideLoading();
                        MainViewModel.GetInstance().LogExecutionDelayChart = new LogExecutionDelayChartViewModel(true, LogExecutionDelayResults);
                        await Application.Current.MainPage.Navigation.PushModalAsync(new LogExecutionDelayChartPage());
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError("Ocurrió un error.");
            }
        }
Esempio n. 7
0
 private async void Status()
 {
     MainViewModel.GetInstance().StatusInfoDependencies = new StatusInfoDependenciesViewModel();
     await Application.Current.MainPage.Navigation.PushModalAsync(new StatusInfoDependenciesPage());
 }
Esempio n. 8
0
        private async void Report()
        {
            if (this.LogItemSelected == null)
            {
                Alert.Show("Debe seleccionar una bitácora!");
                return;
            }

            try
            {
                UserDialogs.Instance.ShowLoading("Obteniendo datos del reporte...", MaskType.Black);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!TokenValidator.IsValid(TokenGet))
                    {
                        if (!await ApiIsOnline())
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            if (!await GetTokenSuccess())
                            {
                                UserDialogs.Instance.HideLoading();
                                Toast.ShowError(AlertMessages.Error);
                                return;
                            }
                        }
                    }
                    OperationsLogResultQueryValues operationsLogResultQueryValues = new OperationsLogResultQueryValues()
                    {
                        IdLog         = this.LogItemSelected.IdLog,
                        IdUser        = (this.OperatorItemSelected != null ? this.OperatorItemSelected.IdUser : ""),
                        IdStatus      = (this.StatusItemSelected != null ? this.StatusItemSelected.IdStatus : ""),
                        IdEnvironment = (this.EnvironmentItemSelected != null ? this.EnvironmentItemSelected.IdEnvironment : 0),
                        IdService     = (this.ServiceItemSelected != null ? this.ServiceItemSelected.IdService : 0),
                        IdLot         = (this.LotItemSelected != null ? this.LotItemSelected.IdLot : 0),
                        IdCommand     = (this.CommandItemSelected != null ? this.CommandItemSelected.IdCommand : 0),
                        StartDateFrom = (this.StartDateFromValue == null ? DateTime.Now : this.StartDateFromValue.SelectedDate),
                        StartDateTo   = (this.StartDateToValue == null ? DateTime.Now : this.StartDateToValue.SelectedDate),
                        EndDateFrom   = (this.EndDateFromValue == null ? DateTime.Now : this.EndDateFromValue.SelectedDate),
                        EndDateTo     = (this.EndDateToValue == null ? DateTime.Now : this.EndDateToValue.SelectedDate),
                    };
                    Response resultGetResults = await ApiSrv.OperationsLogGetResults(TokenGet.Key, operationsLogResultQueryValues);

                    if (!resultGetResults.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        OperationsLogResults = JsonConvert.DeserializeObject <List <OperationsLogResult> >(Crypto.DecodeString(resultGetResults.Data));
                        if (OperationsLogResults.Count == 0)
                        {
                            UserDialogs.Instance.HideLoading();
                            Alert.Show("No hay datos para mostrar!");
                            return;
                        }
                        if (OperationsLogReportItems == null)
                        {
                            OperationsLogReportItems = new ObservableCollection <OperationsLogReportItem>();
                        }
                        else
                        {
                            OperationsLogReportItems.Clear();
                        }
                        foreach (OperationsLogResult item in OperationsLogResults)
                        {
                            OperationsLogReportItems.Add(new OperationsLogReportItem()
                            {
                                IdLog           = item.IdLog,
                                IdInstance      = item.IdInstance,
                                IdLot           = item.IdLot,
                                IdCommand       = item.IdCommand,
                                IdUser          = item.IdUser,
                                Environment     = item.Environment,
                                Service         = item.Service,
                                CodeCommand     = item.CodeCommand,
                                NameCommand     = item.NameCommand,
                                Product         = item.Product,
                                StartDate       = (item.StartDate != null) ? ((DateTime)item.StartDate) : new DateTime(),
                                EndDate         = (item.EndDate != null) ? ((DateTime)item.EndDate) : new DateTime(),
                                Duration        = item.Duration,
                                Status          = item.Status,
                                IPClient        = item.IPClient,
                                NameLog         = item.NameLog,
                                InstanceNumber  = item.InstanceNumber,
                                CodeLot         = item.CodeLot,
                                NameLot         = item.NameLot,
                                Source          = item.Source,
                                Critical        = item.Critical,
                                StartDateString = (item.StartDate != null) ? ((DateTime)item.StartDate).ToString(DateTimeFormatString.LatinDate24Hours) : "",
                                EndDateString   = (item.EndDate != null) ? ((DateTime)item.EndDate).ToString(DateTimeFormatString.LatinDate24Hours) : ""
                            });
                        }
                        UserDialogs.Instance.HideLoading();
                        MainViewModel.GetInstance().OperationsLogReport = new OperationsLogReportViewModel(true, OperationsLogReportItems);
                        await Application.Current.MainPage.Navigation.PushModalAsync(new OperationsLogReportPage());
                    }
                }
            }
            catch (Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError("Ocurrió un error.");
            }
        }