Example #1
0
        protected void getReviews()
        {
            Classes.UserInfo         ui     = new Classes.UserInfo();
            Tuple <int[], DataTable> result = ui.reviews(Convert.ToInt32(Page.RouteData.Values["Id"].ToString()));

            int[]     rateCount = result.Item1;
            DataTable dt        = result.Item2;

            if (dt.Rows.Count != 0)
            {
                LabelRateOne.Text   = rateCount[0].ToString();
                LabelRateTwo.Text   = rateCount[1].ToString();
                LabelRateThree.Text = rateCount[2].ToString();
                LabelRateFour.Text  = rateCount[3].ToString();
                LabelRateFive.Text  = rateCount[4].ToString();

                RepeaterReviews.DataSource = dt;
                RepeaterReviews.DataBind();
            }
            else
            {
                LabelReviewsNoRecord.Visible = true;
                LabelReviewsNoRecord.Text    = "There is no review!";
            }
        }
Example #2
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/Invite");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Invite");
                }
            }

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

            HiddenFieldUserId.Value = UserId.ToString();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            //reading cookies for loginint UserId = 0;
            if (Session["UserId"] != null)
            {
                Response.Redirect("~/Done/Welcome");
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    int UserId = ls.getUserId(VC);
                    if (UserId != 0) //user logged before
                    {
                        Response.Redirect("~/Done/Welcome");
                    }
                }
            }

            if (!Convert.ToBoolean(Application["RegisterAllowed"]))
            {
                LabelError.Text = "Login is not allowed! Please try again later!";
                ButtonRegister.Enabled = false;
            }

            //check if visitor has been invited
            int inviteId = 0;
            try
            {
                inviteId = Convert.ToInt32(Page.RouteData.Values["InviteId"].ToString());

                // create the cookies
                HttpCookie _inviteIdCookies = new HttpCookie("inviteid");
                _inviteIdCookies["inviteid"] = Page.RouteData.Values["InviteId"].ToString();
                _inviteIdCookies.Expires = DateTime.Now.AddHours(1);
                Response.Cookies.Add(_inviteIdCookies);
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            if(inviteId != 0)
            {
                HiddenFieldInvite.Value = inviteId.ToString();
                Classes.UserInfo ui = new Classes.UserInfo();
                Tuple<int, string, string> result = ui.getFirstNamePhotoUrlByUserId(inviteId);
                HiddenFieldInviteStatus.Value = result.Item1.ToString(); 
                HiddenFieldInviteName.Value = result.Item2;
                HiddenFieldInvitePhotoUrl.Value = result.Item3;
            }
        }
Example #4
0
        //public DoneObject(Boolean donestatus, string smiley, string message, Int16 number,
        //string item1text, string item1url, string item1image, string item1color,
        //string item2text, string item2url, string item2image, string item2color,
        //string item3text, string item3url, string item3image, string item3color,
        //string item4text, string item4url, string item4image, string item4color)



        /*Int64 MessageId
         * bool Sender
         * string Message
         * string PassedDate
         * bool Unread
         * int UserId*/

        public Boolean usernameValidator(string username)
        {
            Classes.UserInfo ui             = new Classes.UserInfo();
            bool             usernameExists = ui.checkUsernameExists(username);

            return(usernameExists);
        }
Example #5
0
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            string email     = TextBoxEmail.Text;
            string password1 = TextBoxPassword1.Text;
            string password2 = TextBoxPassword2.Text;
            int    inviteId  = Convert.ToInt32(HiddenFieldInvite.Value);

            Classes.UserProfileSet   ups    = new Classes.UserProfileSet();
            Tuple <int, string, int> result = ups.register(email, password1, password2, inviteId);

            if (result.Item1 == -1)
            {
                LabelError.Visible = true;
                LabelError.Text    = result.Item2;
            }
            else if (result.Item1 == 1)
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userId          = ui.getUserIdByEmail(email);
                Session["UserId"] = userId.ToString();

                int    Hours            = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursShort"].ToString());
                string VerificationCode = Convert.ToString(Guid.NewGuid());

                // set login information
                Classes.LoginSession ls = new Classes.LoginSession();
                ls.setLoginSession(userId, VerificationCode, Hours);

                // create the cookies
                HttpCookie _userInfoCookies = new HttpCookie("VC");
                _userInfoCookies["VC"]   = VerificationCode;
                _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                Response.Cookies.Add(_userInfoCookies);

                //check if user got invited
                int invitorId = 0;

                try
                {
                    invitorId = Convert.ToInt32(Page.RouteData.Values["UserId"]);
                }
                catch (Exception ex)
                {
                }
                finally
                {
                }

                if (invitorId != 0)
                {
                    Classes.Notifications n = new Classes.Notifications();
                    n.notificationAdd(invitorId, 5, userId);
                }

                // redirect the user
                Response.Redirect("~/Completion");
            }
        }
Example #6
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");
            }

            if (!IsPostBack)
            {
                Classes.Locations l = new Classes.Locations();
                DataTable dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }

                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                if (locationId == 0)
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = locationId;

                    DataTable dtLocation = l.locationInfoOnlyId(locationId);

                    locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()));
                    locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()));
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString();
                    DropDownListCity.SelectedValue = locationId.ToString();
                }
            }

        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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

            if (!IsPostBack)
            {
                Classes.Locations l           = new Classes.Locations();
                DataTable         dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }

                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                if (locationId == 0)
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = locationId;

                    DataTable dtLocation = l.locationInfoOnlyId(locationId);

                    locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()));
                    locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()));
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    DropDownListState.SelectedValue   = dtLocation.Rows[0]["StateId"].ToString();
                    DropDownListCity.SelectedValue    = locationId.ToString();
                }
            }
        }
Example #8
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/Nearby");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Nearby");
                }
            }

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

            Page.Title = "Nearby";
            feedCity(4, 99999999);
        }
Example #9
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;
        }
