protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int buttonStatus = 0; //0 guest 1 user 2 owner bool userLogin = false; 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) { } else { userLogin = true; Session["UserId"] = UserId.ToString(); buttonStatus = 1; } } if (UserId != 0) profileId = UserId; try { profileId = Convert.ToInt32(Page.RouteData.Values["Id"].ToString()); } catch (Exception ex) { } finally { } Classes.UserInfo ui = new Classes.UserInfo(); Tuple<int, DataTable> result = ui.profileInfo(UserId, profileId.ToString()); int status = result.Item1; DataTable dt = result.Item2; if (status == -1)// Profile doesn't exist { Response.Redirect("~/Error/NoProfile"); } else { // Profile is redistrected if (status != 1) { Response.Redirect("~/Error/RestrictedProfile"); } else { HiddenFieldProfilePhoto.Value = dt.Rows[0]["ProfilePicUrl"].ToString(); // Show action buttons if (Convert.ToBoolean(dt.Rows[0]["isOwner"].ToString())) //user is the profile owner { buttonStatus = 2; ButtonFollow.Visible = false; } else { if (Convert.ToBoolean(dt.Rows[0]["isFollower"].ToString())) { HiddenFieldFollowText.Value = "UNFOLLOW"; } else { HiddenFieldFollowText.Value = "FOLLOW"; } } } // Profile info Page.Title = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString() + " (@" + dt.Rows[0]["Username"].ToString() + ") " + " Profile"; LabelName.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString(); LabelUsername.Text = dt.Rows[0]["Username"].ToString(); LabelFollowers.Text = dt.Rows[0]["FollowersCount"].ToString(); LabelFollowing.Text = dt.Rows[0]["FollowingCount"].ToString(); LabelAbout.Text = dt.Rows[0]["About"].ToString(); HiddenFieldUserId.Value = dt.Rows[0]["UserId"].ToString(); HiddenFieldProfileVerified.Value = dt.Rows[0]["ProfileVerified"].ToString(); LabelRate.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRatePercent.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRateCount.Text = dt.Rows[0]["RateCount"].ToString(); LabelCountry.Text = dt.Rows[0]["CountryName"].ToString(); LabelCity.Text = dt.Rows[0]["CityName"].ToString(); HiddenFieldFlagId.Value = dt.Rows[0]["CountryCode"].ToString(); HiddenFieldCoverUrl.Value = dt.Rows[0]["CoverUrl"].ToString(); HiddenFieldButtonStatus.Value = buttonStatus.ToString(); } getEvents(); getReviews(); getFollowers(); getFollowing(); }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest bool userLogin = false; 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) { } else { userLogin = true; Session["UserId"] = UserId.ToString(); } } Classes.UserInfo ui = new Classes.UserInfo(); Tuple <int, DataTable> result = ui.profileInfo(UserId, Page.RouteData.Values["Id"].ToString()); int status = result.Item1; DataTable dt = result.Item2; if (status == -1)// Profile doesn't exist { Response.Redirect("~/Error/NoProfile"); } else { // Profile is redistrected if (status != 1) { Response.Redirect("~/Error/RedistrictedProfile"); } else { HiddenFieldProfilePhoto.Value = dt.Rows[0]["ProfilePicUrl"].ToString(); // Show action buttons if (Convert.ToBoolean(dt.Rows[0]["isOwner"].ToString())) //user is the profile owner { HyperLinkEdit.Visible = true; ButtonFollow.Visible = false; } else { if (Convert.ToBoolean(dt.Rows[0]["isFollower"].ToString())) { ButtonFollow.Text = "Unfollow"; } else { ButtonFollow.Text = "Follow"; } } } // Profile info LabelName.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString(); LabelUsername.Text = dt.Rows[0]["Username"].ToString(); LabelFollowers.Text = dt.Rows[0]["FollowersCount"].ToString(); LabelFollowing.Text = dt.Rows[0]["FollowingCount"].ToString(); LabelAbout.Text = dt.Rows[0]["About"].ToString(); HiddenFieldUserId.Value = dt.Rows[0]["UserId"].ToString(); HiddenFieldProfileVerified.Value = dt.Rows[0]["ProfileVerified"].ToString(); LabelRate.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRatePercent.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRateCount.Text = dt.Rows[0]["RateCount"].ToString(); LabelCountry.Text = dt.Rows[0]["CountryName"].ToString(); LabelCity.Text = dt.Rows[0]["CityName"].ToString(); HiddenFieldFlagId.Value = dt.Rows[0]["CountryId"].ToString(); } getEvents(); getReviews(); getFollowers(); getFollowing(); }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest bool userLogin = false; 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) { } else { userLogin = true; Session["UserId"] = UserId.ToString(); } } Classes.UserInfo ui = new Classes.UserInfo(); Tuple<int, DataTable> result = ui.profileInfo(UserId, Page.RouteData.Values["Id"].ToString()); int status = result.Item1; DataTable dt = result.Item2; if (status == -1)// Profile doesn't exist { Response.Redirect("~/Error/NoProfile"); } else { // Profile is redistrected if (status != 1) { Response.Redirect("~/Error/RedistrictedProfile"); } else { HiddenFieldProfilePhoto.Value = dt.Rows[0]["ProfilePicUrl"].ToString(); // Show action buttons if (Convert.ToBoolean(dt.Rows[0]["isOwner"].ToString())) //user is the profile owner { HyperLinkEdit.Visible = true; ButtonFollow.Visible = false; } else { if (Convert.ToBoolean(dt.Rows[0]["isFollower"].ToString())) { ButtonFollow.Text = "Unfollow"; } else { ButtonFollow.Text = "Follow"; } } } // Profile info LabelName.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString(); LabelUsername.Text = dt.Rows[0]["Username"].ToString(); LabelFollowers.Text = dt.Rows[0]["FollowersCount"].ToString(); LabelFollowing.Text = dt.Rows[0]["FollowingCount"].ToString(); LabelAbout.Text = dt.Rows[0]["About"].ToString(); HiddenFieldUserId.Value = dt.Rows[0]["UserId"].ToString(); HiddenFieldProfileVerified.Value = dt.Rows[0]["ProfileVerified"].ToString(); LabelRate.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRatePercent.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRateCount.Text = dt.Rows[0]["RateCount"].ToString(); LabelCountry.Text = dt.Rows[0]["CountryName"].ToString(); LabelCity.Text = dt.Rows[0]["CityName"].ToString(); HiddenFieldFlagId.Value = dt.Rows[0]["CountryId"].ToString(); } getEvents(); getReviews(); getFollowers(); getFollowing(); }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int buttonStatus = 0; //0 guest 1 user 2 owner bool userLogin = false; 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) { } else { userLogin = true; Session["UserId"] = UserId.ToString(); buttonStatus = 1; } } if (UserId != 0) { profileId = UserId; } try { profileId = Convert.ToInt32(Page.RouteData.Values["Id"].ToString()); } catch (Exception ex) { } finally { } Classes.UserInfo ui = new Classes.UserInfo(); Tuple <int, DataTable> result = ui.profileInfo(UserId, profileId.ToString()); int status = result.Item1; DataTable dt = result.Item2; if (status == -1)// Profile doesn't exist { Response.Redirect("~/Error/NoProfile"); } else { // Profile is redistrected if (status != 1) { Response.Redirect("~/Error/RestrictedProfile"); } else { HiddenFieldProfilePhoto.Value = dt.Rows[0]["ProfilePicUrl"].ToString(); // Show action buttons if (Convert.ToBoolean(dt.Rows[0]["isOwner"].ToString())) //user is the profile owner { buttonStatus = 2; ButtonFollow.Visible = false; } else { if (Convert.ToBoolean(dt.Rows[0]["isFollower"].ToString())) { HiddenFieldFollowText.Value = "UNFOLLOW"; } else { HiddenFieldFollowText.Value = "FOLLOW"; } } } // Profile info Page.Title = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString() + " (@" + dt.Rows[0]["Username"].ToString() + ") " + " Profile"; LabelName.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString(); LabelUsername.Text = dt.Rows[0]["Username"].ToString(); LabelFollowers.Text = dt.Rows[0]["FollowersCount"].ToString(); LabelFollowing.Text = dt.Rows[0]["FollowingCount"].ToString(); LabelAbout.Text = dt.Rows[0]["About"].ToString(); HiddenFieldUserId.Value = dt.Rows[0]["UserId"].ToString(); HiddenFieldProfileVerified.Value = dt.Rows[0]["ProfileVerified"].ToString(); LabelRate.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRatePercent.Text = dt.Rows[0]["RatePercent"].ToString(); LabelRateCount.Text = dt.Rows[0]["RateCount"].ToString(); LabelCountry.Text = dt.Rows[0]["CountryName"].ToString(); LabelCity.Text = dt.Rows[0]["CityName"].ToString(); HiddenFieldFlagId.Value = dt.Rows[0]["CountryCode"].ToString(); HiddenFieldCoverUrl.Value = dt.Rows[0]["CoverUrl"].ToString(); HiddenFieldButtonStatus.Value = buttonStatus.ToString(); } getEvents(); getReviews(); getFollowers(); getFollowing(); }