예제 #1
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            Classes.Events      ev     = new Classes.Events();
            Tuple <int, string> result = ev.eventModify(
                Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()),
                TextBoxName.Text,
                TextBoxDate.Text,
                TextBoxParticipants.Text,
                Convert.ToInt32(DropDownListCity.SelectedValue),
                Convert.ToInt16(DropDownListPrivacy.SelectedValue),
                Convert.ToInt16(DropDownListType.SelectedValue),
                1,
                HiddenFieldLanguages.Value,
                TextBoxDescriptions.Text,
                false
                );

            int    status  = result.Item1;
            string message = result.Item2;

            if (status == -1)
            {
                LiteralMessage.Visible = true;
                LiteralMessage.Text    = message;
            }
            else
            {
                // show success message
                PanelInfo.Visible      = false;
                LiteralMessage.Text    = "You have successfully modified this event.";
                LiteralMessage.Visible = true;
            }
        }
예제 #2
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            Classes.Events ev = new Classes.Events();
            Tuple<int, string> result = ev.eventModify(
                Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()),
                TextBoxName.Text,
                TextBoxDate.Text,
                TextBoxParticipants.Text,
                Convert.ToInt32(DropDownListCity.SelectedValue),
                Convert.ToInt16(DropDownListPrivacy.SelectedValue),
                Convert.ToInt16(DropDownListType.SelectedValue),
                1,
                HiddenFieldLanguages.Value,
                TextBoxDescriptions.Text,
                false
                );

            int status = result.Item1;
            string message = result.Item2;

            if (status == -1)
            {
                LiteralMessage.Visible = true;
                LiteralMessage.Text = message;
            }
            else
            {
                // show success message
                PanelInfo.Visible = false;
                LiteralMessage.Text = "You have successfully modified this event.";
                LiteralMessage.Visible = true;
            }
        }
예제 #3
0
        protected void ButtonBookmark_Click(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                Classes.Events ev     = new Classes.Events();
                int            status = ev.eventBookmark(Convert.ToInt32(Session["UserId"]), Convert.ToInt64(Page.RouteData.Values["EventId"]));

                if (status == 1)
                {
                    HiddenFieldToastStatus.Value  = "1";
                    HiddenFieldToastMode.Value    = "bookmark";
                    HiddenFieldToastSmiley.Value  = ":)";
                    HiddenFieldToastMessage.Value = "The event added to your bookmark list!";
                    HiddenFieldButton1Text.Value  = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    ButtonBookmark.Text           = "Remove Bookmark";
                }
                else if (status == 2)
                {
                    HiddenFieldToastStatus.Value  = "1";
                    HiddenFieldToastMode.Value    = "bookmark";
                    HiddenFieldToastSmiley.Value  = ":)";
                    HiddenFieldToastMessage.Value = "The event removed from bookmark list!";
                    HiddenFieldButton1Text.Value  = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    ButtonBookmark.Text           = "Remove Bookmark";
                    ButtonBookmark.Text           = "Add Bookmark";
                }
            }
            else
            {
                LabelMessage.Visible = true;
                LabelMessage.Text    = "You have to login first.";
            }
        }
예제 #4
0
        protected void ButtonBookmark_Click(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                Classes.Events ev     = new Classes.Events();
                int            status = ev.eventBookmark(Convert.ToInt32(Session["UserId"]), Convert.ToInt64(Page.RouteData.Values["EventId"]));

                if (status == 1)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "You have successfully added this event to your bookmark list";
                    ButtonBookmark.Text  = "Remove Bookmark";
                }
                else if (status == 2)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "You have successfully removed this event from your bookmark list";
                    ButtonBookmark.Text  = "Add Bookmark";
                }
            }
            else
            {
                LabelMessage.Visible = true;
                LabelMessage.Text    = "You have to login first.";
            }
        }
예제 #5
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            HiddenFieldStep.Value = "4";
            DateTime date = Convert.ToDateTime(HiddenFieldDate.Value);

            Classes.Events      ev     = new Classes.Events();
            Tuple <int, string> result = ev.eventModify(
                Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()),
                TextBoxName.Text,
                date,
                TextBoxParticipants.Text,
                Convert.ToInt32(HiddenFieldLocationId.Value),
                TextBoxAddress.Text,
                Convert.ToInt16(HiddenFieldTypeId.Value),
                Convert.ToInt32(HiddenFieldCoverId.Value),
                TextBoxDescriptions.Text
                );

            int    status  = result.Item1;
            string message = result.Item2;

            if (status == -1)
            {
                LiteralMessage.Visible = true;
                LiteralMessage.Text    = message;
            }
            else
            {
                // show success message
                Response.Redirect("~/Done/EventModified");
            }
        }
예제 #6
0
파일: ChatHub.cs 프로젝트: m3hrad/CityCrowd
        public bool sendBoardMessage(long eventId, Int32 userId, string message)
        {
            Classes.Events ev      = new Classes.Events();
            Int16          status2 = ev.eventBoardMessagesAdd(eventId, userId, message);

            return(true);
        }