Example #10
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;
        }
        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();
                    HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                }
            }

            DataTable dt;
            Classes.UserInfo ui = new Classes.UserInfo();
            dt = ui.masterPageInfo(UserId);

            if (dt.Rows.Count == 0)// Profile doesn't exist OR user didn't logged in
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                LabelFullName.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
                HyperLinkProfile.NavigateUrl = "~/Profile/" + dt.Rows[0]["Username"].ToString();
                HiddenFieldMessages.Value = dt.Rows[0]["MessagesCount"].ToString();
                HiddenFieldRequests.Value = dt.Rows[0]["RequestsCount"].ToString();
                HiddenFieldNotifications.Value = dt.Rows[0]["NotificationsCount"].ToString();
                HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();

                string photoUrl = "Images/NoPhoto.png";
                if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                {
                    photoUrl = "Files/" + ConfigurationManager.AppSettings["folderName"].ToString() + "/ProfilesPhotos/" + UserId.ToString() + ".jpg";
                }
                HiddenFieldPhotoUrl.Value = photoUrl;
            }
        }
        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();
                    HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                }
            }

            DataTable dt;

            Classes.UserInfo ui = new Classes.UserInfo();
            dt = ui.masterPageInfo(UserId);

            if (dt.Rows.Count == 0)// Profile doesn't exist OR user didn't logged in
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                LabelFullName.Text             = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
                HyperLinkProfile.NavigateUrl   = "~/Profile/" + dt.Rows[0]["Username"].ToString();
                HiddenFieldMessages.Value      = dt.Rows[0]["MessagesCount"].ToString();
                HiddenFieldRequests.Value      = dt.Rows[0]["RequestsCount"].ToString();
                HiddenFieldNotifications.Value = dt.Rows[0]["NotificationsCount"].ToString();
                HiddenFieldUsername.Value      = dt.Rows[0]["Username"].ToString();

                string photoUrl = "Images/NoPhoto.png";
                if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                {
                    photoUrl = "Files/" + ConfigurationManager.AppSettings["folderName"].ToString() + "/ProfilesPhotos/" + UserId.ToString() + ".jpg";
                }
                HiddenFieldPhotoUrl.Value = photoUrl;
            }
        }
Example #13
0
        protected void getFollowing()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            DataTable        dt = ui.followingList(Convert.ToInt32(Session["UserId"]));

            if (dt.Rows.Count != 0)
            {
                RepeaterFollowing.DataSource = dt;
                RepeaterFollowing.DataBind();
            }
            else
            {
                LabelFollowingNoRecord.Visible = true;
                LabelFollowingNoRecord.Text    = "There is no following!";
            }
        }
Example #14
0
        protected void getFollowers()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            DataTable        dt = ui.followersList(profileId);

            if (dt.Rows.Count != 0)
            {
                RepeaterFollowers.DataSource = dt;
                RepeaterFollowers.DataBind();
                HiddenFieldFollowersStatus.Value = "1";
            }
            else
            {
                HiddenFieldFollowersStatus.Value = "0";
            }
        }
Example #15
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/Completion");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Completion");
            }

            //check if user entered these information before
            Classes.UserInfo ui = new Classes.UserInfo();

            if (ui.getUserStatus(UserId) != 0) //if user not logged in redirect to login
            {
                //Response.Redirect("~/Explore");
            }

            if (!IsPostBack)
            {
                DataTable dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }
            }
        }
Example #16
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/Completion");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Completion");
            }

            //check if user entered these information before
            Classes.UserInfo ui = new Classes.UserInfo();

            if (ui.getUserStatus(UserId) != 0) //if user not logged in redirect to login
            {
                //Response.Redirect("~/Explore");
            }

            if (!IsPostBack)
            {
                DataTable         dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }
            }
        }
Example #17
0
        protected void getFollowing()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            DataTable        dt = ui.followingList(profileId);

            if (dt.Rows.Count != 0)
            {
                RepeaterFollowing.DataSource = dt;
                RepeaterFollowing.DataBind();
                HiddenFieldFollowingStatus.Value = "1";
            }
            else
            {
                LabelFollowingNoRecord.Visible   = true;
                LabelFollowingNoRecord.Text      = "There is no following!";
                HiddenFieldFollowingStatus.Value = "0";
            }
        }
Example #18
0
        protected void feedCity()
        {
            int userId = Convert.ToInt32(Session["UserId"]);
            Classes.UserInfo ui = new Classes.UserInfo();
            int locationId = ui.locationIdByUserId(userId);

            Classes.Feed f = new Classes.Feed();
            DataTable dt = f.eventsCity(locationId);

            if (dt.Rows.Count > 0)
            {
                RepeaterCity.DataSource = dt;
                RepeaterCity.DataBind();
            }
            else
            {
                //LabelNoRecord.Visible = true;
            }
        }
Example #19
0
        protected void feedCity()
        {
            int userId = Convert.ToInt32(Session["UserId"]);

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

            Classes.Feed f  = new Classes.Feed();
            DataTable    dt = f.eventsCity(locationId);

            if (dt.Rows.Count > 0)
            {
                RepeaterCity.DataSource = dt;
                RepeaterCity.DataBind();
            }
            else
            {
                //LabelNoRecord.Visible = true;
            }
        }
Example #20
0
        protected void feedCity(int mode, Int64 eventId)
        {
            int userId = Convert.ToInt32(Session["UserId"]);

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

            //{
            //    HiddenFieldStatus.Value = "0";
            //    HiddenFieldSmiley.Value = ":)";
            //    HiddenFieldMessage.Value = "Unfortunatly there is no event in your city 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("C", "");
            //    HiddenFieldLink2Text.Value = result2.Item1;
            //    HiddenFieldLink2Url.Value = result2.Item2;
            //    HiddenFieldLink2Image.Value = result2.Item3;
            //    HiddenFieldLink2Color.Value = result2.Item4;

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

            //    result2 = d.doneItem("F", "");
            //    HiddenFieldLink4Text.Value = result2.Item1;
            //    HiddenFieldLink4Url.Value = result2.Item2;
            //    HiddenFieldLink4Image.Value = result2.Item3;
            //    HiddenFieldLink4Color.Value = result2.Item4;
            //}
        }
Example #21
0
        protected void feedCity(int mode, Int64 eventId)
        {
            int userId = Convert.ToInt32(Session["UserId"]);
            Classes.UserInfo ui = new Classes.UserInfo();
            int locationId = ui.locationIdByUserId(userId);

            //{
            //    HiddenFieldStatus.Value = "0";
            //    HiddenFieldSmiley.Value = ":)";
            //    HiddenFieldMessage.Value = "Unfortunatly there is no event in your city 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("C", "");
            //    HiddenFieldLink2Text.Value = result2.Item1;
            //    HiddenFieldLink2Url.Value = result2.Item2;
            //    HiddenFieldLink2Image.Value = result2.Item3;
            //    HiddenFieldLink2Color.Value = result2.Item4;

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

            //    result2 = d.doneItem("F", "");
            //    HiddenFieldLink4Text.Value = result2.Item1;
            //    HiddenFieldLink4Url.Value = result2.Item2;
            //    HiddenFieldLink4Image.Value = result2.Item3;
            //    HiddenFieldLink4Color.Value = result2.Item4;
            //}
        }
Example #22
0
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            string email = TextBoxEmail.Text;
            string password1 = TextBoxPassword1.Text;
            string password2 = TextBoxPassword2.Text;

            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            Tuple<int, string, int> result = ups.register(email, password1, password2);

            if (result.Item1 == -1)
            {
                LabelError.Visible = true;
                LabelError.Text = result.Item2;
            }
            else if (result.Item1 == 1)
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                Session["UserId"] = ui.getUserIdByEmail(email);

                int Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursShort"].ToString());
                string VerificationCode = Convert.ToString(Guid.NewGuid());

                // set login information
                Classes.LoginSession ls = new Classes.LoginSession();
                ls.setLoginSession(Convert.ToInt32(Session["UserId"]), VerificationCode, Hours);

                // create the cookies
                HttpCookie _userInfoCookies = new HttpCookie("VC");
                _userInfoCookies["VC"] = VerificationCode;
                _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                Response.Cookies.Add(_userInfoCookies);

                // redirect the user
                Response.Redirect("~/Completion");
            }
        }
Example #23
0
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            string email     = TextBoxEmail.Text;
            string password1 = TextBoxPassword1.Text;
            string password2 = TextBoxPassword2.Text;

            Classes.UserProfileSet   ups    = new Classes.UserProfileSet();
            Tuple <int, string, int> result = ups.register(email, password1, password2);

            if (result.Item1 == -1)
            {
                LabelError.Visible = true;
                LabelError.Text    = result.Item2;
            }
            else if (result.Item1 == 1)
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                Session["UserId"] = ui.getUserIdByEmail(email);

                int    Hours            = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursShort"].ToString());
                string VerificationCode = Convert.ToString(Guid.NewGuid());

                // set login information
                Classes.LoginSession ls = new Classes.LoginSession();
                ls.setLoginSession(Convert.ToInt32(Session["UserId"]), VerificationCode, Hours);

                // create the cookies
                HttpCookie _userInfoCookies = new HttpCookie("VC");
                _userInfoCookies["VC"]   = VerificationCode;
                _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                Response.Cookies.Add(_userInfoCookies);

                // redirect the user
                Response.Redirect("~/Completion");
            }
        }
Example #24
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/Messages");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Messages");
                }
            }

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

            int otherId = Convert.ToInt32(Page.RouteData.Values["ProfileId"].ToString());
            HiddenFieldOtherId.Value = otherId.ToString();

            Classes.Messages m = new Classes.Messages();
            Tuple<int, DataTable, DataTable, string, string> result = m.showMessages(UserId, otherId, 99999999);

            int status = result.Item1;
            DataTable dtUserName = result.Item2;
            DataTable dtOtherName = result.Item3;
            HiddenFieldOwnerPhotoUrl.Value = result.Item4;
            HiddenFieldOtherPhotoUrl.Value = result.Item5;

            if (status == -1)
            {
                Response.Redirect("~/Messages");
            }

            HiddenFieldOwnerName.Value = dtUserName.Rows[0]["FirstName"].ToString() + " " + dtUserName.Rows[0]["LastName"].ToString();
            HiddenFieldOtherName.Value = dtOtherName.Rows[0]["FirstName"].ToString() + " " + dtOtherName.Rows[0]["LastName"].ToString();
            Page.Title = "Messages : " + dtOtherName.Rows[0]["FirstName"].ToString() + " " + dtOtherName.Rows[0]["LastName"].ToString();
        }
Example #25
0
        protected void getFollowing()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            DataTable dt = ui.followingList(profileId);

            if (dt.Rows.Count != 0)
            {
                RepeaterFollowing.DataSource = dt;
                RepeaterFollowing.DataBind();
                HiddenFieldFollowingStatus.Value = "1";
            }
            else
            {
                LabelFollowingNoRecord.Visible = true;
                LabelFollowingNoRecord.Text = "There is no following!";
                HiddenFieldFollowingStatus.Value = "0";
            }
        }
Example #26
0
        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();
        }
Example #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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

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

            int otherId = Convert.ToInt32(Page.RouteData.Values["ProfileId"].ToString());

            HiddenFieldOtherId.Value = otherId.ToString();

            Classes.Messages m = new Classes.Messages();
            Tuple <int, DataTable, DataTable, string, string> result = m.showMessages(UserId, otherId, 99999999);

            int       status      = result.Item1;
            DataTable dtUserName  = result.Item2;
            DataTable dtOtherName = result.Item3;

            HiddenFieldOwnerPhotoUrl.Value = result.Item4;
            HiddenFieldOtherPhotoUrl.Value = result.Item5;

            if (status == -1)
            {
                Response.Redirect("~/Messages");
            }

            HiddenFieldOwnerName.Value = dtUserName.Rows[0]["FirstName"].ToString() + " " + dtUserName.Rows[0]["LastName"].ToString();
            HiddenFieldOtherName.Value = dtOtherName.Rows[0]["FirstName"].ToString() + " " + dtOtherName.Rows[0]["LastName"].ToString();
            Page.Title = "Messages : " + dtOtherName.Rows[0]["FirstName"].ToString() + " " + dtOtherName.Rows[0]["LastName"].ToString();
        }
Example #28
0
        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();
        }
