You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.7 KiB
C#

3 years ago
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MailSend.Common
{
public class MailDataContext : DbContext
{
public MailDataContext()
: base("MailDB")
{
}
public MailDataContext(string conn)
: base(conn)
{
}
public DbSet<MailSendTemplate> MailSendTemplates { get; set; }
public DbSet<MailSend> MailSend { get; set; }
public DbSet<MailSendSmtp> MailSendSmtp { get; set; }
}
[Table("Mail_Send")]
public class MailSend
{
public const string MailSendStatusCreate = "Create";
public const string MailSendStatusSending = "Sending";
public const string MailSendStatusSuccess = "Success";
public const string MailSendStatusFail = "Fail";
public const string MailSendStatusRetry = "Retry";
public MailSend()
{
this.GID = Guid.NewGuid().ToString().Replace("-", "");
SendStatus = MailSendStatusCreate;
CreateTime = DateTime.Now;
CustomerSend = false;
}
[Key]
public string GID { get; set; }
public string SendTo { get; set; }
public string CCTo { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public string SendStatus { get; set; }
public DateTime? SendTime { get; set; }
public int TryCount { get; set; }
public DateTime CreateTime { get; set; }
public string RelativeId { get; set; }
public string SmtpConfig { get; set; }
public string ShowName { get; set; }
public string Sender { get; set; }
public string AttachFiles { get; set; }
public bool CustomerSend { get; set; }
public string EmlFile { get; set; }
public bool IsTransmit { get; set; }
public string ResultText { get; set; }
}
[Table("Mail_Send_Smtp")]
public class MailSendSmtp
{
[Key]
public string GID { get; set; }
public string Account { get; set; }
public string Password { get; set; }
public string Server { get; set; }
public int Port { get; set; }
public bool UseSSL { get; set; }
public string Remark { get; set; }
}
[Table("Mail_Send_Template")]
public class MailSendTemplate
{
[Key]
public string GID { get; set; }
public string Name { get; set; }
public string Title { get; set; }
public string Body { get; set; }
}
}