public Presupuesto(
            Cliente cliente, 
            Vehiculo vehiculo, 
            decimal importe, 
            PresupuestoEstado estado = PresupuestoEstado.Abierto)
        {
            Ensure.Argument.NotNull(cliente, Messages.PrespuestoClienteNotNull);
            Ensure.Argument.NotNull(vehiculo, Messages.PreuspuestoVehiculoNotNull);
            Ensure.Argument.IsNot(vehiculo.Id == 0, Messages.PrespuestoVehiculoMustHaveValidId);
            Ensure.Argument.IsNot(cliente.Id == 0, Messages.PrespuestoClienteMustHaveValidId);
            Ensure.That<ArgumentException>(importe > 0, Messages.PresupuestoImporteGreatherThanZero);

            this.Cliente = cliente;
            this.ClienteId = cliente.Id;
            this.Vehiculo = vehiculo;
            this.VehiculoId = vehiculo.Id;
            this.Importe = importe;
            this.Estado = estado;
        }
Exemple #2
0
 public static string GetCodigoConFormato(
     this PresupuestoEstado presupuestoEstado)
 {
     return(Codificable.GenerateCodigo(presupuestoEstado.Codigo));
 }