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.

Event Viewer.  (Mono Support )

Viewed 104064 time(s), 23 post(s) 7/29/2011 1:18:13 AMby shawndg
shawndg

shawndg

7/29/2011 1:18:48 AM
Hello,

I been playing with the events and I have a few issues and request with it and wondering if you could please point me in the right direction..

Bug maybe ?
When i select day view... it shows events for other days not just today..
is this a bug ?

Feature request,
cant change the sorting order.. ability to pick asc or desc.
I noticed that the calendars all start at 8am.. it would be nice to pick a different time.

I like the system a lot but it looks more like a display for outlook then a webpage.

any feedback ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
pajo

pajo

7/29/2011 8:26:32 AM
Hi shawndg,

Event module has two modes simple and advanced, you will need to specify which mode you were trying to use to give you more precise answer.

Day view is available only in advanced mode, I tried to reproduce issue you're having, but without success. If you're using advanced mode and you're getting events for other days it certainly is a bug. If you're using simple mode then day view has no effect, simple mode works more like a list, but you can filter events by date range so it's possible to extend event module to work like day view in simple mode. I can provide you with a sample if you're interested.
This content has not been rated yet. 
629 Reputation 83 Total posts
khorvat

khorvat

7/29/2011 8:30:48 AM
Hi,

I was just speaking with Vlatko (a.k.a pajo) and he told me that you may be talking about the social networking event module, so can you just clear up what module are you referring to exactly ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
shawndg

shawndg

7/30/2011 1:26:32 PM
the main event module. IM trying to get it to display concerts but using the simple mode and only concerts for today. now I would be OK with displaying in advanced if I could get the display to no start at 8am or make it more like a concert calendar then a outlook one.
This content has not been rated yet. 
1871 Reputation 252 Total posts
khorvat

khorvat

7/30/2011 10:16:16 PM
Hi,

If there is a possibility to tweak the Event module to suite your needs you will need to inherit the module and some code to it. I'll try to get the needed information for you in the Monday morning (UTC +01). 

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
pajo

pajo

8/1/2011 10:14:53 AM
Hi shawndg,

you'll need to extend EventModule and EventSimpleView by inheriting MonoSoftware.MonoX.ModuleGallery.EventModule and MonoSoftware.MonoX.ModuleGallery.EventSimpleView respectively.

In your EventSimpleView code behind extending MonoX EventSimpleView add this code:

/// <summary>
/// Gets or sets day to display
/// </summary>
public DateTime SelectedDay { get; set; }
 
public override void DataBind()
{
    // Override filter and set it to show events only for selected day
    dateFrom.SelectedDate = SelectedDay.Date;
    dateTo.SelectedDate = SelectedDay.Date.AddDays(1);
 
    base.DataBind();
}

In your extended EventModule change markup by replacing:

<%@ Register TagPrefix="MonoX" TagName="SimpleEventView" Src="/MonoX/ModuleGallery/EventModule/EventSimpleView.ascx" %>

with the path to your SimpleEventView e.g.:

<%@ Register TagPrefix="MyControls" TagName="MySimpleEventView" Src="/MyEventModule/MyEventSimpleView.ascx" %>

You will also need to change simple view instance in markup to reflect register control changes, in the case of my example you will replace:

<MonoX:SimpleEventView ID="ctlSimpleView" runat="server"></MonoX:SimpleEventView>

with following:

<MyControls:MySimpleEventView ID="ctlSimpleView" runat="server"></MyControls:MySimpleEventView>

you need only to keep ID same.

In your extended EventModule you will need to add following code:

private DateTime _selectedDay = DateTime.Now;
/// <summary>
/// Gets or sets selected day so you can easily change day you want to show
/// </summary>
public DateTime SelectedDay
{
    get { return _selectedDay; }
    set
    {
        _selectedDay = value;
    }
}
 
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
 
    // We can switch mode to simple as we're not interested in advanced mode in this case
    Mode = MonoSoftware.MonoX.ModuleGallery.EventModuleMode.Simple;
    // No point in showing the filter
    ctlSimpleView.ShowFilter = false;
}
 
