public void Process(List<DhlWaybillParam> dhlWaybillParamList, ProcessModeInfo processMode, string enableSendEmail,string taobaoOrderSn)
        {
            if (dhlWaybillParamList.Count == 0)
            {
                return;
            }

            var setting = this.waybillSettingFactory.Create();
            List<string> nameList = dhlWaybillParamList.Select(x => x.Recipient.Name).ToList();
            string targetDir = this.directoryService.CreateDhlWaybillFolder(nameList);
            var excelBuilder = this.dhlWaybillExcelBuilderFactory.CreateBuilder(processMode);

            string xlsFullPath = excelBuilder.Generate(targetDir, dhlWaybillParamList);


            if (enableSendEmail == "true")
            {
                var emailBuilder = this.dhlWaybillEmailBuilderFactory.CreateBuilder(processMode);
                string emailHeader = emailBuilder.GetEmailHeader(dhlWaybillParamList,taobaoOrderSn);
                string emailBody = emailBuilder.GetEmailBody(dhlWaybillParamList, taobaoOrderSn);

                List<string> recipientList = new List<string>() { emailBuilder.ReceiverEmail };
                List<string> ccList = new List<string>();
                ccList.AddRange(setting.CcEmail.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries));


                this.emailService.SendMail(emailHeader, emailBody, recipientList, ccList, System.Net.Mail.MailPriority.High, xlsFullPath);
            }
            else
            {
                FileInfo file = new FileInfo(xlsFullPath);
                System.Diagnostics.Process.Start(file.Directory.FullName);                
            }

        }
Example #2
0
         public IDhlWaybillExcelBuilder CreateBuilder(ProcessModeInfo type)
         {
             if (type.Name == "诚信安全")
                 return this.container.Resolve<CxDhlWaybillExcelBuilder>("CxDhlWaybillExcelBuilder");
             else if (type.Name == "中德快递Bpost")
                 return this.container.Resolve<ZdBpostWaybillExcelBuilder>(new ParameterOverride("modeInfo", type));

             else if (type.Type == "下家客户")
                 return this.container.Resolve<ZdBpostWaybillExcelBuilder>(new ParameterOverride("modeInfo", type));
            return null;
        }
        public ZdBpostWaybillEmailBuilderToClient(ProcessModeInfo modeInfo) : base( modeInfo)
        {

        }
 public ZdBpostWaybillEmailBuilder(ProcessModeInfo modeInfo)
 {
     this.processModeInfo = modeInfo;
     
 }
 public ZdBpostWaybillExcelBuilder(ProcessModeInfo modeInfo, ResourceReleaser resourceReleaser, RandomNameService randomNameService)
 {
     this.modeInfo = modeInfo;
    this.resourceReleaser = resourceReleaser;
    this.randomNameService = randomNameService;
 }