Example #29
0
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            string email = TextBoxEmail.Text;
            string password1 = TextBoxPassword1.Text;
            string password2 = TextBoxPassword2.Text;
            int inviteId = Convert.ToInt32(HiddenFieldInvite.Value);

            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            Tuple<int, string, int> result = ups.register(email, password1, password2, inviteId);

            if (result.Item1 == -1)
            {
                LabelError.Visible = true;
                LabelError.Text = result.Item2;
            }
            else if (result.Item1 == 1)
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userId = ui.getUserIdByEmail(email);
                Session["UserId"] = userId.ToString();

                int Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursShort"].ToString());
                string VerificationCode = Convert.ToString(Guid.NewGuid());

                // set login information
                Classes.LoginSession ls = new Classes.LoginSession();
                ls.setLoginSession(userId, VerificationCode, Hours);

                // create the cookies
                HttpCookie _userInfoCookies = new HttpCookie("VC");
                _userInfoCookies["VC"] = VerificationCode;
                _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                Response.Cookies.Add(_userInfoCookies);

                //check if user got invited
                int invitorId = 0;

                try
                {
                    invitorId = Convert.ToInt32(Page.RouteData.Values["UserId"]);
                }
                catch (Exception ex)
                {

                }
                finally
                {
                    
                }

                if (invitorId != 0)
                {
                    Classes.Notifications n = new Classes.Notifications();
                    n.notificationAdd(invitorId, 5, userId);
                }

                // redirect the user
                Response.Redirect("~/Completion");
            }
        }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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

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

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

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

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

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

            //all read
            Classes.Notifications n = new Classes.Notifications();
            n.allRead(UserId);

            //get notifications
            DataTable dt = n.notifications(UserId);

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

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

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

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

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

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

            if (status == 1)
            {
                DataTable dt = result.Item2;
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Example #32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

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

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

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

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

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

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

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

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

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

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

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

                    locationCountry();
                    DropDownListCountry.SelectedValue = countryCode;
                    locationCity(countryCode);
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
Example #33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2)
            {
                Response.Redirect("~/Maintenance.html");
            }

            //check login
            int UserId     = 0;
            int userStatus = 0;

            Classes.UserInfo ui = new Classes.UserInfo();
            if (Session["UserId"] != null)
            {
                UserId     = Convert.ToInt32(Session["UserId"]);
                userStatus = ui.getUserStatus(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/Completion");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Completion");
                }
            }


            if (!IsPostBack)
            {
                //check if user entered these information before
                userStatus = ui.getUserStatus(UserId);
                if (userStatus != 0)
                {
                    if (userStatus != 4)
                    {
                        Response.Redirect("~/Done/Welcome");
                    }
                }

                if (userStatus == 4)
                {
                    Tuple <string, string, string, string> result = ui.fbCompletion(UserId);

                    TextBoxFirstName.Text            = result.Item1;
                    TextBoxLastName.Text             = result.Item2;
                    HiddenFieldHasPhoto.Value        = result.Item3;
                    DropDownListGender.SelectedValue = result.Item4;
                    if (Convert.ToBoolean(result.Item3))
                    {
                        HiddenFieldPhotoUrl.Value = "Files/Temp/" + UserId.ToString() + "-100.jpg";
                    }
                }

                DataTable         dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                }
            }
        }
Example #34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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

            //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)
            {
                string mode      = "";
                Int64  itemId    = 0;
                bool   modeCheck = false;

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

                if (mode == "event" || mode == "user")
                {
                    modeCheck = true;
                }

                if (!modeCheck || itemId == 0)
                {
                    Response.Redirect("~/Error/PageNotFound");
                }

                if (mode == "event")
                {
                    DropDownListReportType.Items.Add(new ListItem("Select a reason", "0"));
                    DropDownListReportType.Items.Add(new ListItem("Spam", "50"));
                    DropDownListReportType.Items.Add(new ListItem("Inappropriate", "51"));
                    DropDownListReportType.Items.Add(new ListItem("Hateful or racism", "52"));
                    DropDownListReportType.Items.Add(new ListItem("Abusive", "53"));
                    DropDownListReportType.Items.Add(new ListItem("Other", "59"));
                }
                else if (mode == "user")
                {
                    DropDownListReportType.Items.Add(new ListItem("Select a reason", "0"));
                    DropDownListReportType.Items.Add(new ListItem("Fake account", "10"));
                    DropDownListReportType.Items.Add(new ListItem("Inappropriate", "11"));
                    DropDownListReportType.Items.Add(new ListItem("Hateful or racism", "12"));
                    DropDownListReportType.Items.Add(new ListItem("Abusive", "13"));
                    DropDownListReportType.Items.Add(new ListItem("Other", "19"));
                }
            }
        }
Example #35
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Requests");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login");
                }
            }

            //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)
            {

                string mode = "";
                Int64 itemId = 0;
                bool modeCheck = false;

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

                }
                finally
                {

                }

                if (mode == "event" || mode == "user")
                {
                    modeCheck = true;
                }

                if (!modeCheck || itemId == 0)
                {
                    Response.Redirect("~/Error/PageNotFound");
                }

                if (mode == "event")
                {
                    DropDownListReportType.Items.Add(new ListItem("Select a reason", "0"));
                    DropDownListReportType.Items.Add(new ListItem("Spam", "50"));
                    DropDownListReportType.Items.Add(new ListItem("Inappropriate", "51"));
                    DropDownListReportType.Items.Add(new ListItem("Hateful or racism", "52"));
                    DropDownListReportType.Items.Add(new ListItem("Abusive", "53"));
                    DropDownListReportType.Items.Add(new ListItem("Other", "59"));
                }
                else if (mode == "user")
                {
                    DropDownListReportType.Items.Add(new ListItem("Select a reason", "0"));
                    DropDownListReportType.Items.Add(new ListItem("Fake account", "10"));
                    DropDownListReportType.Items.Add(new ListItem("Inappropriate", "11"));
                    DropDownListReportType.Items.Add(new ListItem("Hateful or racism", "12"));
                    DropDownListReportType.Items.Add(new ListItem("Abusive", "13"));
                    DropDownListReportType.Items.Add(new ListItem("Other", "19"));
                }
            }
        }
