Skip to content

Instantly share code, notes, and snippets.

@NineMvp
NineMvp / homecontroller.cs
Created April 12, 2016 10:47
hangfire demo : HomeController
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Hangfire;
using HangfireDemo.Models;
using Microsoft.Win32.SafeHandles;
namespace HangfireDemo.Controllers
@NineMvp
NineMvp / EmailSender.cs
Created April 12, 2016 10:25
hangfire demo : email sender
using System.Net;
using System.Net.Mail;
....
public class EmailSender
{
public static bool SendEmail(int id)
{
try
@NineMvp
NineMvp / startup.cs
Last active April 12, 2016 10:25
hangfire demo : startup.cs
using Hangfire;
using Hangfire.SqlServer;
.....
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
var options = new SqlServerStorageOptions
@NineMvp
NineMvp / ApplicationContext.cs
Created April 12, 2016 09:58
hangfire demo : EF model
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public DbSet<EmailMessage> EmailMessages { get; set; }
@NineMvp
NineMvp / EmailMessage.cs
Last active April 12, 2016 09:56
hangfire demo : email model
public class EmailMessage
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; private set; }
public string FromEmail { get; set; }
public string ToEmail { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public bool SendNow { get; set; }
using System;
using Akka.Actor;
namespace ConsoleApplication1
{
internal class Program
{
private static void Main(string[] args)
{
var smsActorSystem = ActorSystem.Create("SmsActorSystem");
Console.WriteLine("Actor System Created");
using System;
using Akka.Actor;
namespace ConsoleApplication1
{
public class SmsSenderActor : ReceiveActor
{
public SmsSenderActor()
{
Receive<string>(message => Console.WriteLine(message));
using System;
namespace ConsoleApplication1
{
public class SmsMessage
{
public SmsMessage(string senderNumber, string receiverNumber, string message)
{
SenderNumber = senderNumber;
ReceiverNumber = receiverNumber;
using System;
using Akka.Actor;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var smsActorSystem = ActorSystem.Create("SmsActorSystem");
Console.WriteLine("Actor System Created");
using System;
using Akka.Actor;
namespace ConsoleApplication1
{
public class SmsSenderActor : ReceiveActor
{
public SmsSenderActor()
{
Receive<string>(message => Console.WriteLine(message));