[master]
GO
/****** Object: Table [dbo].[Attendance] Script Date: 04/23/2006 22:27:07 ******/
SET ANSI_NULLS
ON
GO
SET QUOTED_IDENTIFIER
ON
GO
CREATE TABLE [dbo].[Attendance](
[eventid] [int] NOT
NULL,
[member] [uniqueidentifier] NOT
NULL,
[numofguest] [int] NOT
NULL,
[UserName] [nvarchar](256)
COLLATE SQL_Latin1_General_CP1_CI_AS
NULL,
[avatar] [image] NULL,
CONSTRAINT [PK_Attendance]
PRIMARY KEY
CLUSTERED
(
[eventid] ASC,
[member] ASC
)WITH
(IGNORE_DUP_KEY
= OFF)
ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
#2.. The Stored Procedures:
------------------------ RSVP - Yes
USE
[master]
GO
/****** Object: StoredProcedure [dbo].[addAttendance] Script Date: 04/23/2006 22:31:55 ******/
SET ANSI_NULLS
ON
GO
SET QUOTED_IDENTIFIER
ON
GO
-- =============================================
-- Author: Angelo Abruzzese
-- Create date:
-- Description:
-- =============================================
CREATE
PROCEDURE [dbo].[addAttendance]
-- Add the parameters for the stored procedure here
@UserId uniqueidentifier
,
@NumberofGuests int,
@EventId int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT
ON;
-- Insert statements for procedure here
DECLARE @ReturnValue
int
SET @ReturnValue
= 0
DECLARE @ErrorCode
int
SET @ErrorCode
= 0
DECLARE @TranStarted
bit
SET @TranStarted
= 0
IF(
@@TRANCOUNT = 0
)
BEGIN
BEGIN TRANSACTION
SET @TranStarted
= 1
END
ELSE
SET @TranStarted
= 0
-- Check if the User has already RSVP'd for the event
-- If found switch to Update.
IF(
EXISTS( SELECT numofguest
FROM dbo.attendance
WHERE EventId
= @EventId
AND Member = @UserId))
BEGIN
update dbo.Attendance
set numofguest
= @NumberofGuests
WHERE EventId
= @EventId
AND Member = @UserId
END
ELSE
BEGIN
INSERT dbo.Attendance
(Member,
EventId,
numofguest)
VALUES (@UserId,
@EventId ,
@NumberofGuests )
END
IF(
@@ERROR <> 0
)
BEGIN
SET @ErrorCode
= -1
GOTO Cleanup
END
IF( @TranStarted
= 1 )
BEGIN
SET @TranStarted
= 0
COMMIT TRANSACTION
END
RETURN 0
Cleanup:
IF( @TranStarted
= 1 )
BEGIN
SET @TranStarted
= 0
ROLLBACK TRANSACTION
END
RETURN @ErrorCode
END
--------------------------------------------------------------- RSVP - NO
USE [master]
GO
/****** Object: StoredProcedure [dbo].[removeattendance] Script Date: 04/23/2006 22:34:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Angelo Abruzzese
-- Create date:
-- Description:
-- =============================================
CREATE PROCEDURE [dbo].[removeattendance]
-- Add the parameters for the stored procedure here
@UserId uniqueidentifier ,
@EventId int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @ReturnValue int
SET @ReturnValue = 0
DECLARE @ErrorCode int
SET @ErrorCode = 0
DECLARE @TranStarted bit
SET @TranStarted = 0
IF( @@TRANCOUNT = 0 )
BEGIN
BEGIN TRANSACTION
SET @TranStarted = 1
END
ELSE
SET @TranStarted = 0
-- Check if the User has already RSVP'd for the event
-- If found switch to Update.
BEGIN
Delete from dbo.Attendance
WHERE EventId = @EventId
AND Member = @UserId
END
IF( @@ERROR <> 0 )
BEGIN
SET @ErrorCode = -1
GOTO Cleanup
END
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
COMMIT TRANSACTION
END
RETURN 0
Cleanup:
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
ROLLBACK TRANSACTION
END
RETURN @ErrorCode
END
#3 -- The Modified Events_view.aspx
<%
@ Page
Language="VB"
MasterPageFile="~/Default.master"
Title="Check Raise Poker Tour Events View" %>
script runat="server">
Private prevEventID, nextEventID
As Integer
Private Member
As Guid
Dim dt As
New DataTable
Const INVALIDID
As Integer = -1
Protected Sub Page_Load(ByVal sender
As Object,
ByVal e As System.EventArgs)
SqlDataSource2.SelectParameters(
"id").DefaultValue =
CStr(EventID)
SqlDataSource1.SelectParameters(
"id").DefaultValue =
CStr(EventID)
If Not Page.User.Identity.IsAuthenticated
Then
RsvpPanel.Visible =
"False"
End If
End Sub
Protected Sub NextButton_Click(ByVal sender
As Object,
ByVal e As System.EventArgs)
InitValsFromSql(EventID)
If nextEventID <> INVALIDID
Then
prevEventID = EventID
EventID = nextEventID
SqlDataSource1.SelectParameters(
"id").DefaultValue =
CStr(nextEventID)
End If
ToggleLinks()
End Sub
Protected Sub PrevButton_Click(ByVal sender
As Object,
ByVal e As System.EventArgs)
InitValsFromSql(EventID)
If prevEventID <> INVALIDID
Then
nextEventID = EventID
EventID = prevEventID
SqlDataSource1.SelectParameters(
"id").DefaultValue =
CStr(prevEventID)
End If
ToggleLinks()
End Sub
Sub ToggleLinks()
LinkButton1.Enabled = (nextEventID <> INVALIDID)
LinkButton3.Enabled = (nextEventID <> INVALIDID)
LinkButton2.Enabled = (prevEventID <> INVALIDID)
LinkButton4.Enabled = (prevEventID <> INVALIDID)
End Sub
Property EventID()
As Integer
Get
Dim m_EventID
As Integer
Dim id As
Object = ViewState("EventID")
If Not id
Is Nothing
Then
m_EventID =
CInt(id)
Else
id = Request.QueryString(
"EventID")
If Not id
Is Nothing
Then
m_EventID =
CInt(id)
Else
m_EventID = 1
End If
ViewState(
"EventID") = m_EventID
End If
Return m_EventID
End Get
Set(ByVal value
As Integer)
ViewState(
"EventID") = value
End Set
End Property
Sub InitValsFromSql(ByVal EventID
As Integer)
Try
Dim connection
As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
Dim command
As New SqlClient.SqlCommand("dbo.NextPrevEvent", connection)
Dim param0
As New SqlClient.SqlParameter("@id", EventID)
Dim param1
As New SqlClient.SqlParameter("@previd", INVALIDID)
Dim param2
As New SqlClient.SqlParameter("@nextid", INVALIDID)
param1.Direction = ParameterDirection.InputOutput
param2.Direction = ParameterDirection.InputOutput
command.Parameters.Add(param0)
command.Parameters.Add(param1)
command.Parameters.Add(param2)
command.CommandType = CommandType.StoredProcedure
connection.Open()
command.ExecuteNonQuery()
If Not param1.Value
Is Nothing
AndAlso Not IsDBNull(param1.Value)
Then prevEventID =
CInt(param1.Value) Else prevEventID = INVALIDID
If Not param2.Value
Is Nothing
AndAlso Not IsDBNull(param2.Value)
Then nextEventID =
CInt(param2.Value) Else nextEventID = INVALIDID
connection.Close()
Catch ex As Exception
'Do nothing in the case of an exception
prevEventID = INVALIDID
nextEventID = INVALIDID
End Try
End Sub
Protected Sub FormView1_DataBound(ByVal sender
As Object,
ByVal e As System.EventArgs)
Dim view As Data.DataRowView =
CType(FormView1.DataItem, Data.DataRowView)
Dim o As
Object = view.Item("staticURL")
If Not o
Is Nothing
AndAlso Not IsDBNull(o)
Then
'We have a static URL, we need to redirect.
Dim staticurl
As String =
CStr(o)
If staticurl <>
"" Then Response.Redirect(staticurl)
End If
End Sub
Function ShowLocationLink(ByVal locationname
As Object,
ByVal id As
Object) As
String
If (Not id
Is Nothing)
AndAlso Not IsDBNull(id)
Then
Return "At " &
"<a href='Locations_view.aspx?LocationID=" &
CStr(id) & "'>" &
CStr(locationname) &
"</a><br/>"
Else
Return ""
End If
End Function
Function ShowDuration(ByVal starttime
As Object,
ByVal endtime
As Object)
As String
Dim starttimeDT
As Date =
CDate(starttime)
If Not endtime
Is Nothing
AndAlso Not IsDBNull(endtime)
Then
Dim endtimeDT
As Date =
CDate(endtime)
If starttimeDT.Date = endtimeDT.Date
Then
If starttimeDT = endtimeDT
Then
Return starttimeDT.ToString("h:mm tt")
Else
Return starttimeDT.ToString("h:mm tt") &
" - " & endtimeDT.ToString("h:mm tt")
End If
Else
Return "thru " & endtimeDT.ToString("M/d/yy")
End If
Else
Return starttimeDT.ToString("h:mm tt")
End If
End Function
Protected Sub FormView1_PageIndexChanging(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs)
End Sub
Protected Sub GridView2_SelectedIndexChanged(ByVal sender
As Object,
ByVal e As System.EventArgs)
End Sub
Sub submitter_update(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.CommandEventArgs)
Try
Dim Member
As Guid = CType(Membership.GetUser().ProviderUserKey, Guid)
Dim connection
As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
Dim command
As New SqlClient.SqlCommand("dbo.addAttendance", connection)
Dim param0
As New SqlClient.SqlParameter("@EventId", EventID)
Dim param1
As New SqlClient.SqlParameter("@NumberofGuests", Convert.ToInt32(numofguests.Text))
Dim param2
As New SqlClient.SqlParameter("@UserId ", Member)
command.Parameters.Add(param0)
command.Parameters.Add(param1)
command.Parameters.Add(param2)
command.CommandType = CommandType.StoredProcedure
connection.Open()
command.ExecuteNonQuery()
connection.Close()
RSVPGrid.DataBind()
Catch ex As Exception
When 1 = 1
Response.Clear()
Response.Write(
"<html><head><title>Sorry, an Error has occured</title>" & _
"<link rel=""stylesheet"" type=""text/css"" href=""client.css"" /></head><body bgcolor=""#ffffff"">" & _
"<p><font class=""error"">An Exception error has occurred on this page:<p>" & _
"<p>" & ex.ToString() &
"<p><b>Record NOT Inserted</b>" & _
"<p>Please go back and <a class=""pageLink"" href=""javascript:history.back();"">try again</a> or " & _
"return to the main page to <a class=""pageLink"" href=""forum.aspx"">view all Topics</a>.</font>" & _
"</body></html>")
Server.ClearError()
Response.End()
End Try
End Sub
Sub canceller_update(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.CommandEventArgs)
Try
Dim Member
As Guid = CType(Membership.GetUser().ProviderUserKey, Guid)
Dim connection
As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
Dim command
As New SqlClient.SqlCommand("dbo.removeAttendance", connection)
Dim param0
As New SqlClient.SqlParameter("@EventId", EventID)
Dim param1
As New SqlClient.SqlParameter("@UserId ", Member)
command.Parameters.Add(param0)
command.Parameters.Add(param1)
command.CommandType = CommandType.StoredProcedure
connection.Open()
command.ExecuteNonQuery()
connection.Close()
RSVPGrid.DataBind()
Catch ex As Exception
When 1 = 1
Response.Clear()
Response.Write(
"<html><head><title>Sorry, an Error has occured</title>" & _
"<link rel=""stylesheet"" type=""text/css"" href=""client.css"" /></head><body bgcolor=""#ffffff"">" & _
"<p><font class=""error"">An Exception error has occurred on this page:<p>" & _
"<p>" & ex.ToString() &
"<p><b>Record NOT Inserted</b>" & _
"<p>Please go back and <a class=""pageLink"" href=""javascript:history.back();"">try again</a> or " & _
"return to the main page to <a class=""pageLink"" href=""forum.aspx"">view all Topics</a>.</font>" & _
"</body></html>")
With the basic Forum sort of finished and the Avatar problem I had yesterday solved I finally got some time to look at your RSVP module.
Impressive I must say and a feature I would also like to integrate.
Is it based on a single Database? Ans what is your advice, should I wait for the final code or can I start fiddling around and start with the first post of this thread?
Probably adding Avatar to the posts like you mentioned recently is still a bit beyond my scope. But I'll keep at it from various angles.
I am also trying to get E-mail notifiaction at reply. Having difficulty with SQL to get the E-mail address from the Starter of a Thread as this is the one that should receive that E-mail. Can I run that through your grey matter at some point?
lexy
Participant
1668 Points
441 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
Mar 20, 2006 06:52 AM|LINK
Hi Angelo,
This RSVP module, I assume that first the user goes through standard registration before he can use it?
I wish I could be of some more help. Whenever you think a novice (like I am) can contribute at any stage, please let me know.
I sent you my E-mail address, using the Contact button as you can find in all the posts. Not really sure it came through, did it?
Regards,
Lex
aabruzzese
Contributor
2806 Points
759 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
Mar 20, 2006 10:42 AM|LINK
Hi Lexy,
Any contribution is a good contribution, sometimes you can find a series of small things to change that actually add up.
I got your email and am zipping up the files for you.
As for the RSVP, yes a user must be authenticated in order to reply.
aabruzzese
Contributor
2806 Points
759 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
Apr 24, 2006 04:39 AM|LINK
Ok I finally sat down and bit the bullet on this one:
You can view it at my site as usual.... http://67.164.255.166:8029/events_view.aspx?eventid=10
Of course to RSVP you need to be authenticated.
Here are the ingredients:
#1 .. The Attendance Table:
USE
[master]GO
/****** Object: Table [dbo].[Attendance] Script Date: 04/23/2006 22:27:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Attendance](
[eventid] [int] NOT NULL,
[member] [uniqueidentifier] NOT NULL,
[numofguest] [int] NOT NULL,
[UserName] [nvarchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[avatar] [image] NULL,
CONSTRAINT [PK_Attendance] PRIMARY KEY CLUSTERED
(
[eventid] ASC,
[member] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
#2.. The Stored Procedures:
------------------------ RSVP - Yes
USE
[master]GO
/****** Object: StoredProcedure [dbo].[addAttendance] Script Date: 04/23/2006 22:31:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Angelo Abruzzese
-- Create date:
-- Description:
-- =============================================
CREATE
PROCEDURE [dbo].[addAttendance]-- Add the parameters for the stored procedure here
@UserId uniqueidentifier ,
@NumberofGuests int,
@EventId int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON; -- Insert statements for procedure here DECLARE @ReturnValue int
SET @ReturnValue = 0
DECLARE @ErrorCode int
SET @ErrorCode = 0
DECLARE @TranStarted bit
SET @TranStarted = 0 IF( @@TRANCOUNT = 0 )
BEGIN
BEGIN TRANSACTION
SET @TranStarted = 1
END
ELSE
SET @TranStarted = 0
-- Check if the User has already RSVP'd for the event
-- If found switch to Update.
IF( EXISTS( SELECT numofguest FROM dbo.attendance
WHERE EventId = @EventId
AND Member = @UserId))
BEGIN
update dbo.Attendance
set numofguest = @NumberofGuests
WHERE EventId = @EventId
AND Member = @UserId
END
ELSE
BEGIN
INSERT dbo.Attendance (Member,
EventId,
numofguest)
VALUES (@UserId,
@EventId ,
@NumberofGuests )
END IF( @@ERROR <> 0 )
BEGIN
SET @ErrorCode = -1
GOTO Cleanup
END
IF( @TranStarted = 1 )
RETURN @ErrorCodeBEGIN
SET @TranStarted = 0
COMMIT TRANSACTION
END
RETURN 0
Cleanup:
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
ROLLBACK TRANSACTION
END
END
--------------------------------------------------------------- RSVP - NO
USE [master]
GO
/****** Object: StoredProcedure [dbo].[removeattendance] Script Date: 04/23/2006 22:34:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Angelo Abruzzese
-- Create date:
-- Description:
-- =============================================
CREATE PROCEDURE [dbo].[removeattendance]
-- Add the parameters for the stored procedure here
@UserId uniqueidentifier ,
@EventId int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @ReturnValue int
SET @ReturnValue = 0
DECLARE @ErrorCode int
SET @ErrorCode = 0
DECLARE @TranStarted bit
SET @TranStarted = 0
IF( @@TRANCOUNT = 0 )
BEGIN
BEGIN TRANSACTION
SET @TranStarted = 1
END
ELSE
SET @TranStarted = 0
-- Check if the User has already RSVP'd for the event
-- If found switch to Update.
BEGIN
Delete from dbo.Attendance
WHERE EventId = @EventId
AND Member = @UserId
END
IF( @@ERROR <> 0 )
BEGIN
SET @ErrorCode = -1
GOTO Cleanup
END
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
COMMIT TRANSACTION
END
RETURN 0
Cleanup:
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
ROLLBACK TRANSACTION
END
RETURN @ErrorCode
END
#3 -- The Modified Events_view.aspx
<%
@ Page Language="VB" MasterPageFile="~/Default.master" Title="Check Raise Poker Tour Events View" %><%
@Import Namespace="System.Data"%><%
@Import Namespace="System.Data.SqlClient"%><%
@ Register TagPrefix="Club" Namespace="ClubSite" %><%
@ Register TagPrefix="Club" TagName="LoginBanner" Src="LoginBanner.ascx" %><%
@ Register TagPrefix="Club" TagName="ImageThumbnail" Src="ImageThumbnail.ascx" %><
script runat="server"> Private prevEventID, nextEventID As Integer Private Member As Guid Dim dt As New DataTable Const INVALIDID As Integer = -1 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)SqlDataSource2.SelectParameters(
"id").DefaultValue = CStr(EventID)SqlDataSource1.SelectParameters(
"id").DefaultValue = CStr(EventID) If Not Page.User.Identity.IsAuthenticated ThenRsvpPanel.Visible =
"False" End If End Sub Protected Sub NextButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)InitValsFromSql(EventID)
If nextEventID <> INVALIDID ThenprevEventID = EventID
EventID = nextEventID
SqlDataSource1.SelectParameters(
"id").DefaultValue = CStr(nextEventID) End IfToggleLinks()
End Sub Protected Sub PrevButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)InitValsFromSql(EventID)
If prevEventID <> INVALIDID ThennextEventID = EventID
EventID = prevEventID
SqlDataSource1.SelectParameters(
"id").DefaultValue = CStr(prevEventID) End IfToggleLinks()
End Sub Sub ToggleLinks()LinkButton1.Enabled = (nextEventID <> INVALIDID)
LinkButton3.Enabled = (nextEventID <> INVALIDID)
LinkButton2.Enabled = (prevEventID <> INVALIDID)
LinkButton4.Enabled = (prevEventID <> INVALIDID)
End Sub Property EventID() As Integer Get Dim m_EventID As Integer Dim id As Object = ViewState("EventID") If Not id Is Nothing Thenm_EventID =
CInt(id) Elseid = Request.QueryString(
"EventID") If Not id Is Nothing Thenm_EventID =
CInt(id) Elsem_EventID = 1
End IfViewState(
"EventID") = m_EventID End If Return m_EventID End Get Set(ByVal value As Integer)ViewState(
"EventID") = value End Set End Property Sub InitValsFromSql(ByVal EventID As Integer) Try Dim connection As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString) Dim command As New SqlClient.SqlCommand("dbo.NextPrevEvent", connection) Dim param0 As New SqlClient.SqlParameter("@id", EventID) Dim param1 As New SqlClient.SqlParameter("@previd", INVALIDID) Dim param2 As New SqlClient.SqlParameter("@nextid", INVALIDID)param1.Direction = ParameterDirection.InputOutput
param2.Direction = ParameterDirection.InputOutput
command.Parameters.Add(param0)
command.Parameters.Add(param1)
command.Parameters.Add(param2)
command.CommandType = CommandType.StoredProcedure
connection.Open()
command.ExecuteNonQuery()
If Not param1.Value Is Nothing AndAlso Not IsDBNull(param1.Value) Then prevEventID = CInt(param1.Value) Else prevEventID = INVALIDID If Not param2.Value Is Nothing AndAlso Not IsDBNull(param2.Value) Then nextEventID = CInt(param2.Value) Else nextEventID = INVALIDIDconnection.Close()
Catch ex As Exception 'Do nothing in the case of an exceptionprevEventID = INVALIDID
nextEventID = INVALIDID
End Try End Sub Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Dim view As Data.DataRowView = CType(FormView1.DataItem, Data.DataRowView) Dim o As Object = view.Item("staticURL") If Not o Is Nothing AndAlso Not IsDBNull(o) Then 'We have a static URL, we need to redirect. Dim staticurl As String = CStr(o) If staticurl <> "" Then Response.Redirect(staticurl) End If End Sub Function ShowLocationLink(ByVal locationname As Object, ByVal id As Object) As String If (Not id Is Nothing) AndAlso Not IsDBNull(id) Then Return "At " & "<a href='Locations_view.aspx?LocationID=" & CStr(id) & "'>" & CStr(locationname) & "</a><br/>" Else Return "" End If End Function Function ShowDuration(ByVal starttime As Object, ByVal endtime As Object) As String Dim starttimeDT As Date = CDate(starttime) If Not endtime Is Nothing AndAlso Not IsDBNull(endtime) Then Dim endtimeDT As Date = CDate(endtime) If starttimeDT.Date = endtimeDT.Date Then If starttimeDT = endtimeDT Then Return starttimeDT.ToString("h:mm tt") Else Return starttimeDT.ToString("h:mm tt") & " - " & endtimeDT.ToString("h:mm tt") End If Else Return "thru " & endtimeDT.ToString("M/d/yy") End If Else Return starttimeDT.ToString("h:mm tt") End If End Function Protected Sub FormView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs) End Sub Protected Sub GridView2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) End Sub Sub submitter_update(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Try Dim Member As Guid = CType(Membership.GetUser().ProviderUserKey, Guid) Dim connection As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString) Dim command As New SqlClient.SqlCommand("dbo.addAttendance", connection) Dim param0 As New SqlClient.SqlParameter("@EventId", EventID) Dim param1 As New SqlClient.SqlParameter("@NumberofGuests", Convert.ToInt32(numofguests.Text)) Dim param2 As New SqlClient.SqlParameter("@UserId ", Member)command.Parameters.Add(param0)
command.Parameters.Add(param1)
command.Parameters.Add(param2)
command.CommandType = CommandType.StoredProcedure
connection.Open()
command.ExecuteNonQuery()
connection.Close()
RSVPGrid.DataBind()
Catch ex As Exception When 1 = 1Response.Clear()
Response.Write(
"<html><head><title>Sorry, an Error has occured</title>" & _ "<link rel=""stylesheet"" type=""text/css"" href=""client.css"" /></head><body bgcolor=""#ffffff"">" & _ "<p><font class=""error"">An Exception error has occurred on this page:<p>" & _ "<p>" & ex.ToString() & "<p><b>Record NOT Inserted</b>" & _ "<p>Please go back and <a class=""pageLink"" href=""javascript:history.back();"">try again</a> or " & _ "return to the main page to <a class=""pageLink"" href=""forum.aspx"">view all Topics</a>.</font>" & _ "</body></html>")Server.ClearError()
Response.End()
End Try End Sub Sub canceller_update(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Try Dim Member As Guid = CType(Membership.GetUser().ProviderUserKey, Guid) Dim connection As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString) Dim command As New SqlClient.SqlCommand("dbo.removeAttendance", connection) Dim param0 As New SqlClient.SqlParameter("@EventId", EventID) Dim param1 As New SqlClient.SqlParameter("@UserId ", Member)command.Parameters.Add(param0)
command.Parameters.Add(param1)
command.CommandType = CommandType.StoredProcedure
connection.Open()
command.ExecuteNonQuery()
connection.Close()
RSVPGrid.DataBind()
Catch ex As Exception When 1 = 1Response.Clear()
Response.Write(
"<html><head><title>Sorry, an Error has occured</title>" & _ "<link rel=""stylesheet"" type=""text/css"" href=""client.css"" /></head><body bgcolor=""#ffffff"">" & _ "<p><font class=""error"">An Exception error has occurred on this page:<p>" & _ "<p>" & ex.ToString() & "<p><b>Record NOT Inserted</b>" & _ "<p>Please go back and <a class=""pageLink"" href=""javascript:history.back();"">try again</a> or " & _ "return to the main page to <a class=""pageLink"" href=""forum.aspx"">view all Topics</a>.</font>" & _ "</body></html>")Server.ClearError()
Response.End()
End Try End Sub</
script><
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <div id="body"> <Club:LoginBanner ID="LoginBanner1" runat="server" /> <!--Left column
-->
<div id="columnleft"> <a name="content_start" id="content_start"></a> <div class="leftblock"> <h2>Events
</h2> <p>Looking for a bit of Poker Fun, well check out all our events and sponsors.
All tournaments are listed here, simply click on it for more information and or directions.
</p> </div> </div> <!--Right column
-->
<div id="columnright"> <div class="rightblock"> <a href="Events_calendar.aspx">month view</a> <a href="Events_list.aspx">list view</a></div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>" SelectCommand="SELECT dbo.Events.id, dbo.Events.starttime, dbo.events.endtime, dbo.Events.title, dbo.Events.description, dbo.Events.staticURL, dbo.Events.photo, dbo.Events.Album, dbo.Events.location, dbo.Locations.title AS locationname FROM dbo.Events LEFT OUTER JOIN dbo.Locations ON dbo.Events.location = dbo.Locations.id where Events.id=@id"> <SelectParameters> <asp:QueryStringParameter DefaultValue="1" Name="id" QueryStringField="EventId" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> <div class="rightblock"> <div class="nextlink"> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="nextButton_Click">next event »</asp:LinkButton> </div> <asp:LinkButton ID="LinkButton2" runat="server" OnClick="prevButton_Click">« previous event</asp:LinkButton> <div class="dashedline"> </div> <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id" AllowPaging="false" Width=100% OnPageIndexChanging="FormView1_PageIndexChanging"> <ItemTemplate> <h2> <asp:Label Text='<%# Eval("title") %>' runat="server" ID="titleLabel" /> </h2> <div class="itemdetails"> <br />location:
<h3> <asp:Label ID="locationLabel" runat="server" Text='<%# ShowLocationLink(Eval("locationname"),Eval("location")) %>' /> </h3> <p> <asp:Label Text='<%# Eval("starttime","{0:D}") %>' runat="server" ID="itemdateLabel" /> <br /> <asp:Label Text='<%# ShowDuration(Eval("starttime"),Eval("endtime")) %>' runat="server" ID="Label1" /> </p> </div> <div class="downloadevent"> <a href="#"> <img src="images/icon_download_event.gif" alt="Download this event to your personal calendar" width="15" height="26" /></a><a href='<%# "events_download.ashx?EventID=" & CStr(Eval("id")) %>'>Addthis event to your personal calendar
</a></div> <Club:ImageThumbnail ID="thumb1" runat="server" imagesize="Large" PhotoID='<%# Eval("photo") %>' /> <p> <asp:Label Text='<%# Eval("description") %>' runat="server" ID="descriptionLabel" /> </p> <asp:panel ID=panel1 runat=server cssclass="actionbuttons" Visible='<%#User.IsInRole("Administrators") %>'> <Club:RolloverLink ID="EditBtn" runat="server" Text="Edit" NavigateURL='<%# "Events_edit.aspx?id=" & cstr(Eval("id")) %>' /> </asp:panel> </ItemTemplate> </asp:FormView> <div class="dashedline"> </div> <h2>RSVP - Sign In Sheet
</h2> <div class="dashedline"> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>" SelectCommand="SELECT aspnet_Users.UserName, aspnet_Users.UserId, Attendance.numofguest, aspnet_MemberShip.ImageId FROM Attendance INNER JOIN aspnet_Users ON Attendance.member = aspnet_Users.UserId INNER JOIN aspnet_MemberShip ON Attendance.member = aspnet_MemberShip.UserId WHERE (Attendance.eventid = @id)"> <SelectParameters> <asp:QueryStringParameter DefaultValue="1" Name="id" QueryStringField="EventId" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> <br /> <asp:Panel ID="RsvpPanel" runat="server"> <table border="0" cellspacing="0" cellpadding="4" id="RsvpTable"> <tr> <td class="requiredField" style="width: 199px">Number of Guests: <asp:TextBox id="numofguests" runat="server" maxlength="1" Width="46px" /></td> <td class="requiredField"> <asp:RangeValidator id="rngguest" runat="server" ControlToValidate = "numofguests" MinimumValue = "0" MaximumValue = "9" ErrorMessage = "Please Specify between 0 and 9 Guests." Display = "Dynamic" Type="Integer"> </asp:RangeValidator> </td> </tr> <tr> <td colspan="2" style="height: 29px"> <asp:button id="submitter" text="RSVP-YES" CausesValidation="True" OnCommand="submitter_update" runat="server" /> <asp:button id="canceller" text="RSVP-NO" CausesValidation="False" OnCommand="canceller_update" runat="server" /> </td> </tr> </table> </asp:Panel> <asp:GridView ID="RSVPGrid" runat="server" AllowPaging="True" DataSourceID="SqlDataSource2" CellPadding="4" ForeColor="#333333" GridLines="None" DataMember="DefaultView" AutoGenerateColumns="False" Width="278px"> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" HorizontalAlign="Center"/> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:BoundField DataField="UserName" HeaderText="Name" SortExpression="UserName"/> <asp:BoundField DataField="numofguest" HeaderText="Guests" SortExpression="numofguest"/> </Columns> </asp:GridView> </div> <div class="dashedline"> </div> <a href="Events_list.aspx">View all events »</a> <div class="nextlink"> <asp:LinkButton ID="LinkButton3" runat="server" OnClick="nextButton_Click">next event »</asp:LinkButton> </div> <asp:LinkButton ID="LinkButton4" runat="server" OnClick="prevButton_Click">« previous event</asp:LinkButton> </div> </div> <div class="clear2column"> </div> </div></
asp:Content>Let me know if it works for you guys as well, I will be expanding on this but for now it works.
lexy
Participant
1668 Points
441 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
Apr 24, 2006 03:10 PM|LINK
Hi Angelo,
Very interested, but as you can understand for now this is way beyond me.
As soon as I get the Forum going I will try and look how far I can get with your RSVP.
It is indeed a function I would really like to implement on my site.
Since on of the goals is to give people a chance to register for courses (Mental Health related)
Regards,
Lex
aabruzzese
Contributor
2806 Points
759 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
Apr 25, 2006 05:16 AM|LINK
I have also finally been able to add the asp:Image to the Gridview with the Member's Avatar on the Gridview Row.
It took some fiddling around but I finally got the thing to work.
http://67.164.255.166:8029/Events_view.aspx?Eventid=4
I also included some code to cover for a user that has not selected an avatar.
I am starting to like this RSVP module.
I will post the final code soon.
lexy
Participant
1668 Points
441 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
May 05, 2006 08:26 AM|LINK
Hi Angelo,
With the basic Forum sort of finished and the Avatar problem I had yesterday solved I finally got some time to look at your RSVP module.
Impressive I must say and a feature I would also like to integrate.
Is it based on a single Database? Ans what is your advice, should I wait for the final code or can I start fiddling around and start with the first post of this thread?
Probably adding Avatar to the posts like you mentioned recently is still a bit beyond my scope. But I'll keep at it from various angles.
I am also trying to get E-mail notifiaction at reply. Having difficulty with SQL to get the E-mail address from the Starter of a Thread as this is the one that should receive that E-mail. Can I run that through your grey matter at some point?
Regards,
Lex
aabruzzese
Contributor
2806 Points
759 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
May 05, 2006 03:37 PM|LINK
Hi Lex,
Of course you can ask and add, that is the whole idea.
The Recipe is listed a couple of posts down from this one:
#1.. 1 New Table being added
#2.. 2 New Stored procedure
#3.. Minor changes to the Events View.aspx page
And you are on your way, there might be just a little bit of tweaking left but not a struggle like you had with the forum.
lexy
Participant
1668 Points
441 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
May 07, 2006 03:15 PM|LINK
Hi Angelo,
I am now trying to add the RSVP stuff, and as to be expected run into some (seemingly) minor problems.
I noticed that the table Attendance goes to the master database (via your script) . Is this a must? As my app can't find it unless its in ASPNETDB.
When I add Attendance to ASPNETDB I get Invalid column name 'ImageId'.
I indeed find no field with that name in script nor table.
Am I doing something completely wrong?
Best Regards,
Lex
BTW,
Admin from Frank (MaineOne) really rocks. Also managed to add FreeTextBox to News. Really cool stuff.
lexy
Participant
1668 Points
441 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
May 07, 2006 03:29 PM|LINK
It seems to be missing in aspnet_MemberShip
lexy
Participant
1668 Points
441 Posts
Re: Expanding the Club Starter Kit .. working to add RSVP to EVENTS
May 07, 2006 04:15 PM|LINK
Ok, took some bold steps here.
1. Added a field ImageId, (Int), Allow nulls yes, to aspnet_MemberShip
2. Addes the SP's to ASPNETDB as well (forgot that)
No more errors, haha
I am not supposed to see the Avatar with this versin am I?
I still need to test it all thoroughly, but do you think it's adequately solved like this? Or do you advice to somehow switch it over to master?
Anyway it looks cool Angelo, thanks,
Lex