예제 #1
0
        public static async void buscarFreteComoMotorista(bool carregando = true)
        {
            if (carregando)
            {
                UserDialogs.Instance.ShowLoading("carregando...");
            }
            try
            {
                var regraMotorista = MotoristaFactory.create();
                var motorista      = regraMotorista.pegarAtual();
                var regraFrete     = FreteFactory.create();
                var fretes         = await regraFrete.listar(0, 0, FreteSituacaoEnum.ProcurandoMotorista);

                var freteListaPage = new FreteListaPage
                {
                    Title       = "Buscar atendimentos",
                    Fretes      = fretes,
                    FiltroBotao = false,
                    NovoBotao   = false
                };
                if (carregando)
                {
                    UserDialogs.Instance.HideLoading();
                }
                ((RootPage)App.Current.MainPage).PushAsync(freteListaPage);
            }
            catch (Exception e)
            {
                if (carregando)
                {
                    UserDialogs.Instance.HideLoading();
                }
                await UserDialogs.Instance.AlertAsync(e.Message, "Erro", "Entendi");
            }
        }
예제 #2
0
        public static async void listarMeuFreteComoMotorista()
        {
            UserDialogs.Instance.ShowLoading("carregando...");
            try
            {
                var regraMotorista = MotoristaFactory.create();
                var motorista      = regraMotorista.pegarAtual();
                var regraFrete     = FreteFactory.create();
                var fretes         = await regraFrete.listar(0, motorista.Id);

                var freteListaPage = new FreteListaPage
                {
                    Title       = "Meus atendimentos",
                    Fretes      = fretes,
                    FiltroBotao = false,
                    NovoBotao   = false
                };
                UserDialogs.Instance.HideLoading();
                ((RootPage)App.Current.MainPage).PushAsync(freteListaPage);
            }
            catch (Exception e)
            {
                UserDialogs.Instance.HideLoading();
                await UserDialogs.Instance.AlertAsync(e.Message, "Erro", "Entendi");
            }
        }