예제 #7
0
        protected void getBoardMessages(Int64 eventId, int ownerId)
        {
            //check if participant or owner

            Classes.Events e  = new Classes.Events();
            DataTable      dt = e.eventBoardMessages(eventId, ownerId);

            if (dt.Rows.Count != 0)
            {
                RepeaterBoardMessages.DataSource = dt;
                RepeaterBoardMessages.DataBind();
            }
        }
예제 #8
0
        protected void ButtonDelete_Click(object sender, EventArgs e)
        {
            Classes.Events ev     = new Classes.Events();
            int            status = ev.eventDelete(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()));

            if (status == 1)
            {
                // show success message
                LiteralMessage.Text    = "You have siccessfully deleted this event.";
                LiteralMessage.Visible = true;
                PanelInfo.Visible      = false;
            }
        }
예제 #9
0
        protected void ButtonDelete_Click(object sender, EventArgs e)
        {
            int   userId  = Convert.ToInt32(Session["UserId"]);
            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            Classes.Events ev = new Classes.Events();
            if (ev.isUserOwner(userId, eventId))
            {
                int status = ev.eventDelete(eventId, userId);
                if (status == 1)
                {
                    Response.Redirect("~/Done/EventDeleted");
                }
            }
        }
예제 #10
0
        protected void getBoardMessages(Int64 eventId, int ownerId)
        {
            Classes.Events e  = new Classes.Events();
            DataTable      dt = e.eventBoardMessages(eventId, ownerId);

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Error/EventNotFound");
            }
            else
            {
                RepeaterBoardMessages.DataSource = dt;
                RepeaterBoardMessages.DataBind();
            }
        }
예제 #11
0
        protected void getEvents()
        {
            Classes.Events ev = new Classes.Events();
            DataTable      dt = ev.eventslist(profileId, "created");

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
                HiddenFieldEventsStatus.Value = "1";
            }
            else
            {
                HiddenFieldEventsStatus.Value = "0";
            }
        }
예제 #12
0
        protected void getEvents()
        {
            Classes.Events ev = new Classes.Events();
            DataTable      dt = ev.eventslist(Convert.ToInt32(Session["UserId"]), "created");

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
            }
            else
            {
                LabelEventsNoRecord.Visible = true;
                LabelEventsNoRecord.Text    = "There is no event!";
            }
        }
예제 #13
0
        protected void ButtonBoardMessageAdd_Click(object sender, EventArgs e)
        {
            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());
            int   userId  = Convert.ToInt32(Session["UserId"]);

            Classes.Events ev     = new Classes.Events();
            bool           status = ev.allowBoard(userId, eventId);

            if (status)
            {
                string message = TextBoxBoardMessageAdd.Text;
                Int16  status2 = ev.eventBoardMessagesAdd(eventId, userId, message);
                HiddenFieldBoardStatus.Value = "1";
            }
            else
            {
                HiddenFieldBoardStatus.Value = "0";
            }
        }
예제 #14
0
        protected void getBoardMessages(Int64 eventId, int ownerId)
        {
            //check if participant or owner

            Classes.Events e = new Classes.Events();
            DataTable dt = e.eventBoardMessages(eventId, ownerId);

            if (dt.Rows.Count != 0)
            {
                RepeaterBoardMessages.DataSource = dt;
                RepeaterBoardMessages.DataBind();
            }
        }
예제 #15
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            HiddenFieldStep.Value = "4";
            bool check = true;

            LiteralMessage.Text = "";

            if (TextBoxName.Text.Length == 0) // check name
            {
                check = false;
                LiteralMessage.Text = "Enter name<br/>";
            }
            if (TextBoxDate.Text.Length == 0) // check date
            {
                check = false;
                LiteralMessage.Text += "Enter date<br/>";
            }
            if (TextBoxParticipants.Text.Length == 0) // check participants +++only number
            {
                check = false;
                LiteralMessage.Text += "Enter participants number<br/>";
            }
            // participants
            double num;
            string candidate = TextBoxParticipants.Text;

            if (!double.TryParse(candidate, out num) && TextBoxParticipants.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Participants is not valid, enter number<br/>";
            }
            // date
            if (Convert.ToDateTime(HiddenFieldDate.Value) < DateTime.Now)
            {
                check = false;
                LiteralMessage.Text += "Date cannot be in the past<br/>";
            }

            if (!check) // there is something wrong with the values that user entered
            {
                LiteralMessage.Visible = true;
            }
            else
            { // user entered valid values
                LiteralMessage.Visible = false;

                DateTime date = Convert.ToDateTime(HiddenFieldDate.Value);

                Classes.Events ev     = new Classes.Events();
                int            status = ev.eventAdd(Convert.ToInt32(Session["UserId"]),
                                                    TextBoxName.Text,
                                                    HiddenFieldDate.Value,
                                                    Convert.ToInt32(HiddenFieldParticipants.Value),
                                                    Convert.ToInt32(HiddenFieldLocationId.Value),
                                                    TextBoxAddress.Text,
                                                    Convert.ToInt16(HiddenFieldTypeId.Value),
                                                    Convert.ToInt16(HiddenFieldCoverId.Value),
                                                    TextBoxDescriptions.Text);

                if (status == 1)
                {
                    Response.Redirect("~/Done/EventAdded");
                }
                else if (status == -1)
                {
                    // +show error message
                }
            }
        }
