예제 #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 UpdateSettings()
    {
        Affinity.SystemSetting ss = new Affinity.SystemSetting(this.phreezer);
        ss.Load(Affinity.SystemSetting.DefaultCode);

        ss.Data = XmlForm.XmlToString(xmlForm.GetResponse(pnlForm));
        ss.Update();

        // we have to update the application global as well because otherwise it won't
        // reflect the changes until the web application is restarted
        Application[Affinity.SystemSetting.DefaultCode] = ss.Settings;

        this.Master.ShowFeedback("System Settings have been updated", MasterPage.FeedbackType.Information);
    }
예제 #3
0
    /// <summary>
    /// Persist to DB and send email notification
    /// </summary>
    /// <returns>result of email notification</returns>
    protected string UpdateRequest()
    {
        // see if the status was changed from it's previous value
        // note we are getting the full description here vs the code
        string oldStatus  = this.request.RequestStatus.Description;
        string newStatus  = ddStatus.SelectedItem.Text;
        bool   filePosted = fuAttachment.HasFile;

        this.request.StatusCode = ddStatus.SelectedValue;          // here we need the code, tho
        this.request.Note       = txtNote.Text;

        // update the details
        XmlForm xf = new XmlForm(this.request.Account);

        this.request.Xml = XmlForm.XmlToString(xf.GetResponse(pnlDetails));

        this.request.Update();
        this.request.Order.SyncStatus();

        // if a file was provided, then upload it
        if (filePosted)
        {
            string ext              = System.IO.Path.GetExtension(fuAttachment.FileName);
            string fileName         = "req_att_" + request.Id + "_" + DateTime.Now.ToString("yyyyMMddhhss") + "." + ext.Replace(".", "");
            Affinity.Attachment att = new Affinity.Attachment(this.phreezer);
            att.RequestId   = this.request.Id;
            att.Name        = txtAttachmentName.Text != "" ? txtAttachmentName.Text : ddFilePurpose.SelectedItem.Text;
            att.PurposeCode = ddFilePurpose.SelectedValue;
            att.Filepath    = fileName;
            att.MimeType    = ext;
            att.SizeKb      = 0;        // fuAttachment.FileBytes.GetUpperBound() * 1024;

            att.Insert();
            if (ddFilePurpose.SelectedValue.Equals("SearchPkg"))
            {
                Affinity.Schedule sched = new Affinity.Schedule(this.phreezer);
                sched.AttachmentID        = att.Id;
                sched.AccountID           = this.request.Account.Id;
                sched.UploadAccountID     = this.GetAccount().Id;
                sched.OrderID             = this.request.OrderId;
                sched.RequestID           = this.request.Id;
                sched.Search_package_date = DateTime.Now;

                sched.Insert();
                Affinity.Global.SetSchedule();
            }
            //TODO: block any harmful file types

            Affinity.UploadLog ul = new Affinity.UploadLog(this.phreezer);

            ul.AttachmentID    = att.Id;
            ul.AccountID       = this.request.Account.Id;
            ul.UploadAccountID = this.GetAccount().Id;
            ul.OrderID         = this.request.OrderId;
            ul.RequestID       = this.request.Id;

            ul.Insert();

            fuAttachment.SaveAs(Server.MapPath("./") + "attachments/" + fileName);

            txtEmailNote.Text = "A new file '" + att.Name + "' has been posted and is ready for your review.  "
                                + txtEmailNote.Text;
        }

        return(SendNotification(oldStatus, newStatus, filePosted, txtEmailNote.Text));
    }
예제 #4
0
    /// <summary>
    /// Persist to DB
    /// </summary>
    protected void UpdateAccount(bool createNew)
    {
        this.account.Username     = txtUsername.Text;
        this.account.FirstName    = txtFirstName.Text;
        this.account.LastName     = txtLastName.Text;
        this.account.StatusCode   = "Active";
        this.account.Modified     = DateTime.Now;
        this.account.PasswordHint = txtPasswordHint.Text;
        // this.account.PreferencesXml = txtPreferencesXml.Text;
        this.account.RoleCode            = ddRole.SelectedValue;
        this.account.CompanyId           = int.Parse(ddCompany.SelectedValue);
        this.account.InternalId          = txtInternalId.Text;
        this.account.Email               = txtEmail.Text;
        this.account.BusinessLicenseID   = txtBusinessLicenseId.Text;
        this.account.IndividualLicenseID = txtIndividualLicenseId.Text;

        // underwriter codes - convert the checkbox list into a comma-separated value
        this.account.UnderwriterCodes = "";
        string delim = "";

        foreach (ListItem cb in cblUnderwriterCodes.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterCodes += delim + cb.Value;
                delim = ",";
            }
        }
        this.account.UnderwriterEndorsements = "";
        delim = "";
        foreach (ListItem cb in Endorse100.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        foreach (ListItem cb in Endorse90.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        foreach (ListItem cb in Endorse88.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        foreach (ListItem cb in Endorse85.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        foreach (ListItem cb in Endorse80.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        foreach (ListItem cb in Endorse75.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        foreach (ListItem cb in Endorse70.Items)
        {
            if (cb.Selected)
            {
                this.account.UnderwriterEndorsements += delim + cb.Value;
                delim = ",";
            }
        }
        //Response.Write(this.account.UnderwriterCodes);
        //Response.End();

        this.account.PreferencesXml = XmlForm.XmlToString(xmlForm.GetResponse(pnlPreferences));


        if (this.account.Id > 0 && !createNew)
        {
            this.account.Update();
        }
        else
        {
            Response.Write(this.account.Username);
            this.account.Insert();
            this.account.Password = "******";
            this.account.SetPassword();
            this.Redirect("AdminAccount.aspx?id=" + this.account.Id.ToString());
        }

        //update the password only if it was supplied
        if (!txtPassword.Text.Equals(""))
        {
            this.account.Password = txtPassword.Text;
            this.account.SetPassword();
        }
    }