public void Log(ErrorCodes ErrorCode, string ErrorDescription, string UserName, string Password, string Email, int?Channel) { AuthenticationLog log = new AuthenticationLog(); log.Method = "Login"; log.ServerIP = Utilities.GetServerIP(); log.CreatedDate = DateTime.Now; log.Channel = Channel; log.ErrorCode = ErrorCode; log.ErrorDescription = ErrorDescription; log.Password = Password; log.Email = Email; log.UserName = UserName; _authenticationLogRepository.Insert(log); }
public void Log(ErrorCodes ErrorCode, string ErrorDescription, RegisterCompanyModel model) { AuthenticationLog log = new AuthenticationLog(); log.Method = "CompanyRegister"; log.ServerIP = Utilities.GetServerIP(); log.CreatedDate = DateTime.Now; log.Channel = model?.Channel; log.ErrorCode = ErrorCode; log.ErrorDescription = ErrorDescription; log.Password = model?.Password; log.Email = model?.Email; log.UserName = model?.Email; log.CompanyCrNumber = model?.CompanyCrNumber; log.CompanyName = model?.CompanyName; log.CompanySponserId = model?.CompanySponserId; log.CompanyVatNumber = model?.CompanyVatNumber; _authenticationLogRepository.Insert(log); }
public override void Save() { try { using (FalconOrchestratorDB db = new FalconOrchestratorDB()) { AuthenticationLog model = new AuthenticationLog(); model.Timestamp = Data.FormattedTimestamp; model.Offset = Metadata.Offset; model.OperationName = Data.OperationName; model.ServiceName = Data.ServiceName; model.Success = Data.Success; model.UserId = Data.UserId; model.UserIp = Data.UserIp; model.CustomerId = Persistence.GetCustomerId(Metadata.CustomerIdString); if (Data.AuditKeyValues != null) { model.TargetName = Data.AuditKeyValues.Where(x => x.Key.Equals("target_name")).Select(x => x.ValueString).FirstOrDefault(); model.Entitlement = Data.AuditKeyValues.Where(x => x.Key.Equals("entitlement")).Select(x => x.ValueString).FirstOrDefault(); model.EntitlementGroup = Data.AuditKeyValues.Where(x => x.Key.Equals("entitlementGroup")).Select(x => x.ValueString).FirstOrDefault(); } else { model.TargetName = null; model.Entitlement = null; model.EntitlementGroup = null; } db.AuthenticationLogs.Add(model); db.SaveChanges(); AppConfiguration.FALCON_STREAM_LAST_OFFSET = Metadata.Offset; log.Debug("[" + Metadata.Offset + "] Authentication audit event saved to database"); } } catch (Exception e) { log.Fatal("[" + Metadata.Offset + "] Error occured while trying to save authentication activity audit event to database", e); System.Environment.Exit(1); } }