Exemple #1
0
        //Metodo valida los datos y para agregarlos a la base de
        //datos o actualizarlos
        public void agregarTipoVehiculo(ENT.TipoVehiculo tipo)
        {
            DAL.Tipo DalTipo = new DAL.Tipo();
            try
            {
                if (tipo.Tipo == string.Empty)
                {
                    throw new Exception("Debes seleccionar un tipo de vehículo");
                }

                if (tipo.Id <= 0)
                {
                    DalTipo.agregarTipo(tipo);
                    if (DalTipo.Error)
                    {
                        throw new Exception("Error al agregar el tipo de vehículo " + DalTipo.ErrorMsg);
                    }
                }
                else
                {
                    DalTipo.editarTipos(tipo);
                    if (DalTipo.Error)
                    {
                        throw new Exception("Error al editar el tipo de vehículo " + DalTipo.ErrorMsg);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
 //Metodo valida los datos necesarios para eliminar este tipo de vehículo
 public void eliminarTipoVehiculo(ENT.TipoVehiculo tipo)
 {
     DAL.Tipo DalTipo = new DAL.Tipo();
     try
     {
         if (tipo.Id <= 0)
         {
             throw new Exception("No ha seleccionado un tipo de vehículo");
         }
         DalTipo.borrarTipo(tipo);
         if (DalTipo.Error)
         {
             throw new Exception("Error al eliminar el vehiculo " + DalTipo.ErrorMsg);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }