コード例 #1
0
    override protected void PageBase_Init(object sender, System.EventArgs e)
    {
        // we have to call the base first so phreezer is instantiated
        base.PageBase_Init(sender, e);

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

        this.account = new Affinity.Account(this.phreezer);
        this.RequirePermission(Affinity.RolePermission.AffinityManager);

        if (!id.Equals(0))
        {
            this.account.Load(id);
        }
        else
        {
            this.account.RoleCode  = Affinity.Role.DefaultCode;
            this.account.CompanyId = Affinity.Company.DefaultId;
        }

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

        xmlForm = new XmlForm(this.account);

        LoadForm();
    }
コード例 #2
0
ファイル: Admin.aspx.cs プロジェクト: radtek/affinityistitle
    protected void Page_Load(object sender, EventArgs e)
    {
        Affinity.Account account = this.GetAccount();
        this.RequirePermission(Affinity.RolePermission.AdminSystem);
        this.Master.SetLayout("Administration Dashboard", MasterPage.LayoutStyle.ContentOnly);

        Hashtable active = this.GetActiveUsers();

        foreach (string key in active.Keys)
        {
            DateTime dt   = (DateTime)active[key];
            TimeSpan diff = DateTime.Now.Subtract(dt);

            string tag = "<div class='active clearfix'>"
                         + "<div class='active_user account'>" + key + "</div>"
                         + "<div class='active_date'>" + dt.ToShortDateString() + "</div>"
                         + "<div class='active_time'>" + diff.Minutes + " minutes ago</div>"
                         + "</div>\r\n";
            pnlActive.Controls.Add(new LiteralControl(tag));
        }

        if (account.Role.HasPermission(Affinity.RolePermission.AffinityManager))
        {
            lnkManageAccounts.Visible   = true;
            lnkManageCompanies.Visible  = true;
            lnkManageWebContent.Visible = true;
        }

        if (account.Role.HasPermission(Affinity.RolePermission.AffinityStaff) && account.Role.HasPermission(Affinity.RolePermission.AffinityManager))
        {
            system_container.Visible = true;
        }

        lblTimeout.Text = Session.Timeout.ToString();
    }
コード例 #3
0
    protected void SendEmail(Affinity.Account ac, string newPass)
    {
        string to      = ac.Email;
        string url     = this.GetSystemSetting("RootUrl") + "";
        string subject = "Affinity Password Reset";
        string from    = this.GetSystemSetting("SendFromEmail");

        lblFromDomain.Text = from.Substring(from.LastIndexOf("@") + 1);

        // send the email
        Com.VerySimple.Email.Mailer mailer = new Com.VerySimple.Email.Mailer(this.GetSystemSetting("SmtpHost"));

        string msg = "Dear " + ac.FirstName + ",\r\n\r\n"
                     + "Your Affinity password has been reset.  Your login information is:\r\n\r\n"
                     + "Username: "******"\r\n"
                     + "Password: "******"\r\n\r\n"
                     + "Please use this new password to login at " + url + ".  "
                     + "Once you have logged in, you may click on \"My Preferences\" and change your "
                     + "password.\r\n\r\n"
                     + this.GetSystemSetting("EmailFooter");

        mailer.Send(
            this.GetSystemSetting("SendFromEmail")
            , to
            , subject
            , msg);
    }
コード例 #4
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
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Affinity.Account account = this.GetAccount();
        this.Master.SetLayout("My Account", MasterPage.LayoutStyle.ContentOnly);
        this.RequirePermission(Affinity.RolePermission.SubmitOrders);

        if (account.Role.HasPermission(Affinity.RolePermission.AttorneyServices))
        {
            DisclosureOwnerDocumentsDIV.Visible = true;
        }

        if (account.Role.HasPermission(Affinity.RolePermission.BrokerAgent))
        {
            DisclosureAgentDocumentsDIV.Visible = true;
        }

        if (!Page.IsPostBack)
        {
            // this gets rid of any half-submitted orders in case the customer
            // has been using the back button in mid-order process
            this.GetAccount().CleanUpOrphanOrders();

            LoadGrid("Modified", SortDirection.Descending, 0);

            LoadActions();
        }
    }
コード例 #6
0
    /// <summary>
    /// submit the order
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Affinity.Account account = this.GetAccount();
        // create a new order for this request
        Affinity.Order order = new Affinity.Order(this.phreezer);

        order.OriginatorId       = account.Id;
        order.CustomerStatusCode = Affinity.OrderStatus.PendingCode;
        order.InternalStatusCode = Affinity.OrderStatus.PendingCode;
        order.InternalId         = Affinity.Order.DefaultInternalId;

        order.ClientName       = txtClientName.Text;
        order.Pin              = txtPIN.Text;
        order.AdditionalPins   = txtAdditionalPins.Text;
        order.PropertyAddress  = txtPropertyAddress.Text;
        order.PropertyAddress2 = txtPropertyAddress2.Text;
        order.PropertyCity     = txtPropertyCity.Text;
        order.PropertyState    = txtPropertyState.Text;
        order.PropertyZip      = txtPropertyZip.Text;
        order.CustomerId       = txtCustomerId.Text;
        order.PropertyCounty   = txtPropertyCounty.Text;
        order.PropertyUse      = (radioResidential.Checked)? "Residential" : "Nonresidential";


        try
        {
            order.ClosingDate = DateTime.Parse(txtClosingDate.Text);
            bool isRefinance = radioRefinance.Checked;

            Affinity.Order PreviousOrder = order.GetPrevious();
            // verify the user has not submitted this PIN in the past
            if (PreviousOrder == null || isDupOrderWarnedHdn.Value.Equals("true"))
            {
                order.Insert();

                this.Redirect("MyRequestSubmit.aspx?new=true&id=" + order.Id + "&code=" + this.rtype.Code);
            }
            else
            {
                isDupOrderWarnedHdn.Value = "true";

                string AffinityIdMessage = "";

                if (!PreviousOrder.InternalId.Equals(""))
                {
                    AffinityIdMessage = " and Affinity ID: " + PreviousOrder.InternalId;
                }

                this.Master.ShowFeedback("You previously submitted order " + PreviousOrder.Id + " for a similar property (PIN " + order.Pin + AffinityIdMessage + ").  Please verify that this is not a duplicate order and click Continue... Otherwise click Cancel.", MasterPage.FeedbackType.Warning);
            }
        }
        catch (FormatException ex)
        {
            this.Master.ShowFeedback("Please check that the estimated closing date is valid and in the format 'mm/dd/yyyy'", MasterPage.FeedbackType.Error);
        }
        catch (Exception ex)
        {
            this.Master.ShowFeedback(ex.Message, MasterPage.FeedbackType.Error);
        }
    }
コード例 #7
0
ファイル: PageBase.cs プロジェクト: radtek/affinityistitle
 public Affinity.Account GetAccount()
 {
     if (this.account == null)
     {
         this.account = (Session[PageBase.accountSessionVar] != null) ? (Affinity.Account)Session[PageBase.accountSessionVar] : new Affinity.Account(this.phreezer);
     }
     return(this.account);
 }
コード例 #8
0
ファイル: PageBase.cs プロジェクト: radtek/affinityistitle
 public void SetAccount(Affinity.Account acc)
 {
     Session[PageBase.accountSessionVar] = acc;
     this.account = acc;
     if (acc != null)
     {
         log.Info("Session started for " + acc.Username);
     }
 }
コード例 #9
0
    /// <summary>
    /// processes the authentaction provided and redirects to the approp page
    /// </summary>
    /// <param name="username"></param>
    /// <param name="password"></param>
    private void ProcessLogin(string username, string password)
    {
        Affinity.Account account = new Affinity.Account(this.phreezer);

        if (account.Login(username, password))
        {
            // save the account in the session
            this.SetAccount(account);

            // also add to the active users list
            this.AddActiveUser(account.Username);

            if (FormsAuthentication.GetRedirectUrl(txtUsername.Text, false).EndsWith("default.aspx"))
            {
                // the user is on the home page so they have not tried to access another page
                FormsAuthentication.SetAuthCookie(txtUsername.Text, false);

                if (account.Role.HasPermission(Affinity.RolePermission.AffinityManager) || account.Role.HasPermission(Affinity.RolePermission.AffinityStaff))
                {
                    this.Redirect("Admin.aspx");
                }
                else
                {
                    this.Redirect("MyAccount.aspx");
                }
            }
            else
            {
                // the user was trying to access another page, so redirect them where they originally \
                // wanted to go
                //Response.Write("'" + FormsAuthentication.GetRedirectUrl(txtUsername.Text, false)+"'");
                //Response.End();
                FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, false);
            }
        }
        else
        {
            log.Warn("Invalid password for username " + username);
            this.Master.ShowFeedback("Unknown Username/Password", MasterPage.FeedbackType.Warning);
        }
    }
コード例 #10
0
    public void SetNavigation(string active)
    {
        // set the navigation based on this users permissions
        PageBase pb = (PageBase)this.Page;

        Affinity.Account acc = pb.GetAccount();

        // TODO: everyone gets to see the fee finder link for the time being
        this.lnkFeeFinder.Visible = true;

        if (acc.Role.IsAuthenticated())
        {
            this.lnkMyAccount.Visible     = true;
            lnkPreferences.Visible        = true;
            this.lnkLogout.Visible        = true;
            this.lnkForms.Visible         = true;
            this.lnkHUDCalculator.Visible = true;

            this.lnkHome.Visible  = false;
            this.lnkAbout.Visible = false;
            lnkNews.Visible       = false;

            this.lnkAdmin.Visible            = acc.Role.HasPermission(Affinity.RolePermission.AdminSystem);
            this.lnkAttorneyServices.Visible = acc.Role.HasPermission(Affinity.RolePermission.AttorneyServices);
            this.checkFrame.Visible          = false;
        }
        else
        {
            this.timeoutdiv.Visible = false;
        }

        if (active.Equals("iframe"))
        {
            this.timeoutdiv.Visible        = false;
            this.headerDIV.Visible         = false;
            this.pnlNav.Visible            = false;
            this.lblcontent_footer.Visible = false;
            this.checkFrame.Visible        = false;
        }
    }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Affinity.Account account = this.GetAccount();
        string           code    = Request["page"] != null ? Request["page"] : "";

        Affinity.Content c = new Affinity.Content(this.phreezer);

        try
        {
            c.Load(code);

            this.Master.SetLayout(c.MetaTitle, MasterPage.LayoutStyle.Photo_01);

            header.InnerHtml = c.Header;
            pnlBody.Controls.Clear();
            pnlBody.Controls.Add(new LiteralControl(c.Body));
        }
        catch (Exception ex)
        {
            // we don't really care - just show the default not-found message
        }
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageBase pb = (PageBase)this.Page;

        Affinity.Account acc = pb.GetAccount();
        this.Master.SetLayout("Process Order", MasterPage.LayoutStyle.ContentOnly);
        this.RequirePermission(Affinity.RolePermission.AdminSystem);

        this.btnClose.Attributes.Add("onclick", "return confirm('Mark this order as closed?');");

        if (!Page.IsPostBack)
        {
            // populate current requests grid
            Affinity.RequestCriteria rc = new Affinity.RequestCriteria();
            rc.AppendToOrderBy("Created", true);
            rGrid.DataSource = order.GetOrderRequests(rc);
            rGrid.DataBind();

            // show any attachments that go with this order
            Affinity.Attachments atts = order.GetAttachments();

            foreach (Affinity.Attachment att in atts)
            {
                pnlAttachments.Controls.Add(new LiteralControl("<div><a class=\"attachment\" href=\"MyAttachment.aspx?id=" + att.Id + "\">" + att.Name + "</a> (" + att.Created.ToString("M/dd/yyyy hh:mm tt") + ") <a class=\"delete\" onclick=\"return confirm('Delete this attachment?');\" href=\"AdminAttachment.aspx?a=delete&id=" + att.Id + "\">Delete</a></div>"));
            }

            // populate the form

            btnReAssign.Visible = acc.Role.HasPermission(Affinity.RolePermission.AffinityManager);

            Affinity.OrderStatuss        codes = new Affinity.OrderStatuss(this.phreezer);
            Affinity.OrderStatusCriteria sc    = new Affinity.OrderStatusCriteria();
            sc.InternalExternal = 1;
            codes.Query(sc);

            /*
             * ddStatus.DataSource = codes;
             * ddStatus.DataTextField = "Description";
             * ddStatus.DataValueField = "Code";
             * ddStatus.SelectedValue = this.order.CustomerStatusCode;
             * ddStatus.DataBind();
             */
            lblStatus.Text = this.order.CustomerStatus.Description;

            txtId.Text               = "WEB-" + this.order.Id.ToString();
            txtInternalId.Text       = this.order.InternalId.ToString();
            txtInternalATSId.Text    = this.order.InternalATSId.ToString();
            txtCustomerId.Text       = this.order.CustomerId.ToString();
            txtPin.Text              = this.order.Pin.ToString();
            txtAdditionalPins.Text   = this.order.AdditionalPins.ToString();
            txtPropertyAddress.Text  = this.order.PropertyAddress.ToString();
            txtPropertyAddress2.Text = this.order.PropertyAddress2.ToString();
            txtPropertyCity.Text     = this.order.PropertyCity.ToString();
            txtPropertyState.Text    = this.order.PropertyState.ToString();
            txtPropertyZip.Text      = this.order.PropertyZip.ToString();
            txtPropertyCounty.Text   = this.order.PropertyCounty.ToString();
            //txtInternalStatusCode.Text = this.order.InternalStatusCode.ToString();
            //txtCustomerStatusCode.Text = this.order.CustomerStatusCode.ToString();
            txtOriginator.Text          = this.order.Account.FullName;
            txtCreated.Text             = this.order.Created.ToString("MM/dd/yyyy hh:mm tt");
            txtModified.Text            = this.order.Modified.ToString("MM/dd/yyyy hh:mm tt");
            txtClosingDate.Text         = this.order.ClosingDate.ToShortDateString();
            txtClientName.Text          = this.order.ClientName.ToString();
            radioResidential.Checked    = (this.order.PropertyUse.Equals("Residential"));
            radioNonResidential.Checked = (this.order.PropertyUse.Equals("Nonresidential"));

            if (txtInternalId.Text.Trim().Equals(""))
            {
                txtInternalId.Focus();
                txtInternalId.Text = "AFF-";
            }
            else if (txtInternalATSId.Text.Trim().Equals(""))
            {
                txtInternalATSId.Focus();
            }

            // the admin wants to see if there is a previous order from ANY user w/ the same PIN because
            // if the PIN was recently submitted, they may be able to use internal records and not have
            // to incur the expense of a full title search.
            Affinity.Order previousOrder = order.GetPrevious(false);

            // If there are any previous orders display a message to the admin
            if (previousOrder != null)
            {
                PreviousOrderNotice.InnerHtml = "This order has a potential duplicate submitted on " + previousOrder.Created.ToShortDateString() + " - order number <a href=\"AdminOrder.aspx?id=" + previousOrder.Id.ToString() + "\">" + previousOrder.Id.ToString() + "</a> " + previousOrder.InternalId.ToString();
                PreviousOrderNotice.Visible   = true;
            }
        }
    }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RequirePermission(Affinity.RolePermission.SubmitOrders);
        this.Master.SetLayout("Agent Examination Form", MasterPage.LayoutStyle.ContentOnly);

        if (Request["ajax"] != null)
        {
            Affinity.Account me = this.GetAccount();
            saveAgentExaminationForm(false, me);
            Response.End();
        }
        else if (!Page.IsPostBack)
        {
            txtCommitmentNumber.Text = request.Order.WorkingId.ToString();
            txtAgentsName.Text       = request.Account.FullName;

            using (MySqlConnection mysqlCon = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString))
            {
                mysqlCon.Open();

                bool   doInsert = true;
                string aefid    = "0";
                using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM agent_examination WHERE aef_status = 0 AND aef_account_id = " + this.GetAccount().Id.ToString() + " and aef_request_id = " + this.request.Id.ToString() + " ORDER BY aef_id desc", mysqlCon))
                {
                    try
                    {
                        MySqlDataReader Reader = cmd.ExecuteReader();
                        while (Reader.Read()) // this part is wrong somehow
                        {
                            txtAgentsName.Text           = Reader["aef_agents_name"].ToString();
                            txtCommitmentNumber.Text     = Reader["aef_commitment_number"].ToString();
                            txtPropertyVesting.Text      = Reader["aef_property_vesting"].ToString();
                            txtPropertyAddress.Text      = Reader["aef_property_address"].ToString();
                            txtPropertyCityStateZip.Text = Reader["aef_property_city_state_zip"].ToString();
                            txtPropertyCounty.Text       = Reader["aef_property_county"].ToString();
                            txtPIN.Text                                = Reader["aef_pin"].ToString();
                            txtPriorYear.Text                          = Reader["aef_prior_year"].ToString();
                            txt1stInstallment.Text                     = Reader["aef_1st_installment"].ToString();
                            txt2ndInstallment.Text                     = Reader["aef_2nd_installment"].ToString();
                            txtCurrentYear.Text                        = Reader["aef_current_year"].ToString();
                            txtTaxAmount1st.Text                       = Reader["aef_tax_amount_1st"].ToString();
                            txtTaxAmount2nd.Text                       = Reader["aef_tax_amount_2nd"].ToString();
                            txtDueDate1st.Text                         = Reader["aef_due_date_1st"].ToString();
                            txtDueDate2nd.Text                         = Reader["aef_due_date_2nd"].ToString();
                            txtTaxYearofSoldtaxes.Text                 = Reader["aef_tax_year_of_sold_taxes"].ToString();
                            txtMortgagesofRecord.Text                  = Reader["aef_mortgages_of_record"].ToString();
                            txtOtherLiensofRecord.Text                 = Reader["aef_other_liens_of_record"].ToString();
                            txtBuildingLines.Text                      = Reader["aef_building_lines"].ToString();
                            txtEasements.Text                          = Reader["aef_easements"].ToString();
                            txtDocumentNumbers.Text                    = Reader["aef_document_numbers"].ToString();
                            radioCondoAssociationYes.Checked           = Reader["aef_condo_association"].ToString().Equals("Yes");
                            chkSearchPackageReviewedAmendments.Checked = Reader["aef_search_package_reviewed_amendments"].ToString().Equals("Yes");
                            chkSearchPackageReviewed.Checked           = Reader["aef_search_package_reviewed"].ToString().Equals("Yes");
                            txtAmendments.Text                         = Reader["aef_amendments"].ToString();
                        }
                        Reader.Close();
                    }

                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                        Response.Write(ex.Message);
                    }
                }
            }
        }
    }
コード例 #14
0
    protected void saveAgentExaminationForm(bool submitted, Affinity.Account me)
    {
        //submitted = false;
        // Declare objects:
        //ZfAPIClass oZfAPI = new ZfAPIClass();
        //ZfLib.UserSession oUserSession;
        //ZfLib.Messages oMessages;
        //ZfLib.Message oMessage;

        try
        {
            // make this an attachment to the request

            string ext = ".pdf";
            //string fileName = "req_att_" + request.Id + "_" + DateTime.Now.ToString("yyyyMMddhhss") + "." + ext.Replace(".","");
            string commitment = txtCommitmentNumber.Text;
            string fileName   = "Agent_Exam_Sheet_for_AFF-" + ((commitment.Equals(""))? request.OrderId.ToString() : commitment.Replace("AFF", ""));
            string suffix     = "_001";

            int    idx          = 1;
            string attID        = "0";
            string contentsHTML = "";

            if (submitted)
            {
                while (File.Exists(Server.MapPath("./") + "attachments/" + fileName + suffix + ext))
                {
                    idx++;
                    string idxstr = idx.ToString();
                    if (idxstr.Length == 1)
                    {
                        suffix = "_00" + idxstr;
                    }
                    else if (idxstr.Length == 2)
                    {
                        suffix = "_0" + idxstr;
                    }
                    else
                    {
                        suffix = "_" + idxstr;
                    }
                }
                fileName = fileName + suffix + ext;

                //string contentsTXT = "";

                using (FileStream fs = new FileStream(Server.MapPath("./") + "AgentExaminationForm.html", FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 8, true))
                {
                    using (StreamReader sr = new StreamReader(fs))
                    {
                        // Read the file using StreamReader class
                        contentsHTML = sr.ReadToEnd();
                    }
                }

                contentsHTML = contentsHTML.Replace("margin-left:46px", "").Replace("txtAgentsName", txtAgentsName.Text).Replace("txtCommitmentNumber", commitment).Replace("txtPropertyVesting", txtPropertyVesting.Text).Replace("txtPropertyAddress", txtPropertyAddress.Text).Replace("txtPropertyCityStateZip", txtPropertyCityStateZip.Text).Replace("txtPropertyCounty", txtPropertyCounty.Text).Replace("txtPIN", txtPIN.Text).Replace("txtPriorYear", txtPriorYear.Text).Replace("txt1stInstallment", txt1stInstallment.Text).Replace("txt2ndInstallment", txt2ndInstallment.Text).Replace("txtCurrentYear", txtCurrentYear.Text).Replace("txtTaxAmount1st", txtTaxAmount1st.Text).Replace("txtTaxAmount2nd", txtTaxAmount2nd.Text).Replace("txtDueDate1st", txtDueDate1st.Text).Replace("txtDueDate2nd", txtDueDate2nd.Text).Replace("txtTaxYearofSoldtaxes", txtTaxYearofSoldtaxes.Text).Replace("txtMortgagesofRecord", txtMortgagesofRecord.Text.Replace("\n", "<br />")).Replace("txtOtherLiensofRecord", txtOtherLiensofRecord.Text.Replace("\n", "<br />")).Replace("txtBuildingLines", txtBuildingLines.Text.Replace("\n", "<br />")).Replace("txtEasements", txtEasements.Text.Replace("\n", "<br />")).Replace("txtDocumentNumbers", txtDocumentNumbers.Text.Replace("\n", "<br />")).Replace("radioCondoAssociationYes", ((radioCondoAssociationYes.Checked) ? " checked='checked'" : "")).Replace("radioCondoAssociationNo", ((radioCondoAssociationNo.Checked) ? " checked='checked'" : "")).Replace("chkSearchPackageReviewedAmendments", ((chkSearchPackageReviewedAmendments.Checked) ? " checked='checked'" : "")).Replace("chkSearchPackageReviewed", ((chkSearchPackageReviewed.Checked) ? " checked='checked'" : "")).Replace("txtAmendments", txtAmendments.Text.Replace("\n", "<br />")).Replace("SIGNATURE", (me.Signature.Equals("")) ? "" : "<img src=\"" + ((Request.Url.Port == 443) ? "https://" : "http://") + Request.Url.Host + "/signatures/" + me.Signature + "\" height=\"50\" border=\"0\">").Replace("DATESTAMP", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());

                /*
                 * using (FileStream fs = new FileStream(Server.MapPath("./") + "AgentExaminationForm.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 8, true))
                 * {
                 *      using (StreamReader sr = new StreamReader(fs))
                 *      {
                 *
                 *              // Read the file using StreamReader class
                 *              contentsTXT = sr.ReadToEnd();
                 *      }
                 * }
                 *
                 * contentsTXT = contentsTXT.Replace("txtAgentsName", txtAgentsName.Text).Replace("txtCommitmentNumber", commitment).Replace("txtPropertyVesting", txtPropertyVesting.Text).Replace("txtPropertyAddress", txtPropertyAddress.Text).Replace("txtPropertyCityStateZip", txtPropertyCityStateZip.Text).Replace("txtPropertyCounty", txtPropertyCounty.Text).Replace("txtPIN", txtPIN.Text).Replace("txtPriorYear", txtPriorYear.Text).Replace("txt1stInstallment", txt1stInstallment.Text).Replace("txt2ndInstallment", txt2ndInstallment.Text).Replace("txtCurrentYear", txtCurrentYear.Text).Replace("txtTaxAmount1st", txtTaxAmount1st.Text).Replace("txtTaxAmount2nd", txtTaxAmount2nd.Text).Replace("txtDueDate1st", txtDueDate1st.Text).Replace("txtDueDate2nd", txtDueDate2nd.Text).Replace("txtTaxYearofSoldtaxes", txtTaxYearofSoldtaxes.Text).Replace("txtMortgagesofRecord", txtMortgagesofRecord.Text).Replace("txtOtherLiensofRecord", txtOtherLiensofRecord.Text).Replace("txtBuildingLines", txtBuildingLines.Text).Replace("txtEasements", txtEasements.Text).Replace("txtDocumentNumbers", txtDocumentNumbers.Text).Replace("radioCondoAssociation", ((radioCondoAssociationYes.Checked) ? "Yes" : "No")).Replace("chkSearchPackageReviewedAmendments", ((chkSearchPackageReviewedAmendments.Checked) ? "The search and the search package has been\nreviewed and examined and we have made our determination of insurability and we direct ATS to\nissue the title commitment in accordance with the search package." : "")).Replace("chkSearchPackageReviewed", ((chkSearchPackageReviewed.Checked) ? "The search and the search package\nhas been reviewed and examined and we have made our determination of insurability and we\ndirect ATS to issue the title commitment after making the following amendments." : "")).Replace("txtAmendments", txtAmendments.Text);
                 */
                Affinity.Attachment att = new Affinity.Attachment(this.phreezer);
                att.RequestId   = this.request.Id;
                att.Name        = "AgentExaminationForm.pdf";
                att.PurposeCode = "ExamSheet";
                att.Filepath    = fileName;
                att.MimeType    = ext;
                att.SizeKb      = 0;            // fuAttachment.FileBytes.GetUpperBound() * 1024;

                att.Insert();
                attID = att.Id.ToString();
                //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();
            }

            using (MySqlConnection mysqlCon = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString))
            {
                mysqlCon.Open();

                bool   doInsert = true;
                string aefid    = "0";

                using (MySqlCommand cmd1 = new MySqlCommand("SELECT aef_id FROM agent_examination WHERE aef_status = 0 AND aef_account_id = " + this.GetAccount().Id.ToString() + " and aef_request_id = " + this.request.Id.ToString(), mysqlCon))
                {
                    try
                    {
                        MySqlDataReader Reader = cmd1.ExecuteReader();
                        while (Reader.Read()) // this part is wrong somehow
                        {
                            aefid = Reader["aef_id"].ToString();
                        }
                        Reader.Close();
                    }

                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                        Response.Write(ex.Message);
                    }
                }

                DateTime t = DateTime.Now;
                if (aefid.Equals("0"))
                {
                    using (MySqlCommand cmd = new MySqlCommand("INSERT INTO agent_examination (`aef_agents_name`, `aef_commitment_number`, `aef_property_vesting`, `aef_property_address`, `aef_property_city_state_zip`, `aef_property_county`, `aef_pin`, `aef_prior_year`, `aef_1st_installment`, `aef_2nd_installment`, `aef_current_year`, `aef_tax_amount_1st`, `aef_tax_amount_2nd`, `aef_due_date_1st`, `aef_due_date_2nd`, `aef_tax_year_of_sold_taxes`, `aef_mortgages_of_record`,  `aef_other_liens_of_record`, `aef_building_lines`, `aef_easements`, `aef_document_numbers`, `aef_condo_association`, `aef_search_package_reviewed_amendments`, `aef_search_package_reviewed`, `aef_amendments`, `aef_signature`, `aef_date_stamp`, `aef_attachment_id`, `aef_upload_account_id`, `aef_account_id`, `aef_order_id`, `aef_request_id`, `aef_created`, `aef_status`) VALUES ('" + txtAgentsName.Text.Replace("'", "''") + "', '" + commitment.Replace("'", "''") + "', '" + txtPropertyVesting.Text.Replace("'", "''") + "', '" + txtPropertyAddress.Text.Replace("'", "''") + "', '" + txtPropertyCityStateZip.Text.Replace("'", "''") + "', '" + txtPropertyCounty.Text.Replace("'", "''") + "', '" + txtPIN.Text.Replace("'", "''") + "', '" + txtPriorYear.Text.Replace("'", "''") + "', '" + txt1stInstallment.Text.Replace("'", "''") + "', '" + txt2ndInstallment.Text.Replace("'", "''") + "', '" + txtCurrentYear.Text.Replace("'", "''") + "', '" + txtTaxAmount1st.Text.Replace("'", "''") + "', '" + txtTaxAmount2nd.Text.Replace("'", "''") + "', " + ((txtDueDate1st.Text.Trim().Equals("") || !DateTime.TryParse(txtDueDate1st.Text, out t))? "null" : "'" + String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(txtDueDate1st.Text.Replace("'", "''"))) + "'") + ", " + ((txtDueDate2nd.Text.Trim().Equals("") || !DateTime.TryParse(txtDueDate2nd.Text, out t))? "null" : "'" + String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(txtDueDate2nd.Text.Replace("'", "''"))) + "'") + ", '" + txtTaxYearofSoldtaxes.Text.Replace("'", "''") + "', '" + txtMortgagesofRecord.Text.Replace("'", "''") + "', '" + txtOtherLiensofRecord.Text.Replace("'", "''") + "', '" + txtBuildingLines.Text.Replace("'", "''") + "', '" + txtEasements.Text.Replace("'", "''") + "', '" + txtDocumentNumbers.Text.Replace("'", "''") + "', '" + ((radioCondoAssociationYes.Checked) ? "Yes" : "No") + "', '" + ((chkSearchPackageReviewedAmendments.Checked) ? "Yes" : "No") + "', '" + ((chkSearchPackageReviewed.Checked) ? "Yes" : "No") + "', '" + txtAmendments.Text.Replace("'", "''") + "', '" + me.Signature.Replace("'", "''") + "', '" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "', " + attID + ", " + this.request.Account.Id.ToString() + ", " + this.GetAccount().Id.ToString() + ", " + this.request.OrderId.ToString() + ", " + this.request.Id.ToString() + ", '" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "', " + ((submitted)? "1" : "0") + " )", mysqlCon))
                    {
                        try
                        {
                            MySqlDataReader Reader = cmd.ExecuteReader();
                            while (Reader.Read()) // this part is wrong somehow
                            {
                                //citationstexter.Add(Reader.GetString(loopReading)); // this works
                                //loopReading++; // this works
                            }
                            Reader.Close();
                        }

                        catch (Exception ex)
                        {
                            //MessageBox.Show(ex.Message);
                            Response.Write(ex.Message);
                        }
                    }
                }
                else
                {
                    using (MySqlCommand cmd = new MySqlCommand("UPDATE agent_examination SET `aef_agents_name` = '" + txtAgentsName.Text.Replace("'", "''") + "', `aef_commitment_number` = '" + commitment.Replace("'", "''") + "', `aef_property_vesting` = '" + txtPropertyVesting.Text.Replace("'", "''") + "', `aef_property_address` = '" + txtPropertyAddress.Text.Replace("'", "''") + "', `aef_property_city_state_zip` = '" + txtPropertyCityStateZip.Text.Replace("'", "''") + "', `aef_property_county` = '" + txtPropertyCounty.Text.Replace("'", "''") + "', `aef_pin` = '" + txtPIN.Text.Replace("'", "''") + "', `aef_prior_year` = '" + txtPriorYear.Text.Replace("'", "''") + "', `aef_1st_installment` = '" + txt1stInstallment.Text.Replace("'", "''") + "', `aef_2nd_installment` = '" + txt2ndInstallment.Text.Replace("'", "''") + "', `aef_current_year` = '" + txtCurrentYear.Text.Replace("'", "''") + "', `aef_tax_amount_1st` = '" + txtTaxAmount1st.Text.Replace("'", "''") + "', `aef_tax_amount_2nd` = '" + txtTaxAmount2nd.Text.Replace("'", "''") + "', `aef_due_date_1st` = " + ((txtDueDate1st.Text.Trim().Equals("") || !DateTime.TryParse(txtDueDate1st.Text, out t))? "null" : "'" + String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(txtDueDate1st.Text.Replace("'", "''"))) + "'") + ", `aef_due_date_2nd` = " + ((txtDueDate2nd.Text.Trim().Equals("") || !DateTime.TryParse(txtDueDate2nd.Text, out t))? "null" : "'" + String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(txtDueDate2nd.Text.Replace("'", "''"))) + "'") + ", `aef_tax_year_of_sold_taxes` = '" + txtTaxYearofSoldtaxes.Text.Replace("'", "''") + "', `aef_mortgages_of_record` = '" + txtMortgagesofRecord.Text.Replace("'", "''") + "',  `aef_other_liens_of_record` = '" + txtOtherLiensofRecord.Text.Replace("'", "''") + "', `aef_building_lines` = '" + txtBuildingLines.Text.Replace("'", "''") + "', `aef_easements` = '" + txtEasements.Text.Replace("'", "''") + "', `aef_document_numbers` = '" + txtDocumentNumbers.Text.Replace("'", "''") + "', `aef_condo_association` = '" + ((radioCondoAssociationYes.Checked) ? "Yes" : "No") + "', `aef_search_package_reviewed_amendments` = '" + ((chkSearchPackageReviewedAmendments.Checked) ? "Yes" : "No") + "', `aef_search_package_reviewed` = '" + ((chkSearchPackageReviewed.Checked) ? "Yes" : "No") + "', `aef_amendments` = '" + txtAmendments.Text.Replace("'", "''") + "', `aef_signature` = '" + me.Signature.Replace("'", "''") + "', `aef_date_stamp` = '" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "', `aef_attachment_id` = " + attID + ", `aef_upload_account_id` = " + this.request.Account.Id.ToString() + ", `aef_account_id` = " + this.GetAccount().Id.ToString() + ", `aef_order_id` = " + this.request.OrderId.ToString() + ", `aef_request_id` = " + this.request.Id.ToString() + ", `aef_created` = '" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "', `aef_status` = " + ((submitted)? "1" : "0") + " WHERE aef_id = " + aefid, mysqlCon))
                    {
                        try
                        {
                            MySqlDataReader Reader = cmd.ExecuteReader();
                            while (Reader.Read()) // this part is wrong somehow
                            {
                                //citationstexter.Add(Reader.GetString(loopReading)); // this works
                                //loopReading++; // this works
                            }
                            Reader.Close();
                        }

                        catch (Exception ex)
                        {
                            //MessageBox.Show(ex.Message);
                            Response.Write(ex.Message);
                        }
                    }
                }
            }

            if (submitted)
            {
                using (FileStream fs = new FileStream(Server.MapPath("./") + "attachments/" + fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite, 8, true))
                {
                    /*
                     * using (StreamWriter sw = new StreamWriter(fs))
                     * {
                     *      // Write to the file using StreamWriter class
                     *      sw.BaseStream.Seek(0, SeekOrigin.End);
                     *      sw.Write(contentsHTML);
                     *      sw.Flush();
                     * }
                     */
                    HiQPdf.HtmlToPdf converter = new HtmlToPdf();
                    converter.SerialNumber = "TwcmHh8rKQMmLT0uPTZ6YX9vfm9+b354eW98fmF+fWF2dnZ2";
                    converter.ConvertHtmlToStream(contentsHTML, "http://" + Request.Url.Host, fs);
                }

                /*
                 * using (FileStream fs = new FileStream(Server.MapPath("./") + "App_Data/" + fileName.Replace(".html", ".txt"), FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite, 8, true))
                 * {
                 *      using (StreamWriter sw = new StreamWriter(fs))
                 *      {
                 *              // Write to the file using StreamWriter class
                 *              sw.BaseStream.Seek(0, SeekOrigin.End);
                 *              sw.Write(contentsTXT);
                 *              sw.Flush();
                 *      }
                 * }
                 */

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

                /*
                 * txtEmailNote.Text = "A new file '" + att.Name + "' has been posted and is ready for your review.  "
                 + txtEmailNote.Text;
                 +
                 + SendNotification(oldStatus, newStatus, filePosted, txtEmailNote.Text);
                 */



                /*
                 * // Load the available messages to the combo box so we can pick one and view the details of this message
                 * // Logon and get message:
                 * oUserSession = oZfAPI.Logon("ADMINIST", false);
                 * oMessages = oUserSession.Outbox.GetMsgList();
                 *
                 * // Insert the message body into the combobox so the message would be selected according to this value
                 * IEnumerator MessaegesEnum = oMessages.GetEnumerator();
                 *
                 * while (MessaegesEnum.MoveNext())
                 * {
                 *      // Iterate through the messages
                 *      oMessage = (ZfLib.Message)MessaegesEnum.Current;
                 *      //cmbMessages.Items.Add(oMessage.GetMsgInfo().Body); //Insert the message into the combobox
                 * }
                 *
                 * // Enable the controls according to the number of messages:
                 * if (cmbMessages.Items.Count == 0) //If there aren't any messages - disable both the combobox and the button
                 * {
                 *      cmbMessages.Enabled = false;
                 *      btnGetMessageInfo.Enabled = false;
                 * }
                 * else // In case there is at least 1 message in the outbox - put it as a default selection in the combobox
                 *      cmbMessages.SelectedIndex = 0;
                 */

                if (FaxRadio.Checked)
                {
                    AffinityFaxServer afs = new AffinityFaxServer();
                    afs.Form_Load(contentsHTML, fileName);
                }
                else
                {
                    //Response.Write(this.GetSystemSetting("SendFromEmail") + "<br />");

                    // send to: [email protected]
                    MailMessage mm = new MailMessage(this.GetSystemSetting("SendFromEmail"), "[email protected], [email protected]", "Agent Examination Form " + commitment, "Agent Examination Form has been submitted by: " + me.FirstName + " " + me.LastName + "<br /><br /><br />\r\n\r\n" + this.GetSystemSetting("EmailFooter"));
                    mm.IsBodyHtml = true;
                    mm.Priority   = MailPriority.Normal;

                    if (File.Exists(Server.MapPath("./") + "attachments/" + fileName))
                    {
                        Attachment attch = new Attachment(Server.MapPath("./") + "attachments/" + fileName);
                        attch.Name = fileName;

                        mm.Attachments.Add(attch);
                    }
                    //SmtpClient sc = new SmtpClient(this.GetSystemSetting("SmtpHost"));
                    //sc.Send(mm);

                    Com.VerySimple.Email.Mailer mailer = new Com.VerySimple.Email.Mailer(this.GetSystemSetting("SmtpHost"));
                    mailer.Send(mm);
                }

                /*
                 * HttpContext.Current.Response.BufferOutput = true;
                 * HttpContext.Current.Response.ContentType = "application/pdf";
                 * HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=AgentExaminationForm.pdf");
                 */

                Response.Write(contentsHTML.Replace("<h2>Affinity Title Search</h2>", "<h2>Affinity Title Search</h2><div style=\"font-size:24px;color:blue;\">The Agent Examination Form has been submitted successfully.</div>"));
                //Response.End();
            }
        }
        catch (System.Exception ex)
        {
            //this.Master.ShowFeedback(ex.Message, MasterPage.FeedbackType.Information);
            //Response.Write(ex.Message);
            Response.End();
        }
    }
コード例 #15
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Affinity.Account me = this.GetAccount();
     saveAgentExaminationForm(true, me);
 }
コード例 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
         * // get stack trace
         * System.Diagnostics.StackFrame fr = new System.Diagnostics.StackFrame(1, true);
         * System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(fr);
         * Response.Write( "method = " + fr.GetMethod().Name + " trace = " + st.ToString() );
         */
        // we have to call the base first so phreezer is instantiated
        base.PageBase_Init(sender, e);
        PageBase pb = (PageBase)this.Page;

        Affinity.Account acc      = pb.GetAccount();
        string           contents = "";

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

        //Response.Write(Request["file"]);
        //Response.End();

        if (id > 0)
        {
            Affinity.Order order = new Affinity.Order(this.phreezer);
            order.Load(id);

            int filecount = 0;
            this.Master.SetLayout("PropertyProfile", MasterPage.LayoutStyle.ContentOnly);
            if (Request["file"] != null)
            {
                string [] file = Request["file"].Split(',');

                for (int i = 0; i < file.Length; i++)
                {
                    if ((file[i].Equals("WD") || file[i].Equals("WD_S") || file[i].Equals("WD_JT") || file[i].Equals("WD_TE")) && Request["warrantyfile"] == null)
                    {
                        continue;
                    }
                    string path = HttpContext.Current.Server.MapPath(".") + "\\downloads\\" + file[i] + ".xml";
                    if (File.Exists(path))
                    {
                        filecount++;
                    }
                }

                //Response.Write(path);

                /*
                 * string fileNameXML = HttpContext.Current.Server.MapPath(".") + "\\downloads\\Disclosure_Agent.doc";
                 *    string FileName = HttpContext.Current.Server.MapPath(".") + "\\downloads\\tested.xml";
                 *
                 *                 Document dc = new Document();
                 *            dc.LoadFromFile(fileNameXML, FileFormat.Doc);
                 *            dc.SaveToFile(FileName, FileFormat.Xml);
                 *            //dc.SaveToStream(HttpContext.Current.Response.OutputStream, FileFormat.Xml);
                 */

                /*
                 * if(false)
                 * {
                 *      int len = contents.Length+50;
                 *      HttpContext.Current.Response.ContentType = "application/ms-excel";
                 *      HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=PropertyProfile.xls");
                 *      HttpContext.Current.Response.AppendHeader("Content-Length", len.ToString());
                 *
                 * HttpContext.Current.Response.Write(contents + "                                                  ");
                 *      HttpContext.Current.Response.Flush();
                 * }
                 */
            }
        }
    }
