public void GoToMap(int position) { Manboss_mandados_ruta r = map.GoTo(position); SetDetallesRuta(r); TabMap(null, null); }
private async void crear_mandado() { //Crear arreglo de rutas List <Manboss_mandados_ruta> rutas = new List <Manboss_mandados_ruta>(); foreach (Lugares lugar in GlobalValues.arr_lugares) { Manboss_mandados_ruta aux = new Manboss_mandados_ruta(); aux.Servicio = lugar.Servicio; aux.Latitud = lugar.Latitud; aux.Longitud = lugar.Longitud; aux.Calle = lugar.Calle; aux.Numero = lugar.Numero; aux.Comentarios = lugar.Comentarios; aux.Terminado = lugar.Terminado; } //Obtener datos de la sesión Context mContext = Application.Context; ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(mContext); int cliente_id = prefs.GetInt("int", 0); //Crear mandado Manboss_mandado mandado = new Manboss_mandado(); mandado.Estado = 1; mandado.Cliente = cliente_id; mandado.Total = 0; mandado.Fecha = DateTime.Now; mandado.Tipo_pago = 0; mandado.Cuenta_pendiente = 0; //Enviar a base de datos await mandado_core.CrearMandado(rutas, mandado); }
private async Task Agregar_marcadores() { if (GlobalValues.arr_lugares.Count > 0) { LatLngBounds.Builder builder = new LatLngBounds.Builder(); List <Manboss_mandados_ruta> puntos = new List <Manboss_mandados_ruta>(); foreach (Lugares aux in GlobalValues.arr_lugares) { MarkerOptions markerOpt1 = new MarkerOptions(); LatLng lugar = new LatLng(aux.Latitud, aux.Longitud); builder.Include(lugar); markerOpt1.SetPosition(lugar); markerOpt1.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.mandado)); _map.AddMarker(markerOpt1); Manboss_mandados_ruta posicion = new Manboss_mandados_ruta(); posicion.Latitud = aux.Latitud; posicion.Longitud = aux.Longitud; puntos.Add(posicion); } //polyline await Obtener_direcciones(puntos); //Mover camera LatLngBounds bounds = builder.Build(); CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngBounds(bounds, 300); _map.MoveCamera(cameraUpdate); //Revisar mínimo de ubicaciones Lugares primero = GlobalValues.arr_lugares.First(); if (GlobalValues.arr_lugares.Count >= primero.Min) { btn_pagar_mandado.Visibility = ViewStates.Visible; } } }
public void SetDetallesRuta(Manboss_mandados_ruta r) { int task = r.Servicio - 1; txt_Task.Text = Common.Services.Service[task]; txt_Direction.Text = r.Calle + " " + r.Numero; txt_Detail.Text = r.Comentarios; }
public string GetComentario(Marker marker) { int n = 0; foreach (Marker m in markers) { if (m.Equals(marker)) { Manboss_mandados_ruta r = Route[n]; return(r.Comentarios); } n++; } return(string.Empty); }
public Manboss_mandados_ruta MarkerClick(Marker marker) { int n = 0; foreach (Marker m in markers) { if (m.Equals(marker)) { Manboss_mandados_ruta r = Route[n]; return(r); } n++; } return(null); }
public bool OnMarkerClick(Marker marker) { string msg = string.Empty; r_actual = map.MarkerClick(marker); if (r_actual != null) { Android.App.AlertDialog.Builder builder = Dialogs.YesNoDialog(string.Empty, string.Empty, this, Resource.Style.AlertDialogDefault); mDialog = builder.Show(); LayoutInflater inflater = this.LayoutInflater; View view = inflater.Inflate(Resource.Layout.CompletePointLayout, null); mDialog.SetContentView(view); mDialog.Window.SetSoftInputMode(SoftInput.StateHidden); Window window = mDialog.Window; window.SetLayout(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); mDialog.Show(); TextView txt_Comment = view.FindViewById <TextView>(Resource.Id.txt_Comment); TextView txt_Comments = view.FindViewById <TextView>(Resource.Id.txt_Comments); TextView txt_Complete = view.FindViewById <TextView>(Resource.Id.txt_Complete); Button btn_ok = view.FindViewById <Button>(Resource.Id.btn_ok); string aux = map.GetComentario(marker); if (aux.Length > 0) { txt_Comments.Text = aux; } else { txt_Comment.Visibility = ViewStates.Gone; txt_Comments.Visibility = ViewStates.Gone; } if (map.Route.Count == 1) { txt_Complete.Text = this.Resources.GetString(Resource.String.active_completeOrder); } else { txt_Complete.Text = this.Resources.GetString(Resource.String.active_completePoint); } btn_ok.Click += RemoveMarker; } return(true); }
public async Task <double> CompleteTask(Manboss_mandados_ruta r) { if (route.Count == 1) { ComissionsData cData = new ComissionsData(context); await data.SetOrder(order.Id, 4); await cData.AddComission(User.Repartidor.Repartidor, order.Id); Manboss_mandado aux = await cData.GetMandado(order.Id); return(aux.Total); } if (await data.CompleteTask(r.Id)) { return(1); } else { return(0); } }
public async void RemoveMarker(object sender, EventArgs e) { Dialogs.CreateProgressDialog(this, Resource.Style.AlertDialogDefault); mDialog.Dismiss(); if (r_actual != null) { double total = await core.CompleteTask(r_actual); r_actual = null; if (core.route.Count == 1) { string result = string.Format("{0:0.00}", total); Android.App.AlertDialog.Builder builder = Dialogs.YesNoDialog( "Total", "El total del mandado fué: \n\n $ " + result, this, Resource.Style.AlertDialogDefault); builder.SetPositiveButton("OK", EndOrder); Dialog d = builder.Show(); } else { OnMapReady(map.Map); } } Dialogs.DismissProgressDialog(); }
private LatLng GetLatLng(Manboss_mandados_ruta r) { LatLng aux = new LatLng(r.Latitud, r.Longitud); return(aux); }