예제 #16
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 (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");
                }
            }

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventInfo(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    LabelName.Text           = dt.Rows[0]["Name"].ToString();
                    Page.Title                      = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value           = dt.Rows[0]["Date"].ToString();
                    HiddenFieldDuration.Value       = dt.Rows[0]["Duration"].ToString();
                    LabelParticipants.Text          = dt.Rows[0]["Participants"].ToString();
                    LabelParticipantsAvailable.Text = participantsAvailable.ToString();
                    LabelLanguages.Text             = dt.Rows[0]["Languages"].ToString(); //enhance
                    LabelDescriptions.Text          = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value       = dt.Rows[0]["Username"].ToString();
                    HiddenFieldTypeId.Value         = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value        = dt.Rows[0]["CoverId"].ToString();
                    int 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]["CityName"].ToString() + " - " + dtLocation.Rows[0]["StateName"].ToString() + " - " + dtLocation.Rows[0]["CountryName"].ToString();
                    }

                    //Event photo url
                    //if (Convert.ToBoolean(dt.Rows[0]["EventHasPhoto"].ToString()))
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Files/Events/" + Page.RouteData.Values["EventId"] + ".jpg";
                    //}
                    //else
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Images/Moods/" + dt.Rows[0]["MoodId"].ToString() + "-big.png";
                    //}
                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-220.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/ProfilesPhotos/nophoto220.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;
                    }

                    //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/" + Page.RouteData.Values["EventId"].ToString();
                    }

                    //bookmark
                    int bookmarkStatus = ev.eventBookmark(UserId, Convert.ToInt64(Page.RouteData.Values["EventId"]));

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


                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(Convert.ToInt32(Page.RouteData.Values["EventId"]));

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

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

                /////////////////////////////////////////////board messages
                getBoardMessages(Convert.ToInt64(Page.RouteData.Values["EventId"]), Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
            }
        }
예제 #17
0
        protected void ButtonBoardMessageAdd_Click(object sender, EventArgs e)
        {
            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());
            int userId = Convert.ToInt32(Session["UserId"]);

            Classes.Events ev = new Classes.Events();
            bool status = ev.allowBoard(userId, eventId);

            if (status)
            {
                string message = TextBoxBoardMessageAdd.Text;
                Int16 status2 = ev.eventBoardMessagesAdd(eventId, userId, message);
                HiddenFieldBoardStatus.Value = "1";
            }
            else
            {
                HiddenFieldBoardStatus.Value = "0";
            }
        }
예제 #18
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/Events");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Events");
            }


            DataTable dt;
            string mode = "created";

            try
            {
                mode = Page.RouteData.Values["Mode"].ToString().ToLower();
                switch (mode)
                {
                    case "created":
                    case "accepted":
                    case "requested":
                    case "bookmark":
                        
                        break;
                    default:
                        mode = "created";
                        break;
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            Classes.Events ev = new Classes.Events();
            dt = ev.eventslist(Convert.ToInt32(Session["UserId"]), mode);

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
            }
            else
            {
                LabelNoRecord.Visible = true;
            }
        }
예제 #19
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            bool check = true;
            LiteralMessage.Text = "";

            if (TextBoxName.Text.Length == 0) // check name
            {
                check = false;
                LiteralMessage.Text = "Enter name<br/>";
            }
            if(TextBoxDate.Text.Length == 0) // check date
            {
                check = false;
                LiteralMessage.Text += "Enter date<br/>";
            }
            if (TextBoxParticipants.Text.Length == 0) // check participants +++only number
            {
                check = false;
                LiteralMessage.Text += "Enter participants number<br/>";
            }
            if (TextBoxLanguages.Text.Length == 0) // check language
            {
                check = false;
                LiteralMessage.Text += "Enter language<br/>";
            }
            // check duration
            double num;
            string candidate = TextBoxDuration.Text;
            if (!double.TryParse(candidate, out num) && TextBoxDuration.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Duration is not valid, enter number<br/>";
            }
            // check pricefrom
            candidate = TextBoxPriceFrom.Text;
            if (!double.TryParse(candidate, out num) && TextBoxPriceFrom.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Price from is not valid, enter number<br/>";
            }
            // check priceto
            candidate = TextBoxPriceTo.Text;
            if (!double.TryParse(candidate, out num) && TextBoxPriceTo.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Price from is not valid, enter number<br/>";
            }
            // participants
            candidate = TextBoxParticipants.Text;
            if (!double.TryParse(candidate, out num) && TextBoxParticipants.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Participants is not valid, enter number<br/>";
            }

            if(!check) // there is something wrong with the values that user entered
            {
                LiteralMessage.Visible = true;
            }
            else
            { // user entered valid values
                LiteralMessage.Visible = false;

                DateTime date = Convert.ToDateTime(HiddenFieldDate.Value);

                Classes.Events ev = new Classes.Events();
                int status = ev.eventAdd(Convert.ToInt32(Session["UserId"]),
                    TextBoxName.Text,
                    HiddenFieldDate.Value,
                    Convert.ToInt32(HiddenFieldParticipants.Value),
                    Convert.ToInt32(DropDownListCity.SelectedValue),
                    Convert.ToInt16(DropDownListPrivacy.SelectedValue),
                    Convert.ToInt16(HiddenFieldTypeId.Value),
                    Convert.ToInt16(HiddenFieldCoverId.Value),
                    HiddenFieldLanguages.Value,
                    TextBoxDescriptions.Text,
                    false,
                    false);

                if (status == 1)
                {
                     //show success message
                    //PanelInfo.Visible = false;
                    LiteralMessage.Text = "You have successfully added an event.";
                    LiteralMessage.Visible = true;
                }
                else if (status == -1)
                {
                    // +show error message
                }
            }
        }
예제 #20
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");
                    }
                }
            }

            //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;
                }
            }

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()));

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //check if user is the owner
                    if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString())
                    {
                        Response.Redirect("~/Error/UserNotEventOwner");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    //get time
                    string timeHour   = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString();
                    string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString();
                    DropDownListTimeHour.SelectedValue   = timeHour;
                    DropDownListTimeMinute.SelectedValue = timeMinute;

                    TextBoxName.Text                      = dt.Rows[0]["Name"].ToString();
                    HiddenFieldTypeId.Value               = dt.Rows[0]["TypeId"].ToString();
                    TextBoxDescriptions.Text              = dt.Rows[0]["Descriptions"].ToString();
                    TextBoxAddress.Text                   = dt.Rows[0]["Address"].ToString();
                    HiddenFieldParticipants.Value         = dt.Rows[0]["Participants"].ToString();
                    HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString();
                    HiddenFieldDate.Value                 = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).ToString("d/M/yyyy hh:mm:ss tt");
                    HiddenFieldCoverId.Value              = dt.Rows[0]["CoverId"].ToString();

                    /////////////////// event photo
                    Classes.Locations l           = new Classes.Locations();
                    string            countryCode = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());

                    locationCountry();
                    DropDownListCountry.SelectedValue = countryCode;
                    locationCity(countryCode);
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
예제 #21
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");
                    }
                }
            }

            //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;
                }
            }

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()));

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //check if user is the owner
                    if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString())
                    {
                        Response.Redirect("~/Error/UserNotEventOwner");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    //get time
                    string timeHour = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString();
                    string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString();
                    DropDownListTimeHour.SelectedValue = timeHour;
                    DropDownListTimeMinute.SelectedValue = timeMinute;

                    TextBoxName.Text = dt.Rows[0]["Name"].ToString();
                    HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                    TextBoxDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    TextBoxAddress.Text = dt.Rows[0]["Address"].ToString();
                    HiddenFieldParticipants.Value = dt.Rows[0]["Participants"].ToString();
                    HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString();
                    HiddenFieldDate.Value = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).ToString("d/M/yyyy hh:mm:ss tt");
                    HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();

                    /////////////////// event photo
                    Classes.Locations l = new Classes.Locations();
                    string countryCode = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());

                    locationCountry();
                    DropDownListCountry.SelectedValue = countryCode;
                    locationCity(countryCode);
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
예제 #22
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 (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");
                }
            }

            if (!IsPostBack)
            {
                
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable dt = ev.eventInfo(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    LabelName.Text = dt.Rows[0]["Name"].ToString();
                    Page.Title = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString();
                    HiddenFieldDuration.Value = dt.Rows[0]["Duration"].ToString();
                    LabelParticipants.Text = dt.Rows[0]["Participants"].ToString();
                    LabelParticipantsAvailable.Text = participantsAvailable.ToString();
                    LabelLanguages.Text = dt.Rows[0]["Languages"].ToString(); //enhance
                    LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();
                    HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();
                    int 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]["CityName"].ToString() + " - " + dtLocation.Rows[0]["StateName"].ToString() + " - " + dtLocation.Rows[0]["CountryName"].ToString();
                    }

                    //Event photo url
                    //if (Convert.ToBoolean(dt.Rows[0]["EventHasPhoto"].ToString()))
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Files/Events/" + Page.RouteData.Values["EventId"] + ".jpg";
                    //}
                    //else
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Images/Moods/" + dt.Rows[0]["MoodId"].ToString() + "-big.png";
                    //}
                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-220.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/ProfilesPhotos/nophoto220.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;
                    }

                    //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/" + Page.RouteData.Values["EventId"].ToString();
                    }

                    //bookmark
                    int bookmarkStatus = ev.eventBookmark(UserId, Convert.ToInt64(Page.RouteData.Values["EventId"]));

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


                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(Convert.ToInt32(Page.RouteData.Values["EventId"]));

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

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

                /////////////////////////////////////////////board messages
                getBoardMessages(Convert.ToInt64(Page.RouteData.Values["EventId"]), Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
            }
        }
예제 #23
0
        protected void ButtonBookmark_Click(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                Classes.Events ev = new Classes.Events();
                int status = ev.eventBookmark(Convert.ToInt32(Session["UserId"]), Convert.ToInt64(Page.RouteData.Values["EventId"]));

                if (status == 1)
                {
                    HiddenFieldToastStatus.Value = "1";
                    HiddenFieldToastMode.Value = "bookmark";
                    HiddenFieldToastSmiley.Value = ":)";
                    HiddenFieldToastMessage.Value = "The event added to your bookmark list!";
                    HiddenFieldButton1Text.Value = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    ButtonBookmark.Text = "Remove Bookmark";
                }
                else if (status == 2)
                {
                    HiddenFieldToastStatus.Value = "1";
                    HiddenFieldToastMode.Value = "bookmark";
                    HiddenFieldToastSmiley.Value = ":)";
                    HiddenFieldToastMessage.Value = "The event removed from bookmark list!";
                    HiddenFieldButton1Text.Value = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                    ButtonBookmark.Text = "Remove Bookmark";
                    ButtonBookmark.Text = "Add Bookmark";
                }
            }
            else
            {
                LabelMessage.Visible = true;
                LabelMessage.Text = "You have to login first.";
            }
        }
예제 #24
0
        protected void ButtonBookmark_Click(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                Classes.Events ev = new Classes.Events();
                int status = ev.eventBookmark(Convert.ToInt32(Session["UserId"]), Convert.ToInt32(Page.RouteData.Values["EventId"]));

                if (status == 1)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text = "You have successfully added this event to your bookmark list";
                    ButtonBookmark.Text = "Remove Bookmark";
                }
                else if (status == 2)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text = "You have successfully removed this event from your bookmark list";
                    ButtonBookmark.Text = "Add Bookmark";
                }
            }
            else
            {
                LabelMessage.Visible = true;
                LabelMessage.Text = "You have to login first.";
            }
        }
예제 #25
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 (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");
                }
            }

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()));

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //check if user is the owner
                    if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString())
                    {
                        Response.Redirect("~/Error/UserNotEventOwner");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    //get time
                    string timeHour   = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString();
                    string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString();
                    DropDownListTimeHour.SelectedValue   = timeHour;
                    DropDownListTimeMinute.SelectedValue = timeMinute;

                    TextBoxName.Text = dt.Rows[0]["Name"].ToString();
                    DropDownListType.SelectedValue        = dt.Rows[0]["TypeId"].ToString();
                    TextBoxDescriptions.Text              = dt.Rows[0]["Descriptions"].ToString();
                    DropDownListPrivacy.SelectedValue     = dt.Rows[0]["Privacy"].ToString(); //show if price selected
                    HiddenFieldParticipants.Value         = dt.Rows[0]["Participants"].ToString();
                    HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString();
                    HiddenFieldDate.Value      = dt.Rows[0]["Date"].ToString();
                    HiddenFieldLanguages.Value = dt.Rows[0]["Languages"].ToString();

                    /////////////////// event photo
                    Classes.Locations l          = new Classes.Locations();
                    DataTable         dtLocation = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    int countryId = Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString());
                    int stateId   = Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString());
                    int cityId    = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());

                    locationCountry();
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    locationState(countryId);
                    DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString();
                    locationCity(stateId);
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
예제 #26
0
        protected void getBoardMessages(Int64 eventId, int ownerId)
        {
            Classes.Events e = new Classes.Events();
            DataTable dt = e.eventBoardMessages(eventId, ownerId);

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Error/EventNotFound");
            }
            else
            {
                RepeaterBoardMessages.DataSource = dt;
                RepeaterBoardMessages.DataBind();
            }
        }
예제 #27
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/Events");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Events");
                }
            }

            //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;
                }
            }


            DataTable dt;
            string mode = "";
            string message = "";

            try
            {
                mode = Page.RouteData.Values["Mode"].ToString().ToLower();
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            switch (mode)
            {
                case "created":
                    message = "Well! You don’t have any events now!";
                    break;
                case "accepted":
                    message = "Well! You haven’t been accepted in any upcoming events!";
                    break;
                case "requested":
                    message = "You haveen't requested to participate in any upcoming events!";
                    break;
                case "bookmarked":
                    message = "You haven't bookmarked any events!";
                    break;
                default:
                    Response.Redirect("~/Events/Mode/Created");
                    break;
            }

            Classes.Events ev = new Classes.Events();
            dt = ev.eventslist(Convert.ToInt32(Session["UserId"]), mode);

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
                LabelNoRecord.Visible = false;
            }
            else
            {
                HiddenFieldStatus.Value = "0";
                HiddenFieldSmiley.Value = ":|";
                HiddenFieldMessage.Value = message;
                HiddenFieldLinksNumber.Value = "1";
                Classes.Done d = new Classes.Done();
                Tuple<string, string, string, string> result = d.doneItem("A", "");
                HiddenFieldLink1Text.Value = result.Item1;
                HiddenFieldLink1Url.Value = result.Item2;
                HiddenFieldLink1Image.Value = result.Item3;
                HiddenFieldLink1Color.Value = result.Item4;
            }
        }
예제 #28
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/Events");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Events");
                }
            }

            //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;
                }
            }


            DataTable dt;
            string    mode    = "";
            string    message = "";

            try
            {
                mode = Page.RouteData.Values["Mode"].ToString().ToLower();
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            switch (mode)
            {
            case "created":
                message = "Well! You don’t have any events now!";
                break;

            case "accepted":
                message = "Well! You haven’t been accepted in any upcoming events!";
                break;

            case "requested":
                message = "You haveen't requested to participate in any upcoming events!";
                break;

            case "bookmarked":
                message = "You haven't bookmarked any events!";
                break;

            default:
                Response.Redirect("~/Events/Mode/Created");
                break;
            }

            Classes.Events ev = new Classes.Events();
            dt = ev.eventslist(Convert.ToInt32(Session["UserId"]), mode);

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
                LabelNoRecord.Visible = false;
            }
            else
            {
                HiddenFieldStatus.Value      = "0";
                HiddenFieldSmiley.Value      = ":|";
                HiddenFieldMessage.Value     = message;
                HiddenFieldLinksNumber.Value = "1";
                Classes.Done d = new Classes.Done();
                Tuple <string, string, string, string> result = d.doneItem("A", "");
                HiddenFieldLink1Text.Value  = result.Item1;
                HiddenFieldLink1Url.Value   = result.Item2;
                HiddenFieldLink1Image.Value = result.Item3;
                HiddenFieldLink1Color.Value = result.Item4;
            }
        }
예제 #29
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";
            }
        }
예제 #30
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/Explore");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Explore");
                }
            }

            //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;
                }
            }

            if (!IsPostBack)
            {
                Classes.Explore    ex     = new Classes.Explore();
                Tuple <int, Int64> result = ex.startRecommending(UserId);

                int   status  = result.Item1;
                Int64 eventId = result.Item2;

                if (status == 1)
                {
                    Classes.Events ev = new Classes.Events();
                    DataTable      dt = ev.eventInfo(eventId, UserId);

                    HiddenFieldStatus.Value = "1";

                    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 = dt.Rows[0]["EventId"].ToString();
                    LabelEventName.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();
                    LabelDescriptions.Text          = dt.Rows[0]["Descriptions"].ToString();
                    LabelAddress.Text               = dt.Rows[0]["Address"].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();
                    int 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;
                    }

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

                    if (bookmarkStatus == true)
                    {
                        ButtonBookmark.Text = "Remove Bookmark";
                    }
                    else
                    {
                        ButtonBookmark.Text = "Add Bookmark";
                    }
                }
                else
                {
                    HiddenFieldStatus.Value      = "0";
                    HiddenFieldSmiley.Value      = ":)";
                    HiddenFieldMessage.Value     = "Unfortunatly there is no event to show now!";
                    HiddenFieldLinksNumber.Value = "4";

                    Classes.Done d = new Classes.Done();
                    Tuple <string, string, string, string> result2 = d.doneItem("A", "");
                    HiddenFieldLink1Text.Value  = result2.Item1;
                    HiddenFieldLink1Url.Value   = result2.Item2;
                    HiddenFieldLink1Image.Value = result2.Item3;
                    HiddenFieldLink1Color.Value = result2.Item4;

                    result2 = d.doneItem("B", "");
                    HiddenFieldLink2Text.Value  = result2.Item1;
                    HiddenFieldLink2Url.Value   = result2.Item2;
                    HiddenFieldLink2Image.Value = result2.Item3;
                    HiddenFieldLink2Color.Value = result2.Item4;

                    result2 = d.doneItem("C", "");
                    HiddenFieldLink3Text.Value  = result2.Item1;
                    HiddenFieldLink3Url.Value   = result2.Item2;
                    HiddenFieldLink3Image.Value = result2.Item3;
                    HiddenFieldLink3Color.Value = result2.Item4;

                    result2 = d.doneItem("E", "");
                    HiddenFieldLink4Text.Value  = result2.Item1;
                    HiddenFieldLink4Url.Value   = result2.Item2;
                    HiddenFieldLink4Image.Value = result2.Item3;
                    HiddenFieldLink4Color.Value = result2.Item4;
                }
            }
        }
예제 #31
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();
        }
예제 #32
0
        protected void getEvents()
        {
            Classes.Events ev = new Classes.Events();
            DataTable dt = ev.eventslist(Convert.ToInt32(Session["UserId"]), "created");

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
            }
            else
            {
                LabelEventsNoRecord.Visible = true;
                LabelEventsNoRecord.Text = "There is no event!";
            }

        }
예제 #33
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/Events");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Events");
            }


            DataTable dt;
            string    mode = "created";

            try
            {
                mode = Page.RouteData.Values["Mode"].ToString().ToLower();
                switch (mode)
                {
                case "created":
                case "accepted":
                case "requested":
                case "bookmark":

                    break;

                default:
                    mode = "created";
                    break;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            Classes.Events ev = new Classes.Events();
            dt = ev.eventslist(Convert.ToInt32(Session["UserId"]), mode);

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
            }
            else
            {
                LabelNoRecord.Visible = true;
            }
        }
예제 #34
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";
            }
        }
예제 #35
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();
        }
예제 #36
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            HiddenFieldStep.Value = "4";
            bool check = true;
            LiteralMessage.Text = "";

            if (TextBoxName.Text.Length == 0) // check name
            {
                check = false;
                LiteralMessage.Text = "Enter name<br/>";
            }
            if(TextBoxDate.Text.Length == 0) // check date
            {
                check = false;
                LiteralMessage.Text += "Enter date<br/>";
            }
            if (TextBoxParticipants.Text.Length == 0) // check participants +++only number
            {
                check = false;
                LiteralMessage.Text += "Enter participants number<br/>";
            }
            // participants
            double num;
            string candidate = TextBoxParticipants.Text;
            if (!double.TryParse(candidate, out num) && TextBoxParticipants.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Participants is not valid, enter number<br/>";
            }
            // date
            if (Convert.ToDateTime(HiddenFieldDate.Value) < DateTime.Now)
            {
                check = false;
                LiteralMessage.Text += "Date cannot be in the past<br/>";
            }

            if(!check) // there is something wrong with the values that user entered
            {
                LiteralMessage.Visible = true;
            }
            else
            { // user entered valid values
                LiteralMessage.Visible = false;

                DateTime date = Convert.ToDateTime(HiddenFieldDate.Value);

                Classes.Events ev = new Classes.Events();
                int status = ev.eventAdd(Convert.ToInt32(Session["UserId"]),
                    TextBoxName.Text,
                    HiddenFieldDate.Value,
                    Convert.ToInt32(HiddenFieldParticipants.Value),
                    Convert.ToInt32(HiddenFieldLocationId.Value),
                    TextBoxAddress.Text,
                    Convert.ToInt16(HiddenFieldTypeId.Value),
                    Convert.ToInt16(HiddenFieldCoverId.Value),
                    TextBoxDescriptions.Text);

                if (status == 1)
                {
                    Response.Redirect("~/Done/EventAdded");
                }
                else if (status == -1)
                {
                    // +show error message
                }
            }
        }
예제 #37
0
        protected void ButtonDelete_Click(object sender, EventArgs e)
        {
            Classes.Events ev = new Classes.Events();
            int status = ev.eventDelete(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()));

            if (status == 1)
            {
                // show success message
                LiteralMessage.Text = "You have siccessfully deleted this event.";
                LiteralMessage.Visible = true;
                PanelInfo.Visible = false;
            }
        }
예제 #38
0
        protected void getEvents()
        {
            Classes.Events ev = new Classes.Events();
            DataTable dt = ev.eventslist(profileId, "created");

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
                HiddenFieldEventsStatus.Value = "1";
            }
            else
            {
                HiddenFieldEventsStatus.Value = "0";
            }

        }
예제 #39
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 (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");
                }
            }

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()));

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //check if user is the owner
                    if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString())
                    {
                        Response.Redirect("~/Error/UserNotEventOwner");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    //get time
                    string timeHour = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString();
                    string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString();
                    DropDownListTimeHour.SelectedValue = timeHour;
                    DropDownListTimeMinute.SelectedValue = timeMinute;

                    TextBoxName.Text = dt.Rows[0]["Name"].ToString();
                    DropDownListType.SelectedValue = dt.Rows[0]["TypeId"].ToString();
                    TextBoxDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    DropDownListPrivacy.SelectedValue = dt.Rows[0]["Privacy"].ToString(); //show if price selected
                    HiddenFieldParticipants.Value = dt.Rows[0]["Participants"].ToString();
                    HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString();
                    HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString();
                    HiddenFieldLanguages.Value = dt.Rows[0]["Languages"].ToString();

                    /////////////////// event photo
                    Classes.Locations l = new Classes.Locations();
                    DataTable dtLocation = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    int countryId = Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString());
                    int stateId = Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString());
                    int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());

                    locationCountry();
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    locationState(countryId);
                    DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString();
                    locationCity(stateId);
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
예제 #40
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            HiddenFieldStep.Value = "4";
            DateTime date = Convert.ToDateTime(HiddenFieldDate.Value);

            Classes.Events ev = new Classes.Events();
            Tuple<int, string> result = ev.eventModify(
                Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()),
                TextBoxName.Text,
                date,
                TextBoxParticipants.Text,
                Convert.ToInt32(HiddenFieldLocationId.Value),
                TextBoxAddress.Text,
                Convert.ToInt16(HiddenFieldTypeId.Value),
                Convert.ToInt32(HiddenFieldCoverId.Value),
                TextBoxDescriptions.Text
                );

            int status = result.Item1;
            string message = result.Item2;

            if (status == -1)
            {
                LiteralMessage.Visible = true;
                LiteralMessage.Text = message;
            }
            else
            {
                // show success message
                Response.Redirect("~/Done/EventModified");
            }
        }
예제 #41
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            bool check = true;

            LiteralMessage.Text = "";

            if (TextBoxName.Text.Length == 0) // check name
            {
                check = false;
                LiteralMessage.Text = "Enter name<br/>";
            }
            if (TextBoxDate.Text.Length == 0) // check date
            {
                check = false;
                LiteralMessage.Text += "Enter date<br/>";
            }
            if (TextBoxParticipants.Text.Length == 0) // check participants +++only number
            {
                check = false;
                LiteralMessage.Text += "Enter participants number<br/>";
            }
            if (TextBoxLanguages.Text.Length == 0) // check language
            {
                check = false;
                LiteralMessage.Text += "Enter language<br/>";
            }
            // check duration
            double num;
            string candidate = TextBoxDuration.Text;

            if (!double.TryParse(candidate, out num) && TextBoxDuration.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Duration is not valid, enter number<br/>";
            }
            // check pricefrom
            candidate = TextBoxPriceFrom.Text;
            if (!double.TryParse(candidate, out num) && TextBoxPriceFrom.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Price from is not valid, enter number<br/>";
            }
            // check priceto
            candidate = TextBoxPriceTo.Text;
            if (!double.TryParse(candidate, out num) && TextBoxPriceTo.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Price from is not valid, enter number<br/>";
            }
            // participants
            candidate = TextBoxParticipants.Text;
            if (!double.TryParse(candidate, out num) && TextBoxParticipants.Text.Length != 0)
            {
                check = false;
                LiteralMessage.Text += "Participants is not valid, enter number<br/>";
            }

            if (!check) // there is something wrong with the values that user entered
            {
                LiteralMessage.Visible = true;
            }
            else
            { // user entered valid values
                LiteralMessage.Visible = false;

                DateTime date = Convert.ToDateTime(HiddenFieldDate.Value);

                Classes.Events ev     = new Classes.Events();
                int            status = ev.eventAdd(Convert.ToInt32(Session["UserId"]),
                                                    TextBoxName.Text,
                                                    HiddenFieldDate.Value,
                                                    Convert.ToInt32(HiddenFieldParticipants.Value),
                                                    Convert.ToInt32(DropDownListCity.SelectedValue),
                                                    Convert.ToInt16(DropDownListPrivacy.SelectedValue),
                                                    Convert.ToInt16(HiddenFieldTypeId.Value),
                                                    Convert.ToInt16(HiddenFieldCoverId.Value),
                                                    HiddenFieldLanguages.Value,
                                                    TextBoxDescriptions.Text,
                                                    false,
                                                    false);

                if (status == 1)
                {
                    //show success message
                    //PanelInfo.Visible = false;
                    LiteralMessage.Text    = "You have successfully added an event.";
                    LiteralMessage.Visible = true;
                }
                else if (status == -1)
                {
                    // +show error message
                }
            }
        }
예제 #42
0
 protected void ButtonDelete_Click(object sender, EventArgs e)
 {
     int userId = Convert.ToInt32(Session["UserId"]);
     Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());
     Classes.Events ev = new Classes.Events();
     if (ev.isUserOwner(userId, eventId))
     {
         int status = ev.eventDelete(eventId, userId);
         if (status == 1)
         {
             Response.Redirect("~/Done/EventDeleted");
         }
     }
 }
예제 #43
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/Explore");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Explore");
                }
            }

            //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;
                }
            }

            if (!IsPostBack)
            {
                Classes.Explore ex = new Classes.Explore();
                Tuple<int, Int64> result = ex.startRecommending(UserId);

                int status = result.Item1;
                Int64 eventId = result.Item2;

                if (status == 1)
                {
                    Classes.Events ev = new Classes.Events();
                    DataTable dt = ev.eventInfo(eventId, UserId);

                    HiddenFieldStatus.Value = "1";

                    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 = dt.Rows[0]["EventId"].ToString();
                    LabelEventName.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();
                    LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    LabelAddress.Text = dt.Rows[0]["Address"].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();
                    int 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;
                    }

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

                    if (bookmarkStatus == true)
                    {
                        ButtonBookmark.Text = "Remove Bookmark";
                    }
                    else
                    {
                        ButtonBookmark.Text = "Add Bookmark";
                    }
                }
                else
                {
                    HiddenFieldStatus.Value = "0";
                    HiddenFieldSmiley.Value = ":)";
                    HiddenFieldMessage.Value = "Unfortunatly there is no event to show now!";
                    HiddenFieldLinksNumber.Value = "4";

                    Classes.Done d = new Classes.Done();
                    Tuple<string, string, string, string> result2 = d.doneItem("A", "");
                    HiddenFieldLink1Text.Value = result2.Item1;
                    HiddenFieldLink1Url.Value = result2.Item2;
                    HiddenFieldLink1Image.Value = result2.Item3;
                    HiddenFieldLink1Color.Value = result2.Item4;

                    result2 = d.doneItem("B", "");
                    HiddenFieldLink2Text.Value = result2.Item1;
                    HiddenFieldLink2Url.Value = result2.Item2;
                    HiddenFieldLink2Image.Value = result2.Item3;
                    HiddenFieldLink2Color.Value = result2.Item4;

                    result2 = d.doneItem("C", "");
                    HiddenFieldLink3Text.Value = result2.Item1;
                    HiddenFieldLink3Url.Value = result2.Item2;
                    HiddenFieldLink3Image.Value = result2.Item3;
                    HiddenFieldLink3Color.Value = result2.Item4;

                    result2 = d.doneItem("E", "");
                    HiddenFieldLink4Text.Value = result2.Item1;
                    HiddenFieldLink4Url.Value = result2.Item2;
                    HiddenFieldLink4Image.Value = result2.Item3;
                    HiddenFieldLink4Color.Value = result2.Item4;
                }
            }
        }