Merge pull request 'Pay slip mail body need to update Done' (#2) from dev_shahadat into devqc

Reviewed-on: http://103.197.204.162:3025/CelHRTeam/CEL_Payroll/pulls/2
This commit is contained in:
shamim 2025-12-04 10:09:29 +06:00
commit cd468381d6
4 changed files with 62 additions and 24 deletions

View File

@ -7,7 +7,8 @@
<section name="InformationForReportTool" type="Ease.SearchTools.Objects.InformationForReportToolConfigHandler, Ease.SearchTools.Objects"/>
</configSections>
<dbSettings>
<connection name="conn" provider="sql" connectionString="server=103.197.204.164,1718;Database=CELPayrol;User ID=DBuser;Password=E@se2@24" sqlSyntax="SQL"/>
<connection name="conn" provider="sql" connectionString="server=cel80;Database=CELPayroll;User ID=CELPayroll;password=4B06094270245E4D5B63" sqlSyntax="SQL"/>
<!--<connection name="conn" provider="sql" connectionString="server=103.197.204.164,1718;Database=CELPayrol;User ID=DBuser;Password=E@se2@24" sqlSyntax="SQL"/>-->
<!--<connection name="conn" provider="sql" connectionString="server=WIN-D48IJC70V70;Database=GPPayroll;integrated security=yes;" sqlSyntax="SQL"/>-->
</dbSettings>
@ -20,13 +21,13 @@
<add key="GratuityParam" value="Grade"/>
<!--<add key="FSSLeaveOnlyBasic" value="no"/>-->
<add key="EERS" value="123456"/>
<add key="WebAddress" value="http://www.celimited.com"/>
<add key="mailGateway" value="SMTP" />
<add key="SendMethod" value="SMTP" />
<add key="EmailServer" value="mail.celimited.com" />
<add key="FromAddress" value="fkanak@celimited.com" />
<add key="UserID" value="fkanak@celimited.com" />
<add key="Password" value="4823074F2F0506582E704159" />
<add key="WebAddress" value="http://www.celimited.com"/>
<add key="mailGateway" value="SMTP" />
<add key="SendMethod" value="SMTP" />
<add key="EmailServer" value="mail.celimited.com" />
<add key="FromAddress" value="fkanak@celimited.com" />
<add key="UserID" value="fkanak@celimited.com" />
<add key="Password" value="4823074F2F0506582E704159" />
<add key="EnableSSL" value="No" />
<add key="PortNumber" value="25" />
<add key="handleAuditTrail" value="No"/>

View File

@ -3504,6 +3504,7 @@
<Content Include="Resource\GStat.png" />
<Content Include="Resource\HeadBack.jpg" />
<Content Include="Resource\Help_48x48.png" />
<Content Include="Resource\home_pano.jpg" />
<Content Include="Resource\Huge.gif" />
<Content Include="Resource\Huge.ico" />
<Content Include="Resource\icon_people.jpg" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -11,6 +11,7 @@ using Payroll.BO;
using Payroll.Controls;
using Payroll.Controls.CustomControls;
using Payroll.Report;
using System.Net.Mail;
namespace Payroll.UI
{
@ -352,7 +353,8 @@ namespace Payroll.UI
sb.AppendLine("Dear " + item.Name + "<br/><br/>");
sb.AppendLine("Attached your pay slip of " + dtpfromDate.Value.ToString("MMMM yyyy") + "." + "<br/><br/>");
sb.AppendLine("If you have any query, please contact :" + "<br/><br/>");
sb.AppendLine("Md. Showkat Hossain, Mobile-01711679640, email: fkanak@celimited.com" + "<br/>");
sb.AppendLine("Md. Showkat Hossain, Mobile-01711679640, email: fkanak@celimited.com" + "<br/><br/>");
sb.AppendLine("<b>Note:</b><br/><b>***Please use the last four digits of your mobile number, that you have shared with us, as the password to open the pay-slip</b>" + "<br/>");
MS.Body = sb.ToString();
}
//else if (nType == 2)
@ -482,40 +484,74 @@ namespace Payroll.UI
lblSelected.Text = "0";
}
//private void btnSendMail_Click(object sender, EventArgs e)
//{
// DirectoryInfo dirInfo = null;
// try
// {
// dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report");
// if (!Directory.Exists(Application.StartupPath + @"\Report"))
// {
// dirInfo.Create();
// }
// else // For Fail Safe Check. Do not remove this 'else' block
// {
// dirInfo.Delete(true);
// dirInfo.Create();
// }
// if (Validation())
// {
// PrepareReport();
// }
// }
// catch (Exception exp)
// {
// throw new Exception(exp.Message);
// }
// finally
// {
// if (dirInfo != null)
// dirInfo.Delete(true);
// }
//}
private void btnSendMail_Click(object sender, EventArgs e)
{
DirectoryInfo dirInfo = null;
string reportPath = Application.StartupPath + @"\Report";
try
{
dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report");
if (!Directory.Exists(Application.StartupPath + @"\Report"))
dirInfo = new DirectoryInfo(reportPath);
if (!dirInfo.Exists)
{
dirInfo.Create();
}
else // For Fail Safe Check. Do not remove this 'else' block
else
{
dirInfo.Delete(true);
dirInfo.Create();
// Clean contents, not directory
foreach (FileInfo file in dirInfo.GetFiles()) file.Delete();
foreach (DirectoryInfo subDir in dirInfo.GetDirectories()) subDir.Delete(true);
}
if (Validation())
{
PrepareReport();
PrepareReport(); // <-- Generate PDF and Send Mail
}
// IMPORTANT: Delete only after everything is closed
foreach (FileInfo file in dirInfo.GetFiles()) file.Delete();
}
catch (Exception exp)
{
throw new Exception(exp.Message);
MessageBox.Show(exp.Message);
}
finally
{
if (dirInfo != null)
dirInfo.Delete(true);
}
}
#endregion
}