Untitled

 avatar
unknown
dart
5 months ago
2.2 kB
2
Indexable
/// Tabla Entorno, contiene datos de empresa
class Entorno1 {
  String clave;

  String nombre;

  int longitudCodcont;

  String cif;

  String direccion;

  String localidad;

  String provincia;

  String pais;

  String cp;

  String tlfno1;

  String tlfno2;

  String email;

  /// Código de serie que se utilizará por defecto
  int? codigoSerie;

  Entorno1(
      {this.clave = "",
      this.cif = "",
      this.direccion = "",
      this.localidad = "",
      this.nombre = "",
      this.pais = "",
      this.provincia = "",
      this.cp = "",
      this.tlfno1 = "",
      this.tlfno2 = "",
      this.email = "",
      this.longitudCodcont = 8,
      this.codigoSerie});

  Entorno1 copy() {
    return Entorno1(
        clave: clave,
        cif: cif,
        direccion: direccion,
        localidad: localidad,
        nombre: nombre,
        pais: pais,
        provincia: provincia,
        cp: cp,
        tlfno1: tlfno1,
        tlfno2: tlfno2,
        email: email,
        longitudCodcont: longitudCodcont,
        codigoSerie: codigoSerie);
  }

  factory Entorno1.fromJson(Map<String, dynamic> json) {
    try {
      return Entorno1(
          clave: json['Clave'],
          cif: json['Cif'] ?? "",
          direccion: json['Direccion'] ?? "",
          localidad: json['Localidad'] ?? "",
          nombre: json['Nombre'] ?? "",
          pais: json['Pais'] ?? "",
          provincia: json['Provincia'] ?? "",
          cp: json['Cp'] ?? "",
          tlfno1: json['Tlfno1'] ?? "",
          tlfno2: json['Tlfno2'] ?? "",
          email: json['Email'] ?? "",
          longitudCodcont: json['Codcont'] ?? 8,
          codigoSerie: json['Serie']);
    } catch (e) {
      throw ("No hay clave de Entorno1");
    }
  }

  Map<String, dynamic> toJson() {
    return {
      'Clave': clave,
      'Cif': cif,
      'Direccion': direccion,
      'Localidad': localidad,
      'Nombre': nombre,
      'Pais': pais,
      'Provincia': provincia,
      'Cp': cp,
      'Tlfno1': tlfno1,
      'Tlfno2': tlfno2,
      'Email': email,
      'Codcont': longitudCodcont,
      'Serie': codigoSerie
    };
  }
}
Editor is loading...
Leave a Comment