Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            if (!IsPostBack)
            {
                if (Session["UserId"] != null)
                {
                    Response.Redirect("~/Done/Welcome");
                }
                //reading cookies for login
                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["LoginAllowed"]))
                {
                    LabelError.Text = "Login is not allowed! Please try again later!";
                    ButtonLogin.Enabled = false;
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //reading cookies for login
                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("~/Explore");
                    }
                }

                //check if login is allowed in the system
                Classes.SiteSettings ss = new Classes.SiteSettings();
                bool loginAllowed = Convert.ToBoolean(ss.getSettings("LoginAllow"));
                if (!loginAllowed) // not allowed
                {
                    LabelError.Text = "Login is not allowed! Please try again later!";
                    ButtonLogin.Enabled = false;
                }
            }
        }
Exemplo n.º 4
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();
                }
            }

        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string mode = "";

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

            }
            finally
            {

            }

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



            switch (mode)
            {
                case "welcome":
                    Classes.Done done = new Classes.Done();
                    Classes.Done.DoneObject result = done.getDone("welcome", 0, 0);
                    var context = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
                    context.Clients.All.setDone("hi!");
            break;
            }
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 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/Feed");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Feed");
            }

            try
            {
                string mode = Page.RouteData.Values["Mode"].ToString().ToLower();

                switch (mode)
                {
                    case "city":
                        Page.Title = "Feed - City";
                        feedCity();
                        break;
                    case "map":
                        Page.Title = "Feed - Map";
                        feedMap();
                        break;
                    case "following":
                        Page.Title = "Feed - Following";
                        feedFollowing();
                        break;
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }
        }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            int UserId = 0;
            if (Session["UserId"] != null)
            {
                Response.Redirect("~/Done/Welcome");
            }
            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("~/Done/Welcome");
                }
            }

            if (!IsPostBack)
            {
                switch (Page.RouteData.Values["Mode"].ToString())
                {
                    case "Request":
                        {
                            PanelRequest.Visible = true;
                            break;
                        }
                    case "Recover":
                        {
                            Classes.ForgotPassword fp = new Classes.ForgotPassword();
                            string email = fp.recoverEmailGet(Page.RouteData.Values["VCode"].ToString());

                            if (email == "")
                            {
                                Response.Redirect("~/Error/PRequestNotFound");
                            }
                            else
                            {
                                LabelRecoverEmail.Text = email;
                                PanelRecover.Visible = true;
                            }
                            break;
                        }
                }
            }
        }
Exemplo n.º 10
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();
                    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;
            }
        }
Exemplo n.º 11
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/Messages");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Messages");
            }

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

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

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

            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();
            
            RepeaterMessages.DataSource = dtMessages;
            RepeaterMessages.DataBind();
        }
Exemplo n.º 12
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()));
                }
            }
        }
Exemplo n.º 13
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/Explore");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Explore");
            }

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

                int status = result.Item1;
                DataTable dt = result.Item2;

                if (status == 1 && dt.Rows.Count != 0)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text = "EventId: " + dt.Rows[0]["EventId"].ToString() + " EventName:" + dt.Rows[0]["Name"].ToString();
                }
                else
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text = "Unfortunatly there is no event to show now, try later!";
                }
            }
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

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

            Classes.Reviews r = new Classes.Reviews();
            DataTable dt = r.reviewRequestInfo(Convert.ToInt32(Session["UserId"]), Convert.ToInt32(Page.RouteData.Values["ReviewRequestId"]));

            if (dt.Rows.Count == 0) //doesn't exist
            {
                Response.Redirect("~/Error/NotFound");
            }
            else //review request exists
            {
                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/" + Page.RouteData.Values["Id"] + "-220.jpg";
                }
                else
                {
                    HiddenFieldUserPhotoUrl.Value = "Images/nophoto.png";
                }
            }
        }
Exemplo n.º 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/Notifications");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Notifications");
            }

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

            //get botifications
            DataTable dt = n.notifications(UserId);
            
            if (dt.Rows.Count == 0)
            {
                //LabelNoRecord.Visible = true;
            }
            else
            {
                RepeaterNotifications.DataSource = dt;
                RepeaterNotifications.DataBind();
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            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)
                {
                    Response.Redirect("~/Home");
                }
            }

            switch (Page.RouteData.Values["Mode"].ToString())
            {
                case "Request":
                    {
                        PanelRequest.Visible = true;
                        break;
                    }
                case "Recover":
                    {
                        Classes.ForgotPassword fp = new Classes.ForgotPassword();
                        string email = fp.recoverEmailGet(Page.RouteData.Values["VCode"].ToString());

                        if(email == "")
                        {
                            Response.Redirect("~/Error/PRequestNotFound");
                        }
                        else
                        {
                            LabelRecoverEmail.Text = email;
                            PanelRecover.Visible = true;
                        }
                        break;
                    }
            }
        }
