Exemplo n.º 1
0
        public int sendRequest(int userId, Int64 eventId)
        {
            Classes.Requests request = new Classes.Requests();
            int result = request.requestSend(userId, eventId, "");

            return(result);
        }
Exemplo n.º 2
0
        protected void ButtonRequest_Click(object sender, EventArgs e)
        {
            string message = TextBoxMessage.Text;

            if (message.Length > 85)
            {
                message = message.Substring(0, 85);
            }

            Classes.Requests r = new Classes.Requests();
            int status         = r.requestSend(Convert.ToInt32(Session["UserId"]), Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()), message);

            switch (status)
            {
            case -1:
                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "request";
                HiddenFieldToastSmiley.Value  = ":)";
                HiddenFieldToastMessage.Value = "You cannot send a request to your event!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
                break;

            case 1:
                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "request";
                HiddenFieldToastSmiley.Value  = ":)";
                HiddenFieldToastMessage.Value = "You canceled your participation!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
                HiddenFieldButtonStatus.Value = "2";
                break;

            case 2:
                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "request";
                HiddenFieldToastSmiley.Value  = ":)";
                HiddenFieldToastMessage.Value = "You canceled your request!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
                HiddenFieldButtonStatus.Value = "2";
                break;

            case 3:
                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "request";
                HiddenFieldToastSmiley.Value  = ":)";
                HiddenFieldToastMessage.Value = "Your request has been successfully sent!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
                HiddenFieldButtonStatus.Value = "3";
                break;
            }
        }
Exemplo n.º 3
0
        public void requestResponse(int userId, Int64 requestId, bool response)
        {
            Classes.Requests r = new Classes.Requests();
            var id             = Convert.ToInt16(userId);

            if (response)
            {
                r.requestAccept(id, requestId);
            }
            else
            {
                r.requestReject(id, requestId);
            }
        }
