コード例 #1
0
ファイル: torno.cs プロジェクト: krlosoul/torno
    private void SalidaTorno(Tortno torno)
    {
        Tarjetas t = this.GetDatoTarjeta();
        t.hora_salida = torno.fecha_actual;//obtiene la hora y fecha actual del torno
        t.estacion_destino = torno.estacion; //nombre de estacion
        t.ultimo_acceso = torno.fecha_actual;

        //calcular el tiempo recorrido
        DateTime fecha1 = Convert.ToDatetime(t.hora_entrada.ToString("HH:mm:ss")));
        DateTime fecha2 = Convert.ToDatetime(t.hora_salida.ToString("HH:mm:ss")));
        double tiempo = fecha2.Subtract(fecha1).TotalHours;
        
        double velocidad = 60; //el recorrido es en promedio de 60 km/h
        double distancia = velocidad * tiempo;
        
        double cobro = 100; //se cobra 100 pesos por kilomero recorrido
        double valor_cobro = distancia * cobro;

        if(valor_cobro > t.valor){
            this.MostrarMensaje("Saldo insuficiente");
            return;//termina sin almacenar la informacion
        }

        t.valor = t.valor - valor_cobro;
        t.ultimo_acceso = torno.fecha_actual;//obtiene la hora y fecha actual del torno
        t.ultimo_valor_pagado =  valor_cobro;

        this.GrabarTarjeta(t);
    }
コード例 #2
0
ファイル: torno.cs プロジェクト: krlosoul/torno
 private void EntradaTorno(Tortno torno)
 {
     Tarjetas t = this.GetDatoTarjeta();
     t.hora_entrada = torno.fecha_actual;//obtiene la hora y fecha actual del torno
     t.estacion_origen = torno.estacion; //nombre de estacion
     t.ultimo_acceso = torno.fecha_actual;
     this.GrabarTarjeta(t);
 }