Пример #1
0
 /// <summary>
 /// ingresa un nuevo chofer al sistema y lo devuelve
 /// </summary>
 /// <param name="chofer"></param>
 /// <param name="libreta"></param>
 /// <returns>Chofer</returns>
 public async Task<Chofer> CrearChofer(Chofer chofer, LibretaDeConducir libreta)
 {
     Chofer salida = null;
     try
     {
         Chofer c = await DBRepositoryMongo<Chofer>.GetUsuario(chofer.User, "Choferes");
         if (c != null)
         {
             throw new MensajeException("El chofer ya existe");
         }
         else
         {
             salida = chofer;
             salida.Tipo = "Chofer";
             salida.Disponible = true;
             salida.LibretaDeConducir = libreta;
             salida.Leyenda = chofer.Numero + " - " + chofer.Nombre + " " + chofer.Apellido;
             if (salida.Ubicacion == null)
             {
                 salida.Ubicacion = new PosicionSatelital() { Latitud = "", Longitud = "" };
             }
             salida = salida.Encriptar(salida);
             await DBRepositoryMongo<Chofer>.Create(salida, "Choferes");
         }
         return salida;
     }
     catch(MensajeException msg)
     {
         throw msg;
     }catch(Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
        public Chofer(string usuario, string pass, string nombre, string apellido, string email, string documento, string telefono, string direccion, string fNacimiento, string numero, string vtoCarneSalud, string categoriaLibreta, string fVtoLibreta, string foto) : base()
        {
            User        = usuario;
            Password    = pass;
            Nombre      = nombre;
            Apellido    = apellido;
            Email       = email;
            Documento   = documento;
            Telefono    = telefono;
            Direccion   = direccion;
            FNacimiento = fNacimiento;
            Numero      = numero;
            LibretaDeConducir libreta = new LibretaDeConducir();

            libreta.Categoria    = categoriaLibreta;
            libreta.FVencimiento = fVtoLibreta;
            LibretaDeConducir    = libreta;
            Foto    = foto;
            Tipo    = "Chofer";
            Leyenda = "";
        }
Пример #3
0
        public Chofer() : base()
        {
            User        = "";
            Password    = "";
            Nombre      = "";
            Apellido    = "";
            Email       = "";
            Documento   = "";
            Telefono    = "";
            Direccion   = "";
            FNacimiento = "";
            Numero      = "";
            LibretaDeConducir libreta = new LibretaDeConducir();

            libreta.Categoria    = "";
            libreta.FVencimiento = "";
            LibretaDeConducir    = libreta;
            Foto    = "";
            Tipo    = "Chofer";
            Leyenda = "";
        }