Exemplo n.º 4
0
        protected void ButtonActionYes_Click(object sender, EventArgs e)
        {
            Classes.Requests r = new Classes.Requests();
            int status         = r.requestSend(Convert.ToInt32(Session["UserId"]), Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), "test");

            switch (status)
            {
            case 1:
                LabelMessage.Text = "You cannot send a request to your event.";
                break;

            case 2:
                LabelMessage.Text = "You already send a request to this event.";
                break;

            case 3:
                LabelMessage.Text = "Your request has been sent.";
                break;
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Requests");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Requests");
            }

            // Actions
            Int64 requestId  = 0;
            int   actionCode = 0;

            try
            {
                requestId  = Convert.ToInt64(Page.RouteData.Values["RequestId"].ToString());
                actionCode = Convert.ToInt32(Page.RouteData.Values["ActionCode"].ToString());
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            if (requestId != 0)
            {
                // accept


                if (actionCode == 1)
                {
                    Classes.Requests r = new Classes.Requests();
                    int status         = r.requestAccept(Convert.ToInt32(Session["UserId"]), requestId);

                    if (status == 1)
                    {
                        //successful
                    }
                    else if (status == -1)
                    {
                        //unsuccessful
                    }
                }
                // reject
                else if (actionCode == 2)
                {
                    Classes.Requests r = new Classes.Requests();
                    r.requestReject(requestId);
                }

                Response.Redirect("~/Requests");
            }

            //all read
            Classes.Requests re = new Classes.Requests();
            re.allRead(UserId);

            DataTable dt = re.requestsList(UserId);

            if (dt.Rows.Count == 0)
            {
                LabelNoRecord.Visible = true;
            }
            else
            {
                LabelNoRecord.Visible       = false;
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Requests");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Requests");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                    case 1:
                        Session["DoneCompletion"] = "1";
                        break;
                    case 0:
                    case 4:
                        Response.Redirect("~/Completion");
                        break;
                    case 2:
                        Response.Redirect("~/Error/UserDisabled");
                        break;
                    case 3:
                        Response.Redirect("~/Error/UserDeactivated");
                        break;
                }
            }

            //all read
            Classes.Requests r = new Classes.Requests();
            r.allRead(UserId);

            Classes.Requests re = new Classes.Requests();
            Tuple<int, DataTable> result = re.requestsList(UserId);

            //status codes: 0 no event 1 requests 2 no request
            int status = result.Item1;

            HiddenFieldRequestsStatus.Value = status.ToString();
            HiddenFieldTitle.Value = "Requests";

            if (status == 1)
            {
                DataTable dt = result.Item2;
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Requests");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Requests");
            }

            // Actions
            Int64 requestId = 0;
            int actionCode = 0;
            try
            {
                requestId = Convert.ToInt64(Page.RouteData.Values["RequestId"].ToString());
                actionCode = Convert.ToInt32(Page.RouteData.Values["ActionCode"].ToString());
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            if (requestId != 0)
                {
                    // accept
                    
                
                    if (actionCode == 1)
                    {
                        Classes.Requests r = new Classes.Requests();
                        int status = r.requestAccept(Convert.ToInt32(Session["UserId"]), requestId);
                        
                        if (status == 1)
                        {
                            //successful
                        }
                        else if (status == -1)
                        {
                            //unsuccessful
                        }
                    }
                    // reject
                    else if (actionCode == 2)
                    {
                        Classes.Requests r = new Classes.Requests();
                        r.requestReject(requestId);
                    }

                    Response.Redirect("~/Requests");
                }

            //all read
            Classes.Requests re = new Classes.Requests();
            re.allRead(UserId);

            DataTable dt = re.requestsList(UserId);

            if (dt.Rows.Count == 0)
            {
                LabelNoRecord.Visible = true;
            }
            else
            {
                LabelNoRecord.Visible = false;
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Exemplo n.º 8
0
        protected void ButtonRemoveParticipant_Click(object sender, EventArgs e)
        {
            int   ownerId = Convert.ToInt32(Session["UserId"]);
            int   userId  = Convert.ToInt32(HiddenFieldParticipantValue.Value);
            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            Classes.Requests r = new Classes.Requests();
            int status         = r.removeParticipant(ownerId, userId, eventId);

            //0 user not owner 1 participants cancelled 2 user was not participant
            if (status == 0)
            {
                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "participants";
                HiddenFieldToastSmiley.Value  = ":(";
                HiddenFieldToastMessage.Value = "You are not the owner of this event!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
            }
            else if (status == 1)
            {
                ////////////////// participants list
                Classes.Events ev             = new Classes.Events();
                DataTable      dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "participants";
                HiddenFieldToastSmiley.Value  = ":)";
                HiddenFieldToastMessage.Value = "The participant got removed!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
            }
            else if (status == 2)
            {
                ////////////////// participants list
                Classes.Events ev             = new Classes.Events();
                DataTable      dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                HiddenFieldToastStatus.Value  = "1";
                HiddenFieldToastMode.Value    = "participants";
                HiddenFieldToastSmiley.Value  = ":)";
                HiddenFieldToastMessage.Value = "The user was not a participant!";
                HiddenFieldButton1Text.Value  = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0)
                    {
                        //Response.Redirect("~/Login");
                    }
                }
            }

            int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant
            int OwnerId       = -1;

            if (UserId == 0)
            {
                buttonsStatus = 0;
            }

            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventInfo(eventId, UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString());
                    if (eventStatus == 4)// event is banned
                    {
                        Response.Redirect("~/Error/EventNotFound");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    int participants          = Convert.ToInt32(dt.Rows[0]["Participants"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    HiddenFieldEventId.Value = Page.RouteData.Values["EventId"].ToString();
                    LabelName.Text           = dt.Rows[0]["Name"].ToString();
                    Page.Title                      = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value           = dt.Rows[0]["Date"].ToString();
                    LabelParticipants.Text          = (participants + 1).ToString();
                    LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString();
                    LabelAddress.Text               = dt.Rows[0]["Address"].ToString();
                    LabelDescriptions.Text          = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value       = dt.Rows[0]["Username"].ToString();
                    HiddenFieldOwnerFullname.Value  = dt.Rows[0]["OwnerName"].ToString();
                    HiddenFieldTypeId.Value         = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value        = dt.Rows[0]["CoverId"].ToString();
                    OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l          = new Classes.Locations();
                    DataTable         dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString();
                    }

                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png";
                    }
                    //owner rate
                    int RateCount      = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore      = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                    case "1":
                        LabelStatus.Text = "Available";
                        break;

                    case "2":
                        LabelStatus.Text = "Full";
                        break;

                    case "3":
                        LabelStatus.Text = "Passed";
                        break;
                    }

                    if (UserId != 0)
                    {
                        //check to see if the user logged in or is a guest
                        if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                        {
                            HyperLinkModify.Visible     = true;
                            HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString();
                            buttonsStatus = 1;
                        }

                        //bookmark
                        bool bookmarkStatus = ev.checkBookmark(UserId, eventId);

                        if (bookmarkStatus == true)
                        {
                            ButtonBookmark.Text = "Remove Bookmark";
                        }
                        else
                        {
                            ButtonBookmark.Text = "Add Bookmark";
                        }

                        HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
                    }
                }

                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                /////////////////////////////////////////////board messages
                bool status = ev.allowBoard(UserId, eventId);

                if (status)
                {
                    getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
                    HiddenFieldBoardStatus.Value = "1";
                }
                else
                {
                    HiddenFieldBoardStatus.Value = "0";
                }
            }
            else
            {
                Page.Title = LabelName.Text;
            }

            if (UserId != 0)
            {
                if (UserId.ToString() == OwnerId.ToString())
                {
                    buttonsStatus = 1;
                }
                else
                {
                    Classes.Requests r = new Classes.Requests();
                    int requestStatus  = r.checkRequest(UserId, eventId);

                    if (requestStatus == 0)
                    {
                        buttonsStatus = 2;
                    }
                    else if (requestStatus == 1)
                    {
                        buttonsStatus = 3;
                    }
                    else if (requestStatus == 2)
                    {
                        buttonsStatus = 4;
                    }
                }
            }

            HiddenFieldRequestStatus.Value = buttonsStatus.ToString();
            HiddenFieldButtonStatus.Value  = buttonsStatus.ToString();
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Requests");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Requests");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus      = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                case 1:
                    Session["DoneCompletion"] = "1";
                    break;

                case 0:
                case 4:
                    Response.Redirect("~/Completion");
                    break;

                case 2:
                    Response.Redirect("~/Error/UserDisabled");
                    break;

                case 3:
                    Response.Redirect("~/Error/UserDeactivated");
                    break;
                }
            }


            Int64 eventId = 0;

            try
            {
                eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            if (eventId == 0)
            {
                Response.Redirect("~/Requests");
            }

            int   actionCode = 0;
            Int64 requestId  = 0;

            try
            {
                actionCode = Convert.ToInt32(Page.RouteData.Values["ActionCode"].ToString());
                requestId  = Convert.ToInt64(Page.RouteData.Values["RequestId"].ToString());
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            if (actionCode != 0 && requestId != 0)
            {
                Classes.Requests r1 = new Classes.Requests();
                if (actionCode == 1)
                {
                    r1.requestAccept(UserId, requestId);
                }
                else if (actionCode == 2)
                {
                    r1.requestReject(UserId, requestId);
                }
                Response.Redirect("~/Requests/" + eventId.ToString());
            }


            // no action, just show the requests
            Classes.Requests r2 = new Classes.Requests();
            DataTable        dt = r2.eventRequestsList(UserId, eventId);

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Requests");
            }
            else
            {
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Requests");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Requests");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                    case 1:
                        Session["DoneCompletion"] = "1";
                        break;
                    case 0:
                    case 4:
                        Response.Redirect("~/Completion");
                        break;
                    case 2:
                        Response.Redirect("~/Error/UserDisabled");
                        break;
                    case 3:
                        Response.Redirect("~/Error/UserDeactivated");
                        break;
                }
            }

            
            Int64 eventId = 0;

            try
            {
                eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            if (eventId == 0)
            {
                Response.Redirect("~/Requests");
            }

            int actionCode = 0;
            Int64 requestId = 0;

            try
            {
                actionCode = Convert.ToInt32(Page.RouteData.Values["ActionCode"].ToString());
                requestId = Convert.ToInt64(Page.RouteData.Values["RequestId"].ToString());
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            if (actionCode != 0 && requestId != 0)
            {
                Classes.Requests r1 = new Classes.Requests();
                if(actionCode == 1)
                {
                    r1.requestAccept(UserId, requestId);
                }
                else if (actionCode == 2)
                {
                    r1.requestReject(UserId, requestId);
                }
                Response.Redirect("~/Requests/" + eventId.ToString());
            }


            // no action, just show the requests
            Classes.Requests r2 = new Classes.Requests();
            DataTable dt = r2.eventRequestsList(UserId, eventId);

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Requests");
            }
            else
            {
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Exemplo n.º 12
0
        protected void ButtonActionYes_Click(object sender, EventArgs e)
        {
            Classes.Requests r = new Classes.Requests();
            int status = r.requestSend(Convert.ToInt32(Session["UserId"]), Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), "test");

            switch (status)
            {
                case 1:
                    LabelMessage.Text = "You cannot send a request to your event.";
                    break;
                case 2:
                    LabelMessage.Text = "You already send a request to this event.";
                    break;
                case 3:
                    LabelMessage.Text = "Your request has been sent.";
                    break;
            }
        }
Exemplo n.º 13
0
        protected void ButtonRemoveParticipant_Click(object sender, EventArgs e)
        {
            int ownerId = Convert.ToInt32(Session["UserId"]);
            int userId = Convert.ToInt32(HiddenFieldParticipantValue.Value);
            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            Classes.Requests r = new Classes.Requests();
            int status = r.removeParticipant(ownerId, userId, eventId);

            //0 user not owner 1 participants cancelled 2 user was not participant
            if(status == 0)
            {
                HiddenFieldToastStatus.Value = "1";
                HiddenFieldToastMode.Value = "participants";
                HiddenFieldToastSmiley.Value = ":(";
                HiddenFieldToastMessage.Value = "You are not the owner of this event!";
                HiddenFieldButton1Text.Value = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
            }
            else if (status == 1)
            {
                ////////////////// participants list
                Classes.Events ev = new Classes.Events();
                DataTable dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                HiddenFieldToastStatus.Value = "1";
                HiddenFieldToastMode.Value = "participants";
                HiddenFieldToastSmiley.Value = ":)";
                HiddenFieldToastMessage.Value = "The participant got removed!";
                HiddenFieldButton1Text.Value = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
            }
            else if (status == 2)
            {
                ////////////////// participants list
                Classes.Events ev = new Classes.Events();
                DataTable dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                HiddenFieldToastStatus.Value = "1";
                HiddenFieldToastMode.Value = "participants";
                HiddenFieldToastSmiley.Value = ":)";
                HiddenFieldToastMessage.Value = "The user was not a participant!";
                HiddenFieldButton1Text.Value = "OK";
                HiddenFieldButton1Color.Value = "d7432e";
            }
        }
Exemplo n.º 14
0
        protected void ButtonRequest_Click(object sender, EventArgs e)
        {
            string message = TextBoxMessage.Text;
            if (message.Length > 85)
            {
                message = message.Substring(0, 85);
            }

            Classes.Requests r = new Classes.Requests();
            int status = r.requestSend(Convert.ToInt32(Session["UserId"]), Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()), message);

            switch (status)
            {
                case -1:
                    HiddenFieldToastStatus.Value = "1";
                    HiddenFieldToastMode.Value = "request";
                    HiddenFieldToastSmiley.Value = ":)";
                    HiddenFieldToastMessage.Value = "You cannot send a request to your event!";
                    HiddenFieldButton1Text.Value = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    break;
                case 1:
                    HiddenFieldToastStatus.Value = "1";
                    HiddenFieldToastMode.Value = "request";
                    HiddenFieldToastSmiley.Value = ":)";
                    HiddenFieldToastMessage.Value = "You canceled your participation!";
                    HiddenFieldButton1Text.Value = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    HiddenFieldButtonStatus.Value = "2";
                    break;
                case 2:
                    HiddenFieldToastStatus.Value = "1";
                    HiddenFieldToastMode.Value = "request";
                    HiddenFieldToastSmiley.Value = ":)";
                    HiddenFieldToastMessage.Value = "You canceled your request!";
                    HiddenFieldButton1Text.Value = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    HiddenFieldButtonStatus.Value = "2";
                    break;
                case 3:
                    HiddenFieldToastStatus.Value = "1";
                    HiddenFieldToastMode.Value = "request";
                    HiddenFieldToastSmiley.Value = ":)";
                    HiddenFieldToastMessage.Value = "Your request has been successfully sent!";
                    HiddenFieldButton1Text.Value = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    HiddenFieldButtonStatus.Value = "3";
                    break;
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0)
                    {
                        //Response.Redirect("~/Login");
                    }
                }
            }

            int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant
            int OwnerId = -1;
            if (UserId == 0)
            {
                buttonsStatus = 0;
            }

            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable dt = ev.eventInfo(eventId, UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString());
                    if (eventStatus == 4)// event is banned
                    {
                        Response.Redirect("~/Error/EventNotFound");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    HiddenFieldEventId.Value = Page.RouteData.Values["EventId"].ToString();
                    LabelName.Text = dt.Rows[0]["Name"].ToString();
                    Page.Title = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString();
                    LabelParticipants.Text = (participants + 1).ToString();
                    LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString();
                    LabelAddress.Text = dt.Rows[0]["Address"].ToString();
                    LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();
                    HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString();
                    HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();
                    OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l = new Classes.Locations();
                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString();
                    }

                     //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png";
                    }
                    //owner rate
                    int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                        case "1":
                            LabelStatus.Text = "Available";
                            break;
                        case "2":
                            LabelStatus.Text = "Full";
                            break;
                        case "3":
                            LabelStatus.Text = "Passed";
                            break;
                    }

                    if (UserId != 0)
                    {
                        //check to see if the user logged in or is a guest
                        if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                        {
                            HyperLinkModify.Visible = true;
                            HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString();
                            buttonsStatus = 1;
                        }

                        //bookmark
                        bool bookmarkStatus = ev.checkBookmark(UserId, eventId);

                        if (bookmarkStatus == true)
                        {
                            ButtonBookmark.Text = "Remove Bookmark";
                        }
                        else
                        {
                            ButtonBookmark.Text = "Add Bookmark";
                        }

                        HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
                    }
                }

                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                /////////////////////////////////////////////board messages
                bool status = ev.allowBoard(UserId, eventId);

                if (status)
                {
                    getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
                    HiddenFieldBoardStatus.Value = "1";
                }
                else
                {
                    HiddenFieldBoardStatus.Value = "0";
                }

            }
            else
            {
                Page.Title = LabelName.Text;
            }

            if (UserId != 0)
            {
                if (UserId.ToString() == OwnerId.ToString())
                {
                    buttonsStatus = 1;
                }
                else
                {
                    Classes.Requests r = new Classes.Requests();
                    int requestStatus = r.checkRequest(UserId, eventId);

                    if (requestStatus == 0)
                    {
                        buttonsStatus = 2;
                    }
                    else if (requestStatus == 1)
                    {
                        buttonsStatus = 3;
                    }
                    else if (requestStatus == 2)
                    {
                        buttonsStatus = 4;
                    }
                }
            }

            HiddenFieldRequestStatus.Value = buttonsStatus.ToString();
            HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Requests");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Requests");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))

            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus      = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                case 1:
                    Session["DoneCompletion"] = "1";
                    break;

                case 0:
                case 4:
                    Response.Redirect("~/Completion");
                    break;

                case 2:
                    Response.Redirect("~/Error/UserDisabled");
                    break;

                case 3:
                    Response.Redirect("~/Error/UserDeactivated");
                    break;
                }
            }

            //all read
            Classes.Requests r = new Classes.Requests();
            r.allRead(UserId);

            Classes.Requests       re     = new Classes.Requests();
            Tuple <int, DataTable> result = re.requestsList(UserId);

            //status codes: 0 no event 1 requests 2 no request
            int status = result.Item1;

            HiddenFieldRequestsStatus.Value = status.ToString();
            HiddenFieldTitle.Value          = "Requests";

            if (status == 1)
            {
                DataTable dt = result.Item2;
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }