예제 #1
0
    protected void UpdateSettings()
    {
        Affinity.Account me = this.GetAccount();

        me.FirstName = txtFirstName.Text;
        me.LastName  = txtLastName.Text;
        me.Email     = txtEmail.Text;

        me.PreferencesXml = XmlForm.XmlToString(xmlForm.GetResponse(pnlPreferences));
        me.Update();

        if (txtPassword.Text != "")
        {
            // password change is being attempted
            if (txtPassword.Text == txtPasswordConfirm.Text)
            {
                me.Password = txtPassword.Text;
                me.SetPassword();
                this.Master.ShowFeedback("Your preferences have been updated and your password has been changed", MasterPage.FeedbackType.Information);
            }
            else
            {
                // password fields don't match
                this.Master.ShowFeedback("The password confirmation did not match.  Your password was not updated", MasterPage.FeedbackType.Error);
            }
        }
        else
        {
            // password was not changed
            this.Master.ShowFeedback("Your preferences have been updated", MasterPage.FeedbackType.Information);
        }

        me.ClearPreferenceCache();    // force preferences to be reloaded
        this.SetAccount(me);          // refresh the session
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RequirePermission(Affinity.RolePermission.SubmitOrders);
        this.Master.SetLayout("My Preferences", MasterPage.LayoutStyle.ContentOnly);
        System.Web.UI.HtmlControls.HtmlForm frm = (System.Web.UI.HtmlControls.HtmlForm) this.Master.FindControl("form1");
        frm.Enctype = "multipart/form-data";

        if (!Page.IsPostBack)
        {
            // populate the form
            Affinity.Account me = this.GetAccount();
            txtUsername.Text  = me.Username.ToString();
            txtFirstName.Text = me.FirstName.ToString();
            txtLastName.Text  = me.LastName.ToString();
            //txtPasswordHint.Text = me.PasswordHint.ToString();
            txtEmail.Text = me.Email.ToString();

            if (me.Signature.Equals(""))
            {
                signature.Visible = false;
            }
            else
            {
                signature.Src = "signatures/" + me.Signature;
            }

            if (!me.Role.Code.Equals("Bank") && !me.Role.Code.Equals("Lender"))
            {
                Response.Write("<script>onload = function(){document.getElementById('group_lenders').style.display = 'none';}</script>");
            }
        }
        else
        {
            if (oFile.HasFile)
            {
                string strFileName = "";
                string strFilePath = "";
                string strFolder;
                strFolder = Server.MapPath(".") + "\\signatures\\";

                // Get the name of the file that is posted.

                strFileName = System.IO.Path.GetFileName(oFile.PostedFile.FileName);
                string[] s   = strFileName.Split('.');
                string   ext = "";

                if (s.Length > 1)
                {
                    ext = "." + s[1];
                }

                string filename = DateTime.Now.Ticks.ToString() + ext;

                strFilePath = strFolder + filename;


                Affinity.Account acc = this.GetAccount();
                acc.Signature = filename;
                acc.Update();


                oFile.PostedFile.SaveAs(strFilePath);
            }
        }
    }