public IQueryable <DomainUserModel> Get() { return(CommonHelpers.ActionHelper.TryCatchWithLoggerGeneric(() => { return new List <DomainUserModel>(1) { _security.GetCurrentUser() }.AsQueryable(); }, _logger, LogCategories)); }
public BaseController(IDSWDataContext dswDataContext, ISecurity security) { _dswDataContext = dswDataContext; _domainUserModel = security.GetCurrentUser() ?? new DomainUserModel() { Name = "anonymous", Domain = "system" }; }
public ProtocolsController(IProtocolService service, IDataUnitOfWork unitOfWork, ILogger logger, IProtocolTableValuedModelMapper mapperTableValued, ISecurity security) : base(service, unitOfWork, logger, security) { _mapperTableValued = mapperTableValued; _logger = logger; _unitOfWork = unitOfWork; _security = security; _currentUser = security.GetCurrentUser(); }
protected BaseService(IDataUnitOfWork unitOfWork, ILogger logger, IValidatorService validationService, IValidatorRuleset validatorRuleset, IMapperUnitOfWork mapperUnitOfWork, ISecurity security) { _unitOfWork = unitOfWork; _mapperUnitOfWork = mapperUnitOfWork; _repositoryAsync = unitOfWork.Repository <TEntity>(); _logger = logger; _validationService = validationService; _instanceId = Guid.NewGuid(); _validatorRuleset = validatorRuleset; _mapper = mapperUnitOfWork.Repository <IDomainMapper <TEntity, TEntity> >(); _currentDomainUser = security.GetCurrentUser(); }
public IHttpActionResult GetProtocolSummary(Guid id) { return(CommonHelpers.ActionHelper.TryCatchWithLoggerGeneric <IHttpActionResult>(() => { IList <Protocol> protocol = _unitOfWork.Repository <Protocol>() .GetUserAuthorizedByUniqueId(id, _security.GetCurrentUser().Account).ToList(); if (protocol == null) { throw new ArgumentNullException("Protocol not found"); } return Ok(protocol); }, _logger, LogCategories)); }
public ProtocolLog CreatProtocoloLog(Protocol protocol, string logType, string logDescription, string registrationUser = "") { ProtocolLog protocolLog = new ProtocolLog() { Year = protocol.Year, Number = protocol.Number, LogDate = DateTime.UtcNow, LogType = logType, LogDescription = logDescription, SystemComputer = Environment.MachineName, Program = "Private.WebAPI", Entity = protocol, RegistrationUser = string.IsNullOrEmpty(registrationUser) ? _security.GetCurrentUser().Account : registrationUser, ObjectState = Repository.Infrastructure.ObjectState.Added }; protocolLog.Hash = HashGenerator.GenerateHash(string.Concat(protocolLog.RegistrationUser, "|", protocolLog.Year, "|", protocolLog.Number, "|", protocolLog.LogType, "|", protocolLog.LogDescription, "|", protocolLog.UniqueId, "|", protocolLog.Entity.UniqueId, "|", protocolLog.LogDate.ToString("yyyyMMddHHmmss"))); return(protocolLog); }
protected BaseODataController(TService service, IDataUnitOfWork unitOfWork, ILogger logger, ISecurity security) : base() { _service = service; _unitOfWork = unitOfWork; _logger = logger; _instanceId = Guid.NewGuid(); DomainUserModel currentUser = security.GetCurrentUser(); Username = currentUser?.Name; Domain = currentUser?.Domain; if (string.IsNullOrEmpty(Username)) { _logger.WriteError(new LogMessage("BaseODataController -> Lo Username non è presente o non è corretto."), LogCategories); throw new DSWException(string.Concat("Il nome utente non è presente o non è corretto."), null, DSWExceptionCode.SC_InvalidAccount); } if (string.IsNullOrEmpty(Domain)) { _logger.WriteError(new LogMessage("BaseODataController -> l Domain non è presente o non è corretto."), LogCategories); throw new DSWException(string.Concat("Il dominio non è presente o non è corretto."), null, DSWExceptionCode.SC_InvalidAccount); } }