Exemple #1
0
 public FormService(IRepository <Form> formRepository, IRepository <FormTab> formTabRepository,
                    IRepository <FormComponentTemplate> formComponentTemplateRepository,
                    IRepository <FormDefaultComponent> formDefaultComponentRepository, ISiteSettingService siteSettingService,
                    IContactService contactService, IEmailLogService emailLogService)
 {
     _formRepository    = formRepository;
     _formTabRepository = formTabRepository;
     _formDefaultComponentRepository  = formDefaultComponentRepository;
     _formComponentTemplateRepository = formComponentTemplateRepository;
     _siteSettingService = siteSettingService;
     _contactService     = contactService;
     _emailLogService    = emailLogService;
 }
Exemple #2
0
 public ContactService(IRepository <Contact> contactRepository, ISiteSettingService siteSettingService,
                       ICompanyService companyService, IContactGroupContactRepository contactGroupContactRepository,
                       IEmailTemplateService emailTemplateService, IEmailLogService emailLogService,
                       IContactCommunicationService contactCommunicationService, IUserRepository userRepository)
 {
     _siteSettingService            = siteSettingService;
     _contactRepository             = contactRepository;
     _companyService                = companyService;
     _contactGroupContactRepository = contactGroupContactRepository;
     _emailTemplateService          = emailTemplateService;
     _emailLogService               = emailLogService;
     _contactCommunicationService   = contactCommunicationService;
     _userRepository                = userRepository;
 }
 public DocumentService(IRepository <ProtectedDocument> protectedDocumentRepository,
                        IProtectedDocumentGroupRepository protectedDocumentGroupRepository,
                        IProtectedDocumentCompanyRepository protectedDocumentCompanyRepository,
                        IProtectedDocumentCompanyTypeRepository protectedDocumentCompanyTypeRepository,
                        ISiteSettingService siteSettingService,
                        IProtectedDocumentLogService protectedDocumentLogService, IEmailTemplateService emailTemplateService,
                        IEmailLogService emailLogService)
 {
     _protectedDocumentRepository            = protectedDocumentRepository;
     _protectedDocumentGroupRepository       = protectedDocumentGroupRepository;
     _protectedDocumentCompanyRepository     = protectedDocumentCompanyRepository;
     _protectedDocumentCompanyTypeRepository = protectedDocumentCompanyTypeRepository;
     _siteSettingService          = siteSettingService;
     _protectedDocumentLogService = protectedDocumentLogService;
     _emailTemplateService        = emailTemplateService;
     _emailLogService             = emailLogService;
 }
Exemple #4
0
 public registerController(IMemberService memberService, IEmailLogService emailLogService, IEventService eventService)
 {
     _memberService   = memberService;
     _emailLogService = emailLogService;
     _eventService    = eventService;
 }
Exemple #5
0
        public static bool SendMail(SendMailViewModel model, ControllerContext controllerContext = null, IEmailLogService logger = null)
        {
            logger = logger ?? DependencyResolver.Current.GetService <IEmailLogService>();
            try
            {
                var message = new MailMessage();

                var toes = model.To.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var to in toes)
                {
                    message.To.Add(to);
                }
                message.From         = model.FromAddress;
                message.BodyEncoding = System.Text.Encoding.UTF8;
                message.IsBodyHtml   = true;
                if (!string.IsNullOrEmpty(model.Bcc))
                {
                    toes = model.Bcc.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var to in toes)
                    {
                        message.Bcc.Add(to);
                    }
                }
                message.Subject = model.Subject;

                if (controllerContext != null)
                {
                    if (model.Files != null)
                    {
                        foreach (var file in model.Files)
                        {
                            var attachment = new Attachment(controllerContext.HttpContext.Server.MapPath(file.Name))
                            {
                                Name = file.SourceName
                            };
                            message.Attachments.Add(attachment);
                        }
                    }
                    var viewData = new ViewDataDictionary(model.ViewModel);
                    message.Body = ViewHelpers.RenderPartialViewToString(model.TemplateName, viewData, controllerContext);
                }
                else
                {
                    message.Body = model.Body;
                    if (model.Files != null)
                    {
                        foreach (var file in model.Files)
                        {
                            var attachment = new Attachment(file.Name)
                            {
                                Name = file.SourceName
                            };
                            message.Attachments.Add(attachment);
                        }
                    }
                }

                lock (LockObject)
                {
                    var client = new SmtpClient();
                    if (client.DeliveryMethod == SmtpDeliveryMethod.SpecifiedPickupDirectory)
                    {
                        client.EnableSsl = false;
                    }
                    client.Send(message);
                }
                logger.Write(model.From, model.To, model.Subject, message.Body, null);
                return(true);
            }
            catch (Exception exception)
            {
                logger.Write(model.From, model.To, model.Subject, model.TemplateName, exception);
                return(false);
            }
        }
Exemple #6
0
 public loginController(IMemberService memberService, ILoginLogService loginLogService, IEmailLogService emailLogService)
 {
     _memberService   = memberService;
     _loginLogService = loginLogService;
     _emailLogService = emailLogService;
 }
 public EmailLogsController(IEmailLogService emailLogService, IEmailAccountService emailAccountService)
 {
     _emailLogService     = emailLogService;
     _emailAccountService = emailAccountService;
 }
 public adminlogController(ISysOperLogService sysOperLogService, IMemberOperLogService memberOperLogService, IEmailLogService emailLogService)
 {
     _sysOperLogService    = sysOperLogService;
     _memberOperLogService = memberOperLogService;
     _emailLogService      = emailLogService;
 }
Exemple #9
0
 public EmailLogsController(IEmailLogService svs, IOptions <AppSettings> appSettings)
 {
     this.svs          = svs;
     this._appSettings = appSettings.Value;
 }