Docker + Jenkfins File + v0.1
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
using System.ComponentModel;
|
||||
using GeradoresService.DAL;
|
||||
using System.ComponentModel;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace GeradoresService
|
||||
{
|
||||
public class NIF
|
||||
{
|
||||
private readonly GeradoresContext _geradoresContext;
|
||||
|
||||
public NIF(GeradoresContext geradoresContext)
|
||||
{
|
||||
_geradoresContext = geradoresContext;
|
||||
}
|
||||
|
||||
public enum NIFType
|
||||
{
|
||||
[Description("Pessoa singular (1)")]
|
||||
@@ -29,16 +37,14 @@ namespace GeradoresService
|
||||
PessoaColectivaIrregular = 9
|
||||
}
|
||||
|
||||
/*public static GetNIFTypes(){
|
||||
EnumHelper.GetEnumValuesAndDescriptions(NIFType);
|
||||
}*/
|
||||
|
||||
public static string Generate(string? type)
|
||||
public string Generate(string? type)
|
||||
{
|
||||
return GenerateRandomNIF(type);
|
||||
var nif = GenerateRandomNIF(type);
|
||||
//SaveNIF(nif);
|
||||
return nif;
|
||||
}
|
||||
|
||||
public static string GenerateRandomNIF(string? nifType)
|
||||
public string GenerateRandomNIF(string? nifType)
|
||||
{
|
||||
var firstDigitValidate = new char[] { '1', '2', '3', '5', '6', '8', '9' };
|
||||
Random rnd = new Random();
|
||||
@@ -86,7 +92,7 @@ namespace GeradoresService
|
||||
return randomNIF;
|
||||
}
|
||||
|
||||
public static bool Validate(string nif)
|
||||
public bool Validate(string nif)
|
||||
{
|
||||
// Verificar se o NIF tem 9 dígitos
|
||||
if (nif.Length != 9)
|
||||
@@ -117,5 +123,16 @@ namespace GeradoresService
|
||||
return digitoControlo == digitos[8];
|
||||
}
|
||||
|
||||
public void SaveNIF(string NIF)
|
||||
{
|
||||
var ger = new Geradore()
|
||||
{
|
||||
Valor = NIF
|
||||
};
|
||||
|
||||
_geradoresContext.Geradores.Add(ger);
|
||||
_geradoresContext.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user