Example #1
0
        public int verifyEmail(int userId)
        {
            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            int status = ups.verifyEmailSend(userId);

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

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

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

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

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

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

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

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

                }
                finally
                {
                    
                }

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

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

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

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

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

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

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

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

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

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

                // redirect the user
                Response.Redirect("~/Completion");
            }
        }
Example #4
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            //validate

            //save
            int status;
            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            status = ups.completion(
                Convert.ToInt32(Session["UserId"]),
                TextBoxUsername.Text,
                TextBoxFirstName.Text,
                TextBoxLastName.Text,
                Convert.ToInt16(DropDownListGender.SelectedValue),
                Convert.ToInt32(DropDownListCity.SelectedValue),
                HiddenFieldDOB.Value);

            if (status == 1)
            {
                Response.Redirect("~/Introduction");
            }
    }
Example #5
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            //validate

            //save
            int status;

            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            status = ups.completion(
                Convert.ToInt32(Session["UserId"]),
                TextBoxUsername.Text,
                TextBoxFirstName.Text,
                TextBoxLastName.Text,
                Convert.ToInt16(DropDownListGender.SelectedValue),
                Convert.ToInt32(DropDownListCity.SelectedValue),
                HiddenFieldDOB.Value);

            if (status == 1)
            {
                Response.Redirect("~/Introduction");
            }
        }
Example #6
0
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            string email = TextBoxEmail.Text;
            string password1 = TextBoxPassword1.Text;
            string password2 = TextBoxPassword2.Text;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            case "mobile":
                status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text));
                break;
            }
        }
Example #10
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            Int16 locationStatus = Convert.ToInt16(HiddenFieldLocationStatus.Value);
            int   locationId     = 0;
            int   userId         = Convert.ToInt32(Session["UserId"]);

            if (locationStatus == 1)
            {
                locationId = Convert.ToInt32(HiddenFieldLocationId.Value);
            }
            else
            {
                locationId = 0;

                Classes.Locations l = new Classes.Locations();
                int status2         = l.request(userId,
                                                TextBoxRequestLocationCountry.Text,
                                                TextBoxRequestLocationCity.Text);
            }

            //save photo
            photoUpload();

            //validate

            //save
            int status;

            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            status = ups.completion(
                userId,
                TextBoxUsername.Text,
                TextBoxFirstName.Text,
                TextBoxLastName.Text,
                Convert.ToInt16(DropDownListGender.SelectedValue),
                locationId,
                HiddenFieldDOB.Value,
                Convert.ToBoolean(HiddenFieldHasPhoto.Value));

            if (status == 1)
            {
                DataTable      dt      = new DataTable();
                DataSet        ds      = new DataSet();
                SqlConnection  sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                SqlDataAdapter sda     = new SqlDataAdapter("sp_fbFriendsList", sqlConn);

                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = userId;

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

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

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SqlConnection sqlConn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlCommand    sqlCmd2  = new SqlCommand("sp_fbFriendsApply", sqlConn2);
                    sqlCmd2.CommandType = CommandType.StoredProcedure;
                    sqlCmd2.Parameters.Add("@FbId", SqlDbType.VarChar).Value = dt.Rows[i]["FriendFbId"].ToString();
                    sqlCmd2.Parameters.Add("@UserId", SqlDbType.Int).Value   = userId;

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

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



                Response.Redirect("~/Introduction");
            }
            else if (status == -1)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text    = "Username is not available, please select another one!";
            }
            else if (status == -2)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text    = "Username must has at least 1 letter!";
            }
            else if (status == -3)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text    = "Username must not contains special characters!";
            }
        }
Example #11
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            Int16 locationStatus = Convert.ToInt16(HiddenFieldLocationStatus.Value);
            int locationId = 0;
            int userId = Convert.ToInt32(Session["UserId"]);

            if (locationStatus == 1)
            {
                locationId = Convert.ToInt32(HiddenFieldLocationId.Value);
            }
            else
            {
                locationId = 0;

                Classes.Locations l = new Classes.Locations();
                int status2 = l.request(userId,
                    TextBoxRequestLocationCountry.Text,
                    TextBoxRequestLocationCity.Text);
            }

            //save photo
            photoUpload();

            //validate

            //save
            int status;
            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            status = ups.completion(
                userId,
                TextBoxUsername.Text,
                TextBoxFirstName.Text,
                TextBoxLastName.Text,
                Convert.ToInt16(DropDownListGender.SelectedValue),
                locationId,
                HiddenFieldDOB.Value,
                Convert.ToBoolean(HiddenFieldHasPhoto.Value));

            if (status == 1)
            {

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

                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = userId;

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

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

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SqlConnection sqlConn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlCommand sqlCmd2 = new SqlCommand("sp_fbFriendsApply", sqlConn2);
                    sqlCmd2.CommandType = CommandType.StoredProcedure;
                    sqlCmd2.Parameters.Add("@FbId", SqlDbType.VarChar).Value = dt.Rows[i]["FriendFbId"].ToString();
                    sqlCmd2.Parameters.Add("@UserId", SqlDbType.Int).Value = userId;

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

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



                Response.Redirect("~/Introduction");
            }
            else if (status == -1)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text = "Username is not available, please select another one!";
            }
            else if (status == -2)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text = "Username must has at least 1 letter!";
            }
            else if (status == -3)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text = "Username must not contains special characters!";
            }
    }