Example #1
0
        public IEnumerable <SecurityDetail> GetSecurityClaims()
        {
            try
            {
                List <tblBooking>     list = _dbEntity.tblBookings.Where(x => (x.IsAccidentalClaimRaised == true || x.IsTheftClaimRaised == true) && x.IsSecurityAmountPaid == true && !string.IsNullOrEmpty(x.SecurityId) && x.IsSecurityCaptureOrRefund == false).ToList();
                List <SecurityDetail> securityDetailList = new List <SecurityDetail>();
                foreach (tblBooking tblBooking in list)
                {
                    SecurityDetail securityDetail1 = new SecurityDetail();
                    securityDetail1.Id = tblBooking.BookingId;
                    string bookingId = tblBooking.BookingId.ToString();
                    securityDetail1.BookingId = bookingId;
                    string empty = string.Empty;

                    DateTime dateTime;
                    if (tblBooking.IsTheftClaimRaised == true)
                    {
                        securityDetail1.TypeOfClaim = "Theft Report";
                        string        appSetting    = ConfigurationManager.AppSettings["TheftClaimPdf"];
                        tblTheftClaim tblTheftClaim = _dbEntity.tblTheftClaims.Where(x => x.BookingId == bookingId).FirstOrDefault();
                        if (tblTheftClaim != null)
                        {
                            securityDetail1.PDF = appSetting + tblTheftClaim.PDFName;
                            SecurityDetail securityDetail2 = securityDetail1;
                            dateTime = Convert.ToDateTime((object)tblTheftClaim.CreatedDate);
                            string str = dateTime.ToString("MM-dd-yyyy  hh:mm tt");
                            securityDetail2.CreatedDate = str;
                        }
                    }
                    else if (tblBooking.IsAccidentalClaimRaised == true)
                    {
                        securityDetail1.TypeOfClaim = "Accidental Claim";
                        string             appSetting         = ConfigurationManager.AppSettings["AccidentalClaimPdf"];
                        tblAccidentalClaim tblAccidentalClaim = _dbEntity.tblAccidentalClaims
                                                                .Where(x => x.BookingId == bookingId).FirstOrDefault();
                        if (tblAccidentalClaim != null)
                        {
                            securityDetail1.PDF = appSetting + tblAccidentalClaim.PDFName;
                            SecurityDetail securityDetail2 = securityDetail1;
                            dateTime = Convert.ToDateTime(tblAccidentalClaim.CreatedDate);
                            string str = dateTime.ToString("MM-dd-yyyy  hh:mm tt");
                            securityDetail2.CreatedDate = str;
                        }
                    }

                    securityDetailList.Add(securityDetail1);
                }
                return(securityDetailList);
            }

            catch (Exception ex)
            {
                Common.ExcepLog(ex);
                throw;
            }
        }
Example #2
0
        private static void GetSecurityDetail(StringBuilder sb)
        {
            sb.AppendLine().AppendLine(Separator).AppendLine("Security details").AppendLine(Separator);
            var detail = new SecurityDetail();

            ((IEventDetail)detail).Populate();
            sb.Append("Process User Name: ").AppendLine(detail.ProcessUserName);
            sb.Append("Authentication Type: ").AppendLine(detail.AuthenticationType);
            sb.Append("Is Authenticated: ").AppendLine(detail.IsAuthenticated.ToString());
            sb.Append("User Name: ").AppendLine(detail.UserName);
        }
Example #3
0
        public static void MapTo(this SecurityDetail detail, TrackingRequestEntity entity)
        {
            Guid?userId = null;

            try
            {
                userId = new Guid(detail.UserName);
            }
            catch (Exception)
            {
            }

            entity.userId = userId;
        }
        public static async Task ProcessSecurityAsync(
            [QueueTrigger(OperationConstants.SecurityQueueName, Connection = "StorageConnectionString")] SecurityDetail data,
            [DataRepository(
                 DataType = typeof(Graph.Alert))] DocumentRepository <Graph.Alert> securityAlertRepository,
            [DataRepository(DataType = typeof(Graph.SecureScore))] DocumentRepository <Graph.SecureScore> secureScoreRepository,
            [SecureScore(
                 ApplicationId = "{AppEndpoint.ApplicationId}",
                 CustomerId = "{Customer.Id}",
                 Period = "{Period}",
                 Resource = "{AppEndpoint.ServiceAddress}",
                 SecretName = "{AppEndpoint.ApplicationSecretId}")] List <Graph.SecureScore> scores,
            [SecurityAlerts(
                 ApplicationId = "{AppEndpoint.ApplicationId}",
                 CustomerId = "{Customer.Id}",
                 Resource = "{AppEndpoint.ServiceAddress}",
                 SecretName = "{AppEndpoint.ApplicationSecretId}")] List <Graph.Alert> alerts,
            ILogger log)
        {
            if (data.Customer.ProcessException != null)
            {
                log.LogWarning($"Unable to process {data.Customer.Id} please check the customer's last exception for more information.");
                return;
            }

            if (scores?.Count > 0)
            {
                log.LogInformation($"Importing {scores.Count} Secure Score entries from the past {data.Period} periods for {data.Customer.Id}");

                await secureScoreRepository.AddOrUpdateAsync(
                    scores,
                    data.Customer.Id).ConfigureAwait(false);
            }

            if (alerts?.Count > 0)
            {
                log.LogInformation($"Importing {alerts.Count} security alert entries for {data.Customer.Id}");

                await securityAlertRepository.AddOrUpdateAsync(
                    alerts,
                    data.Customer.Id).ConfigureAwait(false);
            }

            log.LogInformation($"Successfully process data for {data.Customer.Id}");
        }