コード例 #17
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);
            }
        }
    }
コード例 #18
0
    /// <summary>
    /// Persist to DB and send email notification
    /// </summary>
    /// <returns>result of email notification</returns>
    protected string UpdateRequest()
    {
        if (!fuAttachment.HasFile)
        {
            return("No File Uploaded.");
        }

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

        // if a file was provided, then upload it
        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();
        //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);

        Affinity.Account me = this.GetAccount();
        bool             isNotSurveyServices = this.request.GetDataValue("SurveyServices").Equals("");

        string to    = "[email protected], [email protected]";
        string state = this.request.Order.PropertyState.ToUpper();

        if (isNotSurveyServices && (state.Equals("IN") || state.Equals("MI") || state.Equals("FL")))
        {
            to += ", " + ((state.Equals("IN"))? "*****@*****.**" : (state.Equals("MI"))? "*****@*****.**" : "*****@*****.**");
        }

        MailMessage mm = new MailMessage(this.GetSystemSetting("SendFromEmail"), to, "File Uploaded for Affinity Order '" + this.request.Order.ClientName.Replace("\r", "").Replace("\n", "") + "' #" + this.request.Order.WorkingId, "File: " + att.Name + " (" + fileName + ") was uploaded to: #" + this.request.Order.WorkingId + " and was uploaded by: " + me.FirstName + " " + me.LastName + "<br /><br /><br />\r\n\r\n" + this.GetSystemSetting("EmailFooter"));

        mm.IsBodyHtml = true;
        mm.Priority   = MailPriority.Normal;

        if (File.Exists(Server.MapPath("./") + "attachments/" + fileName))
        {
            Attachment attch = new Attachment(Server.MapPath("./") + "attachments/" + fileName);
            attch.Name = fileName;

            mm.Attachments.Add(attch);
        }
        //SmtpClient sc = new SmtpClient(this.GetSystemSetting("SmtpHost"));
        //sc.Send(mm);

        Com.VerySimple.Email.Mailer mailer = new Com.VerySimple.Email.Mailer(this.GetSystemSetting("SmtpHost"));
        mailer.Send(mm);

        return("File was uploaded successfully.");
    }
