Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string mode = "";

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

            }
            finally
            {

            }

            //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/Done/" + mode);
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Done/" + mode);
                }
            }



            switch (mode)
            {
                case "welcome":
                    Classes.Done done = new Classes.Done();
                    Classes.Done.DoneObject result = done.getDone("welcome", 0, 0);
                    var context = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
                    context.Clients.All.setDone("hi!");
            break;
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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

            Classes.UserInfo ui = new Classes.UserInfo();
            int locationId = ui.locationIdByUserId(UserId);

            Classes.Locations l = new Classes.Locations();
            Tuple<int, string> result1 = l.locationUsersCount(locationId);
            int locationUsersCount = result1.Item1;
            string locationName = result1.Item2;
            int minLocationUsers = Convert.ToInt32(ConfigurationManager.AppSettings["MinLocationUsers"].ToString());

            Page.Title = "Hi!";
            HiddenFieldTitle.Value = "Hi!";
            HiddenFieldSmiley.Value = ":)";
            HiddenFieldMessage.Value = "How are you doing today? Where can I redirect you?!";
            HiddenFieldLinksNumber.Value = "1";
            HiddenFieldLocationUsersCount.Value = locationUsersCount.ToString();
            HiddenFieldMinLocationUsers.Value = minLocationUsers.ToString();
            HiddenFieldLocation.Value = locationName;

            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;
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string errorType = "unknown";

            try
            {
                if (Page.RouteData.Values["Code"].ToString() != "") // redirect user to a page with item id
                {
                    errorType = Page.RouteData.Values["Code"].ToString();
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            Classes.Done d = new Classes.Done();

            switch (errorType.ToLower())
            {
                case "404":
                    {
                        Page.Title = "Error";
                        HiddenFieldTitle.Value = "Error";
                        HiddenFieldSmiley.Value = ":|";
                        HiddenFieldMessage.Value = "Page not found!";
                        HiddenFieldLinksNumber.Value = "4";

                        Tuple<string, string, string, string> result = d.doneItem("G", "");
                        HiddenFieldLink1Text.Value = result.Item1;
                        HiddenFieldLink1Url.Value = result.Item2;
                        HiddenFieldLink1Image.Value = result.Item3;
                        HiddenFieldLink1Color.Value = result.Item4;

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

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

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

                        break;
                    }
                case "eventnotfound":
                    {
                        Page.Title = "Error";
                        HiddenFieldTitle.Value = "Error";
                        HiddenFieldSmiley.Value = ":|";
                        HiddenFieldMessage.Value = "We were unable to find this event!";
                        HiddenFieldLinksNumber.Value = "4";

                        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;

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

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

                        result = d.doneItem("K", "");
                        HiddenFieldLink4Text.Value = result.Item1;
                        HiddenFieldLink4Url.Value = result.Item2;
                        HiddenFieldLink4Image.Value = result.Item3;
                        HiddenFieldLink4Color.Value = result.Item4;

                        break;
                    }
                case "usernoteventowner":
                    {
                        Page.Title = "Error";
                        HiddenFieldTitle.Value = "Error";
                        HiddenFieldSmiley.Value = ":|";
                        HiddenFieldMessage.Value = "You are not the owner of this event!";
                        HiddenFieldLinksNumber.Value = "4";

                        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;

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

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

                        result = d.doneItem("K", "");
                        HiddenFieldLink4Text.Value = result.Item1;
                        HiddenFieldLink4Url.Value = result.Item2;
                        HiddenFieldLink4Image.Value = result.Item3;
                        HiddenFieldLink4Color.Value = result.Item4;

                        break;
                    }
                case "prequestnotfound":
                    {
                        Page.Title = "Error";
                        HiddenFieldTitle.Value = "Error";
                        HiddenFieldSmiley.Value = ":|";
                        HiddenFieldMessage.Value = "Your verification code for recovering your password was not found in the system!";
                        HiddenFieldLinksNumber.Value = "2";

                        Tuple<string, string, string, string> result = d.doneItem("L", "");
                        HiddenFieldLink1Text.Value = result.Item1;
                        HiddenFieldLink1Url.Value = result.Item2;
                        HiddenFieldLink1Image.Value = result.Item3;
                        HiddenFieldLink1Color.Value = result.Item4;

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

                        break;
                    }
            }
        }
Beispiel #4
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;
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {

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

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

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

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

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

                    HiddenFieldStatus.Value = "1";

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

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

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

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

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

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

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

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

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

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

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

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