public override void DataBind()
{
    // Before we bind data we need to set day we want to show
    ((MyEventSimpleView)ctlSimpleView).SelectedDay = this.SelectedDay;
 
    base.DataBind();
}


This content has not been rated yet. 
629 Reputation 83 Total posts
shawndg

shawndg

8/1/2011 11:50:08 AM
awesome thanks guys..

I will work on this and let you know the results.
This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

8/8/2011 9:05:19 PM
I have not had a lot of time to work on this..

But I did play with it and had no luck.. but then I just realized I think I did it backward..

It looks like I need to first create my own version of the EventModule and then inherit my version.. not Monox default ?

That will allow me to expose the properties to my own control.. because by default they are not exposed ?

Also.. is there any way I can change between ASC and DESC ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
pajo

pajo

8/9/2011 8:51:38 AM
Hi shawndg,

You're right, first you need to create your version of the EventModule and then you need to create your version of the EventSimpleView and change MonoX EventSimpleView inside EventModule with your version of the EventSimpleView. Now you just need to extend your modules with the code provided and you should get daily list.

And to change sort direction you would have to completely override DataBind in EventSimpleView with your events fetching code. In your case you would need to add following code:

public override void DataBind()
{
    // Fetch filter, we can ignore module filter in this case as we have full control over fetching
    IRelationPredicateBucket filter = new RelationPredicateBucket();
    filter.PredicateExpression.Add(CalendarEventFields.CalendarId == this.CalendarId);
    filter.PredicateExpression.Add(CalendarEventFields.StartTime >= this.SelectedDate.Date);
    filter.PredicateExpression.Add(CalendarEventFields.StartTime < this.SelectedDate.Date.AddDays(1));
       
    // Set sorter, here you'll change sort direction by changing SortOperator
    ISortExpression sorter = new SortExpression(new SortClause(CalendarEventFields.StartTime, null, SortOperator.Descending));
   
   EntityCollection<CalendarEventEntity> items= new EntityCollection<CalendarEventEntity>();
   BaseMonoXRepository.GetInstance().FetchEntityCollection(items, filter, 0, sorter, null, pager.CurrentPageIndex + 1, pager.PageSize);
    int recordCount = this.GetDbCount(items, filter);
   
  PagerUtility.BindPager(pager, DataBind, lvItems, items, recordCount);
}
This content has not been rated yet. 
629 Reputation 83 Total posts
shawndg

shawndg

8/11/2011 12:40:49 AM
Ok I tried evrything and I got tons of errors and no good results =/

But here is all the code I wrote..

EventModuleExt.ascx

MarkUp
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EventModuleExt.ascx.cs" Inherits="TheScene.Web.TheScene.WebParts.EventModuleExt.EventModuleExt" %>
<%@ Register TagPrefix="MyControls" TagName="EventSimpleViewExt" Src="/TheScene/WebParts/EventModuleExt/EventSimpleViewExt.ascx" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="MonoX" TagName="StyledButton" Src="/MonoX/controls/StyledButton.ascx" %>
<%@ Register TagPrefix="MonoX" TagName="EventEditor" Src="/MonoX/ModuleGallery/EventModule/EventEditor.ascx" %>
<%@ Register TagPrefix="MonoX" TagName="SimpleEventView" Src="/MonoX/ModuleGallery/EventModule/EventSimpleView.ascx" %>
 
<asp:PlaceHolder ID="plhNoCalendar" runat="server" Visible="false">
    <%= MonoSoftware.MonoX.Resources.EventModuleResources.NoCalendarSelected %>
</asp:PlaceHolder>
 
