コード例 #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();
        }
    }
コード例 #5
0
ファイル: XmlRenderer.cs プロジェクト: radtek/affinityistitle
        public override string Render(string keyAttribute)
        {
            XmlDocument doc = this.request.GetTranslatedResponse(keyAttribute, true, true);

            return(XmlForm.XmlToString(doc).Replace("</field>", "</field>\r\n").Replace("<response>", "<response>\r\n"));
        }
コード例 #6
0
    /// <summary>
    /// The form controls are created at this point.  if we create them at page load
    /// then their viewstate will not be persisted.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    override protected void PageBase_Init(object sender, System.EventArgs e)
    {
        bool isRefinance = (Request["Refinance"] != null && Request["Refinance"].Equals("True"));

        // we have to call the base first so phreezer is instantiated
        base.PageBase_Init(sender, e);

        int orderId = NoNull.GetInt(Request["id"], 0);

        string requestCode = NoNull.GetString(Request["code"], Affinity.RequestType.DefaultCode);


        this.order = new Affinity.Order(this.phreezer);
        order.Load(orderId);

        // make sure this user has permission to make updates to this order
        if (!order.CanUpdate(this.GetAccount()))
        {
            this.Crash(300, "Permission denied.");
        }

        this.rtype = new Affinity.RequestType(this.phreezer);
        rtype.Load(requestCode);

        this.xmlForm = new XmlForm(this.order.Account);

        this.changeId = NoNull.GetInt(Request["change"], 0);
        this.isChange = (!changeId.Equals(0));

        if (this.rtype.Code.Equals("ClerkingRequest"))
        {
            ContentFooterSpan.InnerHtml = "&copy; Copyright <%=DateTime.Now.Year.ToString() %>, Advocate Title Services, LLC";
        }

        string busindxml = "<field name=\"BusinessLicenseID\">" + this.GetAccount().BusinessLicenseID + "</field>" + "<field name=\"IndividualLicenseID\">" + this.GetAccount().IndividualLicenseID + "</field>";

        if (this.isChange)
        {
            // create a form for a change request
            Affinity.Request req = new Affinity.Request(this.phreezer);
            req.Load(changeId);
            pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, req.Xml.Replace("</response>", "") + busindxml + "</response>"));

            this.btnCancelChange.Visible = true;
            this.btnChange.Visible       = true;
            this.btnCancelSubmit.Visible = false;
            this.btnSubmit.Visible       = false;
        }
        else if (rtype.Code == Affinity.RequestType.DefaultChangeCode)
        {
            // this is a change to the main order, we store this as a request as well
            // but we treat it a little bit differently
            string resXml = XmlForm.XmlToString(order.GetResponse());
            pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, resXml.Replace("</response>", "") + busindxml + "</response>"));

            this.btnCancelChange.Visible = true;
            this.btnChange.Visible       = true;
            this.btnCancelSubmit.Visible = false;
            this.btnSubmit.Visible       = false;
        }
        else
        {
            // create a form for a new request
            //string reqXml = XmlForm.XmlToString(order.GetResponse());
            string reqXml = this.GetAccount().PreferencesXml;

            if (this.rtype.Code.Equals("ClerkingRequest"))
            {
                Affinity.RequestCriteria rc = new Affinity.RequestCriteria();
                rc.RequestTypeCode = "Order";
                Affinity.Requests reqs = order.GetOrderRequests(rc);

                if (reqs.Count > 0)
                {
                    Affinity.Request r = (Affinity.Request)reqs[reqs.Count - 1];


                    //log.Debug(r.Xml);
                    reqXml = reqXml.Replace("</response>", "") + busindxml +
                             XmlForm.XmlToString(order.GetResponse()).Replace("<response>", "").Replace("</response>", "") +
                             r.Xml.Replace("<response>", "");
                    pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, reqXml));
                }
                else
                {
                    reqXml = reqXml.Replace("</response>", "") + busindxml +
                             XmlForm.XmlToString(order.GetResponse()).Replace("<response>", "").Replace("</response>", "");
                    pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, XmlForm.XmlToString(order.GetResponse())));
                }
            }
            else
            {
                pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, reqXml));
            }
        }
    }