コード例 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
         * // get stack trace
         * System.Diagnostics.StackFrame fr = new System.Diagnostics.StackFrame(1, true);
         * System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(fr);
         * Response.Write( "method = " + fr.GetMethod().Name + " trace = " + st.ToString() );
         */
        // we have to call the base first so phreezer is instantiated
        base.PageBase_Init(sender, e);
        PageBase pb = (PageBase)this.Page;

        Affinity.Account acc      = pb.GetAccount();
        string           contents = "";

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

        //Response.Write(Request["file"]);
        //Response.End();

        if (id > 0)
        {
            Affinity.Order order = new Affinity.Order(this.phreezer);
            order.Load(id);

            int filecount = 0;
            this.Master.SetLayout("Documents", MasterPage.LayoutStyle.ContentOnly);
            if (Request["file"] != null)
            {
                string [] file        = Request["file"].Split(',');
                string [] MailAddress = "".Split(',');

                if (Request["MailAddress"] != null)
                {
                    MailAddress = Request["MailAddress"].Split(',');
                }

                for (int i = 0; i < file.Length; i++)
                {
                    if ((file[i].Equals("WD") || file[i].Equals("WD_S") || file[i].Equals("WD_JT") || file[i].Equals("WD_TE")) && Request["warrantyfile"] == null)
                    {
                        continue;
                    }
                    string path = HttpContext.Current.Server.MapPath(".") + "\\downloads\\" + file[i] + ".xml";
                    if (File.Exists(path))
                    {
                        filecount++;
                    }
                }

                //Response.Write(path);

                string header = "";
                string footer = "";

                using (FileStream fs = new FileStream(HttpContext.Current.Server.MapPath(".") + "\\downloads\\header.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite))
                {
                    using (StreamReader sr = new StreamReader(fs))
                    {
                        header = sr.ReadToEnd() + "\n";
                    }
                }

                using (FileStream fs = new FileStream(HttpContext.Current.Server.MapPath(".") + "\\downloads\\footer.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite))
                {
                    using (StreamReader sr = new StreamReader(fs))
                    {
                        footer = sr.ReadToEnd() + "\n";
                    }
                }

                contents = header;

                for (int i = 0; i < file.Length; i++)
                {
                    if ((file[i].Equals("WD") || file[i].Equals("WD_S") || file[i].Equals("WD_JT") || file[i].Equals("WD_TE")) && Request["warrantyfile"] == null)
                    {
                        continue;
                    }
                    string path = HttpContext.Current.Server.MapPath(".") + "\\downloads\\" + file[i] + ".xml";
                    if (File.Exists(path))
                    {
                        using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
                        {
                            using (StreamReader sr = new StreamReader(fs))
                            {
                                contents += sr.ReadToEnd();
                                if ((i + 1) < filecount)
                                {
                                    contents += "\n\n\n<w:p w:rsidR=\"00F4055C\" w:rsidRDefault=\"00F4055C\"/><w:p w:rsidR=\"005D7E36\" w:rsidRDefault=\"005D7E36\"><w:r><w:br w:type=\"page\"/></w:r></w:p><w:p w:rsidR=\"005D7E36\" w:rsidRDefault=\"005D7E36\"><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/><w:bookmarkEnd w:id=\"0\"/></w:p>";
                                }
                            }
                        }
                    }
                }


                contents += footer;

                //Response.Write(contents);

                //Response.End();
                string   County              = "";
                string   CommittmentDate     = "";
                string   Grantee             = "";
                string   Grantor             = "";
                string   Grantee2            = "";
                string   Grantor2            = "";
                DateTime DeedDate            = order.ClosingDate;
                string   ContractDate        = "";
                string   BuyersName          = "";
                string   SellersName         = "";
                string   SellersAddress      = "";
                string   BuyersAddress       = "";
                string   GrantorAddressLine1 = "";
                string   GrantorAddressLine2 = "";
                string   GrantorCity         = "";
                string   GrantorState        = "";
                string   GrantorZip          = "";
                string   GrantorCounty       = "";
                DateTime now                    = DateTime.Now;
                string   DateDay                = Ordinal(now.Day).ToString();
                string   DateMonth              = now.ToString("MMMM");
                string   DateYear               = now.ToString("yyyy");
                string   PIN                    = "";
                string   SellersAttorney        = "";
                string   SellersAttorneyAddress = "";

                int    day             = DeedDate.Day;
                string DeedDateOrdinal = day.ToString();

                if (day == 11 || day == 12 || day == 13)
                {
                    DeedDateOrdinal += "th";
                }
                else
                {
                    switch (day % 10)
                    {
                    case 1: DeedDateOrdinal += "st"; break;

                    case 2: DeedDateOrdinal += "nd"; break;

                    case 3: DeedDateOrdinal += "rd"; break;

                    default: DeedDateOrdinal += "th"; break;
                    }
                }

                //Response.Write(request.Xml);
                //Response.End();

                try {
                    XmlDocument doc = new XmlDocument();
                    // show the details for the active requests
                    Affinity.Requests rs = order.GetCurrentRequests();

                    foreach (Affinity.Request r in rs)
                    {
                        if (r.IsCurrent)
                        {
                            doc.LoadXml(r.Xml);
                            //Response.Write(r.Xml);
                            //Response.End();

                            XmlNode node = doc.SelectSingleNode("//response/field[@name = 'CommittmentDeadline']");
                            if (node != null)
                            {
                                CommittmentDate = XMLEscape(node.InnerText.Replace("T:00:00:00", ""));
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Seller']");
                            if (node != null)
                            {
                                SellersName = XMLEscape(node.InnerText);
                            }
                            Grantor = SellersName;

                            node = doc.SelectSingleNode("//response/field[@name = 'Seller1Name2']");
                            if (node != null)
                            {
                                Grantor2 = " and " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer']");
                            if (node != null)
                            {
                                BuyersName = XMLEscape(node.InnerText);
                            }
                            Grantee = BuyersName;

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer1Name2']");
                            if (node != null)
                            {
                                Grantee2    = " and " + XMLEscape(node.InnerText);
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer2Name1']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer2Name2']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer3Name1']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer3Name2']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer4Name1']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer4Name2']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer5Name1']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'Buyer5Name2']");
                            if (node != null)
                            {
                                BuyersName += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'ApplicantAddress']");
                            if (node != null)
                            {
                                BuyersAddress = XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'ApplicantAddress2']");
                            if (node != null)
                            {
                                BuyersAddress += " " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'ApplicantCity']");
                            if (node != null)
                            {
                                BuyersAddress += " " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'ApplicantState']");
                            if (node != null)
                            {
                                BuyersAddress += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'ApplicantZip']");
                            if (node != null)
                            {
                                BuyersAddress += " " + XMLEscape(node.InnerText);
                            }
                            BuyersAddress = BuyersAddress.Trim();

                            node = doc.SelectSingleNode("//response/field[@name = 'SellersAttorneyName']");
                            if (node != null)
                            {
                                SellersAttorney = XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'SellersAttorneyAddress']");
                            if (node != null)
                            {
                                SellersAttorneyAddress = XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'SellersAttorneyAddress2']");
                            if (node != null)
                            {
                                SellersAttorneyAddress += " " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'SellersAttorneyCity']");
                            if (node != null)
                            {
                                SellersAttorneyAddress += " " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'SellersAttorneyState']");
                            if (node != null)
                            {
                                SellersAttorneyAddress += ", " + XMLEscape(node.InnerText);
                            }

                            node = doc.SelectSingleNode("//response/field[@name = 'SellersAttorneyZip']");
                            if (node != null)
                            {
                                SellersAttorneyAddress += " " + XMLEscape(node.InnerText);
                            }

                            GrantorAddressLine1 = XMLEscape(order.PropertyAddress);
                            GrantorAddressLine2 = XMLEscape(order.PropertyAddress2);
                            GrantorCity         = XMLEscape(order.PropertyCity);
                            GrantorState        = XMLEscape(order.PropertyState);
                            GrantorZip          = XMLEscape(order.PropertyZip);
                            GrantorCounty       = XMLEscape(order.PropertyCounty);

                            SellersAddress = GrantorAddressLine1 + " " + GrantorAddressLine2 + " " + GrantorCity + ", " + GrantorState + " " + GrantorZip;

                            ContractDate = XMLEscape(order.ClosingDate.ToString()).Replace(" 12:00:00 AM", "");

                            County = order.PropertyCounty;
                            PIN    = order.Pin;
                        }
                    }
                } catch (Exception err) {}

                contents = contents.Replace("[COUNTY]", County).Replace("[GRANTOR]", Grantor).Replace("[GRANTOR2]", Grantor2).Replace("[GRANTORCITY]", GrantorCity).Replace("[GRANTORCOUNTY]", GrantorCounty).Replace("[GRANTORADDRESSLINE1]", GrantorAddressLine1).Replace("[GRANTORADDRESSLINE2]", GrantorAddressLine2).Replace("[GRANTEE]", Grantee).Replace("[GRANTEE2]", Grantee2).Replace("[DEEDDATE]", DeedDate.ToString("MM/dd/yyyy")).Replace("[DEEDMONTH]", DeedDate.ToString("MMMM")).Replace("[DEEDYEAR]", DeedDate.ToString("yyyy")).Replace("[DEEDDAY]", DeedDateOrdinal).Replace("[CONTRACTDATE]", ContractDate).Replace("[BUYERSNAME]", BuyersName).Replace("[BUYERSADDRESS]", BuyersAddress).Replace("[SELLERSNAME]", SellersName).Replace("[SELLERSADDRESS]", SellersAddress).Replace("[COMMITMENTDATE]", CommittmentDate).Replace("[DATEDAY]", DateDay).Replace("[DATEMONTH]", DateMonth).Replace("[DATEYEAR]", DateYear).Replace("[PIN]", PIN).Replace("[SELLERSATTORNEY]", SellersAttorney).Replace("[SELLERSATTORNEYADDRESS]", SellersAttorneyAddress);

                contents = contents.Replace("[MAILTONAME]", "");
                contents = contents.Replace("[MAILTOADDRESS1]", "");
                contents = contents.Replace("[MAILTOADDRESS2]", "");

                contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type month]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type year]\" </w:instrText>", "");

                if (!County.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type in county]\" </w:instrText>", "");
                }

                if (!CommittmentDate.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type in commitment date]\" </w:instrText>", "");
                }

                if (!Grantee.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantee's name]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantees' names]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantee's name]\" </w:instrText>", "");
                }

                if (!Grantor.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantor's name]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantors' names]\" </w:instrText>", "");
                }

                if (!GrantorAddressLine1.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantor's address line 1]\" </w:instrText>", "");
                }

                if (!GrantorAddressLine1.Equals("") || !GrantorAddressLine2.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantor's address line 2]\" </w:instrText>", "");
                }

                if (!GrantorCity.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantors' town]\" </w:instrText>", "");
                }

                if (!GrantorCounty.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantors’s County]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type county]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type in County}\" </w:instrText>", "");
                }

                if (!DeedDate.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type in date of deed]\" </w:instrText>", "");
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type month of deed]\" </w:instrText>", "");
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type date of deed]\" </w:instrText>", "");
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type month of deed]\" </w:instrText>", "");
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type year of deed]\" </w:instrText>", "");
                }

                if (!ContractDate.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type contract date]\" </w:instrText>", "");
                }

                if (!SellersName.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type sellers' names]\" </w:instrText>", "");
                }

                if (!BuyersName.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type buyers' name]\" </w:instrText>", "");
                }

                if (!BuyersAddress.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type buyers' address]\" </w:instrText>", "");
                }

                if (!SellersAddress.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type sellers' address]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesInDoc \"[Click and type property address]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantee's address]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type property address]\" </w:instrText>", "").Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type grantees' address]\" </w:instrText>", "");
                }

                if (!PIN.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type PIN]\" </w:instrText>", "");
                }

                if (!SellersAttorney.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type Attorney's Name]\" </w:instrText>", "");
                }

                if (!SellersAttorneyAddress.Equals(""))
                {
                    contents = contents.Replace("<w:instrText xml:space=\"preserve\"> MACROBUTTON  AcceptAllChangesShown \"[Click here and type Attorney's Address]\" </w:instrText>", "");
                }

                /*
                 * string fileNameXML = HttpContext.Current.Server.MapPath(".") + "\\downloads\\Disclosure_Agent.doc";
                 *    string FileName = HttpContext.Current.Server.MapPath(".") + "\\downloads\\tested.xml";
                 *
                 *                 Document dc = new Document();
                 *            dc.LoadFromFile(fileNameXML, FileFormat.Doc);
                 *            dc.SaveToFile(FileName, FileFormat.Xml);
                 *            //dc.SaveToStream(HttpContext.Current.Response.OutputStream, FileFormat.Xml);
                 */

                int len = contents.Length + 50;
                HttpContext.Current.Response.ContentType = "application/ms-word";
                HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=ATS.doc");
                HttpContext.Current.Response.AppendHeader("Content-Length", len.ToString());

                HttpContext.Current.Response.Write(contents + "                                                  ");
                HttpContext.Current.Response.Flush();
            }
        }
    }
コード例 #20
0
    /// <summary>
    /// This processed the order re-assign
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDoReAssign_Click(object sender, EventArgs e)
    {
        this.RequirePermission(Affinity.RolePermission.AffinityManager);
        Affinity.Account acct = new Affinity.Account(this.phreezer);
        acct.Load(ddNewOriginator.SelectedValue);
        txtOriginator.Text = acct.FullName;

        Affinity.Request request;

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

        Affinity.Requests requests = new Affinity.Requests(this.phreezer);

        Affinity.RequestCriteria rc = new Affinity.RequestCriteria();
        rc.OrderId = id;
        requests.Query(rc);

        XmlDocument prefDoc = new XmlDocument();

        prefDoc.LoadXml(acct.PreferencesXml);

        foreach (Affinity.Request req in requests)
        {
            req.OriginatorId = acct.Id;

            if (req.RequestTypeCode.Equals("Order"))
            {
                XmlDocument reqDoc = new XmlDocument();
                reqDoc.LoadXml(req.Xml);

                // ApplicantName
                XmlNode reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantName']");
                XmlNode prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantName']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantAttorneyName
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantAttorneyName']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAttorneyName']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantAddress
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantAddress']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAddress']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantAddress2
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantAddress2']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAddress2']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantCity
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantCity']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantCity']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantState
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantState']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantState']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantZip
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantZip']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantZip']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantPhone
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantPhone']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantPhone']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantFax
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantFax']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantFax']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantEmail
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantEmail']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantEmail']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }

                // ApplicantAttentionTo
                reqNode  = reqDoc.SelectSingleNode("//field[@name='ApplicantAttentionTo']");
                prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAttentionTo']");

                if (prefNode != null && reqNode != null)
                {
                    reqNode.InnerText = prefNode.InnerText;
                }
                req.Xml = reqDoc.OuterXml;
                req.Update();
            }
        }

        this.order.OriginatorId = acct.Id;
        this.order.Update();

        txtOriginator.Visible = true;
        //txtOriginator.Text = request.Id.ToString() + " - " + request.OrderId.ToString();
        btnReAssign.Visible     = true;
        ddNewOriginator.Visible = false;
        btnDoReAssign.Visible   = false;
    }
