Exemple #1
0
    protected void gvrGrid_rowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            GridView gev = (GridView)e.Row.FindControl("elGrid");

            Affinity.ExportLogs el = new Affinity.ExportLogs(this.phreezer);
            // populate current exports grid
            Affinity.ExportLogCriteria elc = new Affinity.ExportLogCriteria();
            Affinity.Request           r   = (Affinity.Request)e.Row.DataItem;
            elc.RequestID = r.Id;
            el.Query(elc);

            gev.DataSource = el;
            gev.DataBind();


            GridView guv = (GridView)e.Row.FindControl("ulGrid");

            Affinity.UploadLogs ul = new Affinity.UploadLogs(this.phreezer);
            // populate current uploads grid
            Affinity.UploadLogCriteria ulc = new Affinity.UploadLogCriteria();
            ulc.RequestID = r.Id;
            ul.Query(ulc);

            guv.DataSource = ul;
            guv.DataBind();
        }
    }
Exemple #2
0
    /// <summary>
    /// Send a survey services notification
    /// </summary>
    /// <param name="r"></param>
    /// <param name="isCancel"></param>
    /// <param name="isNew"></param>
    protected void SendSurveyNotification(Affinity.Request r, bool isCancel, bool isNew)
    {
        string to = this.GetSystemSetting("SurveyServicesEmail");

        // send the notification email if the originator wants it
        if (!to.Equals(""))
        {
            string url     = this.GetSystemSetting("RootUrl") + "AdminOrder.aspx?id=" + r.Order.Id.ToString();
            string header  = isNew ? "Survey Request" : "Survey Cancellation";
            string subject = "Affinity " + header + " For " + r.Order.WorkingId;

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

            string msg = "* This is an automated notification from the Affinity Web System *\r\n\r\n"
                         + "Type: " + header + "\r\n"
                         + "Submitted By: " + r.Order.Account.FullName + "\r\n"
                         + "Working ID: " + r.Order.WorkingId + "\r\n"
                         + "PIN: " + r.Order.Pin + "\r\n"
                         + "Friendly: " + r.Order.ClientName + "\r\n"
                         + "Tracking Code: " + r.Order.CustomerId + "\r\n"
                         + "\r\n"
                         + "URL: " + url + "\r\n"
                         + "\r\n"
                         + "If you no longer wish to receive these notifications, please contact the Affinity Administrator.\r\n"
                         + this.GetSystemSetting("EmailFooter");

            mailer.Send(
                this.GetSystemSetting("SendFromEmail")
                , to.Replace(";", ",")
                , subject
                , msg);
        }
    }
Exemple #3
0
    /// <summary>
    /// The form controls are created at this point.  if we create them at page load
    /// then their viewstate will not be persisted.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    override protected void PageBase_Init(object sender, System.EventArgs e)
    {
        // we have to call the base first so phreezer is instantiated
        base.PageBase_Init(sender, e);

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

        request = new Affinity.Request(this.phreezer);
        Affinity.Order order = new Affinity.Order(this.phreezer);
        order.Load(id);
        Affinity.RequestCriteria criteria = new Affinity.RequestCriteria();
        Affinity.Requests        reqs     = order.GetOrderRequests(criteria);
        Affinity.Request         req      = (Affinity.Request)reqs[0];
        this.request.Load(req.Id);
    }
    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);

        request = new Affinity.Request(this.phreezer);
        this.request.Load(id);

        // add the form for the request details
        XmlForm xf = new XmlForm(this.request.Account);

        pnlDetails.Controls.Add(xf.GetFormFieldControl(request.RequestType.Definition, request.Xml));
    }
Exemple #5
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>";
        }
    }