Example #36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Requests");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Requests");
                }
            }

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

            
            Int64 eventId = 0;

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

            }
            finally
            {

            }

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

            int actionCode = 0;
            Int64 requestId = 0;

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

            }
            finally
            {

            }

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


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

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Requests");
            }
            else
            {
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Example #37
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            switch (HiddenFieldSearchType.Value)
            {
            case "1":     //username
            {
                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchUsername(TextBoxUsername.Text);

                if (dt.Rows.Count == 0)
                {
                    PanelUsername.Visible         = false;
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "0";
                }
                else
                {
                    RepeaterUsername.DataSource = dt;
                    RepeaterUsername.DataBind();

                    PanelUsername.Visible         = true;
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "1";
                }
                break;
            }

            case "2":     //hashtag
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchHashtag(TextBoxTag.Text, locationId);

                if (dt.Rows.Count == 0)
                {
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "0";
                }
                else
                {
                    RepeaterResult.DataSource = dt;
                    RepeaterResult.DataBind();

                    PanelUsername.Visible         = false;
                    PanelResult.Visible           = true;
                    HiddenFieldSearchStatus.Value = "1";
                }
                break;
            }

            case "3":     //type
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchType(Convert.ToInt32(HiddenFieldTypeId.Value), locationId);

                if (dt.Rows.Count == 0)
                {
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "0";
                }
                else
                {
                    RepeaterResult.DataSource = dt;
                    RepeaterResult.DataBind();

                    PanelUsername.Visible         = false;
                    PanelResult.Visible           = true;
                    HiddenFieldSearchStatus.Value = "1";
                }
                break;
            }
            }
        }
Example #38
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2)
            {
                Response.Redirect("~/Maintenance.html");
            }

            //reading cookies for loginint UserId = 0;
            if (Session["UserId"] != null)
            {
                Response.Redirect("~/Done/Welcome");
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    int UserId = ls.getUserId(VC);
                    if (UserId != 0) //user logged before
                    {
                        Response.Redirect("~/Done/Welcome");
                    }
                }
            }

            if (!Convert.ToBoolean(Application["RegisterAllowed"]))
            {
                LabelError.Text        = "Login is not allowed! Please try again later!";
                ButtonRegister.Enabled = false;
            }

            //check if visitor has been invited
            int inviteId = 0;

            try
            {
                inviteId = Convert.ToInt32(Page.RouteData.Values["InviteId"].ToString());

                // create the cookies
                HttpCookie _inviteIdCookies = new HttpCookie("inviteid");
                _inviteIdCookies["inviteid"] = Page.RouteData.Values["InviteId"].ToString();
                _inviteIdCookies.Expires     = DateTime.Now.AddHours(1);
                Response.Cookies.Add(_inviteIdCookies);
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            if (inviteId != 0)
            {
                HiddenFieldInvite.Value = inviteId.ToString();
                Classes.UserInfo            ui     = new Classes.UserInfo();
                Tuple <int, string, string> result = ui.getFirstNamePhotoUrlByUserId(inviteId);
                HiddenFieldInviteStatus.Value   = result.Item1.ToString();
                HiddenFieldInviteName.Value     = result.Item2;
                HiddenFieldInvitePhotoUrl.Value = result.Item3;
            }
        }
Example #39
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            switch (HiddenFieldSearchType.Value)
            {
                case "1": //username
                    {
                        Classes.Search s = new Classes.Search();
                        DataTable dt = s.searchUsername(TextBoxUsername.Text);

                        if (dt.Rows.Count == 0)
                        {
                            PanelUsername.Visible = false;
                            PanelResult.Visible = false;
                            HiddenFieldSearchStatus.Value = "0";
                        }
                        else
                        {
                            RepeaterUsername.DataSource = dt;
                            RepeaterUsername.DataBind();

                            PanelUsername.Visible = true;
                            PanelResult.Visible = false;
                            HiddenFieldSearchStatus.Value = "1";
                        }
                        break;
                    }
                case "2": //hashtag
                    {
                        Classes.UserInfo ui = new Classes.UserInfo();
                        int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                        Classes.Search s = new Classes.Search();
                        DataTable dt = s.searchHashtag(TextBoxTag.Text, locationId);

                        if (dt.Rows.Count == 0)
                        {
                            PanelResult.Visible = false;
                            HiddenFieldSearchStatus.Value = "0";
                        }
                        else
                        {
                            RepeaterResult.DataSource = dt;
                            RepeaterResult.DataBind();

                            PanelUsername.Visible = false;
                            PanelResult.Visible = true;
                            HiddenFieldSearchStatus.Value = "1";
                        }
                        break;
                    }
                case "3": //type
                    {
                        Classes.UserInfo ui = new Classes.UserInfo();
                        int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                        Classes.Search s = new Classes.Search();
                        DataTable dt = s.searchType(Convert.ToInt32(HiddenFieldTypeId.Value), locationId);

                        if (dt.Rows.Count == 0)
                        {
                            PanelResult.Visible = false;
                            HiddenFieldSearchStatus.Value = "0";
                        }
                        else
                        {
                            RepeaterResult.DataSource = dt;
                            RepeaterResult.DataBind();

                            PanelUsername.Visible = false;
                            PanelResult.Visible = true;
                            HiddenFieldSearchStatus.Value = "1";
                        }
                        break;
                    }
            }
        }
Example #40
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;
            }
        }
Example #41
0
        protected void getReviews()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            Tuple<int[], DataTable> result = ui.reviews(Convert.ToInt32(Page.RouteData.Values["Id"].ToString()));

            int[] rateCount = result.Item1;
            DataTable dt = result.Item2;

            if (dt.Rows.Count != 0)
            {
                LabelRateOne.Text = rateCount[0].ToString();
                LabelRateTwo.Text = rateCount[1].ToString();
                LabelRateThree.Text = rateCount[2].ToString();
                LabelRateFour.Text = rateCount[3].ToString();
                LabelRateFive.Text = rateCount[4].ToString();

                RepeaterReviews.DataSource = dt;
                RepeaterReviews.DataBind();
            }
            else
            {
                LabelReviewsNoRecord.Visible = true;
                LabelReviewsNoRecord.Text = "There is no review!";
            }
        }
Example #42
0
        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();
        }
Example #43
0
        protected void getFollowing()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            DataTable dt = ui.followingList(Convert.ToInt32(Session["UserId"]));

            if (dt.Rows.Count != 0)
            {
                RepeaterFollowing.DataSource = dt;
                RepeaterFollowing.DataBind();
            }
            else
            {
                LabelFollowingNoRecord.Visible = true;
                LabelFollowingNoRecord.Text = "There is no following!";
            }
        }
