示例#1
0
        private void FillUserPreferences()
        {
            sSQL = "select username,full_name,authentication_type,email,security_question,security_answer from users where user_id = '" + ui.GetSessionUserID() + "'";

            DataRow dr = null;

            if (!dc.sqlGetDataRow(ref dr, sSQL, ref sErr))
            {
                ui.RaiseError(Page, sErr, true, "");
            }
            else
            {
                if (dr != null)
                {
                    lblName.Text               = (object.ReferenceEquals(dr["full_name"], DBNull.Value) ? "" : dr["full_name"].ToString());
                    lblUserName.Text           = (object.ReferenceEquals(dr["username"], DBNull.Value) ? "" : dr["username"].ToString());
                    lblAuthenticationType.Text = (object.ReferenceEquals(dr["authentication_type"], DBNull.Value) ? "" : dr["authentication_type"].ToString());
                    txtEmail.Text              = (object.ReferenceEquals(dr["email"], DBNull.Value) ? "" : dr["email"].ToString());
                    hidEmail.Value             = txtEmail.Text;
                    txtSecurityQuestion.Text   = (object.ReferenceEquals(dr["security_question"], DBNull.Value) ? "" : dc.DeCrypt(dr["security_question"].ToString()));
                    string sSecurityAnswer = (object.ReferenceEquals(dr["security_answer"], DBNull.Value) ? "" : dc.DeCrypt(dr["security_answer"].ToString()));
                    if (sSecurityAnswer.Length > 0)
                    {
                        txtSecurityAnswer.Attributes.Add("value", sSecurityAnswer);
                        hidSecurityAnswer.Value = sSecurityAnswer;
                    }
                    ;

                    // we know the user has a password, or they would not be on the screen
                    string sPasswordFiller = "($%#d@x!&";
                    txtPassword.Attributes.Add("value", sPasswordFiller);
                    txtPasswordConfirm.Attributes.Add("value", sPasswordFiller);

                    if (lblAuthenticationType.Text == "ldap")
                    {
                        pnlLocalSettings.Visible = false;
                    }
                }
            }
        }