MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

HOW TO DISPLAY NOTIFICATIONS WHEN USER HAS UNREAD MESSAGES  (Mono Support )

Viewed 26975 time(s), 20 post(s) 8/1/2014 7:00:34 PMby ZaeVega

Related topics

amrmagdy

amrmagdy

12/23/2014 12:50:36 AM
Please
Where I can add this code?

I get this error:
"MonoSoftware.MonoX.Repositories.MessageRepository' does not contain a definition for 'GetInstance"
This content has not been rated yet. 
127 Reputation 15 Total posts
imarusic

imarusic

12/23/2014 8:22:11 AM
Hi,

can you please let us know what MonoX version you have?

Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
amrmagdy

amrmagdy

12/23/2014 1:25:13 PM

MonoX v5.1.40.5030 [31/10/2014], DB v4.7.3842

This content has not been rated yet. 
127 Reputation 15 Total posts
imarusic

imarusic

12/23/2014 1:36:54 PM
Hi,

you need to use DI in order to get an instance  for the Message repository:

DependencyInjectionFactory.Resolve<IMessageRepository>().GetNumberOfUnreadMessages(userId);
Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
amrmagdy

amrmagdy

12/23/2014 1:50:58 PM
error CS0103: The name 'DependencyInjectionFactory' does not exist in the current context

full code is :
<asp:PlaceHolder runat="server" ID="plhNumber"><br><span class='number'><%= DependencyInjectionFactory.Resolve<IMessageRepository>().GetNumberOfUnreadMessages(userId) %></span></asp:PlaceHolder
This content has not been rated yet. 
127 Reputation 15 Total posts
imarusic

imarusic

12/23/2014 2:32:08 PM
Just tried on the "SeoLoginStatus" control which has "DependencyInjectionFactory" property inherited from the BaseUserControl and it works.

Also, you need include repository import in your markup:

<%@ Import Namespace="MonoSoftware.MonoX.Repositories" %>

Rated 5.00, 1 vote(s). 
3016 Reputation 428 Total posts
amrmagdy

amrmagdy

12/23/2014 2:50:38 PM
"SeoLoginStatus" control code now is
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SeoLoginStatus.ascx.cs"
    Inherits="MonoSoftware.MonoX.Controls.SeoLoginStatus" %>
    <%@ Import Namespace="MonoSoftware.MonoX.Repositories" %>
 
<asp:PlaceHolder ID="panStatus" runat="server">
    <asp:LinkButton runat="server" ID="btnButton">
        <span class="icon-logout"><%= LogoutText %></span>       
    </asp:LinkButton>
    <asp:HyperLink runat="server" ID="btnLink"><%= LoginText %></asp:HyperLink>
</asp:PlaceHolder>
 
<asp:PlaceHolder runat="server" ID="plhNumber">
<span class='number'><%= DependencyInjectionFactory.Resolve<IMessageRepository>().GetNumberOfUnreadMessages(userId) %></span>
 
 
</asp:PlaceHolder>
But I get this error:
error CS0103: The name 'userId' does not exist in the current context
This content has not been rated yet. 
127 Reputation 15 Total posts
imarusic

imarusic

12/23/2014 2:55:58 PM
"userId" was just a hint that you need provide "GetNumberOfUnreadMessages" with the required parameters.

UserId can be obtained as I wrote in the topic marked as answered:

SecurityUtility.GetUserId();
It returns current logged user's id.

Regards.
Rated 5.00, 1 vote(s). 
3016 Reputation 428 Total posts
amrmagdy

amrmagdy

12/23/2014 3:21:32 PM
Thank you &  I'm sorry it's my mistake  :)
This content has not been rated yet. 
127 Reputation 15 Total posts
imarusic

imarusic

12/23/2014 3:23:42 PM
No problem, we are glad that you managed to implement it.

Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
1 2