Example #1
0
    private void sendEmail(String _estNum, String filenm, String IsFinancial)
    {
        Whitfieldcore _wcore = new Whitfieldcore();
        whitfielduser _wuser = new whitfielduser();

        using (DataSet dsContacts = _wcore.GetContactsForProject(Convert.ToInt32(_estNum)))
        {
            DataTable dtContacts = dsContacts.Tables[0];
            if (dtContacts.Rows.Count > 0)
            {
                foreach (DataRow dRow in dtContacts.Rows)
                {
                    String _contactNm     = dRow["contactName"] == DBNull.Value ? " " : dRow["contactName"].ToString();
                    String _contactEmail  = dRow["email"] == DBNull.Value ? " " : dRow["email"].ToString();
                    String _clientnm      = dRow["Name"] == DBNull.Value ? " " : dRow["Name"].ToString();
                    String _contactNumber = _wuser.GetContactNo(prjEsti);

                    String mode = "";
                    if (IsFinancial == "Y")
                    {
                        mode = "Proposal";
                    }
                    else
                    {
                        mode = "Scope";
                    }

                    //HHS Uncomment this portion when there is an email list.
                    MailMessage message = new MailMessage();

                    //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["devEmail"]);

                    //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["AdminEmail"].ToString());


                    message.To.Add(_contactEmail);                                                                       //This will be added once JW oks the function
                    message.To.Add(System.Configuration.ConfigurationManager.AppSettings["EstimatingEmail"].ToString()); //This is tested for contact Email, remove once JW oks the function.

                    message.From       = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["EstimatingEmail"]);
                    message.Subject    = txtprjname + " Architectural Millwork - WhitfieldCo - " + mode;
                    message.IsBodyHtml = true;

                    StringBuilder sb = new StringBuilder();
                    sb.Append("<html><head></head>");
                    sb.Append("<body>");


                    sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
                    sb.Append("<TD>");



                    sb.Append(_contactNm.Replace(",", " ") + ",<br>");
                    sb.Append("<br>Thank you for the opportunity to provide pricing on the " + txtprjname + " project for " + _clientnm + ". <br>");
                    sb.Append("<br>Please find attached our " + mode + " for the Custom Architectural Millwork which includes a complete and comprehensive scope for this work.<br>");
                    sb.Append("<br>You may contact me at " + _contactNumber + " with any questions regarding this estimate.<br>");
                    //sb.Append(<br>"_wuser.GetEstimatorName(prjEsti));
                    sb.Append("<br>" + txtNotes);
                    sb.Append("<br><br>" + _wuser.GetEstimatorName(prjEsti) + ",<br>");
                    sb.Append("Estimator");
                    sb.Append("<br><br>");
                    sb.Append("</TD>");
                    sb.Append("</TR></TABLE>");


                    //Footer
                    sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
                    sb.Append("<TD><IMG height='80' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/TWC%20Primary%20Logo1.JPG' border='0'></TD></TR>");
                    sb.Append("<TR><TD class='form1' vAlign='bottom' align='left' width='100%'><b>The Whitfield Co., Inc.<br>");
                    sb.Append("8836 Washington Blvd., Ste 101<br>");
                    sb.Append("Jessup, MD 20794<br>");
                    sb.Append("(301)-483-0791<br>");
                    sb.Append("(301)-483-0792<br>");
                    sb.Append("http://www.whitfield-co.com<br>");
                    sb.Append("<IMG height='9' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/images.gif' width='1'>");
                    sb.Append("</TD>");
                    sb.Append("</TR></TABLE>");
                    sb.Append("</body></html>");
                    message.Body = sb.ToString();

                    message.Attachments.Add(new System.Net.Mail.Attachment(HttpContext.Current.Server.MapPath("~/attachments/") + filenm));
                    SmtpClient smtp = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["smtp"]);
                    smtp.Send(message);

                    if (!_contactEmail.Equals(""))
                    {
                        _wcore.InsertEmailConversation(Convert.ToInt32(_estNum), _contactEmail, _contactNm, DateTime.Now.ToString("MM-dd-yyyy"), DateTime.Now.ToString("T"), mode);
                    }
                }
            }
        }
    }