<asp:UpdatePanel ID="upEventModule" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:PlaceHolder ID="plhEventEditor" runat="server" Visible="false">
            <MonoX:EventEditor ID="ctlEventEditor" runat="server"></MonoX:EventEditor>
        </asp:PlaceHolder>
 
        <asp:PlaceHolder ID="plhSchedule" runat="server">
            <table cellpadding="0" cellspacing="0" width="100%" class="event-module">
                <tr>
                    <td class="calendar">
                        <asp:PlaceHolder ID="plhAddNewEvent" runat="server">
                            <asp:LinkButton ID="btnNewEvent" runat="server" CssClass="add-new-event"></asp:LinkButton>
                        </asp:PlaceHolder>
                        <div style="clear:both">
                            <telerik:RadCalendar ID="calEvent" runat="server" Skin="WebBlue">
                            </telerik:RadCalendar>
                        </div>
                    </td>
                    <td class="scheduler">
                        <div>
                            <telerik:RadScheduler ID="schEvent" runat="server" Height="100%"
                            DataKeyField="Id" DataStartField="StartTime" DataEndField="EndTime" DataSubjectField="Title" DataDescriptionField="Description"
                            Skin="Vista" CssClass="event-scheduler" SelectedView="WeekView">
                            </telerik:RadScheduler>
                        </div>
                    </td>
                </tr>
            </table>
             
            <telerik:RadToolTip ID="rttEventDetails" runat="server" IgnoreAltAttribute="true" ShowEvent="FromCode" HideEvent="ManualClose" Position="BottomCenter" RelativeTo="Element" Width="300px">
            </telerik:RadToolTip>
            <div style="display:none">
                <asp:HiddenField ID="fldRefreshParams" runat="server" />
                <asp:Button ID="btnRefresh" runat="server" />
            </div>
        </asp:PlaceHolder>
         
        <asp:PlaceHolder ID="plhSimpleView" runat="server">
            <div class="event-simple-view">
                <MonoX:StyledButton ID="btnNewSimpleMode" runat="server" />
                <MonoX:SimpleEventView ID="ctlSimpleView" runat="server"></MonoX:SimpleEventView>
            </div>
        </asp:PlaceHolder>
    </ContentTemplate>
</asp:UpdatePanel>

Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX.Utilities;
using MonoSoftware.MonoX.ModuleGallery;
 
 
namespace TheScene.Web.TheScene.WebParts.EventModuleExt
{
    public partial class EventModuleExt : MonoSoftware.MonoX.ModuleGallery.EventSimpleView
    {
 
        private DateTime _selectedDay = DateTime.Now;
        /// <summary>
        /// Gets or sets selected day so you can easily change day you want to show
        /// </summary>
        public DateTime SelectedDay
        {
            get { return _selectedDay; }
            set
            {
                _selectedDay = value;
            }
        }
 
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
 
            // We can switch mode to simple as we're not interested in advanced mode in this case
            Mode = MonoSoftware.MonoX.ModuleGallery.EventModuleMode.Simple;
            // No point in showing the filter
            ctlSimpleView.ShowFilter = false;
        }
 
        public override void DataBind()
        {
            // Before we bind data we need to set day we want to show
            ((EventSimpleViewExt)ctlSimpleView).SelectedDay = this.SelectedDay;
 
            base.DataBind();
        }
 
 
    }
}


EventSimpleViewExt

MarkUp:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EventSimpleViewExt.ascx.cs" Inherits="TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt" %>
 
<%@ Register Namespace="MonoSoftware.Web.Pager" Assembly="MonoSoftware.Web.Pager" TagPrefix="mono" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="MonoX" TagName="StyledButton" Src="/MonoX/controls/StyledButton.ascx" %>
 
<asp:PlaceHolder ID="plhFilter" runat="server">
    <div class="top-button-holder">
        <div class="date-picker"><telerik:RadDateTimePicker ID="dateFrom" runat="server"></telerik:RadDateTimePicker></div>
        <div class="date-picker"><telerik:RadDateTimePicker ID="dateTo" runat="server"></telerik:RadDateTimePicker></div>
        <MonoX:StyledButton ID="btnFilter" runat="server" />
        <MonoX:StyledButton ID="btnClearFilter" runat="server" />
    </div>
</asp:PlaceHolder>
 
