Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.userID = Request.QueryString.Get("id");

            if (!IsPostBack)
            {
                if (Session["User"] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                else if (((UserData)Session["User"]).isAdmin() == 0)
                {
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    Title = "twoGAMES: Edit User";

                    UserService.UserCRUDClient userService = new UserService.UserCRUDClient();
                    userService.Open();
                    Object[] userDetails = userService.getUserDetailsManagement(Convert.ToInt32(userID));
                    userService.Close();

                    txtFirstName.Value = (string)userDetails[3];
                    txtLastName.Value  = (string)userDetails[4];

                    txtEmail.Value      = (string)userDetails[5];
                    txtCellNumber.Value = (string)userDetails[6];

                    txtDoB.Value     = (string)userDetails[7];
                    txtRegDate.Value = (string)userDetails[8];

                    txtUsername.Value = (string)userDetails[1];

                    if (Convert.ToBoolean(userDetails[9]))
                    {
                        radioMod.Checked = true;
                    }
                    else if (Convert.ToBoolean(userDetails[10]))
                    {
                        radioAdmin.Checked = true;
                    }
                    else if (Convert.ToBoolean(userDetails[11]))
                    {
                        radioPrem.Checked = true;
                    }
                    else
                    {
                        radioFree.Checked = true;
                    }

                    if (Convert.ToBoolean(userDetails[12]))
                    {
                        flaggedSwitch.Checked = true;
                    }
                }
            }
        }
        protected void flagged_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient userCRUDService = new UserService.UserCRUDClient();
            userCRUDService.Open();
            Object[][] users = userCRUDService.getFlaggedUsersManagement();
            userCRUDService.Close();

            UserManageView.InnerHtml = createUserManageView(users, "There are no flagged users.", "Flagged Users");
        }
        protected void stats_ServerClick(object sender, EventArgs e)
        {
            //UserManageView.InnerHtml = "<span class='card-title'>Feature coming soon...</span>";
            //UserManageView.InnerHtml = "<img src=\"MakeUserRegChart.cshtml\" />";

            //UserManageView.InnerHtml = "<asp:Chart ID=\"chtNBAChampionships\" runat=\"server\">";
            //UserManageView.InnerHtml += "<Series>";
            //UserManageView.InnerHtml += "<asp:Series Name=\"Championships\" YValueType=\"Int32\" ChartType=\"Column\" ChartArea=\"MainChartArea\">";
            //UserManageView.InnerHtml += "<Points>";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"Celtics\" YValues=\"17\"/>";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"Lakers\" YValues=\"15\" />";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"Bulls\" YValues=\"6\" />";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"Spurs\" YValues=\"4\" />";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"76ers\" YValues=\"3\" />";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"Pistons\" YValues=\"3\" />";
            //UserManageView.InnerHtml += "<asp:DataPoint AxisLabel=\"Warriors\" YValues=\"3\" />";
            //UserManageView.InnerHtml += "</Points>";
            //UserManageView.InnerHtml += "</asp:Series>";
            //UserManageView.InnerHtml += "</Series>";
            //UserManageView.InnerHtml += "<ChartAreas>";
            //UserManageView.InnerHtml += "<asp:ChartArea Name=\"MainChartArea\">";
            //UserManageView.InnerHtml += "</asp:ChartArea>";
            //UserManageView.InnerHtml += "</ChartAreas>";
            //UserManageView.InnerHtml += "</asp:Chart>";

            UserService.UserCRUDClient userCRUDService = new UserService.UserCRUDClient();
            userCRUDService.Open();
            DateTime todayIs            = DateTime.Today;
            int      newUsersThisYear   = userCRUDService.numNewUsersYearManagement(todayIs);
            int      newUsersThisMonth  = userCRUDService.numNewUsersMonthManagement(todayIs);
            int      newUsersThisWeek   = userCRUDService.numNewUsersWeekManagement(todayIs);
            int      newUsersToday      = userCRUDService.numNewUsersDayManagement(todayIs);
            int      reportedusersTotal = userCRUDService.numReportedUsersManagement();
            int      flaggedUsersTotal  = userCRUDService.numFlaggedUsersManagement();
            int      premUsersTotal     = userCRUDService.numPremUsersManagement();

            userCRUDService.Close();

            string statsView = "<span class='card-title'>Stats</span>";

            statsView += "<div class='row'>";
            statsView += "<p>New Users This <b>Year:</b> " + newUsersThisYear.ToString() + "</p>";
            statsView += "<p>New Users This <b>Month:</b> " + newUsersThisMonth.ToString() + "</p>";
            statsView += "<p>New Users This <b>Week:</b> " + newUsersThisWeek.ToString() + "</p>";
            statsView += "<p>New Users <b>Today:</b> " + newUsersToday.ToString() + "</p>";
            statsView += "<br/>";
            statsView += "<p>Number of <b>Premium Users:</b> " + premUsersTotal.ToString() + "</p>";
            statsView += "<p>Number of <b>Reported Users:</b> " + reportedusersTotal.ToString() + "</p>";
            statsView += "<p>Number of <b>Flagged Users:</b> " + flaggedUsersTotal.ToString() + "</p>";
            statsView += "</div>";

            UserManageView.InnerHtml = statsView;
        }
Exemple #4
0
        protected void btnDeleteAcc_Click(object sender, EventArgs e)
        {
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            int result = service.deleteUser(((UserData)Session["User"]).getUsername());

            service.Close();
            if (result == 1)//if the result is one then the user is deleted and redirected to the index page
            {
                Session["User"] = null;
                //Response.Write("<script>alert('User Account Deleted!');</script>");
                Response.Redirect("Index.aspx");
            }
        }
Exemple #5
0
        protected void btnUpdateAccount_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            int result = service.updateUserInfo(((UserData)Session["User"]).getID(), txtFirstName.Value, txtLastName.Value, txtCellNumber.Value, Convert.ToDateTime(txtDoB.Value));

            service.Close();
            if (result == 1)//if the result is one then the user is deleted and redirected to the index page
            {
                Session["User"] = null;

                myProfileView.InnerHtml  = "<div class='col s12 m6 push-m3'>";
                myProfileView.InnerHtml += "<div class='card white'>";
                myProfileView.InnerHtml += "<div class='card-content Black-text'>";
                myProfileView.InnerHtml += "<span class='card-title bold'>Account Updated Successfully</span>";
                myProfileView.InnerHtml += "<p>Your account has been updated successfully.<br/><br/>Please proceeed to log back into your account to view the changes.</p>";

                myProfileView.InnerHtml += "</div>";
                myProfileView.InnerHtml += "<div class='card-action'> ";
                myProfileView.InnerHtml += "<a href='Login.aspx' class='btn waves-effect waves-light'>Continue</a> ";
                myProfileView.InnerHtml += "<a href='Index.aspx' class='btn waves-effect waves-light orange lighten-2'>Cancel</a> ";
                myProfileView.InnerHtml += "</div>";
                myProfileView.InnerHtml += "</div>";
                myProfileView.InnerHtml += "</div>";

                //Response.Redirect("Index.aspx");
            }
            else
            {
                Session["User"] = null;

                myProfileView.InnerHtml  = "<div class='col s12 m6 push-m3'>";
                myProfileView.InnerHtml += "<div class='card white'>";
                myProfileView.InnerHtml += "<div class='card-content Black-text'>";
                myProfileView.InnerHtml += "<span class='card-title bold'>Oh No...An Error Occured</span>";
                myProfileView.InnerHtml += "<p>Unfortunately we were unable to update your account.<br/><br/>As a precaution, please log back into your account where you may try again.</p>";

                myProfileView.InnerHtml += "</div>";
                myProfileView.InnerHtml += "<div class='card-action'> ";
                myProfileView.InnerHtml += "<a href='Login.aspx' class='btn waves-effect waves-light'>Continue</a> ";
                myProfileView.InnerHtml += "<a href='Index.aspx' class='btn waves-effect waves-light orange lighten-2'>Cancel</a> ";
                myProfileView.InnerHtml += "</div>";
                myProfileView.InnerHtml += "</div>";
                myProfileView.InnerHtml += "</div>";
            }
        }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] != null)
     {
         Title         = "twoGAMES: Contact Us";
         txtName.Value = ((UserData)Session["User"]).getFirstName() + " " + ((UserData)Session["User"]).getSurname();
         UserService.UserCRUDClient userCRUDServ = new UserService.UserCRUDClient();
         userCRUDServ.Open();
         txtEmail.Value = userCRUDServ.getUserEmail(((UserData)Session["User"]).getID());
         userCRUDServ.Close();
         txtSubject.Focus();
     }
     else
     {
         txtName.Focus();
     }
 }