Example #2
0
    private void sendEmail(String _estNum, String filenm, String IsFinancial)
    {
        Whitfieldcore _wcore = new Whitfieldcore();
        whitfielduser _wuser = new whitfielduser();
        using (DataSet dsContacts = _wcore.GetContactsForProject(Convert.ToInt32(_estNum)))
        {
            DataTable dtContacts = dsContacts.Tables[0];
            if (dtContacts.Rows.Count > 0)
            {
                foreach (DataRow dRow in dtContacts.Rows)
                {

                    String _contactNm = dRow["contactName"] == DBNull.Value ? " " : dRow["contactName"].ToString();
                    String _contactEmail = dRow["email"] == DBNull.Value ? " " : dRow["email"].ToString();
                    String _clientnm = dRow["Name"] == DBNull.Value ? " " : dRow["Name"].ToString();
                    String _contactNumber = _wuser.GetContactNo(prjEsti);

                    String mode = "";
                    if (IsFinancial == "Y")
                    {
                        mode = "Proposal";
                    }
                    else
                    {
                        mode = "Scope";
                    }

                    //HHS Uncomment this portion when there is an email list.
                    MailMessage message = new MailMessage();

                    //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["devEmail"]);

                    //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["AdminEmail"].ToString());

                    message.To.Add(_contactEmail); //This will be added once JW oks the function
                    message.To.Add(System.Configuration.ConfigurationManager.AppSettings["EstimatingEmail"].ToString());  //This is tested for contact Email, remove once JW oks the function.

                    message.From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["EstimatingEmail"]);
                    message.Subject = txtprjname + " Architectural Millwork - WhitfieldCo - " + mode;
                    message.IsBodyHtml = true;

                    StringBuilder sb = new StringBuilder();
                    sb.Append("<html><head></head>");
                    sb.Append("<body>");

                    sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
                    sb.Append("<TD>");

                    sb.Append(_contactNm.Replace(",", " ")  + ",<br>");
                    sb.Append("<br>Thank you for the opportunity to provide pricing on the " + txtprjname + " project for " +  _clientnm + ". <br>");
                    sb.Append("<br>Please find attached our " + mode + " for the Custom Architectural Millwork which includes a complete and comprehensive scope for this work.<br>");
                    sb.Append("<br>You may contact me at " + _contactNumber + " with any questions regarding this estimate.<br>");
                    //sb.Append(<br>"_wuser.GetEstimatorName(prjEsti));
                    sb.Append("<br>" + txtNotes);
                    sb.Append("<br><br>" + _wuser.GetEstimatorName(prjEsti)+ ",<br>");
                    sb.Append("Estimator");
                    sb.Append("<br><br>");
                    sb.Append("</TD>");
                    sb.Append("</TR></TABLE>");

                    //Footer
                    sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
                    sb.Append("<TD><IMG height='80' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/TWC%20Primary%20Logo1.JPG' border='0'></TD></TR>");
                    sb.Append("<TR><TD class='form1' vAlign='bottom' align='left' width='100%'><b>The Whitfield Co., Inc.<br>");
                    sb.Append("8836 Washington Blvd., Ste 101<br>");
                    sb.Append("Jessup, MD 20794<br>");
                    sb.Append("(301)-483-0791<br>");
                    sb.Append("(301)-483-0792<br>");
                    sb.Append("http://www.whitfield-co.com<br>");
                    sb.Append("<IMG height='9' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/images.gif' width='1'>");
                    sb.Append("</TD>");
                    sb.Append("</TR></TABLE>");
                    sb.Append("</body></html>");
                    message.Body = sb.ToString();

                    message.Attachments.Add(new System.Net.Mail.Attachment(HttpContext.Current.Server.MapPath("~/attachments/") + filenm));
                    SmtpClient smtp = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["smtp"]);
                    smtp.Send(message);

                    if (!_contactEmail.Equals(""))
                    {
                        _wcore.InsertEmailConversation(Convert.ToInt32(_estNum), _contactEmail, _contactNm, DateTime.Now.ToString("MM-dd-yyyy"), DateTime.Now.ToString("T"), mode);
                    }
                }
            }
        }
    }