This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(customers != null) | |
| if(customers.Count() > 0) | |
| if(customers.FirstOrDefault().Orders != null) | |
| if(customers.FirstOrDefault().Orders.Count() >0) | |
| if(customers.FirstOrDefault().Orders.First().Address != null) | |
| return customers.FirstOrDefault().Orders.First().Address.First.Zip; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Fact] | |
| public void EvalTest() | |
| { | |
| var redisConnection = GetRedisConnection(); | |
| redisConnection.StringSet("foo", 77); | |
| redisConnection.StringSet("foo.count", 1); | |
| string script = @"local currentval = redis.call('get', ARGV[1]) | |
| local currentcount = redis.call('get', ARGV[1] .. '.count') | |
| redis.call('incr', ARGV[1] .. '.count') | |
| currentval = (currentval * (currentcount/(currentcount + 1))) + (ARGV[2]/(currentcount+1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public byte[] GetScriptHash(string script) | |
| { | |
| SHA1 sha = new SHA1CryptoServiceProvider(); | |
| return sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(script)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Fact] | |
| public void EvalTest() | |
| { | |
| var redisConnection = GetRedisConnection(); | |
| redisConnection.StringSet("foo", 77); | |
| redisConnection.StringSet("foo.count", 1); | |
| var result = redisConnection.ScriptEvaluate(@"local currentval = redis.call('get', ARGV[1]) | |
| local currentcount = redis.call('get', ARGV[1] .. '.count') | |
| redis.call('incr', ARGV[1] .. '.count') | |
| currentval = (currentval * (currentcount/(currentcount + 1))) + (ARGV[2]/(currentcount+1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local currentval = redis.call('get', ARGV[1]) | |
| local currentcount = redis.call('get', ARGV[1] .. '.count') | |
| redis.call('incr', ARGV[1] .. '.count') | |
| currentval = (currentval * (currentcount/(currentcount + 1))) + (ARGV[2]/(currentcount+1)) | |
| redis.call('set', ARGV[1], currentval) | |
| return currentval |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .on("click", function (d) { | |
| var fillPattern = svg.append("pattern") | |
| .attr("id", "rectpattern" + d.id) | |
| .attr("patternUnits", "userSpaceOnUse") | |
| .attr("width", 10) | |
| .attr("height", 10) | |
| .attr("patternTransform", "rotate(45)"); | |
| var fillPatternRectangle = fillPattern.append("rect") | |
| .attr("height", 20) | |
| .attr("width", 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fillPattern = svg.append("pattern") | |
| .attr("id", "rectpattern" + d.id) | |
| .attr("patternUnits", "userSpaceOnUse") | |
| .attr("width", 10) | |
| .attr("height", 10) | |
| .attr("patternTransform", "rotate(45)"); | |
| var fillPatternRectangle = fillPattern.append("rect") | |
| .attr("height", 20) | |
| .attr("width", 5) | |
| .attr("fill", colorScale.getColor(d)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (CommandLine.Parser.Default.ParseArguments(args, options)) | |
| { | |
| if (options.Help) | |
| { | |
| Console.WriteLine(CommandLine.Text.HelpText.AutoBuild(options)); | |
| return; | |
| } | |
| Console.WriteLine(options.JobsToExport); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Options | |
| { | |
| [Option('u', "export-users", HelpText = "Toggle export of users.", Required = false, DefaultValue = true)] | |
| public bool ExportUsers { get; set; } | |
| [Option("number-of-jobs", HelpText = "Number of jobs to export.", Required = false, DefaultValue = Int32.MaxValue)] | |
| public int JobsToExport { get; set; } | |
| [Option('h', "help", HelpText = "Prints this help", Required = false, DefaultValue = false)] | |
| public bool Help { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void SendMessage(MailMessage message) | |
| { | |
| HostingEnvironment.QueueBackgroundWorkItem(async (_) => { | |
| using(var smtpClient = new SmtpClient()){ | |
| //configure client if needed | |
| await smtpClient.SendMailAsync(message); | |
| } | |
| }); | |
| } |