private void CreateEmailBody()
{
string Comments = string.Empty;
string emailbody = string.Empty;
int flag = 0;
int sncount = Convert.ToInt32(Dts.Variables["SNCount"].Value.ToString());
int notescount = Convert.ToInt32(Dts.Variables["NotesCount"].Value.ToString());
int emailindicator = 0;
int results = (sncount - notescount);
if ((results == 0) && (sncount > 0) && (notescount > 0))//rows match
emailindicator = 1;
Dts.Variables["EmailIndicator"].Value = emailindicator;
if (emailindicator == 0)
{
Dts.Variables["ErrorCounter"].Value = Convert.ToInt32(Dts.Variables["ErrorCounter"].Value.ToString()) + 1;
if (sncount == 0)
{
Comments = "Snapshot table has no rows.";
flag = 1;
}
if (@notescount == 0)
{
if (flag == 1)
{
Comments = "Both Notes and Snapshot tables have no rows.";
}
else
{
Comments = "Notes table has no rows.";
}
}
if (results < 0 && notescount > 0 && sncount > 0)
{
Comments = "Number of rows in Notes table exceeds rows in Snapshot table by <b>" + -(results) + "</b> rows.";
}
if (results > 0 && notescount > 0 && sncount > 0)
{
Comments = "Number of rows in Snapshot table exceeds rows in Notes table by <b>" + results + "</b> rows.";
}
emailbody = "<p><b>Feedname:</b> " + Dts.Variables["Table"].Value.ToString() + "<br>" +
"<b>Package Run Time:</b> " + GetParsedDate(DateTime.Now) + "<br>" +
"<b>Error Message:</b> " + Comments + "<br><br></p>";
Dts.Variables["EmailBody"].Value = Dts.Variables["EmailBody"].Value + emailbody;
}
else
{
/* *
emailbody = "<p><b>Feedname:</b> " + Dts.Variables["Table"].Value.ToString() + "<br>" +
"<b>Package Run Time:</b> " + GetParsedDate(DateTime.Now) + "<br>" +
"<b>Status:</b> Success" + "<br>" +
"<b>Message:</b> " + " Insert completed sucessfully.<br><br></p>";
Dts.Variables["EmailBody"].Value = Dts.Variables["EmailBody"].Value + emailbody;
* */
}
}
{
string Comments = string.Empty;
string emailbody = string.Empty;
int flag = 0;
int sncount = Convert.ToInt32(Dts.Variables["SNCount"].Value.ToString());
int notescount = Convert.ToInt32(Dts.Variables["NotesCount"].Value.ToString());
int emailindicator = 0;
int results = (sncount - notescount);
if ((results == 0) && (sncount > 0) && (notescount > 0))//rows match
emailindicator = 1;
Dts.Variables["EmailIndicator"].Value = emailindicator;
if (emailindicator == 0)
{
Dts.Variables["ErrorCounter"].Value = Convert.ToInt32(Dts.Variables["ErrorCounter"].Value.ToString()) + 1;
if (sncount == 0)
{
Comments = "Snapshot table has no rows.";
flag = 1;
}
if (@notescount == 0)
{
if (flag == 1)
{
Comments = "Both Notes and Snapshot tables have no rows.";
}
else
{
Comments = "Notes table has no rows.";
}
}
if (results < 0 && notescount > 0 && sncount > 0)
{
Comments = "Number of rows in Notes table exceeds rows in Snapshot table by <b>" + -(results) + "</b> rows.";
}
if (results > 0 && notescount > 0 && sncount > 0)
{
Comments = "Number of rows in Snapshot table exceeds rows in Notes table by <b>" + results + "</b> rows.";
}
emailbody = "<p><b>Feedname:</b> " + Dts.Variables["Table"].Value.ToString() + "<br>" +
"<b>Package Run Time:</b> " + GetParsedDate(DateTime.Now) + "<br>" +
"<b>Error Message:</b> " + Comments + "<br><br></p>";
Dts.Variables["EmailBody"].Value = Dts.Variables["EmailBody"].Value + emailbody;
}
else
{
/* *
emailbody = "<p><b>Feedname:</b> " + Dts.Variables["Table"].Value.ToString() + "<br>" +
"<b>Package Run Time:</b> " + GetParsedDate(DateTime.Now) + "<br>" +
"<b>Status:</b> Success" + "<br>" +
"<b>Message:</b> " + " Insert completed sucessfully.<br><br></p>";
Dts.Variables["EmailBody"].Value = Dts.Variables["EmailBody"].Value + emailbody;
* */
}
}