コード例 #7
0
    /// <summary>
    /// submits the order
    /// </summary>
    protected void SubmitOrder()
    {
        this.header.InnerText = "Your order has been submitted";
        this.Master.SetLayout(this.header.InnerText, MasterPage.LayoutStyle.ContentOnly);

        // parse the controls on the page and generate an xml doc
        XmlDocument doc = this.xmlForm.GetResponse(pnlForm);

        XmlNode TractSearchNode = doc.SelectSingleNode("//field[@name = 'TractSearch']");
        XmlNode BuyerNameNode   = doc.SelectSingleNode("//field[@name = 'Buyer']");

        if (TractSearchNode != null && TractSearchNode.InnerText.Equals("Yes") && BuyerNameNode != null && BuyerNameNode.InnerText.Equals(""))
        {
            BuyerNameNode.InnerText = ".";
        }

        Affinity.Request req = new Affinity.Request(this.phreezer);
        req.OrderId         = order.Id;
        req.OriginatorId    = this.GetAccount().Id;
        req.RequestTypeCode = this.rtype.Code;
        req.StatusCode      = (this.isChange || this.rtype.Code == Affinity.RequestType.DefaultChangeCode) ? Affinity.RequestStatus.ChangedCode : Affinity.RequestStatus.DefaultCode;

        req.Xml = XmlForm.XmlToString(doc).Replace("’", "'");

        req.Insert();

        string surveyServices = req.GetDataValue("SurveyServices");

        // if this is a change, we have to update any previous requests of the
        // same type so they are no longer recognized as the most current and we
        // know that they have been replaced by a newer request
        if (this.isChange)
        {
            Affinity.Request cr = new Affinity.Request(this.phreezer);
            cr.Load(this.changeId);
            // just a safety check to block any querystring monkeybusiness
            if (cr.OrderId == order.Id)
            {
                cr.IsCurrent = false;
                cr.Update();
            }

            if (surveyServices != cr.GetDataValue("SurveyServices"))
            {
                // the survey services has been changed.  it's either new or cancelled
                SendSurveyNotification(req, (surveyServices != "REQUIRED"), (surveyServices == "REQUIRED"));
            }
        }
        else if (surveyServices == "REQUIRED")
        {
            // send a notification that a new survey service has been requested
            SendSurveyNotification(req, false, true);
        }

        // if this was a property change, we need to update the master order record
        // as well so the data on the datagrids shows correctly
        if (this.rtype.Code == Affinity.RequestType.DefaultChangeCode)
        {
            order.ClientName       = FindOrderField(pnlForm, "ClientName", order.ClientName);
            order.Pin              = FindOrderField(pnlForm, "PIN", order.Pin); // case is different
            order.AdditionalPins   = FindOrderField(pnlForm, "AdditionalPins", order.AdditionalPins);
            order.PropertyAddress  = FindOrderField(pnlForm, "PropertyAddress", order.PropertyAddress2);
            order.PropertyAddress2 = FindOrderField(pnlForm, "PropertyAddress2", order.PropertyAddress);
            order.PropertyCity     = FindOrderField(pnlForm, "PropertyCity", order.PropertyCity);
            order.PropertyState    = FindOrderField(pnlForm, "PropertyState", order.PropertyState);
            order.PropertyZip      = FindOrderField(pnlForm, "PropertyZip", order.PropertyZip);
            order.CustomerId       = FindOrderField(pnlForm, "CustomerId", order.CustomerId);
            order.PropertyCounty   = FindOrderField(pnlForm, "PropertyCounty", order.PropertyCounty);

            string closingDate = FindOrderField(pnlForm, "ClosingDate", order.ClosingDate.ToShortDateString());

            try
            {
                order.ClosingDate = DateTime.Parse(closingDate);
            }
            catch (FormatException ex)
            {
                // TODO: check this at an earlier stage so we can roll back the transaction
                this.Master.ShowFeedback("Your order was updated however the new closing date was ignored because it was not a valid date in the format 'mm/dd/yyyy'", MasterPage.FeedbackType.Error);
            }
        }

        // we have to sync the status of the order because any new requests may change it
        // this will also call Update on the order if we've made any changes
        order.SyncStatus();

        // notify affinity if specified in system settings
        SendNotification(req);

        //TODO: redirect to a thank-you page instead of just showing the message
        ShowConfirmation();
    }