示例#1
0
        public MailService(ITempFilesService tempFilesService, IRazorEngineService razorEngineService, ILogService logService, ISettingsService settingsService)
        {
            _tempFilesService   = tempFilesService;
            _razorEngineService = razorEngineService;
            _logService         = logService;
            _settingsService    = settingsService;

            Mapper.CreateMap <RoCMS.Web.Contract.Models.MailMsg, RoCMS.Data.Models.Mail>()
            .ForMember(x => x.MailId, x => x.Ignore())
            .ForMember(x => x.CreationDate, x => x.Ignore())
            .ForMember(x => x.ErrorMessage, x => x.Ignore())
            .ForMember(x => x.Sent, x => x.Ignore())
            .ForMember(x => x.Attaches, x => x.ResolveUsing(s =>
            {
                string result = "";
                var attachIds = s.AttachIds;
                if (attachIds != null && attachIds.Any())
                {
                    foreach (Guid id in attachIds)
                    {
                        try
                        {
                            var file = _tempFilesService.GetFile(id);
                            if (file != null)
                            {
                                if (result.Length > 0)
                                {
                                    result += ",";
                                }
                                result += file.FileName;
                            }
                        }
                        catch (Exception e)
                        {
                            _logService.LogError(e);
                        }
                    }
                }
                return(result);
            }));
            Mapper.AssertConfigurationIsValid();
        }
示例#2
0
 public TempFileApiController(ITempFilesService tempService, ILogService logService)
 {
     _tempService = tempService;
     _logService  = logService;
 }
示例#3
0
 public TempUploadHandler()
 {
     _tempFilesService = DependencyResolver.Current.GetService <ITempFilesService>();
     js = new JavaScriptSerializer();
     js.MaxJsonLength = 5242880;
 }