Exemple #7
0
        protected void btnReportUser_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient userService = new UserService.UserCRUDClient();
            userService.Open();
            int reportUserResult = userService.reportUser(Convert.ToInt32((string)this.adDetails[13]));

            userService.Close();

            if (reportUserResult == 1)
            {
                detailedAdActionResutView.InnerHtml  = "<div class='col s12 m6 l4 push-l4 push-m3'>";
                detailedAdActionResutView.InnerHtml += "<div class='card'>";
                detailedAdActionResutView.InnerHtml += "<div class='card-content black-text'>";
                detailedAdActionResutView.InnerHtml += "<span class='card-title bold'>User Reported Successfully</span>";
                detailedAdActionResutView.InnerHtml += "<p>You have successfully reported this user. Our proficient team of Moderators and Administrators will review the user's account and ads, and will then decide their fate.<br/><br/>We personally thank you for making twoGames even better!</p><br/>";
                detailedAdActionResutView.InnerHtml += "<div class='card-action'>";
                detailedAdActionResutView.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Continue</a>";
                if (Session["User"] != null)
                {
                    if (((UserData)Session["User"]).isAdmin() == 1)
                    {
                        detailedAdActionResutView.InnerHtml += " <a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a>";
                    }
                }
                detailedAdActionResutView.InnerHtml += "</div></div></div></div>";
            }
            else
            {
                detailedAdActionResutView.InnerHtml  = "<div class='col s12 m6 l4 push-l4 push-m3'>";
                detailedAdActionResutView.InnerHtml += "<div class='card'>";
                detailedAdActionResutView.InnerHtml += "<div class='card-content black-text'>";
                detailedAdActionResutView.InnerHtml += "<span class='card-title bold'>User Reported Unsuccessfully</span>";
                detailedAdActionResutView.InnerHtml += "<p>An error occured trying to report this user. You can go back and try again.</p><br/>";
                detailedAdActionResutView.InnerHtml += "<div class='card-action'>";
                detailedAdActionResutView.InnerHtml += "<a href='DetailedAd.aspx?" + (string)adDetails[0] + "' runat='server' class='btn waves-effect waves-light'>Go Back</a>";
                if (Session["User"] != null)
                {
                    if (((UserData)Session["User"]).isAdmin() == 1)
                    {
                        detailedAdActionResutView.InnerHtml += " <a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a>";
                    }
                }
                detailedAdActionResutView.InnerHtml += "</div></div></div></div>";
            }
        }
Exemple #8
0
        protected void LoginUser_ServerClick(object sender, EventArgs e)
        {
            btnLogin.Disabled    = true;
            loginSpinner.Visible = true;
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            Object[] ds = service.Authenticate(user_name.Value, Security.HashPassword(password.Value));
            //invalidLogin.InnerHtml = "<p>" +  Security.HashPassword(password.Value) +"</p>";
            UserData user = null;

            if (!(ds == null))
            {
                int ds5 = 0;
                int ds6 = 0;
                int ds7 = 0;

                if (Convert.ToBoolean(ds[5]))
                {
                    ds5 = 1;
                }
                if (Convert.ToBoolean(ds[6]))
                {
                    ds6 = 1;
                }
                if (Convert.ToBoolean(ds[7]))
                {
                    ds7 = 1;
                }

                user            = new UserData(Convert.ToInt32((String)ds[0]), user_name.Value, (String)ds[1], (String)ds[2], (string)ds[3], Convert.ToDateTime((string)ds[4]), ds5, ds6, ds7);
                Session["User"] = user;
                Response.Redirect("Index.aspx");
            }
            else
            {
                invalidLogin.InnerHtml = "<p>Invalid username or password. Please try again.</p>";
                btnLogin.Disabled      = false;
                loginSpinner.Visible   = false;
            }
            service.Close();
        }
