40766b24-ff74-431b-b387-6c221ede77cf
true
p3121-sql-02.sdt.local
jazz prd UNC 20180206.1
true
<ProgramFilesX64>\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\plugins\Diagnostics\Newtonsoft.Json.dll
Amazon.Lambda.S3Events
AWSSDK.Core
AWSSDK.S3
RestSharp
Amazon
Amazon.Auth.AccessControlPolicy
Amazon.Auth.AccessControlPolicy.ActionIdentifiers
Amazon.Internal
Amazon.Lambda.S3Events
Amazon.MissingTypes
Amazon.Runtime
Amazon.Runtime.CredentialManagement
Amazon.Runtime.CredentialManagement.Internal
Amazon.Runtime.EventStreams
Amazon.Runtime.EventStreams.Internal
Amazon.Runtime.Internal
Amazon.Runtime.Internal.Auth
Amazon.Runtime.Internal.Settings
Amazon.Runtime.Internal.Transform
Amazon.Runtime.Internal.Util
Amazon.Runtime.SharedInterfaces
Amazon.Runtime.SharedInterfaces.Internal
Amazon.S3
Amazon.S3.Encryption
Amazon.S3.Encryption.Internal
Amazon.S3.Internal
Amazon.S3.IO
Amazon.S3.Model
Amazon.S3.Model.Internal.MarshallTransformations
Amazon.S3.Transfer
Amazon.S3.Util
Amazon.Util
Amazon.Util.Internal
Amazon.Util.Internal.PlatformServices
Newtonsoft.Json
Newtonsoft.Json.Converters
Newtonsoft.Json.Linq
Newtonsoft.Json.Schema
Newtonsoft.Json.Serialization
System
System.Diagnostics
System.Diagnostics.Tracing
System.IO.Compression
ThirdParty.BouncyCastle.Asn1
ThirdParty.BouncyCastle.Asn1.Utilities
ThirdParty.BouncyCastle.Math
ThirdParty.BouncyCastle.OpenSsl
ThirdParty.BouncyCastle.Utilities.IO.Pem
ThirdParty.Ionic.Zlib
ThirdParty.Json.LitJson
ThirdParty.MD5
RestSharp
RestSharp.Authenticators
private static string baseurl = "https://dev.sdt.local/StrataJazz201931";
private static Random _rnd;
void Main()
{
var now = DateTime.Today.AddDays(-1 * (7 + ((DateTime.Today.DayOfWeek - DayOfWeek.Monday)) % 7));
var staffing = new Staffing
{
pr = new PayPeriod
{
StartDate = now.AddDays(-14),
EndDate = now.AddDays(-7)
},
Departments = Enumerable.Range(0, 26).ToList()
.ConvertAll(e => //new Department { department =
new DeptInfo($"dept_{e}", Random.Next() * 10m, Random.Next() * 10m, Random.Next() * 10m * Random.Next(-1, 1))
//}
)
};
var data = JsonConvert.SerializeObject(staffing);
data.Dump();
SendMessageByTemplateId(data).Content.Dump();
}
internal static Random Random
{
get => _rnd ?? (_rnd = new Random());
set => _rnd = value;
}
// Define other methods and classes here
public class Staffing
{
public PayPeriod pr { get; set; }
public List overall => new List { Departments.FirstOrDefault() };
public List departments => new List
{
new DeptInfo(
$"Current Pay Period ({pr.endDate:M/dd})",
Departments.Sum(d => d.latest_total_variance),
Departments.Sum(d => d.latest_pay_variance),
Departments.Sum(d => d.latest_flex_variance)
)
};
internal List Departments { get; set; }
}
public class PayPeriod
{
internal DateTime StartDate { get; set; }
internal DateTime EndDate { get; set; }
public string startDate => StartDate.ToString("MM/dd");
public string endDate => EndDate.ToString("MM/dd");
}
public class Department
{
public DeptInfo department { get; set; }
}
public class DeptInfo
{
public string hyperlink => baseurl;
public string name { get; set; }
internal decimal latest_total_variance { get; set; }
internal decimal latest_pay_variance { get; set; }
internal decimal latest_flex_variance { get; set; }
public string total_variance => $"{latest_total_variance:C}";
public string pay_variance => $"{latest_pay_variance:C}";
public string flex_variance => $"{latest_flex_variance:C}";
public string six_month_total_chart => "graph_sparkline_6_pay_period_-1281183930.png";
public string six_month_pay_chart => "graph_sparkline_6_pay_period_1140344931.png";
public string six_month_flex_chart => "graph_sparkline_6_pay_period_489356044.png";
public string total_color => latest_total_variance >= 0 ? "positive" : "negative";
public string pay_color => latest_pay_variance >= 0 ? "positive" : "negative";
public string flex_color => latest_flex_variance >= 0 ? "positive" : "negative";
public DeptInfo(string deptName, decimal total, decimal pay, decimal flex)
{
name = deptName;
latest_total_variance = total;
latest_pay_variance = pay;
latest_flex_variance = flex;
}
}
public static IRestResponse SendMessageByTemplateId(string jsonStr)
{
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3/notifications-dev.stratanetwork.com");
client.Authenticator =
new HttpBasicAuthenticator("api",
"key-12ea6389d906cef290ad8a0557a3a8c4");
RestRequest request = new RestRequest();
//request.AddParameter("domain", "notifications.stratanetwork.com", ParameterType.UrlSegment);
//request.Resource = "{domain}/messages";
request.Resource = "/messages";
request.AddParameter("from", "Mailgun Sandbox ");
//request.AddParameter("to", "Dhara ");
//request.AddParameter("to", "Nicole ");
request.AddParameter("to", "Thom Lamb ");
//request.AddParameter("to", "Kevin Lamb ");
//request.AddParameter("to", "Shruthi Agni ");
//request.AddParameter("to", "Tucker Debolt ");
request.AddParameter("subject", "Hello Thom Lamb");
//request.AddParameter("template", "daily_pr_snapshot");
request.AddParameter("template", "overall_pr_notification");
request.AddParameter("h:X-Mailgun-Variables", jsonStr);
request.Method = Method.POST;
return client.Execute(request);
}