Exemplo n.º 17
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");
            }
        }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Invite");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Invite");
            }
        }
Exemplo n.º 19
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/Following");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Following");
                }
            }

            //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 = "Following";
            //feedFollowing();
        }
Exemplo n.º 20
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();
            }
        }
Exemplo n.º 21
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";
                    }
                }
            }
        }
Exemplo n.º 22
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;
            }
        }
Exemplo n.º 23
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();
                }
            }
        }
Exemplo n.º 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/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();
            }
        }
Exemplo n.º 25
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();
        }
Exemplo n.º 26
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");
            }
        }
Exemplo n.º 27
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();
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/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"));
                }
            }
        }
Exemplo n.º 29
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");
            }

            //check premissions
            Classes.Admins a = new Classes.Admins();
            if (!a.permissions(UserId, "Home"))
            {
                Response.Redirect("~/Error/404");
            }


            try
            {
                if (Page.RouteData.Values["Page"].ToString().Length > 0)
                {
                    string pathToUserControl = "~/AdminPages/" + Page.RouteData.Values["Page"].ToString() + ".ascx";
                    var    ucSrc             = LoadControl(pathToUserControl);
                    PanelPage.Controls.Add(ucSrc);

                    switch (Page.RouteData.Values["Page"].ToString().ToLower())
                    {
                    case "admins":
                    {
                        Page.Title = "Admin - Admins";
                        break;
                    }

                    case "blog":
                    {
                        Page.Title = "Admin - Blog";
                        break;
                    }

                    case "content":
                    {
                        Page.Title = "Admin - Content";
                        break;
                    }

                    case "events":
                    {
                        Page.Title = "Admin - Events";
                        break;
                    }

                    case "locations":
                    {
                        Page.Title = "Admin - Locations";
                        break;
                    }

                    case "newsletter":
                    {
                        Page.Title = "Admin - Newsletters";
                        break;
                    }

                    case "settings":
                    {
                        Page.Title = "Admin - Settings";
                        break;
                    }

                    case "statistics":
                    {
                        Page.Title = "Admin - Statistics";
                        break;
                    }

                    case "support":
                    {
                        Page.Title = "Admin - Support";
                        break;
                    }

                    case "users":
                    {
                        Page.Title = "Admin - Users";
                        break;
                    }

                    case "feedback":
                    {
                        Page.Title = "Admin - Feedback";
                        break;
                    }
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

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

            int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant
            int OwnerId       = -1;

            if (UserId == 0)
            {
                buttonsStatus = 0;
            }

            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventInfo(eventId, UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString());
                    if (eventStatus == 4)// event is banned
                    {
                        Response.Redirect("~/Error/EventNotFound");
                    }

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

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

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

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

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

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

                    case "2":
                        LabelStatus.Text = "Full";
                        break;

                    case "3":
                        LabelStatus.Text = "Passed";
                        break;
                    }

                    if (UserId != 0)
                    {
                        //check to see if the user logged in or is a guest
                        if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                        {
                            HyperLinkModify.Visible     = true;
                            HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString();
                            buttonsStatus = 1;
                        }

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

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

                        HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
                    }
                }

                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(eventId);

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

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

                /////////////////////////////////////////////board messages
                bool status = ev.allowBoard(UserId, eventId);

                if (status)
                {
                    getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
                    HiddenFieldBoardStatus.Value = "1";
                }
                else
                {
                    HiddenFieldBoardStatus.Value = "0";
                }
            }
            else
            {
                Page.Title = LabelName.Text;
            }

            if (UserId != 0)
            {
                if (UserId.ToString() == OwnerId.ToString())
                {
                    buttonsStatus = 1;
                }
                else
                {
                    Classes.Requests r = new Classes.Requests();
                    int requestStatus  = r.checkRequest(UserId, eventId);

                    if (requestStatus == 0)
                    {
                        buttonsStatus = 2;
                    }
                    else if (requestStatus == 1)
                    {
                        buttonsStatus = 3;
                    }
                    else if (requestStatus == 2)
                    {
                        buttonsStatus = 4;
                    }
                }
            }

            HiddenFieldRequestStatus.Value = buttonsStatus.ToString();
            HiddenFieldButtonStatus.Value  = buttonsStatus.ToString();
        }
