- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
var sEmailRecipient = string.Empty;
string m_sPhysicalPath = "";
if (SaveType == "both" || SaveType == "email")
{
List<User> recipients = null;
if (RecipentSelectMode == "auto")
{
if (!string.IsNullOrEmpty(AutoRecipient))
recipients = Notification.ConvertToUsers(AutoRecipient, MethodologyId, CurrentObjectId, CurrentUserId, CurrentEntityName);
}
if(RecipentSelectMode == "manual"){
if (Recipient != null)
sEmailRecipient = EvaluateExpression(CurrentUserId, MethodologyId, MainEntityName, MainObjectId, Recipient);
}
m_sPhysicalPath = Document.AbsoluteApplicationPath + "/" + p_sReportPath.Substring(p_sReportPath.LastIndexOf("storage"));
if (RecipentSelectMode == "auto")
{
foreach (User user in recipients)
{
if (Regex.IsMatch(user.Email, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.None))
{
SendReportByEmail(m_sPhysicalPath, user);
}
}
}
if (RecipentSelectMode == "manual")
{
if (Regex.IsMatch(Recipient, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.None))
{
SendReportByEmail(m_sPhysicalPath, new User { Email = sEmailRecipient });
}
else
{
return CreateResult(GetClientData(), "Email message sending failed - incorrect email address - " + Recipient, (int)ReportRenderingFailType.Success);
}
}
}
if (SaveType == "email")
{
FileInfo file = new FileInfo(m_sPhysicalPath);
if (file.Exists)
file.Delete();
}