Exemple #9
0
        protected void btnDeleteUser_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            int result = service.deleteUser(this.userID);

            service.Close();
            if (result == 1)//if the result is one then the user is deleted
            {
                userCard.InnerHtml  = "<div class='col s12 m6 push-m3'>";
                userCard.InnerHtml += "<div class='card white'>";
                userCard.InnerHtml += "<div class='card-content Black-text'>";
                userCard.InnerHtml += "<span class='card-title bold'>User Deleted Successfully</span>";
                userCard.InnerHtml += "<p>You have successfully deleted the user with ID = " + this.userID + ".</p>";

                userCard.InnerHtml += "</div>";
                userCard.InnerHtml += "<div class='card-action'>";
                userCard.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a>";
                userCard.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Done</a>";
                userCard.InnerHtml += "</div>";
                userCard.InnerHtml += "</div>";
                userCard.InnerHtml += "</div>";
            }
            else
            {
                userCard.InnerHtml  = "<div class='col s12 m6 push-m3'>";
                userCard.InnerHtml += "<div class='card white'>";
                userCard.InnerHtml += "<div class='card-content Black-text'>";
                userCard.InnerHtml += "<span class='card-title bold'>User Deleted Unsuccessfully</span>";
                userCard.InnerHtml += "<p>We where unable to delete the user with ID = " + this.userID + ". Please try again and if the problem persists please contact us <a href='ContactUs.aspx'>here</a>.</p>";

                userCard.InnerHtml += "</div>";
                userCard.InnerHtml += "<div class='card-action'>";
                userCard.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a> ";
                userCard.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Done</a>";
                userCard.InnerHtml += "</div>";
                userCard.InnerHtml += "</div>";
                userCard.InnerHtml += "</div>";
            }
        }
Exemple #10
0
        protected void btnActivatePrem_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            Object[] ds = service.Authenticate(txtEmail.Value, Security.HashPassword(txtUserPass.Value));
            service.Close();
            service = null;

            if (!(ds == null))
            {
                //if (txtEmail.Value.Equals(txtConfirmEmail.Value))
                //{
                UserService.UserCRUDClient UserCRUDService = new UserService.UserCRUDClient();
                UserCRUDService.Open();
                int result = 0;
                result = UserCRUDService.updateUserPremAccess(((UserData)Session["User"]).getID(), Security.HashPassword(txtUserPass.Value), txtEmail.Value, ((UserData)Session["User"]).getCellNumber(), ((UserData)Session["User"]).getDoB(), 1);
                UserCRUDService.Close();
                if (result == 1)
                {
                    Session["User"] = null;
                    changeCard();
                }
                else
                {
                    invalidPremActivation.InnerHtml = "<p>An error occured<br/>Please make sure you enter the correct account information for verification purposes</p>";
                }

                /*}
                 * else
                 * {
                 *  invalidPremActivation.InnerHtml = "<p>Please make sure you confirm your email address</p>";
                 * }*/
            }
            else
            {
                invalidPremActivation.InnerHtml = "<p>Invalid account details<br/>Please make sure you enter your current email address and password</p>";
            }
        }
Exemple #11
0
        protected void btnVerifyDelete_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            UserData user = (UserData)Session["User"];

            Object[] ds = service.Authenticate(user.getUsername(), Security.HashPassword(txtPassword.Value));

            if (!(ds == null))
            {
                int deleteResult = service.deleteUser(this.userID);
                if (deleteResult == 1)
                {
                    //deleteUserView.InnerHtml += "<div class='col s12 m6 l4 push-l4 push-m3'>";
                    //deleteUserView.InnerHtml += "<div class='card white'>";
                    //deleteUserView.InnerHtml += "<div class='card-content black-text'>";
                    deleteUserView.InnerHtml  = "<span class='card-title bold'>User Deleted Successfully</span>";
                    deleteUserView.InnerHtml += "<p>You have successfully deleted the user \"" + this.userName + "\" with ID " + userID + ".</p><br/>";
                    deleteUserView.InnerHtml += "<div class='card-action'>";
                    deleteUserView.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light'>Manage Users</a>";
                    deleteUserView.InnerHtml += "</div>";
                }
                else
                {
                    deleteUserView.InnerHtml  = "<span class='card-title bold'>User Deleted Unsuccessfully</span>";
                    deleteUserView.InnerHtml += "<p>An error occured trying to delete user \"" + this.userName + "\" with ID " + userID + "</p><br/>";
                    deleteUserView.InnerHtml += "<div class='card-action'>";
                    deleteUserView.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light'>Manage Useres</a>";
                    deleteUserView.InnerHtml += "</div>";
                }
                service.Close();
            }
            else
            {
                invalidVerify.InnerHtml = "<p>Invalid password. Please try again.</p>";
            }
        }
Exemple #12
0
        protected void btnUpdateEmail_ServerClick(object sender, EventArgs e)
        {
            UserService.UserCRUDClient service = new UserService.UserCRUDClient();
            service.Open();
            Object[] ds = service.Authenticate(txtOldEmail.Value, Security.HashPassword(txtUserPass.Value));
            service.Close();
            service = null;

            if (!(ds == null))
            {
                if (txtNewEmail.Value.Equals(txtNewEmailConfirm.Value))
                {
                    UserService.UserCRUDClient UserCRUDService = new UserService.UserCRUDClient();
                    UserCRUDService.Open();
                    int result = 0;
                    result = UserCRUDService.updateUserEmail(((UserData)Session["User"]).getID(), Security.HashPassword(txtUserPass.Value), txtOldEmail.Value, txtNewEmailConfirm.Value);
                    UserCRUDService.Close();
                    if (result == 1)
                    {
                        Session["User"] = null;
                        changeCard();
                    }
                    else
                    {
                        invalidEmailUpdate.InnerHtml = "<p>An error occured<br/>Please make sure you enter your correct current email address and password</p>";
                    }
                }
                else
                {
                    invalidEmailUpdate.InnerHtml = "<p>Please make sure you confirm your new email address</p>";
                }
            }
            else
            {
                invalidEmailUpdate.InnerHtml = "<p>Invalid account details<br/>Please make sure you enter your current email address and password</p>";
            }
        }
        protected void RegisterUser_ServerClick(object sender, EventArgs e)
        {
            String innerHTML = "<p>";

            //invalidRegister.InnerHtml = "";//"<p class="black-text">Processing the information you provided...</p>";

            Boolean blnRegister = true;

            //DateTime dttToday = DateTime.Today;

            if ((txtFirstName.Value.Equals("")) || (txtLastName.Value.Equals("")) || (txtEmail.Value.Equals("")) || (txtConfirmEmail.Value.Equals("")) || (txtDoB.Value.Equals("")) || (txtCellNumber.Value.Equals("")) || (txtUsername.Value.Equals("")) || (txtPassword.Value.Equals("")) || (txtConfirmPassword.Value.Equals("")))
            {
                blnRegister = false;
                //Show fields empty error message
                innerHTML += "*Please make sure you have filled in all the fields<br/>";
            }
            else
            {
                if (!(txtEmail.Value.Contains("@")))
                {
                    blnRegister = false;
                    //Show email is not valid
                    innerHTML += "*Your email is not valid<br/>";
                }

                if (!(txtConfirmEmail.Value.Equals(txtEmail.Value)))
                {
                    blnRegister = false;
                    //Show email not match error message
                    innerHTML += "*Your emails do not match<br/>";
                }
                if (!((DateTime.Today.Year - Convert.ToDateTime(txtDoB.Value).Year) >= 16))
                {
                    blnRegister = false;
                    //Show date of birth error message
                    innerHTML += "*You need to be at least 16 years old to use twoGames<br/>If you are too young then ask your parents for some help<br/>";
                }

                try
                {
                    int intNumTest = Convert.ToInt32(txtCellNumber.Value);
                }
                catch (Exception)
                {
                    blnRegister = false;
                    //Show cell number error message
                    innerHTML += "*Please provide a correct cell number<br/>";
                }
                if (!(txtPassword.Value.Length >= 8))
                {
                    blnRegister = false;
                    //Show Password is short
                    innerHTML += "*Your Password is too short. <br/> It has to be more than 8 characters<br/>";
                }
                if (!(txtConfirmPassword.Value.Equals(txtPassword.Value)))
                {
                    blnRegister = false;
                    //Show password not match error
                    innerHTML += "*Your passwords do not match<br/>";
                }
            }

            innerHTML += "</p>";

            if (blnRegister)
            {
                UserService.UserCRUDClient service = new UserService.UserCRUDClient();
                service.Open();
                service.insertUser(txtUsername.Value, Security.HashPassword(txtPassword.Value), txtFirstName.Value, txtLastName.Value, txtEmail.Value, txtCellNumber.Value, Convert.ToDateTime(txtDoB.Value), DateTime.Today, 0, 0, 0);
                service.Close();
                changePage();
            }
            else
            {
                invalidRegister.InnerHtml = innerHTML;
            }
        }