Exemplo n.º 31
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();
        }
Exemplo n.º 32
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (TextBoxUsername.Text.Length == 0 || TextBoxPassword.Text.Length == 0) //blank information
            {
                LabelError.Visible = true;
                LabelError.Text    = "Please enter the username and password!";
            }
            else
            {
                string username = TextBoxUsername.Text;
                Regex  regex    = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
                Match  match    = regex.Match(username);
                int    mode     = 0;
                bool   isValid  = false;

                if (match.Success) //user entered email
                {
                    mode    = 1;
                    isValid = true;
                }
                else //user entered phone number
                {
                    Regex strPattern = new Regex("[0-9]*[_]*");

                    if (!strPattern.IsMatch(username))
                    {
                        mode    = 2;
                        isValid = true;
                    }
                }

                if (isValid)
                {
                    Classes.LoginSession ls = new Classes.LoginSession();
                    int userId = ls.login(mode, username, TextBoxPassword.Text);

                    if (userId == 0) // user information was not valid
                    {
                        LabelError.Visible = true;
                        LabelError.Text    = "You username and/or password is not valid!";
                    }
                    else if (userId == -1)
                    {
                        LabelError.Visible = true;
                        LabelError.Text    = "Access to user's panel is not allowed!";
                    }
                    else // user information was valid
                    {
                        Session["UserId"] = userId.ToString();

                        int    Hours;
                        string VerificationCode = Convert.ToString(Guid.NewGuid());

                        if (CheckBoxRemember.Checked) // user want the system to remember him/her
                        {
                            Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursLong"].ToString());
                        }
                        else
                        {
                            Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursShort"].ToString());
                        }

                        // set login information
                        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 user
                        try
                        {
                            if (Page.RouteData.Values["ItemId"].ToString() != "") // redirect user to a page with item id
                            {
                                Response.Redirect("~/" + Page.RouteData.Values["Page"].ToString() + "/" + Page.RouteData.Values["ItemId"].ToString());
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                        finally
                        {
                        }
                        try
                        {
                            if (Page.RouteData.Values["Page"].ToString() != "") // redirect user to a page
                            {
                                Response.Redirect("~/" + Page.RouteData.Values["Page"].ToString());
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                        finally
                        {
                        }
                        // redirect the user to his/her panel
                        Response.Redirect("~/Done/Welcome");
                    }
                }
                else
                {
                    LabelError.Visible = true;
                    LabelError.Text    = "Wrong information!";
                }
            }
        }
Exemplo n.º 33
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (TextBoxUsername.Text.Length == 0 || TextBoxPassword.Text.Length == 0) //blank information
            {
                LabelError.Visible = true;
                LabelError.Text = "Please enter the username and password!";
            }
            else
            {
                string username = TextBoxUsername.Text;
                Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
                Match match = regex.Match(username);
                int mode = 0;
                bool isValid = false;

                if (match.Success) //user entered email
                {
                    mode = 1;
                    isValid = true;
                }
                else //user entered phone number
                {
                    Regex strPattern = new Regex("[0-9]*[_]*");

                    if (!strPattern.IsMatch(username))
                    {
                        mode = 2;
                        isValid = true;
                    }
                }

                if (isValid)
                {
                    Classes.LoginSession ls = new Classes.LoginSession();
                    int userId = ls.login(mode, username, TextBoxPassword.Text);

                    if (userId == 0) // user information was not valid
                    {
                        LabelError.Visible = true;
                        LabelError.Text = "You username and/or password is not valid!";
                    }
                    else if (userId == -1)
                    {
                        LabelError.Visible = true;
                        LabelError.Text = "Access to user's panel is not allowed!";
                    }
                    else // user information was valid
                    {
                        Session["UserId"] = userId.ToString();

                        int Hours;
                        string VerificationCode = Convert.ToString(Guid.NewGuid());

                        if (CheckBoxRemember.Checked) // user want the system to remember him/her
                        {
                            Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursLong"].ToString());
                        }
                        else
                        {
                            Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursShort"].ToString());
                        }

                        // set login information
                        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 user
                        try
                        {
                            if (Page.RouteData.Values["ItemId"].ToString() != "") // redirect user to a page with item id
                            {
                                Response.Redirect("~/" + Page.RouteData.Values["Page"].ToString() + "/" + Page.RouteData.Values["ItemId"].ToString());
                            }
                        }
                        catch (Exception ex)
                        {

                        }
                        finally
                        {

                        }
                        try
                        {
                            if (Page.RouteData.Values["Page"].ToString() != "") // redirect user to a page
                            {
                                Response.Redirect("~/" + Page.RouteData.Values["Page"].ToString());
                            }
                        }
                        catch (Exception ex)
                        {

                        }
                        finally
                        {

                        }
                        // redirect the user to his/her panel
                        Response.Redirect("~/Explore");
                    }
                }
                else
                {
                    LabelError.Visible = true;
                    LabelError.Text = "Wrong information!";
                }
            }
        }
Exemplo n.º 34
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();
        }
Exemplo n.º 35
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/Settings");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Settings");
            }

            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
                {
                }
            }
        }
