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);
    }
Esempio n. 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);
        }
    }
Esempio n. 3
0
    protected string SendNotification(string message)
    {
        bool   sendEmail           = false;
        bool   userEmailPreference = false;
        string statusChange        = "";
        string actionTaken         = "";
        string emailPreferenceCode = "";         // this code will return empty string

        // file posted
        sendEmail           = true;
        userEmailPreference = this.request.Account.GetPreference("EmailOnFilePost").Equals("Yes");
        emailPreferenceCode = "EmailOnFilePostAddress";

        if (userEmailPreference == false)
        {
            actionTaken = "No email was sent based on the customer's " + emailPreferenceCode + " preference setting";
        }
        else
        {
            // the customer does want to receive this email

            string to      = this.request.Account.GetPreference(emailPreferenceCode, this.request.Order.Account.Email);
            string url     = this.GetSystemSetting("RootUrl") + "MyOrder.aspx?id=" + this.request.Order.Id.ToString();
            string subject = "Affinity Order '" + this.request.Order.ClientName.Replace("\r", "").Replace("\n", "") + "' #" + this.request.Order.WorkingId + " Updated";

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

            string msg = "Dear " + this.request.Order.Account.FirstName + ",\r\n\r\n"
                         + "Your Affinity " + this.request.RequestTypeCode + " for '" + this.request.Order.ClientName + "', ID #"
                         + this.request.Order.WorkingId + " has a new Attachment\r\n\r\n"
                         + (message != "" ? message + "\r\n\r\n" : "")
                         + "You may view the full details of your order anytime online at " + url + ".  "
                         + "If you would prefer to not receive this notification, you may also login "
                         + "to your Affinity account and customize your email notification preferences.\r\n\r\n"
                         + this.GetSystemSetting("EmailFooter");

            //Response.Write(msg);
            //Response.Write(this.GetSystemSetting("SendFromEmail"));
            //Response.Write(to);
            //Response.Write(subject);

            mailer.Send(
                this.GetSystemSetting("SendFromEmail")
                , to.Replace(";", ",")
                , subject
                , msg);

            actionTaken = "Email notification was sent to " + to;
        }

        return(actionTaken);
    }
    protected void btnSendTestEmail_Click(object sender, EventArgs e)
    {
        // send the test email
        string from    = this.GetSystemSetting("SendFromEmail");
        string to      = txtTestEmailAddress.Text.Replace("\r", "").Replace("\n", "");
        string smtp    = this.GetSystemSetting("SmtpHost");
        string subject = "Affinity Email Test Sent " + DateTime.Now.ToLongTimeString();

        Com.VerySimple.Email.Mailer mailer = new Com.VerySimple.Email.Mailer(smtp);


        string msg = "SmtpHost = '" + smtp + "'\r\n"
                     + "SendFromEmail = '" + from + "'\r\n"
                     + "TestEmailAddress = '" + to + "'\r\n\r\n"
                     + this.GetSystemSetting("EmailFooter");

        mailer.Send(from, to, subject, msg);

        this.Master.ShowFeedback(subject, MasterPage.FeedbackType.Information);
    }
Esempio n. 5
0
    protected string SendNotification(string oldStatus, string newStatus, bool filePosted, string message)
    {
        bool   sendEmail           = false;
        bool   userEmailPreference = false;
        string statusChange        = "";
        string actionTaken         = "";
        string emailPreferenceCode = "";         // this code will return empty string

        // if a file was posted and the status was changed, the file post takes priority
        if (filePosted == true)
        {
            // file posted
            sendEmail           = true;
            userEmailPreference = this.request.Account.GetPreference("EmailOnFilePost").Equals("Yes");
            emailPreferenceCode = "EmailOnFilePostAddress";
        }
        else if (oldStatus != newStatus)
        {
            // status update
            statusChange = "The new order status is '" + newStatus + ".'";
            sendEmail    = true;

            if (this.request.RequestTypeCode == Affinity.RequestType.ClosingRequestCode)
            {
                // this is a status change for a schedule/closing request
                userEmailPreference = this.request.Account.GetPreference("EmailOnScheduleRequest").Equals("Yes");
                emailPreferenceCode = "EmailOnScheduleRequestAddress";
            }
            else
            {
                // this is a status change for a regular order
                userEmailPreference = this.request.Account.GetPreference("EmailOnStatusChange").Equals("Yes");
                emailPreferenceCode = "EmailOnStatusChangeAddress";
            }
        }

        if (sendEmail == false)
        {
            actionTaken = "Email was not sent because no status change or file post occured";
        }
        //else if (cbEnableEmail.Checked == false)
        //{
        //	actionTaken = "Email notification was disabled for this update";
        //}
        else if (userEmailPreference == false)
        {
            actionTaken = "No email was sent based on the customer's " + emailPreferenceCode + " preference setting";
        }
        else
        {
            // the customer does want to receive this email

            string to      = this.request.Account.GetPreference(emailPreferenceCode, this.request.Order.Account.Email);
            string url     = this.GetSystemSetting("RootUrl") + "MyOrder.aspx?id=" + this.request.Order.Id.ToString();
            string subject = "Affinity Order '" + this.request.Order.ClientName.Replace("\r", "").Replace("\n", "") + "' #" + this.request.Order.WorkingId + " Updated";

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

            string msg = "Dear " + this.request.Order.Account.FirstName + ",\r\n\r\n"
                         + "Your Affinity " + this.request.RequestTypeCode + " for '" + this.request.Order.ClientName + "', ID #"
                         + this.request.Order.WorkingId + " has been processed.  " + statusChange + "\r\n\r\n"
                         + (message != "" ? message + "\r\n\r\n" : "")
                         + "You may view the full details of your order anytime online at " + url + ".  "
                         + "If you would prefer to not receive this notification, you may also login "
                         + "to your Affinity account and customize your email notification preferences.\r\n\r\n"
                         + this.GetSystemSetting("EmailFooter");

            //Response.Write(msg);
            //Response.Write(this.GetSystemSetting("SendFromEmail"));
            //Response.Write(to);
            //Response.Write(subject);

            mailer.Send(
                this.GetSystemSetting("SendFromEmail")
                , to.Replace(";", ",")
                , subject
                , msg);

            actionTaken = "Email notification was sent to " + to;
        }

        return(actionTaken);
    }
Esempio n. 6
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();
        }
    }
Esempio n. 7
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);
        }
    }
Esempio n. 8
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.");
    }