Beispiel #1
0
        private async Task <bool> CreateAggregateSpreadsheetRow(InqueryHistoryStatusChangedToParsedDomainEvent @event)
        {
            logger.CreateLogger(nameof(@event)).LogTrace($"Start: Inquery history aggregate spreadsheet updated. Inquiry history: {@event.InqueryHistory.Id} - spreadsheet: {@event.InqueryHistory.AgentInquiryInfo.AggregateShareableUrl}.");

            try
            {
                InsertRowToSpreadsheetCommand insertRowToSpreadsheetCommand = new InsertRowToSpreadsheetCommand
                {
                    SpreadSheetId   = @event.InqueryHistory.AgentInquiryInfo.AggregateShareableId,
                    WorkSheetName   = "Aggregate",
                    ApplicationName = "LeadsPlus",
                    Values          = new List <object>()
                    {
                        @event.InqueryHistory.Id,
                        @event.InqueryHistory.CreatedDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"),
                        Enum.GetName(typeof(InquiryType), @event.InqueryHistory.InquiryType),
                        "FALSE",
                        "FALSE",
                        "FALSE",
                        "FALSE",
                        @event.InqueryHistory.OrganizationInfo.OrganizationDomain
                    }
                };

                var spreadsheet = mediator.Send(insertRowToSpreadsheetCommand).Result;
            }
            catch (Exception ex)
            {
                logger.CreateLogger(nameof(@event)).LogTrace(ex.StackTrace);
            }

            logger.CreateLogger(nameof(@event)).LogTrace($"End: Inquery history aggregate spreadsheet updated. Inquiry history: {@event.InqueryHistory.Id} - spreadsheet: {@event.InqueryHistory.AgentInquiryInfo.AggregateShareableUrl}.");

            return(true);
        }
Beispiel #2
0
        public async Task Handle(InqueryHistoryStatusChangedToParsedDomainEvent @event, CancellationToken cancellationToken)
        {
            InsertRowToSpreadsheetCommand insertRowToSpreadsheetCommand = new InsertRowToSpreadsheetCommand
            {
                SpreadSheetId   = @event.InqueryHistory.AgentInquiryInfo.SpreadsheetId,
                WorkSheetName   = Enum.GetName(typeof(InquiryType), @event.InqueryHistory.InquiryType),
                ApplicationName = "LeadsPlus",
                Values          = new List <object>()
                {
                    @event.InqueryHistory.Id,
                    @event.InqueryHistory.CreatedDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"),
                    $"{@event.InqueryHistory.CustomerInfo.Firstname} {@event.InqueryHistory.CustomerInfo.Lastname}",
                    @event.InqueryHistory.CustomerInfo.Email,
                    @event.InqueryHistory.CustomerInfo.Phone,
                    @event.InqueryHistory.CustomerInfo.Address,
                    @event.InqueryHistory.CustomerInfo.Aboutme,
                    @event.InqueryHistory.OrganizationInfo.OrganizationDomain,
                    Enum.GetName(typeof(InquiryType), @event.InqueryHistory.InquiryType),
                    @event.InqueryHistory.PropertyInfo.Message,
                    @event.InqueryHistory.PropertyInfo.PropertyAddress,
                    @event.InqueryHistory.PropertyInfo.ReferenceNo,
                    @event.InqueryHistory.PropertyInfo.PropertyUrl,
                }
            };

            var spreadsheet = mediator.Send(insertRowToSpreadsheetCommand).Result;

            await CreateAggregateSpreadsheetRow(@event);

            logger.CreateLogger(nameof(@event)).LogTrace($"Inquery history spreadsheet updated. Inquiry history: {@event.InqueryHistory.Id} - Inquiry from: {@event.InqueryHistory.OrganizationInfo.OrganizationEmail}.");
        }