Exemplo n.º 36
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()));
                }
            }
        }
Exemplo n.º 37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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


            DataTable dt;
            string mode = "created";

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

            }
            finally
            {

            }

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

            if (dt.Rows.Count > 0)
            {
                RepeaterEvents.DataSource = dt;
                RepeaterEvents.DataBind();
            }
            else
            {
                LabelNoRecord.Visible = true;
            }
        }
Exemplo n.º 38
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();
        }
Exemplo n.º 39
0
        private void CheckAuthorization()
        {
            string app_id = "880736035338936";
            string app_secret = "720dfa778da7953acf9c19b68eafa064";
            string scope = "public_profile,email,user_friends";

            if (Request["code"] == null)
            {
                Response.Redirect(string.Format(
                    "https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}",
                    app_id, Request.Url.AbsoluteUri, scope));
            }
            else
            {
                Dictionary<string, string> tokens = new Dictionary<string, string>();

                string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}",
                    app_id, Request.Url.AbsoluteUri, scope, Request["code"].ToString(), app_secret);

                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;

                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    string vals = reader.ReadToEnd();

                    foreach (string token in vals.Split('&'))
                    {
                        //meh.aspx?token1=steve&token2=jake&...
                        tokens.Add(token.Substring(0, token.IndexOf("=")),
                            token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }

                string access_token = tokens["access_token"];

                var client = new FacebookClient(access_token);
                string result = client.Get("me", new { fields = "id,email,first_name,last_name,gender" }).ToString();
                string friends = client.Get("me", new { fields = "friends" }).ToString();

                JObject json = JObject.Parse(result);
                JObject jsonFriends = JObject.Parse(friends);

            string id="";
            string name = "";

            

                Int16 gender = 0;

                if (json.GetValue("gender").ToString() == "male") gender = 1;
                else if (json.GetValue("gender").ToString() == "female") gender = 2;

                int inviteId = 0;

                if (Request.Cookies["inviteid"] != null)
                {
                    string myid = Request.Cookies["inviteid"].Values["inviteid"];
                    inviteId = Convert.ToInt32(myid);
                }

                DataTable dt = new DataTable();
                DataSet ds = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                SqlDataAdapter sda = new SqlDataAdapter("sp_loginByFacebook", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@Email", SqlDbType.VarChar).Value = json.GetValue("email").ToString();
                sda.SelectCommand.Parameters.Add("@FbId", SqlDbType.VarChar).Value = json.GetValue("id").ToString();
                sda.SelectCommand.Parameters.Add("@FbAccessToken", SqlDbType.VarChar).Value = access_token;
                sda.SelectCommand.Parameters.Add("@FirstName", SqlDbType.NVarChar).Value = json.GetValue("first_name").ToString();
                sda.SelectCommand.Parameters.Add("@LastName", SqlDbType.NVarChar).Value = json.GetValue("last_name").ToString();
                sda.SelectCommand.Parameters.Add("@Gender", SqlDbType.TinyInt).Value = gender;
                sda.SelectCommand.Parameters.Add("@HasPhoto", SqlDbType.Bit).Value = false;
                sda.SelectCommand.Parameters.Add("@InviteId", SqlDbType.Int).Value = inviteId;

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

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

                int userId = 0;
                int status = 0;

                if (dt.Rows.Count != 0)
                {
                    userId = Convert.ToInt32(dt.Rows[0]["UserId"].ToString());
                    status = Convert.ToInt32(dt.Rows[0]["Status"].ToString());
                }
                else
                {
                    Response.Redirect("~/Login");
                }

                if (status == 4)
                {
                    //fb friends

                    foreach (var i in jsonFriends["friends"]["data"].Children())
                    {
                        SqlConnection sqlConn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                        SqlCommand sqlCmd2 = new SqlCommand("sp_fbFriends", sqlConn2);
                        sqlCmd2.CommandType = CommandType.StoredProcedure;
                        sqlCmd2.Parameters.Add("@FbId", SqlDbType.VarChar).Value = i["id"].ToString().Replace("\"", "");
                        sqlCmd2.Parameters.Add("@UserId", SqlDbType.Int).Value = userId;

                        //try
                        //{
                            sqlConn2.Open();
                            sqlCmd2.ExecuteNonQuery();
                        //}
                        //catch
                        //{

                        //}
                        //finally
                        //{
                            sqlConn2.Close();
                            sqlConn2.Dispose();
                            sqlCmd2.Dispose();
                        //}
                    }

                    

                    //picture
                    WebClient webClient = new WebClient();
                    webClient.DownloadFile("https://graph.facebook.com/" + json.GetValue("id").ToString() + "/picture?type=large",
                        Server.MapPath(@"~\Files\Temp\" + userId.ToString() + "-100.jpg"));

                    Bitmap img = new Bitmap(Server.MapPath(@"~\Files\Temp\" + userId.ToString() + "-100.jpg"));
                    int imageHeight = Convert.ToInt32(img.Height);
                    img.Dispose();

                    if (imageHeight == 126)
                    {
                        File.Delete(Server.MapPath(@"~\Files\Temp\" + userId.ToString() + "-100.jpg"));
                    }
                    else
                    {
                        SqlConnection sqlConn3 = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                        SqlCommand sqlCmd = new SqlCommand("sp_settingsPhotoEdit", sqlConn3);
                        sqlCmd.CommandType = CommandType.StoredProcedure;
                        sqlCmd.Parameters.Add("@UserId", SqlDbType.Int).Value = userId;
                        sqlCmd.Parameters.Add("@HasPhoto", SqlDbType.Bit).Value = true;

                        //try
                        //{
                            sqlConn3.Open();
                            sqlCmd.ExecuteNonQuery();
                        //}
                        //catch (Exception ex)
                        //{

                        //}
                        //finally
                        //{
                            sqlConn3.Close();
                            sqlCmd.Dispose();
                            sqlConn3.Dispose();
                        //}
                    }
                }


                Session["UserId"] = userId.ToString();
                Session.Remove("InviteId");

                int Hours = Convert.ToInt32(ConfigurationManager.AppSettings["LoginHoursLong"].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);

                if(status == 4)
                {
                    Response.Redirect("~/Completion");
                }
                else
                {
                    Response.Redirect("~/Done/Welcome");
                }
                
            }


        }
Exemplo n.º 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/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
                {

                }
            }
        }
Exemplo n.º 41
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/Requests");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Requests");
            }

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

            }
            finally
            {

            }

            if (requestId != 0)
                {
                    // accept
                    
                
                    if (actionCode == 1)
                    {
                        Classes.Requests r = new Classes.Requests();
                        int status = r.requestAccept(Convert.ToInt32(Session["UserId"]), requestId);
                        
                        if (status == 1)
                        {
                            //successful
                        }
                        else if (status == -1)
                        {
                            //unsuccessful
                        }
                    }
                    // reject
                    else if (actionCode == 2)
                    {
                        Classes.Requests r = new Classes.Requests();
                        r.requestReject(requestId);
                    }

                    Response.Redirect("~/Requests");
                }

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

            DataTable dt = re.requestsList(UserId);

            if (dt.Rows.Count == 0)
            {
                LabelNoRecord.Visible = true;
            }
            else
            {
                LabelNoRecord.Visible = false;
                RepeaterRequests.DataSource = dt;
                RepeaterRequests.DataBind();
            }
        }
Exemplo n.º 42
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";
            }
        }
Exemplo n.º 43
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

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