1
Personal I need a help, in my system I have two Environments, one of production and the other of homologation. So in my system, I have a part that sends email, to the user. Could someone help me so that when sending the email, the system idenficiar the environment and signal with the name [HOMOLOGATION] - [PRODUCTION] I will post below my controller.
public void EnviaAlertaBaixoEstoque(Centro hospital, int tipo)
{
var fluidos = new List<string> { "", "A", "B", "C", "D", "E", "F" };
var objEmail = FactoryMailMessage(MailPriority.High);
objEmail.To.Add("Leonardo Macedo <[email protected]>");
objEmail.Subject = $"Controle de Fluídos BaSICS - Aviso de estoque mínimo de fluídos {fluidos[tipo]} no {hospital.CentroId} - {hospital.Nome}";
var fluido = hospital.EstoqueA;
switch (tipo)
{
case 2:
fluido = hospital.EstoqueB;
break;
case 3:
fluido = hospital.EstoqueC;
break;
case 4:
fluido = hospital.EstoqueD;
break;
case 5:
fluido = hospital.EstoqueE;
break;
case 6:
fluido = hospital.EstoqueF;
break;
}
objEmail.Body = $"O {hospital.CentroId} - {hospital.Nome} está com estoque de fluídos {fluidos[tipo]} em {fluido} litro(s).";
EnviarEmail(objEmail);
}
Summarizing in the message Control of Basics Fluids before the word Control turn up [HOMOLOGATION] Control of Basics fluids or [PRODUCTION] Control of Basics Fluids
I found an example on the internet only that I could not implement in my system.
var titulo = "zzzz";
if (Request.Url.Scheme.Contains("homolog"))
{
titulo = "[HOMOLOGAÇÃO] " + titulo;
}
i kind of understood, could explain me again on how to use System.Configuration.Configurationmanager.Appsettings["environment"], where to use
– Leonardo Macedo
I updated the answer, see if you understand cool now.
– Ricardo