Aktivity „garymedina@hotmail.com“

Hi,

I am having an issue where my app service is being run multiple times. It is inconsistently running 1 - 4 times on a single start. I need it to run one time

Here is the service -

using BridgeMlsPinApi;
using OrganizeRe.Crg.Listing;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
using AutoMapper.Internal.Mappers;
using CsvHelper;
using OrganizeRe.Crg.TeamMembers;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Newtonsoft.Json;
using Volo.Abp.Application.Services;
using Microsoft.Extensions.Hosting;
using OrganizeRe.Crg.MlsPostLogs;

namespace OrganizeRe.Crg
{
    public class MlsActivityAppService : ApplicationService, IMlsActivityAppService
    {
        protected ITeamMemberRepository _teamMembersRepository;
        protected IMlsPostLogRepository _mlsPostLogRepository;
        protected MlsPostLogManager _mlsPostLogManager;

        public MlsActivityAppService(ITeamMemberRepository teamMembersRepository, 
            IMlsPostLogRepository mlsPostLogRepository, MlsPostLogManager mlsPostLogManager)
        {
            _teamMembersRepository = teamMembersRepository;
            _mlsPostLogRepository = mlsPostLogRepository;
            _mlsPostLogManager = mlsPostLogManager;
        }

        public async Task<string> ProcessActivityAsync()
        {
            MlsFetch mlsFetch = new MlsFetch("mls_key");

            List<TeamMember> teamMembers = await _teamMembersRepository.GetListAsync();
            teamMembers = teamMembers.Where(x => x.AutopostMlsSold == true).ToList();

            HashSet<ProcessDto> listingToProcess = new HashSet<ProcessDto>();


            //Get all the listings for the agents in list and add to process list
            foreach (var agent in teamMembers)
            {
                if (agent.MlsId != null)
                {
                    Debug.WriteLine("Processing listings for agent ID " + agent);

                    //Get listings for each agent from MLSPin
                    var listings = await mlsFetch.GetLIstingsByAgentAsync(agent.MlsId);

                    foreach (var listing in listings)
                    {
                        var listingExist = await _mlsPostLogRepository.FindAsync(e => e.MlsId ==  listing.ListingId
                            && e.MlsStatus == listing.MlsStatus);

                       
                        if (listingExist == null)
                        {
                            //filter out all but New and check if agent has New checked
                            if (listing.MlsStatus == "New" && agent.AutopostMlsNew)
                            {
                                Console.WriteLine(listing.ListingId + " | " + listing.MlsStatus);
                                listingToProcess.Add(new ProcessDto() { Agent = agent, Listing = listing });
                            }

                            //filter out all but UAG and check if agent has New checked
                            if (listing.MlsStatus == "Under Agreement" && agent.AutopostMlsSold)
                            {
                                Console.WriteLine(listing.ListingId + " | " + listing.MlsStatus);
                                listingToProcess.Add(new ProcessDto() { Agent = agent, Listing = listing });
                            }

                            //filter out all but Sold and check if agent has New checked
                            if (listing.MlsStatus == "Sold" && agent.AutopostMlsSold)
                            {
                                Console.WriteLine(listing.ListingId + " | " + listing.MlsStatus);
                                listingToProcess.Add(new ProcessDto() { Agent = agent, Listing = listing });
                            }
                        }
                    }
                }
            }

            // Process the list and create graphics
            var fileName = string.Empty;
            var gm = new GraphicsMillUtil();

            foreach (var listing in listingToProcess)
            {
                fileName = await gm.CreateSoldGraphics(listing);

                // invisible line break - 
                var postMessage = $"{listing.Listing.MlsStatus} by {listing.Agent.Name} \\u2063\\n" +
                                  $"{listing.Listing.StreetNumber} {listing.Listing.StreetName} \\u2063\\n" +
                                  $"{listing.Listing.City}, {listing.Listing.StateOrProvince} {listing.Listing.PostalCode} \\u2063\\n" +
                                  $"\\u2063\\n" +
                                  $"{listing.Listing.PublicRemarks} \\u2063\\n" +
                                  $"\\u2063\\n" +
                                  $"https://idx.mlspin.com/MLS.SocialMedia/Listing/{listing.Listing.ListingId}";

                // Post to social via AyrShare
                AyrshareService ayrshare = new AyrshareService("as_key");
                var results = ayrshare.CreatePost(postMessage, "https://crg.organizere.com/images/" + fileName, includeFacebook: true,
                    includeInstagram: true);


                // Insert into log
                var mlsPostLog = await _mlsPostLogManager.CreateAsync(
                    listing.Listing.ListingId, listing.Listing.MlsStatus
                );

            }

            Debug.WriteLine("------- End of Post Job ---------");
            return "Done";
        }


    }
}

-------- And starting with a simple api call but would like to execute with hangfire when this does not repeat ------

    [Route("/test")]
    public async Task Test()
    {
        await _testAppService.ProcessActivityAsync();
    }

---- And the hangfire job -----

using System.Threading.Tasks;
using Hangfire;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.DependencyInjection;

namespace OrganizeRe.Crg
{
    [Queue("alpha")]
    public class MlsActivityJob : AsyncBackgroundJob<string>, ITransientDependency
    {
        private readonly IMlsActivityAppService _mlsActivityAppService;

        public MlsActivityJob(IMlsActivityAppService mlsActivityAppService)
        {
            _mlsActivityAppService = mlsActivityAppService;
        }

        public override async Task ExecuteAsync(string args)
        {
            await _mlsActivityAppService.ProcessActivityAsync();
        }
    }
}

I would like to replicate the Profile picture page /Account/Manage and cropping service but can not find the code in the project. Is this available anywhere and/or can you provide the source code to replicate this page with the cropping widget?

Hi,

I am back with this issue but this time it's happening when deployed on the server. I have followed the instructions here but I am unsure of where the Authserver is on an MVC project to place the certificate as in these instructions "Also, please remember to copy authserver.pfx to the Content Root Folder of the AuthServer website"

I am trying to update the CLI and I am receiving an error: **Tool 'volo.abp.cli' has multiple versions installed and cannot be updated." I am also receiving similar errors about having mulitple install when trying to remove. Please let me know how I can clean this up and update to the newest CLI and Suite.

Thanks, Gary

I am new to ABP commercial and never had issues with non-commercial but I am receiving the error "HTTP Error 500.30 - ASP.NET Core app failed to start" when using the Public Website Template. It would be great to use IIS Express in VS2022 but I have built and deployed to IIS server with the same results. I have reinstalled the .Net 7 SDK and Hosting with the same results. Can someone direct me to a fix please?

Zobrazených 1 až 5 z 5 záznamov
Made with ❤️ on ABP v8.2.0-preview Updated on marca 25, 2024, 15:11