0
I would like in my system Crud ASP.NET to make an image in the form of a padlock disabled when a certain user profile log in to the system, the name of this controller below is called Maintainability
My idea is to take advantage of and save in Session the information that is in the Controller Loggincontroller.Cs and call in Maintenancepower, but I assembled the first part of the access to the attribute of the class that comes empty and wanted to know how to bringla, below is the code of the Maintainability:
public Jsonresult _Listirfinalities() { List purposes = new list();
using (var ws = new VREWebServiceClient())
{
ObterFinalidadeResponse obj = new ObterFinalidadeResponse();
/* Eu */
BSeguranca BSeguranca = new BSeguranca();
Usuario usuario = new Usuario();
int Recebe_NMUsuario = usuario.NUsuario;
obj = ws.ObterFinalidade(false);
bool historico;
string acaoHistorico = string.Empty;
var objHistorico = obj.Finalidade.Where(w => w.DatVigncAte != null);
foreach (var item in obj.Finalidade)
{
historico = false;
string acaoVisualizarFinalidade = String.Format("<a href=\"/ManterFinalidade/VisualizarFinalidade?codigo={0}\" title=\"Dados da Finalidade\"><img src=\"/Content/images/detalhes.png\" style=\"cursor: pointer;\" width=\"16px\" border=\"0\"></a>", item.CodFinld);
string acaoAssociarDeclaracaoFinalidade = String.Format("<a href=\"/ManterFinalidade/AssociarDeclaracaoFinalidade?codigo={0}\" title=\"Associar Declaração - Finalidade\"><img src=\"/Content/images/associar.png\" style=\"cursor: pointer;\" width=\"16px\" border=\"0\"></a>", item.NumFinld);
foreach (var x in objHistorico)
{
if (x.CodFinld == item.CodFinld)
historico = true;
}
if (historico)
acaoHistorico = "<img src=\"/Content/images/historico.png\" style=\"cursor: pointer;\" title=\"Visualizar Histórico\" width=\"16px\" border=\"0\" class=\"accordion\">";
else
acaoHistorico = "<img src=\"/Content/images/historico_off.png\" title=\"Visualizar Histórico\" width=\"16px\" border=\"0\">";
if (item.DatVigncAte == null)
{
finalidades.Add(new EFinalidadeGrid()
{
CodFinld = item.CodFinld,
DesFinld = item.DesFinld,
DatVigncDe = item.DatVigncDe,
DatVigncAte = item.DatVigncAte,
HtmlAcoes = String.Format("{0} {1} {2}", acaoHistorico, acaoVisualizarFinalidade, acaoAssociarDeclaracaoFinalidade)
});
}
}
}
return Json(new
{
Retorno = finalidades
}, JsonRequestBehavior.AllowGet);
}
In the next image, I want to capture the value of the Nusuario attribute that is equal to 16783 for technical profile and compare with line 60 if it is technical profile, shows the disabled image, otherwise it enables if it is another profile:
Can anyone help me, what is missing to bring the data filled in image 2?
Personal thank you