Exemple #14
0
        protected void btnUpdateUser_ServerClick(object sender, EventArgs e)
        {
            if (!txtUsername.Equals("") && !txtFirstName.Value.Equals("") && !txtLastName.Value.Equals("") && !txtEmail.Equals("") && !txtCellNumber.Equals("") && !txtDoB.Equals("") && !txtRegDate.Equals(""))
            {
                if ((DateTime.Today.Year - Convert.ToDateTime(txtDoB.Value).Year) >= 16)
                {
                    int premChecked    = 0;
                    int modChecked     = 0;
                    int adminChecked   = 0;
                    int flaggedChecked = 0;
                    if (radioPrem.Checked)
                    {
                        premChecked = 1;
                    }
                    if (radioMod.Checked)
                    {
                        modChecked = 1;
                    }
                    if (radioAdmin.Checked)
                    {
                        adminChecked = 1;
                    }
                    if (flaggedSwitch.Checked)
                    {
                        flaggedChecked = 1;
                    }

                    UserService.UserCRUDClient userService = new UserService.UserCRUDClient();
                    userService.Open();
                    int updateResult = userService.updateUserDetailsManagement(Convert.ToInt32(this.userID), txtUsername.Value, txtFirstName.Value, txtLastName.Value, txtEmail.Value, txtCellNumber.Value, Convert.ToDateTime(txtDoB.Value), Convert.ToDateTime(txtRegDate.Value), modChecked, adminChecked, premChecked, flaggedChecked, 0);
                    userService.Close();

                    if (updateResult == 1)
                    {
                        userCard.InnerHtml  = "<div class='col s12 m6 push-m3'>";
                        userCard.InnerHtml += "<div class='card white'>";
                        userCard.InnerHtml += "<div class='card-content Black-text'>";
                        userCard.InnerHtml += "<span class='card-title bold'>User Updated Successfully</span>";
                        userCard.InnerHtml += "<p>You have successfully updated the user with ID = " + this.userID + ".</p>";

                        userCard.InnerHtml += "</div>";
                        userCard.InnerHtml += "<div class='card-action'>";
                        userCard.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a> ";
                        userCard.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Done</a>";
                        userCard.InnerHtml += "</div>";
                        userCard.InnerHtml += "</div>";
                        userCard.InnerHtml += "</div>";
                    }
                    else
                    {
                        userCard.InnerHtml  = "<div class='col s12 m6 push-m3'>";
                        userCard.InnerHtml += "<div class='card white'>";
                        userCard.InnerHtml += "<div class='card-content Black-text'>";
                        userCard.InnerHtml += "<span class='card-title bold'>User Updated Unsuccessfully</span>";
                        userCard.InnerHtml += "<p>We where unable to update the user with ID = " + this.userID + ". Please try again and if the problem persists please contact us <a href='ContactUs.aspx'>here</a>.</p>";

                        userCard.InnerHtml += "</div>";
                        userCard.InnerHtml += "<div class='card-action'>";
                        userCard.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a>";
                        userCard.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Done</a>";
                        userCard.InnerHtml += "</div>";
                        userCard.InnerHtml += "</div>";
                        userCard.InnerHtml += "</div>";
                    }
                }
                else
                {
                    invalidUserUpdate.InnerHtml = "*Invalid Date of Birth. Needs to be at least 16 years old.";
                }
            }
            else
            {
                invalidUserUpdate.InnerHtml = "*Please make sure all fields are filled in.";
            }
        }
