コード例 #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
ファイル: Explore.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsModify.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsModify.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: Profile.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsAdd.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: Events.aspx.cs プロジェクト: farhad85/CityCrowd
        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
ファイル: EventsAdd.aspx.cs プロジェクト: farhad85/CityCrowd
        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
ファイル: EventsModify.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsModify.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: farhad85/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: farhad85/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: farhad85/CityCrowd
        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
ファイル: Events.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: Explore.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: Profile.aspx.cs プロジェクト: farhad85/CityCrowd
        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
ファイル: Events.aspx.cs プロジェクト: MichaelSong9/CityCrowd
        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
ファイル: EventsView.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsAdd.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: Profile.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsModify.aspx.cs プロジェクト: m3hrad/CityCrowd
        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
ファイル: EventsModify.aspx.cs プロジェクト: m3hrad/CityCrowd
 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
ファイル: Explore.aspx.cs プロジェクト: m3hrad/CityCrowd
        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;
                }
            }
        }