-
Notifications
You must be signed in to change notification settings - Fork 2
/
system.cs
executable file
·57 lines (49 loc) · 1.81 KB
/
system.cs
1
2
3
4
5
6
7
8
9
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
52
53
54
55
56
57
using System.Net.Mail;
namespace PardotAPI
{
// -----------------------------------------------
// --------- Adding Global Constants -------------
// -----------------------------------------------
public static class GlobalConstants
{
public static string pardotAPIUrl = "https://pi.pardot.com/api";
}
public static class GlobalMethods
{
public static void notifyAdmin(string message)
{
SmtpClient smtp = new SmtpClient();
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings.Get("PardotContactFrom"));
mailMessage.To.Add(System.Configuration.ConfigurationManager.AppSettings.Get("PardotContactTo"));
mailMessage.Body = "<h1>The Pardot API has failed.</h1><br/><br/><strong>Error Message:</strong> " + message;
mailMessage.Subject = "Pardot API Failure";
mailMessage.IsBodyHtml = true;
smtp.Send(mailMessage);
}
}
// --------------------------------------------------
// --------- Extending Base Class Types -------------
// --------------------------------------------------
public static class StringExtension
{
public static bool notFilled(this string str)
{
str = str.Trim();
if (str != null && str.Length > 0 && str != " ")
{
return false;
}
return true;
}
public static bool isFilled(this string str)
{
str = str.Trim();
if (str == null || str.Length == 0 || str == " ")
{
return false;
}
return true;
}
}
}