Пример #1
0
        protected void JoinEvent_Click(object sender, EventArgs e)
        {
            string userName = this.User.Identity.Name;
            DataAccess databaseAccess = DataAccess.Instance();

            EventData eventDetailsTable = DataAccess.Instance().retrieveEventDetailsFromId(eventRecId);

            if (databaseAccess.getNumberOfParticipantsInEvent(eventRecId) + 1 <= eventDetailsTable.MaxParticipants || eventDetailsTable.MaxParticipants == 0)
            {
                databaseAccess.joinEvent(eventRecId, userName);
                //Alert.Show("Congratulations! You have successfully registered to " + EventTitle.Text);

                LeaveEvent.Visible = true;
                JoinEvent.Visible = false;

                UrlParameterPasser urlWrapper = new UrlParameterPasser("EventDetail.aspx");
                urlWrapper["eventId"] = eventRecId.ToString();
                urlWrapper.PassParameters();
            }
            else
            {
                Alert.Show("Sorry, but this event is already full.");

                LeaveEvent.Visible = false;
                JoinEvent.Visible = true;
            }
        }
Пример #2
0
        protected void AddComment(object sender, EventArgs e)
        {
            DataAccess accessDataBase = DataAccess.Instance();
            UrlParameterPasser urlWrapper;

            accessDataBase.addComment(eventRecId, this.User.Identity.Name, txtCommentBody.Text.Trim());

            // Reload page
            urlWrapper = new UrlParameterPasser("EventDetail.aspx");
            urlWrapper["eventId"] = eventRecId.ToString();
            urlWrapper.PassParameters();
        }
Пример #3
0
        protected void AddEvent_Click(object sender, EventArgs e)
        {
            string              ownerUserName = this.User.Identity.Name;
            int                 maxNumParticipants = 0;
            int                 minNumParticipants = 0;
            string              eventId;
            UrlParameterPasser  urlWrapper;

            if (this.IsValid)
            {
                //Insert to TtlerEventsDB
                DataAccess insertEventToDB = DataAccess.Instance();

                if (MaxParticipants.Text != "")
                {
                    maxNumParticipants = Int32.Parse(MaxParticipants.Text);
                }

                if (MinParticipants.Text != "")
                {
                    minNumParticipants = Int32.Parse(MinParticipants.Text);
                }

                insertEventToDB.insertEvent(
                    EventTitle.Text,
                    EventLocation.Text,
                    EventStartDateTime.Text,
                    EventEndDateTime.Text,
                    EventDescription.Text,
                    maxNumParticipants,
                    minNumParticipants,
                    ownerUserName);

                eventId = insertEventToDB.getEventIdFromEventNameAndDateTime(EventTitle.Text, EventStartDateTime.Text);

                insertEventToDB.joinEvent(Int64.Parse(eventId), ownerUserName);

                // Pass textbox values to ReceiveQueryString.aspx
                urlWrapper = new UrlParameterPasser("EventDetail.aspx");

                // Add some values
                urlWrapper["eventId"] = eventId;

                // Redirect to the page, passing the parameters in the querystring
                urlWrapper.PassParameters();
            }
        }
Пример #4
0
        protected void LeaveEvent_Click(object sender, EventArgs e)
        {
            string userName = this.User.Identity.Name;
            DataAccess addPartiicipantToDB = DataAccess.Instance();

            addPartiicipantToDB.leaveEvent(eventRecId, userName);

            LeaveEvent.Visible = false;
            JoinEvent.Visible = true;

            //Alert.Show("You have left the event " + EventTitle.Text);

            UrlParameterPasser urlWrapper = new UrlParameterPasser("EventDetail.aspx");
            urlWrapper["eventId"] = eventRecId.ToString();
            urlWrapper.PassParameters();
        }