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.

347 lines
10 KiB
C#

using DSWeb.Common.DB;
using DSWeb.Common.Model;
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 DSWeb.Common.DB
{
public class MailDataContext : DbContext
{
public MailDataContext()
: base("DongShengDB")
{
}
public MailDataContext(string conn)
: base(conn)
{
}
public DbSet<MailUserAccountInfo> UserAccounts { get; set; }
public DbSet<MailSendTemplate> MailSendTemplates { get; set; }
public DbSet<MailParserConfigInfo> ParserConfigs { get; set; }
public DbSet<MailParserRelation> ParserRelations { get; set; }
public DbSet<MailRetransmissionInfo> Retransmissions { get; set; }
public DbSet<MailReceiveRecordInfo> ReceiveRecords { get; set; }
public DbSet<MailRfc2047ConfigInfo> Rfc2047Configs { get; set; }
public DbSet<MailReceiveExcludeInfo> ReceiveExcludes { get; set; }
public DbSet<MailParserParamsInfo> ParserParams { get; set; }
public DbSet<MailSend> MailSend { get; set; }
public DbSet<MailProcessorChain> ProcessorChains { get; set; }
public DbSet<MailProcessorChainStep> ProcessorChainSteps { get; set; }
public DbSet<MailProcessStep> ProcessSteps { get; set; }
//查询发送记录
public DbSet<MailSendQuery> MailSendQuerys { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<CompanyNew> Companies { get; set; }
}
[Table("Mail_User_Account")]
public class MailUserAccountInfo
{
[Key]
public string GID { get; set; }
public string MailAccount { get; set; }
public string Password { get; set; }
public string ReceiveServer { get; set; }
public bool UseImap { get; set; }
public int ReceivePort { get; set; }
public bool ReceiveSSL { get; set; }
public string SmtpServer { get; set; }
public int SmtpPort { get; set; }
public bool SmtpSSL { get; set; }
public bool IsChanged { get; set; }
public string RelativeId { get; set; }
public int ProcessorCount { get; set; }
public int SenderCount { get; set; }
public string ManagerMailAddress { get; set; }
public int ParserCount { get; set; }
public string UserId { get; set; }
public string CompId { get; set; }
public string UserName { get; set; }
public string CompName { get; set; }
public string UseForCode { get; set; }
public string UseFor { 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 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("V_MailSend")]
public class MailSendQuery
{
[Key]
public string GID { get; set; }
public string SendTo { get; set; }
public string CCTo { get; set; }
public string Title { get; set; }
public string SendStatus { get; set; }
public string SendTime { get; set; }
//public int TryCount { get; set; }
public string CreateTime { get; set; }
public string MailAccount { get; set; }
public string EmlFile { 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; }
}
[Table("Mail_Parser_Config")]
public class MailParserConfigInfo
{
[Key]
public string GID { get; set; }
public string MailAccount { get; set; }
public string SubjectRegex { get; set; }
public string BodyRegex { get; set; }
public string SenderRegex { get; set; }
public string AttachRegex { get; set; }
public string ParserType { get; set; }
//public string ProcessorType { get; set; }
public string ProcessorChain { get; set; }
public string ParserName { get; set; }
public int Sort { get; set; }
public DateTime CreateTime { get; set; }
public DateTime? ModifyTime { get; set; }
public string CreateUser { get; set; }
public string ModifyUser { get; set; }
}
[Table("Mail_Parser_Relation")]
public class MailParserRelation
{
[Key, Column(Order = 0)]
public string ParserId { get; set; }
[Key, Column(Order = 1)]
public string MailAccount { get; set; }
public bool TransferFlag { get; set; }
}
[Table("Mail_Retransmission")]
public class MailRetransmissionInfo
{
public MailRetransmissionInfo()
{
SendStatus = RetransmissionStatus.Create.ToString();
CreateTime = DateTime.Now;
}
[Key]
public string GID { get; set; }
public string SendTo { get; set; }
public string CCTo { get; set; }
public string MailRecordId { get; set; }
public string MailAccount { get; set; }
public long MailId { get; set; }
public string MailPath { get; set; }
public string SendStatus { get; set; }
public DateTime? SendTime { get; set; }
public DateTime CreateTime { get; set; }
public string Operator { get; set; }
public string RelativeId { get; set; }
public string RetransmitSubject { get; set; }
}
[Table("Mail_Receive_Record")]
public class MailReceiveRecordInfo
{
public MailReceiveRecordInfo()
{
this.GID = Guid.NewGuid().ToString();
this.IsCheck = false;
this.IsProcess = false;
this.IsProcess = false;
this.MailDate = DateTime.Today;
}
[Key]
public string GID { get; set; }
public string MailAccount { get; set; }
public long MailId { get; set; }
public string Subject { get; set; }
public string Sender { get; set; }
public DateTime RecTime { get; set; }
public bool IsCheck { get; set; }
public bool IsParse { get; set; }
public bool IsProcess { get; set; }
public string Body { get; set; }
public string Attachments { get; set; }
public DateTime MailDate { get; set; }
public string FilePath { get; set; }
public string MessageUid { get; set; }
public string PopId { get; set; }
public string UserId { get; set; }
public string CompId { get; set; }
public string UserName { get; set; }
public string CompName { get; set; }
}
[Table("Mail_Processor_Chain")]
public class MailProcessorChain
{
[Key]
public string GID { get; set; }
public string ChainName { get; set; }
public string Description { get; set; }
}
[Table("Mail_Processor_Chain_Step")]
public class MailProcessorChainStep
{
[Key, Column(Order = 1)]
public string ChainId { get; set; }
[Key, Column(Order = 2)]
public int StepId { get; set; }
public string Description { get; set; }
public string ProcessorClass { get; set; }
}
[Table("Mail_Receive_Exclude")]
public class MailReceiveExcludeInfo
{
[Key]
public string GID { get; set; }
public string MailAccount { get; set; }
public string SubjectRegex { get; set; }
public string SenderRegex { get; set; }
}
[Table("Mail_Rfc2047_Config")]
public class MailRfc2047ConfigInfo
{
[Key]
public string GID { get; set; }
public string MailAccount { get; set; }
public string SubjectRegex { get; set; }
public string SenderRegex { get; set; }
public string Encoding { get; set; }
}
[Table("Mail_Parser_Params")]
public class MailParserParamsInfo
{
public MailParserParamsInfo()
{
}
[Key]
public string GID { get; set; }
public string ParserId { get; set; }
public string ParamKey { get; set; }
public string ParamValue { get; set; }
}
[Table("Mail_Process_Step")]
public class MailProcessStep
{
[Key]
public string GID { get; set; }
public string RecId { get; set; }
public string ChainId { get; set; }
public int CurrentStep { get; set; }
public string CurrentStatus { get; set; }
public string ParamJson { get; set; }
public string ProcessContent { get; set; }
public bool AllFinish { get; set; }
public DateTime? RecentCall { get; set; }
}
}