views:

4936

answers:

6

I need a calendar/scheduler control for asp.net - not a pop-up date picker, but a full page monthly calendar.

I'm trying to create an on call rotation / scheduler utility for work, and it'd be great to display the who's on call info in a calendar on a web page where others could quickly see who's on call.

using visual studio 2008/asp/net 3.5

(I had a look around the net and on this site, but didn't turn up what I was looking for so I am hopeing someone here can point me in the right direction)

A: 

This won't work if you need more fine-grained control over it, but have you checked out using Google Apps? It comes with Google Calendar baked in and could be all you need if all you want is the ability for people to put their schedules online and share them with other users.

Kevin Pang
GC won't work for us - The scheduling data is(or will be) in a local DB that is also used by our notification systems. This way who ever is on call gets the email alerts when things go down.
basementjack
+2  A: 

This seems like something that you could easily write yourself.

Here is a SQL query that I found somewhere on the net when writing something similar for our department:

CREATE      procedure [dbo].[CalMonthByYearMonth] (@YEAR INT, @MONTH INT) AS
DECLARE @INPUTDATE DATETIME
DECLARE @DATE DATETIME
DECLARE @LASTDATE DATETIME
DECLARE @MONTHDAYCOUNT INT
DECLARE @COUNT INT
DECLARE @DAY VARCHAR(10)
DECLARE @STARTWEEK INT
DECLARE @CURWEEK INT
DECLARE @STARTMONTH INT
SET @INPUTDATE='01/01/' + CAST(@YEAR AS CHAR(4))
PRINT @INPUTDATE
SET @STARTMONTH=@MONTH
SET @INPUTDATE=DATEADD(MM,@MONTH - 1,@INPUTDATE)

    SET @COUNT=1
    SET @DATE = DATEADD(d, -(DATEPART(dd, @INPUTDATE) - 1), @INPUTDATE)
    SET @LASTDATE=DATEADD(DD,-1,DATEADD(MM,1,@DATE))
    SET @MONTHDAYCOUNT=datediff(d, @date, dateadd(m, 1, @date))
    SET @STARTWEEK=DATEPART(WEEK,@INPUTDATE)
    DECLARE @CURRWEEK INT
    DECLARE @CUR INT
    CREATE TABLE #TEMP(
     WEEK VARCHAR(10),
     SUNDAY VARCHAR(10),
     MONDAY VARCHAR(10),
     TUESDAY VARCHAR(10),
     WEDNESDAY VARCHAR(10),
     THURSDAY VARCHAR(10),
     FRIDAY VARCHAR(10),
     SATURDAY VARCHAR(10),
        YEARWEEK VARCHAR(10))
    DECLARE @wkcount int
    DECLARE @weeksinmonth int
    DECLARE @EXEC NVARCHAR(2000)
    SET @WKCOUNT=1
    SET @weeksinmonth=datediff(week, @date, @lastdate) + 1
    WHILE @wkcount<= @weeksinmonth
        begin
        INSERT INTO #TEMP VALUES(@wkcount,'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', @STARTWEEK + @WKCOUNT - 1)
        SET @WKCOUNT=@WKCOUNT + 1
    end
    WHILE @COUNT<=@MONTHDAYCOUNT
        BEGIN
         SET @DAY=DATENAME(WEEKDAY,@DATE)
         IF @STARTWEEK=DATENAME(WEEK,@DATE)
          SET @CURRWEEK=1
         ELSE
         BEGIN
          SET @CUR=DATENAME(WEEK,@DATE)
          SET @CURRWEEK=(@CUR-@STARTWEEK)+1
         END

         SET @EXEC='UPDATE #TEMP SET ' + @DAY + ' =' + CAST(@COUNT AS CHAR(2)) + ' WHERE WEEK=' + CAST(@CURRWEEK AS CHAR(2))+ 'AND WEEK IS NOT NULL'
         EXEC SP_EXECUTESQL @EXEC
         SET @DATE=DATEADD(DD,1,@DATE)
         SET @COUNT=@COUNT + 1
    END
    UPDATE #TEMP SET SUNDAY=' ' WHERE SUNDAY='SUNDAY'
    UPDATE #TEMP SET MONDAY=' ' WHERE MONDAY='MONDAY'
    UPDATE #TEMP SET TUESDAY=' ' WHERE TUESDAY='TUESDAY'
    UPDATE #TEMP SET WEDNESDAY=' ' WHERE WEDNESDAY='WEDNESDAY'
    UPDATE #TEMP SET THURSDAY=' ' WHERE THURSDAY='THURSDAY'
    UPDATE #TEMP SET FRIDAY=' ' WHERE FRIDAY='FRIDAY'
    UPDATE #TEMP SET SATURDAY=' ' WHERE SATURDAY='SATURDAY'
    SELECT Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday --, YEARWEEK
    --SELECT Monday, Tuesday, Wednesday, Thursday, Friday, YEARWEEK
    FROM #TEMP order by week
    DROP TABLE #TEMP

That should get you most of the way there. Next, you'll need a table to hold the schedule and you'll have to write some code to output the results to some sort of HTML table...

Hope this helps.

BoltBait
A: 

Check out this calendar / scheduling control: http://www.codeproject.com/KB/webforms/EventCalendarControl.aspx

A: 

Have you tried VCalendar?

George Stocker
+4  A: 

Check out DayPilot Lite (open-source):

http://www.daypilot.org/demo/Lite/

[Disclosure: Shameless self-promotion]

Dan
I have used DayPilot Lite before and it is by far the best free Calendar for creating appointments.
runxc1 Bret Ferrier
I am using DayPilot Lite for a schedule, and it's really flexible
jao
A: 

Try the Ext Scheduler, integrates easily with ASP.NET. Examples here:

http://ext-scheduler.com/examples.html

mats