<div class="list-view">
    <asp:ListView ID="lvItems" runat="server">
        <LayoutTemplate>
            <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
        </LayoutTemplate>
        <ItemTemplate></ItemTemplate>
    </asp:ListView>
 
    <mono:Pager runat="server" ID="pager" PageSize="10" NumericButtonCount="5" AllowCustomPaging="true" AutoPaging="false">
        <PagerTemplate></PagerTemplate>
    </mono:Pager>
</div>

Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX.Utilities;
using MonoSoftware.MonoX.ModuleGallery;
 
namespace TheScene.Web.TheScene.WebParts.EventModuleExt
{
    public partial class EventSimpleViewExt : MonoSoftware.MonoX.ModuleGallery.EventSimpleView
    {
 
        public override void DataBind()
        {
            // Fetch filter, we can ignore module filter in this case as we have full control over fetching
            IRelationPredicateBucket filter = new RelationPredicateBucket();
            filter.PredicateExpression.Add(CalendarEventFields.CalendarId == this.CalendarId);
            filter.PredicateExpression.Add(CalendarEventFields.StartTime >= this.SelectedDate.Date);
            filter.PredicateExpression.Add(CalendarEventFields.StartTime < this.SelectedDate.Date.AddDays(1));
 
            // Set sorter, here you'll change sort direction by changing SortOperator
            ISortExpression sorter = new SortExpression(new SortClause(CalendarEventFields.StartTime, null, SortOperator.Descending));
 
            EntityCollection<CalendarEventEntity> items = new EntityCollection<CalendarEventEntity>();
            BaseMonoXRepository.GetInstance().FetchEntityCollection(items, filter, 0, sorter, null, pager.CurrentPageIndex + 1, pager.PageSize);
            int recordCount = this.GetDbCount(items, filter);
 
            PagerUtility.BindPager(pager, DataBind, lvItems, items, recordCount);
        }
 
 
    }
}


Error List..
Error 13 The type or namespace name 'SortExpression' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 24 42 Portal
Error 14 The type or namespace name 'SortClause' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 24 61 Portal
Error 6 The type or namespace name 'RelationPredicateBucket' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 18 51 Portal
Error 12 The type or namespace name 'ISortExpression' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 24 13 Portal
Error 5 The type or namespace name 'IRelationPredicateBucket' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 18 13 Portal
Error 18 The type or namespace name 'EntityCollection' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 26 13 Portal
Error 20 The type or namespace name 'EntityCollection' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 26 63 Portal
Error 17 The type or namespace name 'CalendarEventEntity' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 26 30 Portal
Error 19 The type or namespace name 'CalendarEventEntity' could not be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 26 80 Portal
Error 16 The name 'SortOperator' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 24 109 Portal
Error 23 The name 'Mode' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventModuleExt.ascx.cs 34 13 Portal
Error 7 The name 'CalendarEventFields' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 19 44 Portal
Error 8 The name 'CalendarEventFields' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 20 44 Portal
Error 10 The name 'CalendarEventFields' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 21 44 Portal
Error 15 The name 'CalendarEventFields' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 24 72 Portal
Error 21 The name 'BaseMonoXRepository' does not exist in the current context C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 27 13 Portal
Error 24 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' does not contain a definition for 'SelectedDay' and no extension method 'SelectedDay' accepting a first argument of type 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' could be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventModuleExt.ascx.cs 42 49 Portal
Error 9 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' does not contain a definition for 'SelectedDate' and no extension method 'SelectedDate' accepting a first argument of type 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' could be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 20 82 Portal
Error 11 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' does not contain a definition for 'SelectedDate' and no extension method 'SelectedDate' accepting a first argument of type 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' could be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 21 81 Portal
Error 22 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' does not contain a definition for 'GetDbCount' and no extension method 'GetDbCount' accepting a first argument of type 'TheScene.Web.TheScene.WebParts.EventModuleExt.EventSimpleViewExt' could be found (are you missing a using directive or an assembly reference?) C:\#ThePittsburghScene\TheScene\WebParts\EventModuleExt\EventSimpleViewExt.ascx.cs 28 36 Portal

This content has not been rated yet. 
1871 Reputation 252 Total posts
1 2 3