Exemple #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string adID     = Request.QueryString.Get("ad");
            bool   isnumber = int.TryParse(adID, out adnum);

            if (isnumber)
            {
                AdService.AdCRUDClient adService = new AdService.AdCRUDClient();
                adService.Open();
                this.adDetails = adService.getAdDetails(adID);
                adService.incViewCount(Convert.ToInt32(adID));
                adService.Close();
                if (this.adDetails != null)
                {
                    //--------------TITLE
                    lblGameTitle.InnerHtml = (string)adDetails[1];
                    Title = "twoGAMES: " + (string)adDetails[1];

                    //--------------PRICE
                    lblGamePrice.InnerHtml = "Price: R" + (string)adDetails[6];

                    //--------------NEGOTIABLE
                    if (Convert.ToBoolean(adDetails[7]))
                    {
                        lblGamePrice.InnerHtml += " Negotiable";
                    }

                    //--------------USERNAME + PREMIUM ICON
                    UserService.UserCRUDClient userService = new UserService.UserCRUDClient();
                    userService.Open();
                    string  username    = userService.getUsername(Convert.ToInt32((string)adDetails[13]));
                    Boolean premiumUser = Convert.ToBoolean(userService.isUserPrem(Convert.ToInt32((string)adDetails[13])));
                    userService.Close();

                    editButtonSpan.InnerHtml = "Posted By: " + username;
                    if (premiumUser)
                    {
                        editButtonSpan.InnerHtml += " <i class='material-icons tooltipped' data-position='right' data-tooltip='Premium Member'>star</i>";
                    }

                    //--------------ADMIN MOD BUTTONS
                    //editButtonSpan.InnerHtml = "";
                    if (Session["User"] != null)
                    {
                        if (((UserData)Session["User"]).isAdmin() == 1 || ((UserData)Session["User"]).isMod() == 1)
                        {
                            btnReportAd.Visible = false;
                            if (Convert.ToBoolean((string)adDetails[14]))
                            {
                                btnUnflagAdAdminMod.Visible = true;
                            }
                            else
                            {
                                btnFlagAdAdminMod.Visible = true;
                            }
                            editButtonSpan.InnerHtml += " <a class='btn right waves-effect waves-light orange lighten-2' href='EditAdPage.aspx?ad=" + Request.QueryString.Get("ad") + "'>Edit</a> ";
                        }
                    }

                    //--------------IMAGES
                    if (!((string)adDetails[9]).Equals("NOPIC"))
                    {
                        imgPic1.Src = "data:image/jpeg;base64," + (string)adDetails[9];
                    }
                    else
                    {
                        imgPic1.Visible = false;
                    }
                    if (!((string)adDetails[10]).Equals("NOPIC"))
                    {
                        imgPic2.Src = "data:image/jpeg;base64," + (string)adDetails[10];
                    }
                    else
                    {
                        imgPic2.Visible = false;
                    }
                    if (!((string)adDetails[11]).Equals("NOPIC"))
                    {
                        imgPic3.Src = "data:image/jpeg;base64," + (string)adDetails[11];
                    }
                    else
                    {
                        imgPic3.Visible = false;
                    }

                    //--------------PLATFORM
                    lblGamePlatform.InnerHtml = "Platform: " + (string)adDetails[2];

                    //--------------DESCRIPTION
                    txtGameDescription.Value = (string)adDetails[4];

                    //--------------LOCATION
                    txtGameLocation.Value = (string)adDetails[5];
                    String mapString = (string)adDetails[5];
                    mapString = mapString.Replace(" ", "+");
                    adMap.Src = "https://www.google.com/maps/embed/v1/place?key=AIzaSyB7eq5IZFtbXZitO0yI53upIROFqC5RBcY&q=" + mapString;

                    //--------------YOUTUBE SOURCE
                    adYoutubeFrame.Src = "https://www.youtube.com/embed?listType=search&list=" + (string)adDetails[1] + " ign review?theme=light&color=white";

                    //--------------CELL NUMBER
                    if (Convert.ToBoolean(adDetails[8]))
                    {
                        txtCellNumber.Value = (string)adDetails[16];
                    }
                    else
                    {
                        sellerCellNumberDiv.InnerHtml = "";
                    }
                }
            }
            else
            {
                Response.Redirect("Index.aspx");
            }
        }