summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.CalculoWeb.Auto/Veiculo.cs
blob: 780cf09073d52375f8b744e79ce07774a00e717d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
namespace Gestor.Model.CalculoWeb.Auto;

public class Veiculo
{
	private string _combustivel;

	public string NumeroChassi { get; set; }

	public string Placa { get; set; }

	public string Uf { get; set; }

	public string Modelo { get; set; }

	public string Fabricante { get; set; }

	public string AnoFabricacao { get; set; }

	public string AnoModelo { get; set; }

	public string CodigoFipe { get; set; }

	public string Rastreador { get; set; }

	public string Antifurto { get; set; }

	public string KitGas { get; set; }

	public string ZeroKm { get; set; }

	public string Alienado { get; set; }

	public string Combustivel
	{
		get
		{
			return _combustivel;
		}
		set
		{
			_combustivel = value;
			ConvertCombustivelCalculo(_combustivel);
		}
	}

	public string CepPernoite { get; set; }

	public Fipe Fipe { get; set; }

	public string Blindado { get; set; }

	public long Id { get; set; }

	private static string ConvertCombustivelCalculo(string combustivel)
	{
		if (combustivel != null)
		{
			int length = combustivel.Length;
			if (length == 1)
			{
				switch (combustivel[0])
				{
				case '4':
					return "1";
				case '2':
					return "2";
				case '1':
					return "3";
				case '3':
					return "4";
				case '9':
					break;
				case '5':
				case '7':
				case '8':
					return "6";
				default:
					goto IL_00c7;
				}
				goto IL_00b5;
			}
			if (length == 2)
			{
				switch (combustivel[1])
				{
				case '0':
					break;
				case '2':
					goto IL_007f;
				case '1':
					if (!(combustivel == "11"))
					{
						goto IL_00c7;
					}
					return "7";
				default:
					goto IL_00c7;
				}
				if (combustivel == "10")
				{
					goto IL_00b5;
				}
			}
		}
		goto IL_00c7;
		IL_00c7:
		return string.Empty;
		IL_00b5:
		return "5";
		IL_007f:
		if (combustivel == "12")
		{
			goto IL_00b5;
		}
		goto IL_00c7;
	}
}