コード例 #1
0
        private bool Obtener_Transaccion_Vehiculo(string vehiculo, 
                                                  string transaccion,
                                                  ref Int16 idVehiculo, 
                                                  ref string numUnidad)
        {
            bool correcto = false;

            clsUtil.totPasajerosLeidos = 0;
            wsConsettur.Vehiculo wsVehiculoVal = new ConsetturMobile.wsConsettur.Vehiculo();           
            Int16 accionTransAnt = 0;
            string loginUserTrans = string.Empty;
            string codBarrasChofer = string.Empty;

            //1° OBTENER DATOS TRANSACCIÓN DE VEHÍCULO
            try
            {
                clsUtil.opIdTx = transaccion;
                wsTrasaccion = null;
                wsTrasaccion = wsConsMobile.buscar_tx_control_cabecera(transaccion,
                                                                       clsUtil.opLoginUser);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(),
                                clsUtil.TituloAviso,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);

                Cursor.Current = Cursors.Default;
                txtVehiculo.SelectAll();
                txtVehiculo.Focus();
                btnEscanear.Enabled = false;
                txtChofer.ReadOnly = true;
                return false;
            }

            //2° VERIFICAR TRANSACCIÓN
            Int16 idCentroCP = wsTrasaccion.idCentro;

            if (idCentroCP != 0)
            {
                if (((wsTrasaccion.errNumber == 0) && (clsUtil.opIdCentro != idCentroCP)) ||
                   ((wsTrasaccion.errNumber == -1) && (clsUtil.opIdCentro != idCentroCP) && (wsTrasaccion.mensaje == "Control en proceso por otro usuario")))
                {
                    //2.1° Cerrar transacción anterior y crear una nueva
                    accionTransAnt = 1;
                }

                if ((wsTrasaccion.errNumber == -1) && (clsUtil.opIdCentro == idCentroCP) && (wsTrasaccion.mensaje == "Control en proceso por otro usuario"))
                {
                    //2° Obtener información de transacción anterior para continuar
                    accionTransAnt = 2;
                }
            }
            switch (accionTransAnt)
            {
                case 1:
                    MessageBox.Show("Bus en proceso. Cerrando transacción anterior ...",
                                    clsUtil.TituloAviso,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);

                    //2.1.1° Cerrar transacción anterior
                    CerrarTransaccion(false);
                    NuevoControl();
                    txtVehiculo.Text = vehiculo;

                    //2.1.2° Generar nueva transacción por vehículo
                    try
                    {
                        wsVehiculoVal = wsConsMobile.buscar_vehiculos(vehiculo);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message.ToString(),
                                        clsUtil.TituloAviso,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation,
                                        MessageBoxDefaultButton.Button1);

                        Cursor.Current = Cursors.Default;
                        txtVehiculo.SelectAll();
                        txtVehiculo.Focus();
                        btnEscanear.Enabled = false;
                        txtChofer.ReadOnly = true;
                        return false;
                    }

                    if (wsVehiculoVal.errNumber == -1)
                    {
                        MessageBox.Show(wsVehiculoVal.mensaje,
                                        clsUtil.TituloAviso,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation,
                                        MessageBoxDefaultButton.Button1);

                        Cursor.Current = Cursors.Default;
                        txtVehiculo.SelectAll();
                        txtVehiculo.Focus();
                        btnEscanear.Enabled = false;
                        txtChofer.ReadOnly = true;
                        return false;
                    }

                    if (wsVehiculoVal.marca.Length > 0)
                    {
                        idVehiculo = wsVehiculoVal.idVehiculo;
                        numUnidad = wsVehiculoVal.nroUnidad.Trim();
                        clsUtil.opIdTx = wsVehiculoVal.marca.Trim();
                        wsTrasaccion = null;
                    }

                    break;

                case 2:
                    //2.2.1° Obtener información de transacción en proceso
                    string[] datos;
                    datos = wsTrasaccion.docChofer.Split('|');
                    loginUserTrans = string.Empty;

                    clsUtil.opIdTx = wsTrasaccion.idTx;
                    codBarrasChofer = datos[0].Trim();
                    loginUserTrans = datos[1].Trim();

                    try
                    {
                        wsTrasaccion = null;
                        wsTrasaccion = wsConsMobile.buscar_tx_control_cabecera(clsUtil.opIdTx,
                                                                               loginUserTrans);
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        MessageBox.Show(ex.Message.ToString(),
                                        clsUtil.TituloAviso,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation,
                                        MessageBoxDefaultButton.Button1);
                        return false;
                    }
                    break;
            }

            //3° MOSTRAR INFORMACIÓN DE TRANSACCIÓN
            Int16 idChofer = 0;
            string nombreChofer = string.Empty;

            if ((accionTransAnt == 0) || (accionTransAnt == 2))
            {
                if ((wsTrasaccion.docChofer != null) && (wsTrasaccion.docChofer.Trim().Length != 0))
                {
                    //Vehículo
                    idVehiculo = wsTrasaccion.idVehiculo;
                    vehiculo = wsTrasaccion.placaVehiculo.Trim();
        
                    //Chofer
                    idChofer = wsTrasaccion.idChofer;

                    string[] datos;
                    datos = wsTrasaccion.docChofer.Split('|');

                    if (datos.Length > 0)
                    {
                        codBarrasChofer = datos[0].Trim();
                    }
                    nombreChofer = wsTrasaccion.chofer.Trim();

                    //Tickets Leídos
                    clsUtil.totPasajerosLeidos = 0;

                    //* Detalle
                    if ((wsTrasaccion != null) && (wsTrasaccion.transaccionDetalle != null))
                    {
                        clsUtil.totPasajerosLeidos = wsTrasaccion.transaccionDetalle.ToList().Count;
                    }

                    //* Detalle Varios
                    Int32 pasajeroVarios = 0;
                    if ((wsTrasaccion != null) && (wsTrasaccion.transaccionDetalleVarios != null))
                    {
                        foreach (wsConsettur.TransaccionDetalleVarios item in wsTrasaccion.transaccionDetalleVarios)
                        {
                            pasajeroVarios = pasajeroVarios + item.cantidad;
                        }
                        clsUtil.totPasajerosLeidos = clsUtil.totPasajerosLeidos + pasajeroVarios;
                    }
                }
            }

            //Vehículo
            clsUtil.opIdVehiculo = idVehiculo;
            clsUtil.opCodBarrasVehiculo = vehiculo;
            txtVehiculo.Text = vehiculo;
            txtNumVehiculo.Text = numUnidad;
            lblNumBus.Text = numUnidad;

            //Transacción
            txtNumControl.Text = clsUtil.opIdTx.Trim();

            //Chofer
            clsUtil.opIdChofer = idChofer;
            txtChofer.Text = codBarrasChofer;
            clsUtil.opCodBarrasChofer = codBarrasChofer;
            txtNombreChofer.Text = nombreChofer;
            clsUtil.opNombreChofer = nombreChofer;

           

            //Total Tickets Leídos
            txtTotal.Text = clsUtil.totPasajerosLeidos.ToString();

            Cursor.Current = Cursors.Default;
            correcto = true;

            return correcto;
        }
コード例 #2
0
 /// <remarks/>
 public System.IAsyncResult Beginsincronizacion_offline(Transaccion transOfflne, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("sincronizacion_offline", new object[] {
                 transOfflne}, callback, asyncState);
 }
コード例 #3
0
 /// <remarks/>
 public System.IAsyncResult Begincancelar_transaccion(Transaccion transaccion, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("cancelar_transaccion", new object[] {
                 transaccion}, callback, asyncState);
 }
コード例 #4
0
 public Transaccion sincronizacion_offline(Transaccion transOfflne) {
     object[] results = this.Invoke("sincronizacion_offline", new object[] {
                 transOfflne});
     return ((Transaccion)(results[0]));
 }
コード例 #5
0
 public Transaccion cancelar_transaccion(Transaccion transaccion) {
     object[] results = this.Invoke("cancelar_transaccion", new object[] {
                 transaccion});
     return ((Transaccion)(results[0]));
 }