Example #44
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2)
            {
                Response.Redirect("~/Maintenance.html");
            }

            //check to see if the user logged in or is a guest
            bool userLogin = false;
            int  UserId    = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
                HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                userLogin = true;
            }
            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)
                    {
                        //guest
                    }
                    else
                    {
                        Session["UserId"]            = UserId.ToString();
                        HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                        userLogin = true;
                    }
                }
                else
                {
                    userLogin = false;
                }
            }

            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)
                {
                    HiddenFieldLoginStatus.Value = "0";
                }
                else
                {
                    Session["UserId"]            = UserId.ToString();
                    HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                }
            }

            if (userLogin)
            {
                //check user status
                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;
                }

                HiddenFieldLoginStatus.Value = "1";

                DataTable        dt;
                Classes.UserInfo ui2 = new Classes.UserInfo();
                dt = ui2.masterPageInfo(UserId);

                if (dt.Rows.Count == 0)// Profile doesn't exist OR user didn't logged in
                {
                    Response.Redirect("~/Error/NoProfileForSettings");
                }
                else
                {
                    LabelFullName.Text             = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
                    HyperLinkProfile.NavigateUrl   = "~/Profile/" + dt.Rows[0]["Username"].ToString();
                    HiddenFieldMessages.Value      = dt.Rows[0]["MessagesCount"].ToString();
                    HiddenFieldRequests.Value      = dt.Rows[0]["RequestsCount"].ToString();
                    HiddenFieldNotifications.Value = dt.Rows[0]["NotificationsCount"].ToString();
                    HiddenFieldUsername.Value      = dt.Rows[0]["Username"].ToString();
                    HiddenFieldUserId.Value        = Session["UserId"].ToString();

                    string photoUrl = "Images/NoPhoto.png";
                    if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                    {
                        photoUrl = "Files/ProfilesPhotos/" + UserId.ToString() + "-100.jpg";
                    }
                    HiddenFieldPhotoUrl.Value = photoUrl;
                }
            }
            else
            {
                HiddenFieldLoginStatus.Value = "0";
            }
        }
Example #45
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/Search");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Search");
                }
            }


            if (!IsPostBack)
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                LabelLocation.Text = ui.getUserLocationInfoByUserId(UserId);

                string keyword = "";

                try
                {
                    keyword = Page.RouteData.Values["Keyword"].ToString();
                }
                catch
                {

                }
                finally
                {
                   
                }

                if (keyword.Length > 0)
                {
                    int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    Classes.Search s = new Classes.Search();
                    DataTable dt = s.searchHashtag(keyword, locationId);
                    TextBoxTag.Text = keyword;
                    HiddenFieldSearchType.Value = "2";

                    if (dt.Rows.Count == 0)
                    {
                        PanelResult.Visible = false;
                        HiddenFieldSearchStatus.Value = "0";
                    }
                    else
                    {
                        RepeaterResult.DataSource = dt;
                        RepeaterResult.DataBind();

                        PanelUsername.Visible = false;
                        PanelResult.Visible = true;
                        HiddenFieldSearchStatus.Value = "1";
                    }
                }
            }
        }
Example #46
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/Review");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Review");
                }
            }

            //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.Reviews r = new Classes.Reviews();
                WebApplication1.Classes.Reviews.ReviewRequest myReviewRequest = r.reviewInfo(Convert.ToInt32(Session["UserId"]));

                //if (dt.Rows.Count == 0) //doesn't exist
                //{
                //    HiddenFieldStatus.Value = "0";
                //    HiddenFieldSmiley.Value = ":)";
                //    HiddenFieldMessage.Value = "You have no review request 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;
                //}
                //else //review request exists
                //{
                //    HiddenFieldReviewRequestId.Value = myReviewRequest.ReviewRequestId.ToString();
                //    //LabelEventName.Text = dt.Rows[0]["EventName"].ToString();
                //    //HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                //    //HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();
                //    //HyperLinkUser.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
                //    //HyperLinkUser.NavigateUrl = "~/Profile/" + dt.Rows[0]["UserId"].ToString();

                //    //// Show profile's photo
                //    //if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                //    //{
                //    //    HiddenFieldUserPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["UserId"].ToString() + "-100.jpg";
                //    //}
                //    //else
                //    //{
                //    //    HiddenFieldUserPhotoUrl.Value = "Images/nophoto.png";
                //    //}
                //}
            }
        }
Example #47
0
        protected void getFollowers()
        {
            Classes.UserInfo ui = new Classes.UserInfo();
            DataTable dt = ui.followersList(profileId);

            if (dt.Rows.Count != 0)
            {
                RepeaterFollowers.DataSource = dt;
                RepeaterFollowers.DataBind();
                HiddenFieldFollowersStatus.Value = "1";
            }
            else
            {
                HiddenFieldFollowersStatus.Value = "0";
            }
        }
Example #48
0
        protected void getDataLocation()
        {
            hidePanels();
            PanelLocation.Visible = true;

            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_settingsLocationGet", sqlConn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

            //try
            //{
                sda.Fill(ds);
                dt = ds.Tables[0];
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
                sqlConn.Close();
                sda.Dispose();
                sqlConn.Dispose();
            //}

            if (dt.Rows.Count == 0)// Profile doesn't exist
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                if (!IsPostBack)
                {
                    Classes.Locations l = new Classes.Locations();
                    DataTable dtCountries = l.countriesList();

                    List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                    DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                    for (int i = 0; i < dtCountries.Rows.Count; i++)
                    {
                        DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                    }

                    Classes.UserInfo ui = new Classes.UserInfo();
                    int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    if (locationId == 0)
                    {
                        DropDownListCountry.SelectedValue = "0";
                    }
                    else
                    {
                        string countryCode = l.locationInfoOnlyId(locationId);

                        locationCity(countryCode);
                        DropDownListCountry.SelectedValue = countryCode;
                        DropDownListCity.SelectedValue = locationId.ToString();
                    }

                    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();
                    }
                }

                if (dt.Rows[0]["LocationId"].ToString() == "0")
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());
                    DataTable dtLocation = new DataTable();
                    DataSet dsLocation = new DataSet();
                    SqlConnection sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlDataAdapter sdaLocation = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation);
                    sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId;

                    //try
                    //{
                        sdaLocation.Fill(dsLocation);
                        dtLocation = dsLocation.Tables[0];
                    //}
                    //catch (Exception ex)
                    //{

                    //}
                    //finally
                    //{
                        sqlConnLocation.Close();
                        sdaLocation.Dispose();
                        sqlConnLocation.Dispose();
                    //}

                    locationCity(dtLocation.Rows[0]["CountryCode"].ToString());
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString();
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }

            }
        }
