private void SendEmail() { MasterTablesManager MasMgr = new MasterTablesManager(); MailManagerSmtpClient objMail = new MailManagerSmtpClient(); DataTable dt = MasMgr.GetEmailNotification(); string strRetText = ""; string strToAddr = dt.Rows[0]["Disburse"].ToString().Trim(); string strCC = dt.Rows[0]["Notify"].ToString().Trim() + ";" + dt.Rows[0]["Verify"].ToString().Trim() + ";" + dt.Rows[0]["Review"].ToString().Trim(); string strSubject = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been Approved"; string strBody = "Salary is approved, please proceed for payment."; string strFromAddr = Session["EMAILID"].ToString().Trim(); strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC); if (strRetText == "Y") { lblMsg.Text = lblMsg.Text + ", and Email has been sent to Disburse by Finance."; } else { lblMsg.Text = lblMsg.Text + ", Email sending failed."; } }
private void SendEmail() { MasterTablesManager MasMgr = new MasterTablesManager(); MailManagerSmtpClient objMail = new MailManagerSmtpClient(); DataTable dt = MasMgr.GetEmailNotification(); string strRetText = ""; string strToAddr = dt.Rows[0]["Approval"].ToString().Trim(); string strCC = dt.Rows[0]["Notify"].ToString().Trim() + ";" + dt.Rows[0]["Verify"].ToString().Trim(); string strSubject = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been waiting for your Approval"; string strBody = "Hi,<br />The salary has been reviwed and found ok, you may now approve."; string strFromAddr = Session["EMAILID"].ToString().Trim(); strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC); if (strRetText == "Y") { lblMsg.Text = lblMsg.Text + ", and Email has been sent to Approve by CR."; } else { lblMsg.Text = lblMsg.Text + ", Email sending failed."; } }
private void SendEmail() { MasterTablesManager MasMgr = new MasterTablesManager(); MailManagerSmtpClient objMail = new MailManagerSmtpClient(); DataTable dt = MasMgr.GetEmailNotification(); string strRetText = ""; string strToAddr = dt.Rows[0]["Review"].ToString().Trim(); string strCC = dt.Rows[0]["Notify"].ToString().Trim(); string strSubject = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been waiting for ur Recommendation"; string strBody = "Hi,<br />The salary has been verified by Finance and found ok, you may recommend for approval."; string strFromAddr = Session["EMAILID"].ToString().Trim(); strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC); if (strRetText == "Y") { lblMsg.Text = lblMsg.Text + ", and Email has been sent to Review by Director Finance."; } else { lblMsg.Text = lblMsg.Text + ", Email sending failed."; } }
private void SendEmail() { MasterTablesManager MasMgr = new MasterTablesManager(); MailManagerSmtpClient objMail = new MailManagerSmtpClient(); DataTable dt = MasMgr.GetEmailNotification(); string strRetText = ""; string strToAddr = dt.Rows[0]["Notify"].ToString().Trim(); string strCC = dt.Rows[0]["Verify"].ToString().Trim() + ";" + dt.Rows[0]["Review"].ToString().Trim() + ";" + dt.Rows[0]["Approval"].ToString().Trim(); string strSubject = "Payroll has been Disbursed"; string strBody = ""; string strFromAddr = Session["EMAILID"].ToString().Trim(); strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC); if (strRetText == "Y") { lblMsg.Text = lblMsg.Text + ", and Email has been sent to Notify previous Actors."; } else { lblMsg.Text = lblMsg.Text + ", Email sending failed."; } }
private void SendEmail() { MasterTablesManager MasMgr = new MasterTablesManager(); MailManagerSmtpClient objMail = new MailManagerSmtpClient(); DataTable dt = MasMgr.GetEmailNotification(); string strRetText = ""; string strToAddr = dt.Rows[0]["Verify"].ToString().Trim(); string strSubject = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been waiting for your verification"; string strBody = "Hi,<br />The salary has been prepared by HR. Please verify and forword to Dir finance & Admin."; string strFromAddr = Session["EMAILID"].ToString().Trim(); strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, ""); if (strRetText == "Y") { lblMsg.Text = lblMsg.Text + "Email has been sent to Verify by Finance."; } else { lblMsg.Text = lblMsg.Text + "Email sending failed."; } }
protected void btnSendEmail_Click(object sender, EventArgs e) { string strRetText = ""; string strToAddr = ""; string strSubject = ""; string strBody = ""; string strFromAddr = Session["EMAILID"].ToString().Trim(); string strPayslipMonth = ddlMonth.SelectedItem.Text.Trim() + " " + ddlYear.SelectedValue.Trim(); string strSalType = chkBonus.Checked == true ? "B" : "S"; foreach (GridViewRow gRow in grEmployee.Rows) { CheckBox chkB = (CheckBox)gRow.Cells[0].FindControl("chkBox"); if (chkB.Checked == true) { this.ResetGridView(grGrossandBenefits, true); this.ResetGridView(grDeduct, true); this.ResetGridView(grNetPay, true); grGrossandBenefits.DataSource = objPayRptMgr.GetPayslipMonthlyGrossAndBenefits(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType); grGrossandBenefits.DataBind(); //grDeduct.DataSource = objPayRptMgr.GetPayslipMonthlyDeductions(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType); //grDeduct.DataBind(); //grNetPay.DataSource = objPayRptMgr.GetPayslipMonthlyNetPay(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType); //grNetPay.DataBind(); lblRemarks.Text = objPayRptMgr.GetPayrollRemarksForPayslip(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType); if (string.IsNullOrEmpty(lblRemarks.Text) == false) { lblRemarks.Text = "* " + lblRemarks.Text; } this.FormatGrossAndBenefitsGrid(); this.FormatDeductionGrid(); strToAddr = gRow.Cells[7].Text.Trim(); if (chkBonus.Checked == true) { strSubject = "Festival Allowance - " + strPayslipMonth; } else { strSubject = "Payslip for the Month of " + strPayslipMonth; } strBody = " <pre style=" + "\"font-weight:bold;font-size:14px;font-family:Arial;\"" + "> " + "Save The Children " + " </pre> " + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + gRow.Cells[3].Text.Trim() + " </pre> " + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + gRow.Cells[5].Text.Trim() + " </pre> " + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + gRow.Cells[4].Text.Trim() + " </pre> " + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + "Employee ID: " + gRow.Cells[2].Text.Trim() + " </pre> " + " <pre> </pre>" + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + "Date of Issue : " + DateTime.Today.ToLongDateString() + " </pre> " + " <pre> </pre>" + " <pre style=" + "\"font-weight:bold;font-size:14px;font-family:Arial;\"" + "> " + strSubject + " </pre> " + " <pre> </pre>" + " <table style=" + "\"width:100%;\"" + "> " + " \n " + " <tr> " + " \n " + " <td style=" + "\"width:49%;vertical-align:top;\"" + "> " + " \n " + this.GetGridViewHTML(grGrossandBenefits) + " \n " + " </td> " + " \n " + " <td style=" + "\"width:49%;vertical-align:top;\"" + "> " + " \n " + this.GetGridViewHTML(grDeduct) + " <pre> </pre>" + this.GetGridViewHTML(grNetPay) + " <pre> </pre>" + lblRemarks.Text.Trim() + " </td> " + " \n " + " </tr> " + " \n " + " <tr> " + " \n " + " <td colspan=" + "\"2\"" + ">" + " \n " + " <pre> </pre>" + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + " Note: This is a computer generated payslip and does not require any signature. If any discrepancy is found please " + " inform HR Team within 7 days of the issuance. " + "</pre> " + " </td> " + " </tr> " + "\n " + " </table> " + " \n "; strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, ""); if (strRetText == "N") { gRow.Cells[1].ForeColor = System.Drawing.Color.Red; gRow.Cells[2].ForeColor = System.Drawing.Color.Red; gRow.Cells[3].ForeColor = System.Drawing.Color.Red; gRow.Cells[4].ForeColor = System.Drawing.Color.Red; gRow.Cells[5].ForeColor = System.Drawing.Color.Red; gRow.Cells[6].ForeColor = System.Drawing.Color.Red; gRow.Cells[7].ForeColor = System.Drawing.Color.Red; break; } chkB.Checked = false; gRow.Cells[1].ForeColor = System.Drawing.Color.Green; gRow.Cells[2].ForeColor = System.Drawing.Color.Green; gRow.Cells[3].ForeColor = System.Drawing.Color.Green; gRow.Cells[4].ForeColor = System.Drawing.Color.Green; gRow.Cells[5].ForeColor = System.Drawing.Color.Green; gRow.Cells[6].ForeColor = System.Drawing.Color.Green; gRow.Cells[7].ForeColor = System.Drawing.Color.Green; } } this.ResetGridView(grGrossandBenefits, false); this.ResetGridView(grDeduct, false); this.ResetGridView(grNetPay, false); lblRemarks.Text = ""; if (strRetText == "N") { lblMsg.Text = "Failure in Sending Mail"; } if (strRetText == "Y") { lblMsg.Text = "Payslip email has been sent successfully"; } }