Exemple #6
0
    /// <summary>
    /// Sends a notification to the affinity administrator if set in the system settings
    /// </summary>
    /// <param name="r"></param>
    protected void SendNotification(Affinity.Request r)
    {
        bool isNewRequest        = this.isChange == false && r.RequestTypeCode != Affinity.RequestType.DefaultChangeCode;
        bool isClosing           = (r.RequestTypeCode == Affinity.RequestType.ClosingRequestCode);
        bool isClerking          = (r.RequestTypeCode == Affinity.RequestType.ClerkingRequestCode);
        bool isNotSurveyServices = r.GetDataValue("SurveyServices").Equals("");

        string to = isClosing ? this.GetSystemSetting("ClosingRequestEmail") : this.GetSystemSetting("NewOrderEmail");

        if (isClerking)
        {
            if (to.Equals(""))
            {
                to = this.GetSystemSetting("ClerkingRequestEmail");
            }
            else
            {
                to += ", " + this.GetSystemSetting("ClerkingRequestEmail");
            }
        }

        string state = order.PropertyState.ToUpper();

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

        // send the notification email if the originator wants it
        if (!to.Equals(""))
        {
            string url     = this.GetSystemSetting("RootUrl") + "AdminOrder.aspx?id=" + r.Order.Id.ToString();
            string subject = "Affinity " + r.RequestTypeCode + " Notification For " + r.Order.WorkingId;
            string header  = isNewRequest ? "New Request" : "Change Request";

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

            string msg = "* This is an automated notification from the Affinity Web System *\r\n\r\n"
                         + "Type: " + r.RequestTypeCode + " - " + header + "\r\n"
                         + "Submitted By: " + r.Order.Account.FullName + "\r\n"
                         + "Working ID: " + r.Order.WorkingId + "\r\n"
                         + "PIN: " + r.Order.Pin + "\r\n"
                         + "Friendly: " + r.Order.ClientName + "\r\n"
                         + "Tracking Code: " + r.Order.CustomerId + "\r\n"
                         + "\r\n"
                         + "URL: " + url + "\r\n"
                         + "\r\n"
                         + "If you no longer wish to receive these notifications, please contact the Affinity Administrator.\r\n"
                         + this.GetSystemSetting("EmailFooter");

            mailer.Send(
                this.GetSystemSetting("SendFromEmail")
                , to.Replace(";", ",")
                , subject
                , msg);
        }
    }
Exemple #7
0
    /// <summary>
    /// The form controls are created at this point.  if we create them at page load
    /// then their viewstate will not be persisted.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    override protected void PageBase_Init(object sender, System.EventArgs e)
    {
        bool isRefinance = (Request["Refinance"] != null && Request["Refinance"].Equals("True"));

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


                    //log.Debug(r.Xml);
                    reqXml = reqXml.Replace("</response>", "") + busindxml +
                             XmlForm.XmlToString(order.GetResponse()).Replace("<response>", "").Replace("</response>", "") +
                             r.Xml.Replace("<response>", "");
                    pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, reqXml));
                }
                else
                {
                    reqXml = reqXml.Replace("</response>", "") + busindxml +
                             XmlForm.XmlToString(order.GetResponse()).Replace("<response>", "").Replace("</response>", "");
                    pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, XmlForm.XmlToString(order.GetResponse())));
                }
            }
            else
            {
                pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, reqXml));
            }
        }
    }