Example #49
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            //check to see if the user logged in or is a guest
            bool userLogin = false;
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
                HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                userLogin = true;
            }
            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)
                    {
                        //guest
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                        HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                        userLogin = true;
                    }
                }
                else
                {
                    userLogin = false;
                }
            }

            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)
                {
                    HiddenFieldLoginStatus.Value = "0";
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                    HyperLinkProfile.NavigateUrl = "~/Profile/" + UserId.ToString();
                }
            }

            if (userLogin)
            {
                //check user status
                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;
                }

                HiddenFieldLoginStatus.Value = "1";

                DataTable dt;
                Classes.UserInfo ui2 = new Classes.UserInfo();
                dt = ui2.masterPageInfo(UserId);

                if (dt.Rows.Count == 0)// Profile doesn't exist OR user didn't logged in
                {
                    Response.Redirect("~/Error/NoProfileForSettings");
                }
                else
                {
                    LabelFullName.Text = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
                    HyperLinkProfile.NavigateUrl = "~/Profile/" + dt.Rows[0]["Username"].ToString();
                    HiddenFieldMessages.Value = dt.Rows[0]["MessagesCount"].ToString();
                    HiddenFieldRequests.Value = dt.Rows[0]["RequestsCount"].ToString();
                    HiddenFieldNotifications.Value = dt.Rows[0]["NotificationsCount"].ToString();
                    HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();
                    HiddenFieldUserId.Value = Session["UserId"].ToString();

                    string photoUrl = "Images/NoPhoto.png";
                    if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                    {
                        photoUrl = "Files/ProfilesPhotos/" + UserId.ToString() + "-100.jpg";
                    }
                    HiddenFieldPhotoUrl.Value = photoUrl;
                }
            }
            else
            {
                HiddenFieldLoginStatus.Value = "0";
            }
        }
Example #50
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0)
                    {
                        Response.Redirect("~/Login");
                    }
                }
            }

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

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

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

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

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

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

                    locationCountry();
                    DropDownListCountry.SelectedValue = countryCode;
                    locationCity(countryCode);
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
Example #51
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            //check login
            int UserId = 0;
            int userStatus = 0;
            Classes.UserInfo ui = new Classes.UserInfo();
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
                userStatus = ui.getUserStatus(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/Completion");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Completion");
                }
            }


            if (!IsPostBack)
            {
                //check if user entered these information before
                userStatus = ui.getUserStatus(UserId);
                if (userStatus != 0)
                {
                    if (userStatus != 4) Response.Redirect("~/Done/Welcome");
                }

                if (userStatus == 4)
                {
                    Tuple<string, string, string, string> result = ui.fbCompletion(UserId);

                    TextBoxFirstName.Text = result.Item1;
                    TextBoxLastName.Text = result.Item2;
                    HiddenFieldHasPhoto.Value = result.Item3;
                    DropDownListGender.SelectedValue = result.Item4;
                    if(Convert.ToBoolean(result.Item3))
                    {
                        HiddenFieldPhotoUrl.Value = "Files/Temp/" + UserId.ToString() + "-100.jpg";
                    }
                }

                DataTable dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                }
            }
        }
Example #52
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;
            }
        }
Example #53
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;
                }
            }
        }
Example #54
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/Settings");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Settings");
                }
            }

            //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)
            {
                // pre show a tab
                try
                {
                    switch (Page.RouteData.Values["Section"].ToString().ToLower())
                    {
                    case "information":
                        PanelInformation.Visible = true;
                        getDataInformation();
                        break;

                    case "photo":
                        PanelPhoto.Visible = true;
                        getDataPhoto();
                        break;

                    case "location":
                        PanelLocation.Visible = true;
                        getDataLocation();
                        break;

                    case "preferences":
                        PanelPreferences.Visible = true;
                        getDataPreferences();
                        break;

                    case "account":
                        PanelAccount.Visible = true;
                        getDataAccount();
                        break;

                    case "privacy":
                        PanelPrivacy.Visible = true;
                        getDataPrivacy();
                        break;

                    default:
                        break;
                    }
                }
                catch
                {
                }
                finally
                {
                }
            }
        }
Example #55
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/Settings");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Settings");
                }
            }

            //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)
            {
                // pre show a tab
                try
                {
                    switch (Page.RouteData.Values["Section"].ToString().ToLower())
                    {
                        case "information":
                            PanelInformation.Visible = true;
                            getDataInformation();
                            break;
                        case "photo":
                            PanelPhoto.Visible = true;
                            getDataPhoto();
                            break;
                        case "location":
                            PanelLocation.Visible = true;
                            getDataLocation();
                            break;
                        case "preferences":
                            PanelPreferences.Visible = true;
                            getDataPreferences();
                            break;
                        case "account":
                            PanelAccount.Visible = true;
                            getDataAccount();
                            break;
                        case "privacy":
                            PanelPrivacy.Visible = true;
                            getDataPrivacy();
                            break;
                        default:
                            break;
                    }
                }
                catch
                {

                }
                finally
                {

                }
            }
        }
