using MP.AppAuth.Models;
namespace MP.SPEC.Data
{
public class MsgServiceSpec
{
#region Public Events
public event Action EA_BroadCastMsg = null!;
#endregion Public Events
#region Public Properties
///
/// Dominio utente
///
public string DomainName { get; set; } = "";
public string newBCMsg
{
get => _newBCMsg;
set
{
if (_newBCMsg != value)
{
_newBCMsg = value;
reportMsg();
}
}
}
///
/// Username utente
///
public string UserName { get; set; } = "";
///
/// Diritti utente (solo Funzione/Ruolo)
///
public List UserRight { get; set; } = new List();
///
/// Verifica ruolo utente
///
///
///
public bool HasRole(string Ruolo)
{
bool answ = false;
if (UserRight != null && UserRight.Count > 0)
{
answ = UserRight
.Where(x => x.Equals(Ruolo, StringComparison.InvariantCultureIgnoreCase))
.Count() > 0;
}
return answ;
}
#endregion Public Properties
#region Protected Methods
protected void reportMsg()
{
if (EA_BroadCastMsg != null)
{
EA_BroadCastMsg?.Invoke();
}
}
#endregion Protected Methods
#region Private Properties
private string _newBCMsg { get; set; } = "";
#endregion Private Properties
}
}