Exemple #8
0
    /// <summary>
    /// Hides the form and shows the results of the request submission
    /// </summary>
    protected void ShowConfirmation()
    {
        pnlResults.Visible = true;

        // hide all the form controls
        pnlForm.Visible         = false;
        btnSubmit.Visible       = false;
        btnChange.Visible       = false;
        btnCancelChange.Visible = false;
        btnCancelSubmit.Visible = false;

        pnlResults.Controls.Add(new LiteralControl("<div class=\"actions\">"));

        bool isTaxStampsSet = false;

        Affinity.RequestCriteria rc = new Affinity.RequestCriteria();
        rc.RequestTypeCode = "ClerkingRequest";

        Affinity.Requests reqs = order.GetOrderRequests(rc);

        int    requestCount    = reqs.Count;
        string changeParameter = "";

        // check to see if any Clerking Requests exist
        if (requestCount > 0)
        {
            Affinity.Request req = (Affinity.Request)reqs[requestCount - 1];

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(req.Xml);

            XmlNode clerkingservicenode = doc.SelectSingleNode("//field[@name='ClerkingServicesSuburbanTransferStamps']");

            if (clerkingservicenode != null)
            {
                string [] csnArry = clerkingservicenode.InnerText.ToLower().Split(',');
                int       csnLen  = csnArry.GetLength(0);

                for (int i = 0; i < csnLen; i++)
                {
                    // verify if city is selected
                    if (csnArry[i].Equals(order.PropertyCity.ToLower()))
                    {
                        isTaxStampsSet = true;
                        break;
                    }
                }
            }

            changeParameter = "change=" + req.Id.ToString() + "&";
        }

        if (!isTaxStampsSet && order.IsTaxStampsRequired())
        {
            if (changeParameter.Equals(""))
            {
                pnlResults.Controls.Add(new LiteralControl("<div class=\"notice\">The Tax District, " + order.PropertyCity + ", requires the purchase of tax stamps.<br>You can add tax stamps to this order by clicking on \"Add a Clerking Services Request to this Order\" below: </div>"));
            }
            else
            {
                pnlResults.Controls.Add(new LiteralControl("<div class=\"notice\">The Tax District, " + order.PropertyCity + ", requires the purchase of tax stamps.<br>You have an existing Clerking Request, but you didn't pick the stamp for your city.<br>You can add the tax stamp for your city to this order by clicking on \"Add a Clerking Services Request to this Order\" below and under the section heading \"SUBURBAN TRANSFER STAMPS\", check the checkbox next to " + order.PropertyCity + ": </div>"));
            }
        }
        else
        {
            isTaxStampsSet = true;
        }

        // show the available actions that can be done with this order
        Affinity.RequestTypes rts = order.GetAvailableRequestTypes();
        pnlResults.Controls.Add(new LiteralControl("<div class=\"actions\">"));
        foreach (Affinity.RequestType rt in rts)
        {
            if (rt.Code.Equals("ClerkingRequest"))
            {
                isTaxStampsSet = true;
            }
            pnlResults.Controls.Add(new LiteralControl("<div><a class=\"add\" href=\"MyRequestSubmit.aspx?id=" + order.Id + "&code=" + rt.Code + "\">Add a " + rt.Description + " to this Order</a></div>"));
        }
        if (!isTaxStampsSet)
        {
            pnlResults.Controls.Add(new LiteralControl("<div><a class=\"add\" href=\"MyRequestSubmit.aspx?" + changeParameter + "id=" + order.Id + "&code=ClerkingRequest\">Add a Clerking Services Request to this Order</a></div></div>"));
        }
        pnlResults.Controls.Add(new LiteralControl("</div>"));

        pnlResults.Controls.Add(new LiteralControl("<div><a class=\"order\" href=\"MyOrder.aspx?id=" + order.Id + "\">View My Order</a></div>"));
        pnlResults.Controls.Add(new LiteralControl("<div><a class=\"home\" href=\"MyAccount.aspx\">Return To My Account</a></div>"));
        pnlResults.Controls.Add(new LiteralControl("</div>"));
    }
Exemple #9
0
    /// <summary>
    /// submits the order
    /// </summary>
    protected void SubmitOrder()
    {
        this.header.InnerText = "Your order has been submitted";
        this.Master.SetLayout(this.header.InnerText, MasterPage.LayoutStyle.ContentOnly);

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

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

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

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

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

        req.Insert();

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

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

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

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

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

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

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

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

        //TODO: redirect to a thank-you page instead of just showing the message
        ShowConfirmation();
    }
Exemple #10
0
    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);
        }
    }