public void Execute(IJobExecutionContext context) { EmailServices.SendEmails(20); }
private void SendMailtoApproved() { string strFromEmail = ""; string strToEmail = ""; string strCCEmail = ""; List <string> strToEmails = new List <string>(); List <string> strCCEmails = new List <string>(); DataTable dtInquriyDetails = new DatabaseService().executeSelectQuery("SELECT * FROM Inquiry WHERE InquiryNumber = '" + lblChangeInqNo.Text.ToString() + "'"); DataTable dtCusDetais = new DatabaseService().executeSelectQuery("SELECT * FROM Customer WHERE Id = '" + GetCusId(lblChangeCus.Text.Trim()) + "'"); string[] acDate = lblChangeActDate.Text.ToString().Trim().Split(' '); // string[] dueDate = grdVwPendingAppDateChange.GetFocusedDataRow()["ReqCompDate"].ToString().Split(' '); string[] ReqDate = lblChangeReqDate.Text.ToString().Trim().Split(' '); strFromEmail = GetEmail(GetEmpId(Views.frmHome.EmpName)); strToEmail = GetEmail(dtInquriyDetails.Rows[0]["SiteResponsible"].ToString()); //strCCEmail = GetEmail(GetEmpId(lblInqForBy.Text.Trim())); StringBuilder strBuliderEmailSubject = new StringBuilder(); strBuliderEmailSubject.Append("Inquiry Completion Date Change Approved – Customer :" + lblChangeCus.Text.Trim() + " " + " -Inquiry No :" + lblChangeInqNo.Text.Trim() + " "); StringBuilder strBuliderEmailBody = new StringBuilder(); strBuliderEmailBody.Append("<head>"); strBuliderEmailBody.Append("<title>"); strBuliderEmailBody.Append(Guid.NewGuid().ToString()); strBuliderEmailBody.Append("</title>"); strBuliderEmailBody.Append("</head>"); strBuliderEmailBody.Append("<body>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Dear " + lblChangeReqBy.Text.Trim() + ","); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Inquiry Completion Date Change <b><u><FONT COLOR=DodgerBlue>Approved</FONT></u></b>,"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Inquiry No : </b>" + lblChangeInqNo.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Type : </b>" + lblChangeType.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Customer : </b>" + lblChangeCus.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Location : </b>" + GetSubLocationName(dtInquriyDetails.Rows[0]["Location"].ToString()) + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Caller Name : </b>" + dtInquriyDetails.Rows[0]["CallerName"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Caller Phone : </b>" + dtInquriyDetails.Rows[0]["CallerPhone"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Inquiry Details : </b>" + dtInquriyDetails.Rows[0]["FollowupDetails"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Priority : </b>" + dtInquriyDetails.Rows[0]["Priority"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Accepted Date & Time : </b>" + acDate[0] + " " + lblChangeActTime.Text.ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>New Completion Date & Time : </b>" + ReqDate[0] + " " + lblChangeReqTime.Text.ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Regards,"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("" + Views.frmHome.EmpName + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<FONT COLOR=darkred>Auto generated email from CRM system</FONT>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("</body>"); strBuliderEmailBody.Append("</html>"); EmailServices Email = new EmailServices(); Email.SendEmails(strFromEmail.Trim(), strToEmail.Trim(), strBuliderEmailSubject.ToString(), strBuliderEmailBody.ToString()); }