コード例 #21
0
ファイル: Export.aspx.cs プロジェクト: radtek/affinityistitle
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RequirePermission(Affinity.RolePermission.SubmitOrders);
        string id           = NoNull.GetString(Request["id"]);
        string keyAttribute = NoNull.GetString(Request["key"], "sp_id");
        string format       = NoNull.GetString(Request["format"], "hash");
        string exportformat = "PFT";

        if (!format.Equals("entire"))
        {
            Affinity.Request r = new Affinity.Request(this.phreezer);
            r.Load(id);

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

            IBaseRenderer renderer = null;

            // depending on the format requested, get the correct renderer object
            switch (format)
            {
            case "entire":
                break;

            case "xml":
                exportformat = "Generic XML";
                renderer     = new XmlRenderer(r, this.GetSystemSettings());
                break;

            case "rei":
                exportformat = "REI XML";
                renderer     = new XmlREIRenderer(r, this.GetSystemSettings());
                break;

            case "change":
                exportformat = "PFT (Changes Only)";
                renderer     = new PFTChangeRenderer(r, this.GetSystemSettings());
                break;

            case "TPS":
                exportformat = "TPS";
                renderer     = new TPSServicePFTRenderer(r, this.GetSystemSettings());
                break;

            //case "special":
            //	renderer = new XmlSpecialRenderer(r, this.GetSystemSettings());
            //	break;
            default:
                renderer = new PFTRenderer(r, this.GetSystemSettings());
                break;
            }

            Affinity.ExportLog exportlog = new Affinity.ExportLog(this.phreezer);
            Affinity.Account   account   = this.GetAccount();
            exportlog.AccountID    = account.Id;
            exportlog.OrderID      = r.OrderId;
            exportlog.RequestID    = r.Id;
            exportlog.ExportFormat = exportformat;
            exportlog.Insert();

            // output the results of the renderer
            OutputRenderer(renderer, keyAttribute);
        }
        else
        {
            Affinity.RequestTypes        rts = new Affinity.RequestTypes(this.phreezer);
            Affinity.RequestTypeCriteria rtc = new Affinity.RequestTypeCriteria();
            rtc.IsActive = 1;
            rts.Query(rtc);
            Object [] renderers = new Object[rts.Count];

            IEnumerator      i = rts.GetEnumerator();
            int              j = 0;
            bool             isClerkingServices = false;
            Affinity.Account account            = this.GetAccount();
            exportformat = "Entire Order";

            while (i.MoveNext())
            {
                Affinity.RequestType rt    = (Affinity.RequestType)i.Current;
                Affinity.Order       order = new Affinity.Order(this.phreezer);
                order.Load(id);

                Affinity.RequestCriteria rc = new Affinity.RequestCriteria();
                rc.RequestTypeCode = rt.Code;
                order.GetOrderRequests(rc);

                Affinity.Requests reqs = order.GetOrderRequests(rc);
                Affinity.Request  r    = null;

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

                    if (rt.Code.Equals("ClerkingRequest"))
                    {
                        isClerkingServices = true;
                    }
                    IBaseRenderer renderer = new PFTRenderer(r, this.GetSystemSettings());

                    renderers[j] = renderer;

                    j++;
                }

                if (r != null)
                {
                    Affinity.ExportLog exportlog = new Affinity.ExportLog(this.phreezer);
                    exportlog.AccountID    = account.Id;
                    exportlog.OrderID      = r.OrderId;
                    exportlog.RequestID    = r.Id;
                    exportlog.ExportFormat = exportformat;
                    exportlog.Insert();
                }
            }

            OutputMultiRenderer(renderers, keyAttribute, isClerkingServices);
        }
    }
