Пример #1
0
        protected void timerPosition_Tick(object sender, EventArgs e)
        {
            if (hiddenLatitude.Value != String.Empty && hiddenLongitude.Value != String.Empty)
            {
                txtEndereco.Text = Localizacao.ObterEndereco(Convert.ToDouble(hiddenLatitude.Value.Replace(".", ",")), Convert.ToDouble(hiddenLongitude.Value.Replace(".", ",")));
            }

            divCarregando.Visible = false;
            divPosicao.Visible    = true;
            timerPosition.Enabled = false;
            txtEndereco.Focus();

            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), CONSTANTE_SCRIPT_GEOLOCALIZACAO, true);
        }
Пример #2
0
        public static Leg ObterDirecao(double latTaxista, double lngTaxista, double latCliente, double lngCliente)
        {
            DirectionsRequest request = new DirectionsRequest();

            request.Origin      = Localizacao.ObterEndereco(latTaxista, lngTaxista);
            request.Destination = Localizacao.ObterEndereco(latCliente, lngCliente);
            //request.TravelMode = TravelMode.Transit;
            //request.DepartureTime = DateTime.Now;

            try
            {
                DirectionsResponse response = GoogleMapsApi.GoogleMaps.Directions.Query(request);
                return(response.Routes.First().Legs.First());
            }
            catch { }

            return(null);
        }
Пример #3
0
        protected void viewAguardandoAtendimento_Activate(object sender, EventArgs e)
        {
            lblTitulo.Text = App_LocalResources.MensagensResource.ATENDIMENTO_REQUISICAO;

            OFMS       ofms       = OFMS.GetInstance();
            Requisicao requisicao = ofms.ObterRequisicao(Base.SessaoUsuario.ID);

            if (requisicao != null && requisicao.Taxista != null && requisicao.Taxista.PosicaoAtual != null)
            {
                DirectionsRequest request = new DirectionsRequest();
                request.Origin      = Localizacao.ObterEndereco(requisicao.Taxista.PosicaoAtual.Latitude, requisicao.Taxista.PosicaoAtual.Longitude);
                request.Destination = Localizacao.ObterEndereco(requisicao.Cliente.PosicaoAtual.Latitude, requisicao.Cliente.PosicaoAtual.Longitude);

                try
                {
                    DirectionsResponse response = GoogleMapsApi.GoogleMaps.Directions.Query(request);
                    Leg leg = response.Routes.First().Legs.First();
                    lblPrevisao.Text  = leg.Duration.Text.ToString();
                    lblDistancia.Text = leg.Distance.Text.ToString();

                    StringBuilder rota = new StringBuilder();
                    foreach (Step step in leg.Steps)
                    {
                        rota.Append("&#8226; " + step.HtmlInstructions.Replace("<b>", "").Replace("<b />", "") + "<br />");
                    }
                    lblRota.Text = rota.ToString();

                    if (requisicao.Cliente != null)
                    {
                        lblCliente.Text = requisicao.Cliente.Pessoa.NomeOuRazaoSocial;
                    }
                }
                catch { }
            }

            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "GetAtendimento()", true);
        }
Пример #4
0
        protected void viewAguardeAtendimento_Activate(object sender, EventArgs e)
        {
            OFMS       ofms       = OFMS.GetInstance();
            Requisicao requisicao = ofms.ObterRequisicao(Base.SessaoUsuario.ID);

            if (requisicao != null && requisicao.Taxista != null && requisicao.Taxista.PosicaoAtual != null)
            {
                DirectionsRequest request = new DirectionsRequest();
                request.Origin      = Localizacao.ObterEndereco(requisicao.Taxista.PosicaoAtual.Latitude, requisicao.Taxista.PosicaoAtual.Longitude);
                request.Destination = Localizacao.ObterEndereco(requisicao.Cliente.PosicaoAtual.Latitude, requisicao.Cliente.PosicaoAtual.Longitude);

                try
                {
                    DirectionsResponse response = GoogleMapsApi.GoogleMaps.Directions.Query(request);
                    Leg leg = response.Routes.First().Legs.First();
                    lblPrevisao.Text    = leg.Duration.Text.ToString();
                    lblPlaca.Text       = requisicao.Taxista.Veiculo.Placa;
                    lblResponsavel.Text = requisicao.Taxista.Pessoa.NomeOuRazaoSocial;
                }
                catch { }
            }

            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "GetAtendimento()", true);
        }