示例#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;
                    }
                }
            }
        }