コード例 #22
0
    /// <summary>
    /// submit the order
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        this.RequirePermission(Affinity.RolePermission.AffinityManager);

        if (!fuAttachment.HasFile)
        {
            pnlResults.Visible = true;
            pResults.InnerHtml = "<h3 style=\"color:red;\">No File Uploaded.  Please choose an Excel file to upload.<h3>";
        }
        else
        {
            int    accountidInt     = 0;
            string originalfilename = fuAttachment.FileName;
            string ext             = System.IO.Path.GetExtension(fuAttachment.FileName);
            string accountid       = ddNewOriginator.SelectedValue;
            string county          = txtPropertyCounty.Text;
            string transactiontype = ddTransactionType.SelectedValue;
            string tractsearch     = (TractSearch.Checked.Equals("True")? "Yes" : "No");

            int.TryParse(accountid, out accountidInt);

            // Get the next available Internal ID and then increment for each order
            int internalId = 0;

            using (MySqlDataReader reader = this.phreezer.ExecuteReader("select Max(REPLACE(REPLACE(o_internal_id, 'AFF_', ''), 'AFF', '')) as maxId from `order` where o_internal_id like 'AFF%'"))
            {
                if (reader.Read())
                {
                    string numStr = reader["maxId"].ToString();
                    int.TryParse(numStr, out internalId);
                    internalId++;
                }
            }

            string internalIdStr = internalId.ToString();
            string filename      = internalIdStr + ext;
            int    uploadidInt   = 0;

            using (MySqlDataReader reader = this.phreezer.ExecuteReader("insert into order_upload_log (oul_a_id, oul_original_filename, oul_filename, oul_starting_internal_id, oul_created, oul_modified) VALUES (" + this.GetAccount().Id.ToString() + ", '" + originalfilename + "', '" + filename + "', " + internalIdStr + ", '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'); SELECT @@IDENTITY as id;"))
            {
                if (reader.Read())
                {
                    int.TryParse(reader["id"].ToString(), out uploadidInt);
                }
            }

            SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
            string path     = Server.MapPath(".\\") + "XlsUploads\\";
            string filepath = path + filename;

            if (File.Exists(filepath))
            {
                File.Delete(filepath);
            }
            fuAttachment.SaveAs(filepath);

            ExcelFile xlsFile = new ExcelFile();

            if (ext.Equals(".xlsx"))
            {
                string zippath = path + internalIdStr + "\\";

                if (!Directory.Exists(zippath))
                {
                    Directory.CreateDirectory(zippath);
                }

                string zipfilepath = path + internalIdStr + ".zip";
                if (File.Exists(zipfilepath))
                {
                    File.Delete(zipfilepath);
                }
                File.Move(filepath, zipfilepath);
                Xceed.Zip.Licenser.LicenseKey = "ZIN20N4AFUNK71J44NA";
                string[] sarr = { "*" };


                Xceed.Zip.QuickZip.Unzip(zipfilepath, zippath, sarr);
                xlsFile.LoadXlsxFromDirectory(zippath, XlsxOptions.None);
            }
            else
            {
                xlsFile.LoadXls(path);
            }
            ExcelWorksheet ws = xlsFile.Worksheets[0];

            pnlResults.Visible = true;
            pnlForm.Visible    = false;
            btnSubmit.Visible  = false;
            btnCancel.Text     = "Back to Admin";
            ListDictionary duplicatePINs = new ListDictionary();


            string pin                 = " ";
            string address             = " ";
            string address1            = "";
            string address2            = "";
            string city                = "";
            string state               = "";
            string zip                 = "";
            string firmname            = "";
            string attorney            = "";
            string attorneyaddress1    = "";
            string attorneyaddress2    = "";
            string attorneycity        = "";
            string attorneystate       = "";
            string attorneyzip         = "";
            string attorneyphone       = "";
            string attorneyemail       = "";
            string attorneyattentionto = "";
            int    idx                 = 1;

            /****************************************************************************************
            *  GET ACCOUNT INFORMATION
            ****************************************************************************************/
            Affinity.Account account = new Affinity.Account(this.phreezer);

            account.Load(accountid);

            XmlDocument preferencesXML = new XmlDocument();
            preferencesXML.LoadXml(account.PreferencesXml);

            XmlNode node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantName']");
            if (node != null)
            {
                firmname = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantAttorneyName']");
            if (node != null)
            {
                attorney = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantAddress']");
            if (node != null)
            {
                attorneyaddress1 = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantAddress2']");
            if (node != null)
            {
                attorneyaddress2 = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantCity']");
            if (node != null)
            {
                attorneycity = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantState']");
            if (node != null)
            {
                attorneystate = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantZip']");
            if (node != null)
            {
                attorneyzip = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantPhone']");
            if (node != null)
            {
                attorneyphone = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantEmail']");
            if (node != null)
            {
                attorneyemail = node.InnerText;
            }

            node = preferencesXML.SelectSingleNode("//Field[@name='ApplicantAttentionTo']");
            if (node != null)
            {
                attorneyattentionto = node.InnerText;
            }

            string xml = "<response><field name=\"CommittmentDeadline\"></field><field name=\"PreviousTitleEvidence\"></field><field name=\"Prior\"></field><field name=\"TypeOfProperty\">Single Family</field><field name=\"PropertyUse\"></field><field name=\"TransactionType\">[TRANSACTIONTYPE]</field><field name=\"TractSearch\">[TRACTSEARCH]</field><field name=\"ShortSale\"></field><field name=\"Foreclosure\"></field><field name=\"CashSale\"></field><field name=\"ConstructionEscrow\"></field><field name=\"ReverseMortgage\"></field><field name=\"EndorsementEPA\"></field><field name=\"EndorsementLocation\"></field><field name=\"EndorsementCondo\"></field><field name=\"EndorsementComp\"></field><field name=\"EndorsementARM\"></field><field name=\"EndorsementPUD\"></field><field name=\"EndorsementBalloon\"></field><field name=\"EndorsementOther\"></field><field name=\"MortgageAmount\">1.00</field><field name=\"PurchasePrice\"></field><field name=\"TRID\">No</field><field name=\"LoanNumber\"></field><field name=\"SecondMortgage\">No</field><field name=\"SecondMortgageAmount\"></field><field name=\"LoanNumber2nd\"></field><field name=\"ChainOfTitle\">No</field><field name=\"Buyer\">" + (TractSearch.Checked.Equals("True")? "." : "") + "</field><field name=\"Buyer1Name2\"></field><field name=\"AddBuyer2\"></field><field name=\"Buyer2Name1\"></field><field name=\"Buyer2Name2\"></field><field name=\"AddBuyer3\"></field><field name=\"Buyer3Name1\"></field><field name=\"Buyer3Name2\"></field><field name=\"AddBuyer4\"></field><field name=\"Buyer4Name1\"></field><field name=\"Buyer4Name2\"></field><field name=\"AddBuyer5\"></field><field name=\"Buyer5Name1\"></field><field name=\"Buyer5Name2\"></field><field name=\"Seller\"></field><field name=\"Seller1Name2\"></field><field name=\"AddSeller2\"></field><field name=\"Seller2Name1\"></field><field name=\"Seller2Name2\"></field><field name=\"AddSeller3\"></field><field name=\"Seller3Name1\"></field><field name=\"Seller3Name2\"></field><field name=\"AddSeller4\"></field><field name=\"Seller4Name1\"></field><field name=\"Seller4Name2\"></field><field name=\"AddSeller5\"></field><field name=\"Seller5Name1\"></field><field name=\"Seller5Name2\"></field><field name=\"Underwriter\"></field><field name=\"ApplicantName\">[FIRMNAME]</field><field name=\"ApplicantAttorneyName\">[ATTORNEY]</field><field name=\"ApplicantAddress\">[ADDRESS1]</field><field name=\"ApplicantAddress2\">[ADDRESS1]</field><field name=\"ApplicantCity\">[CITY]</field><field name=\"ApplicantState\">[STATE]</field><field name=\"ApplicantZip\">[ZIP]</field><field name=\"ApplicantPhone\">[PHONE]</field><field name=\"ApplicantFax\"></field><field name=\"ApplicantEmail\">[EMAIL]</field><field name=\"ApplicantAttentionTo\">[ATTENTIONTO]</field><field name=\"CopyApplicationTo\"></field><field name=\"LenderName\"></field><field name=\"LenderContact\"></field><field name=\"LenderAddress\"></field><field name=\"LenderAddress2\"></field><field name=\"LenderCity\"></field><field name=\"LenderState\"></field><field name=\"LenderZip\"></field><field name=\"LenderPhone\"></field><field name=\"LenderFax\"></field><field name=\"LenderEmail\"></field><field name=\"BrokerName\"></field><field name=\"BrokerLoanOfficer\"></field><field name=\"BrokerAddress\"></field><field name=\"BrokerAddress2\"></field><field name=\"BrokerCity\"></field><field name=\"BrokerState\"></field><field name=\"BrokerZip\"></field><field name=\"BrokerPhone\"></field><field name=\"BrokerFax\"></field><field name=\"BrokerEmail\"></field><field name=\"Notes\"></field><field name=\"Source\">Web Order ID</field><field name=\"SubmittedDate\">[DATE]</field><field name=\"OrderRequestStatus\">Requested</field></response>".Replace("[TRANSACTIONTYPE]", transactiontype).Replace("[TRACTSEARCH]", tractsearch).Replace("[FIRMNAME]", firmname).Replace("[ATTORNEY]", attorney).Replace("[ADDRESS1]", attorneyaddress1).Replace("[ADDRESS2]", attorneyaddress2).Replace("[CITY]", attorneycity).Replace("[STATE]", attorneystate).Replace("[ZIP]", attorneyzip).Replace("[PHONE]", attorneyphone).Replace("[EMAIL]", attorneyemail).Replace("[ATTENTIONTO]", attorneyattentionto).Replace("[DATE]", DateTime.Now.ToString());

            /****************************************************************************************
            *  END GETTING ACCOUNT INFORMATION
            ****************************************************************************************/

            while (!pin.Equals("") && ws.Rows[idx] != null && ws.Rows[idx].Cells[1] != null && ws.Rows[idx].Cells[1].Value != null)
            {
                pin                 = ws.Rows[idx].Cells[1].Value.ToString();
                address             = ws.Rows[idx].Cells[3].Value.ToString();
                address1            = "";
                address2            = "";
                city                = "";
                state               = "";
                zip                 = "";
                firmname            = "";
                attorney            = "";
                attorneyaddress1    = "";
                attorneyaddress2    = "";
                attorneycity        = "";
                attorneystate       = "";
                attorneyzip         = "";
                attorneyphone       = "";
                attorneyemail       = "";
                attorneyattentionto = "";

                if (!address.Equals(""))
                {
                    XmlDocument doc = new XmlDocument();
                    string      url = "http://maps.googleapis.com/maps/api/geocode/xml?address=" + address + "&key=";

                    System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
                    req.Method    = "GET";
                    req.Accept    = "text/xml";
                    req.KeepAlive = false;

                    System.Net.HttpWebResponse response = null;

                    using (response = (System.Net.HttpWebResponse)req.GetResponse()) //attempt to get the response.
                    {
                        using (Stream RespStrm = response.GetResponseStream())
                        {
                            doc.Load(RespStrm);
                        }
                    }

                    XmlNode streetnumbernode = doc.SelectSingleNode("/GeocodeResponse/result/address_component[type='street_number']");
                    if (streetnumbernode != null)
                    {
                        address1 += streetnumbernode.SelectSingleNode("long_name").InnerText;
                    }

                    XmlNode routenode = doc.SelectSingleNode("/GeocodeResponse/result/address_component[type='route']");
                    if (routenode != null)
                    {
                        address1 += " " + routenode.SelectSingleNode("long_name").InnerText;
                    }

                    XmlNode citynode = doc.SelectSingleNode("/GeocodeResponse/result/address_component[type='locality']");
                    if (citynode != null)
                    {
                        city = citynode.SelectSingleNode("long_name").InnerText;
                    }

                    if (county.Equals(""))
                    {
                        XmlNode countynode = doc.SelectSingleNode("/GeocodeResponse/result/address_component[type='administrative_area_level_2']");
                        if (countynode != null)
                        {
                            county = countynode.SelectSingleNode("long_name").InnerText;
                        }
                    }

                    XmlNode statenode = doc.SelectSingleNode("/GeocodeResponse/result/address_component[type='administrative_area_level_1']");
                    if (statenode != null)
                    {
                        state = statenode.SelectSingleNode("short_name").InnerText;
                    }

                    XmlNode zipnode = doc.SelectSingleNode("/GeocodeResponse/result/address_component[type='postal_code']");
                    if (zipnode != null)
                    {
                        zip = zipnode.SelectSingleNode("long_name").InnerText;
                    }

                    //Response.Write(idx.ToString() + " - " + pin + " - " + address1 + " - " + city + " - " + state + " - " + zip + " - " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "<br/>");

                    // create a new order for this request
                    Affinity.Order order = new Affinity.Order(this.phreezer);

                    order.OriginatorId       = accountidInt;
                    order.CustomerStatusCode = Affinity.OrderStatus.ReadyCode;
                    order.InternalStatusCode = Affinity.OrderStatus.ReadyCode;
                    order.InternalId         = "";

                    order.ClientName       = "";
                    order.Pin              = pin;
                    order.AdditionalPins   = "";
                    order.PropertyAddress  = address1;
                    order.PropertyAddress2 = address2;
                    order.PropertyCity     = city;
                    order.PropertyState    = state;
                    order.PropertyZip      = zip;
                    order.CustomerId       = pin;
                    order.PropertyCounty   = county;
                    order.PropertyUse      = "Residential";
                    order.OrderUploadLogId = uploadidInt;

                    try
                    {
                        Affinity.Order PreviousOrder = order.GetPrevious();
                        // verify the user has not submitted this PIN in the past
                        if (PreviousOrder == null)
                        {
                            order.Insert();
                            internalId++;

                            Affinity.Request rq = new Affinity.Request(this.phreezer);
                            rq.OrderId         = order.Id;
                            rq.OriginatorId    = accountidInt;
                            rq.RequestTypeCode = "Refinance";
                            rq.StatusCode      = Affinity.RequestStatus.DefaultCode;

                            rq.Xml = xml;

                            rq.Insert();
                        }
                        else
                        {
                            duplicatePINs.Add(pin, "");
                        }
                    }
                    catch (FormatException ex)
                    {
                        this.Master.ShowFeedback("Please check that the estimated closing date is valid and in the format 'mm/dd/yyyy'", MasterPage.FeedbackType.Error);
                    }
                }

                idx++;
            }
            pnlResults.Visible = true;
            pResults.InnerHtml = "<h1 style=\"color:black;\">" + (idx - duplicatePINs.Count).ToString() + " orders have been imported. " + duplicatePINs.Count.ToString() + " records failed.</h1>";
        }
    }