Example #1
0
        private bool PostLead(string xml_data, out string response_text)
        {
            bool ret_status = false;

            try
            {
                DataSet ds = new DataSet();
                ZillowAttributeCollection zcol = new ZillowAttributeCollection();

                // Parse the xml and populate the ZillowAttributeCollection
                using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml_data)))
                {
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        // copy data into collection
                        ds.ReadXml(reader, XmlReadMode.Auto);
                        zcol = ImportManager.ImportLeadFromZillowv5(ds);

                        // re-read the xml
                        stream.Seek(0, SeekOrigin.Begin);
                        zcol.ZillowXml = reader.ReadToEnd();
                    }
                }

                // Read security token
                zcol.PulseSecurityToken = Helpers.ReadSecurityToken();

                // Get Pulse Lead Request object from ZillowAttributeCollection
                PostLeadRequest pulse_lead_req = PulseLeadClient.GetPulseLeadRequest(zcol);

                // post request
                ResponseHdr response_hdr = PulseLeadClient.PostPulseLeadRequest(pulse_lead_req, zcol.ImportTransId.ToString());
                if (response_hdr.Successful)
                {
                    zcol.ReturnStatus = "Success";
                    ret_status        = true;
                    zcol.BorrowerId   = response_hdr._postArgs.ContactId;
                    zcol.CoborrowerId = response_hdr._postArgs.CoBorrowerContactId;
                    zcol.LoanId       = response_hdr._postArgs.LoanId;
                }
                else
                {
                    zcol.ReturnStatus = "Failed.";
                }
                zcol.Save();
                response_text = zcol.ReturnStatus;
            }
            catch (Exception ex)
            {
                response_text = "Application Error<br/>" + ex.Message;
                NLogger.Error(MethodBase.GetCurrentMethod().DeclaringType.FullName, MethodBase.GetCurrentMethod().Name, ex.Message, ex);
            }

            return(ret_status);
        }
Example #2
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet ds = new DataSet();
                ZillowAttributeCollection zcol = new ZillowAttributeCollection();

                // Parse the xml and populate the ZillowAttributeCollection
                using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(TextBoxZillowXml.Text)))
                {
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        // copy data into collection
                        ds.ReadXml(reader, XmlReadMode.Auto);
                        zcol = ImportManager.ImportLeadFromZillowv5(ds);

                        // re-read the xml
                        stream.Seek(0, SeekOrigin.Begin);
                        zcol.ZillowXml = reader.ReadToEnd();
                    }
                }

                // Read security token
                zcol.PulseSecurityToken = Helpers.ReadSecurityToken();

                // Get Pulse Lead Request object from ZillowAttributeCollection
                PostLeadRequest pulse_lead_req = PulseLeadClient.GetPulseLeadRequest(zcol);

                // post request
                ResponseHdr response_hdr = PulseLeadClient.PostPulseLeadRequest(pulse_lead_req, zcol.ImportTransId.ToString());
                if (response_hdr.Successful)
                {
                    zcol.ReturnStatus = "Success";
                    zcol.BorrowerId   = response_hdr._postArgs.ContactId;
                    zcol.CoborrowerId = response_hdr._postArgs.CoBorrowerContactId;
                    zcol.LoanId       = response_hdr._postArgs.LoanId;
                }
                else
                {
                    zcol.ReturnStatus = "Failed.";
                }
                zcol.Save();

                // display html formatted
                LiteralResults.Text = "<p>Response Status: " + zcol.ReturnStatus + "</p><p>" + Helpers.FriendlyHtml(zcol) + "</p>";
            }
            catch (Exception ex)
            {
                LiteralResults.Text = "Application Error<br/>" + ex.Message;
            }
        }
Example #3
0
        protected void ButtonParse_Click(object sender, EventArgs e)
        {
            try
            {
                // Parse the xml and populate the ZillowAttributeCollection
                StringReader tr = new StringReader(TextBoxZillowXml.Text);

                // move data into collection
                DataSet ds = new DataSet();
                ds.ReadXml(tr, XmlReadMode.Auto);
                ZillowAttributeCollection zcoll = ImportManager.ImportLeadFromZillowv5(ds);

                // display html formatted
                LiteralResults.Text = Helpers.FriendlyHtml(zcoll);
            }
            catch (Exception ex)
            {
                LiteralResults.Text = "Error: " + ex.Message;
            }
        }