Base solution for your next web application

Activities of "phoenix"

Good day,

I would like to tie ApplicationLanguage with other entities.

For example, I want to create many-to-many relatioship between ApplicationLanguage and my custom Region class.

The problem is that ApplicationLanguage class in a separate solution and, therefore I can not modify it.

Is there a way to add navigation property to the ApplicationLanguage class ?

Pavel

Good day,

I would like to inject a service to HangFire job. How to properly do it ? I have following code: Global.asax:

_container = new WindsorContainer();
_container.Register(Castle.MicroKernel.Registration.Component.For<IListingImageAppService().ImplementedBy(typeof(ListingImageAppService)).LifestyleSingleton());
JobActivator.Current = new WindsorJobActivator(_container.Kernel);

My JobBundle config:

WindsorContainer con = new WindsorContainer();
ImagesImportJob job = new ImagesImportJob(con.Resolve<ListingImageAppService>());
RecurringJob.AddOrUpdate("JobId", () => job.ImportImages(), Cron.Daily);

And my HangFire Job:

public class ImagesImportJob
{
   private readonly ListingImageAppService _srv;
   public ImagesImportJob(ListingImageAppService srv)  { _srv = srv; }
   public void ImportImages()
   {
        ///
   }
}

Hi,

Could someone please assist in my need to create a route that will handle all my short links without breaking the Signal R / Angular JS front end architecture?

What I need is e.g. host/shortlink1 should redirect to host/applicaiton#/listing/123

The /application#/object is be pre-defined or determined.

I did try that, and my route's doesn't work right. The only way I got around this was by adding a delimeter /sl/ in the url. However my requirement dictates that I cannot have that key delimeter. The only thing I know is that the application#/listing can be pre-defined in the route.

So the default route's that came with aspNetBoilerPlate are

routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            namespaces: new[] { "REP.Regional.Controllers" }
            );

When I add shortlink at the end and it will never trigger routes.MapRoute( name: "ShortLinks", url: "{name}", defaults: new { controller = "ShortLink", action = "Index", name = UrlParameter.Optional } );

If i add short link route in the middle of the route's it will loop indefinitely.

My ShortLinkController code is basic public ActionResult Index(string name) { if (!string.IsNullOrEmpty(name)) { ListResultOutput<ShortLinkListDto> shortLinks = AsyncHelper.RunSync(() => _shortlinkAppService.GetShortLinks(new GetShortLinkInput() { TenantFilter = 1, RegionFilter = 2004 })); ShortLinkListDto shortLink = shortLinks.Items.Where(e => e.Link.Trim().ToLower() == name.ToLower().Trim()).FirstOrDefault(); if (shortLink != null) { return Redirect(shortLink.FullLink); //this will redirect to /application#/listing/123 } } return Redirect("/"); }

Answer

So the default route's that came with aspNetBoilerPlate are

routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );

routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new[] { "REP.Regional.Controllers" } );


When I add shortlink at the end and it will never trigger routes.MapRoute( name: "ShortLinks", url: "{name}", defaults: new { controller = "ShortLink", action = "Index", name = UrlParameter.Optional } );

If i add short link route in the middle of the route's it will loop indefinitely.

My ShortLinkController code is basic public ActionResult Index(string name) { return Redirect("/application#/listing/123"); }

Good day,

I am trying to push notifications from server to client side using abp notification system.

My StartUp.cs:

public class Startup
{
   public void Configuration(IAppBuilder app)
   {
      ...
      app.MapSignalR();
   }
}

My Web Service:

public class ContactFormsAppService : REPAppServiceBase, IContactFormsAppService
{
   private readonly IAppNotifier _appNotifier;
   public ContactFormsAppService(IAppNotifier appNotifier)
   {
      _appNotifier = appNotifier;
   }
   public void SendMessageForOffice()
   {
      _appNotifier.SendMessage(101, "Message");
   }
}

AppNotifier:

public class AppNotifier : REPDomainServiceBase, IAppNotifier
{
   private readonly INotificationPublisher _notificationPublisher;
   public AppNotifier(INotificationPublisher notificationPublisher)
   {
      _notificationPublisher = notificationPublisher;
   }
   public async Task SendMessage(long userId, string message, NotificationSeverity severity = NotificationSeverity.Info)
   {
        await _notificationPublisher.PublishAsync(
             "App.SimpleMessage", 
             new MessageNotificationData(message),  
             severity: severity, 
             userIds: new[] { userId } );
    }
}

I can see messages in debugger console in the browser:

abp.js:285 DEBUG: abp.js:285 Connected to SignalR server! abp.js:285 DEBUG: abp.js:285 Registered to the SignalR server!

However, the event in header.js is never fired:

abp.event.on('abp.notifications.received', function (userNotification) {
   console.log("notification!", userNotification);
});

Any help would be greatly appreciated.

<cite>ismcagdas: </cite> Hi, Which version of ABP do you use ? I remember a similar issue in the one of previous versions.

0.8.4.0

<cite>hikalkan: </cite> Have you registered to the "App.SimpleMessage" notification from the current user? <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Notification-System#subscribe-to-notifications">http://www.aspnetboilerplate.com/Pages/ ... ifications</a>

Yes, I had.

await _notificationSubscriptionManager.IsSubscribedAsync(recepient.Id, "App.SimpleMessage");

returns true.

<cite>ismcagdas: </cite>

Hi, 1 ) is there any other code after app.MapSignalR(); in your Startup.cs's configure method ?

No.

<cite>ismcagdas: </cite>

  1. Is there any other tab/browser window opened with the same account. Because for your version (Abp 0.8.4), the notification will be sent to only last opened browser window/tab.

No.

That should fix that issue:

.ui-grid-render-container-body {
   position: relative;
}

.ui-grid-cell-contents div.btn-group {
   position: absolute !important;
}

Thank you, solved. The problem was related with business logic of the application and had nothing to do with ABP or SignalR.

Showing 1 to 10 of 12 entries