Example #56
0
        protected void getDataLocation()
        {
            hidePanels();
            PanelLocation.Visible = true;

            DataTable      dt      = new DataTable();
            DataSet        ds      = new DataSet();
            SqlConnection  sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlDataAdapter sda     = new SqlDataAdapter("sp_settingsLocationGet", sqlConn);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

            //try
            //{
            sda.Fill(ds);
            dt = ds.Tables[0];
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            sqlConn.Close();
            sda.Dispose();
            sqlConn.Dispose();
            //}

            if (dt.Rows.Count == 0)// Profile doesn't exist
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                if (!IsPostBack)
                {
                    Classes.Locations l           = new Classes.Locations();
                    DataTable         dtCountries = l.countriesList();

                    List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                    DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                    for (int i = 0; i < dtCountries.Rows.Count; i++)
                    {
                        DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                    }

                    Classes.UserInfo ui = new Classes.UserInfo();
                    int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    if (locationId == 0)
                    {
                        DropDownListCountry.SelectedValue = "0";
                    }
                    else
                    {
                        string countryCode = l.locationInfoOnlyId(locationId);

                        locationCity(countryCode);
                        DropDownListCountry.SelectedValue = countryCode;
                        DropDownListCity.SelectedValue    = locationId.ToString();
                    }

                    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();
                    }
                }

                if (dt.Rows[0]["LocationId"].ToString() == "0")
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int            cityId          = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());
                    DataTable      dtLocation      = new DataTable();
                    DataSet        dsLocation      = new DataSet();
                    SqlConnection  sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlDataAdapter sdaLocation     = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation);
                    sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId;

                    //try
                    //{
                    sdaLocation.Fill(dsLocation);
                    dtLocation = dsLocation.Tables[0];
                    //}
                    //catch (Exception ex)
                    //{

                    //}
                    //finally
                    //{
                    sqlConnLocation.Close();
                    sdaLocation.Dispose();
                    sqlConnLocation.Dispose();
                    //}

                    locationCity(dtLocation.Rows[0]["CountryCode"].ToString());
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString();
                    DropDownListCity.SelectedValue    = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
Example #57
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            int userId = Convert.ToInt32(Session["UserId"]);
            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            int status = 0;
            switch (HiddenFieldMode.Value.ToLower())
              {
                    case "firstname":
                        status = ups.firstName(userId, TextBoxFirstName.Text);
                        break;
                    case "lastname":
                        status = ups.lastName(userId, TextBoxLastName.Text);
                        break;
                    case "username":
                        //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful
                        status = ups.username(userId, TextBoxUsername.Text);
                        HiddenFieldStatus.Value = status.ToString();
                        if (status != 1)
                        {
                            Classes.UserInfo ui = new Classes.UserInfo();
                            TextBoxUsername.Text = ui.getUsernameByUserId(userId);
                        }
                        break;
                    case "gender":
                        status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue));
                        break;
                    case "dob":
                        status = ups.birthDate(userId, HiddenFieldDOB.Value);
                        break;
                    case "about":
                        status = ups.about(userId, TextBoxAbout.Text);
                        break;
                    case "photo":
                        bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value);
                        status = ups.hasPhoto(userId, hasPhoto);
                        break;
                    case "cover":
                        status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value));
                        break;
                    case "location":
                        status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value));

                        Classes.Locations l = new Classes.Locations();
                        DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue));
                        if (dtLocation.Rows.Count == 0)
                        {
                            LabelLocation.Text = "Not Available!";
                        }
                        else
                        {
                            LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                        }
                        break;
                    case "notifications":
                        bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value);
                        status = ups.notifications(userId, getNotifications);
                        break;
                    case "mobile":
                        status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text));
                        break;

               }
        }
Example #58
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            int userId = Convert.ToInt32(Session["UserId"]);

            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            int status = 0;

            switch (HiddenFieldMode.Value.ToLower())
            {
            case "firstname":
                status = ups.firstName(userId, TextBoxFirstName.Text);
                break;

            case "lastname":
                status = ups.lastName(userId, TextBoxLastName.Text);
                break;

            case "username":
                //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful
                status = ups.username(userId, TextBoxUsername.Text);
                HiddenFieldStatus.Value = status.ToString();
                if (status != 1)
                {
                    Classes.UserInfo ui = new Classes.UserInfo();
                    TextBoxUsername.Text = ui.getUsernameByUserId(userId);
                }
                break;

            case "gender":
                status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue));
                break;

            case "dob":
                status = ups.birthDate(userId, HiddenFieldDOB.Value);
                break;

            case "about":
                status = ups.about(userId, TextBoxAbout.Text);
                break;

            case "photo":
                bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value);
                status = ups.hasPhoto(userId, hasPhoto);
                break;

            case "cover":
                status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value));
                break;

            case "location":
                status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value));

                Classes.Locations l          = new Classes.Locations();
                DataTable         dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue));
                if (dtLocation.Rows.Count == 0)
                {
                    LabelLocation.Text = "Not Available!";
                }
                else
                {
                    LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                }
                break;

            case "notifications":
                bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value);
                status = ups.notifications(userId, getNotifications);
                break;

            case "mobile":
                status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text));
                break;
            }
        }
Example #59
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/Messages");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Messages");
                }
            }

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

            //all read
            Classes.Messages m = new Classes.Messages();
            m.allRead(UserId);

            //get message lists
            DataTable dt = m.messageLists(UserId);
            if (dt.Rows.Count == 0)
            {
                HiddenFieldStatus.Value = "0";
            }
            else
            {
                RepeaterMessages.DataSource = dt;
                RepeaterMessages.DataBind();
                HiddenFieldStatus.Value = "1";
            }
        }
Example #60
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/Search");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Search");
                }
            }


            if (!IsPostBack)
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                LabelLocation.Text = ui.getUserLocationInfoByUserId(UserId);

                string keyword = "";

                try
                {
                    keyword = Page.RouteData.Values["Keyword"].ToString();
                }
                catch
                {
                }
                finally
                {
                }

                if (keyword.Length > 0)
                {
                    int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    Classes.Search s  = new Classes.Search();
                    DataTable      dt = s.searchHashtag(keyword, locationId);
                    TextBoxTag.Text             = keyword;
                    HiddenFieldSearchType.Value = "2";

                    if (dt.Rows.Count == 0)
                    {
                        PanelResult.Visible           = false;
                        HiddenFieldSearchStatus.Value = "0";
                    }
                    else
                    {
                        RepeaterResult.DataSource = dt;
                        RepeaterResult.DataBind();

                        PanelUsername.Visible         = false;
                        PanelResult.Visible           = true;
                        HiddenFieldSearchStatus.Value = "1";
                    }
                }
            }
        }