Example #1
0
        //***************************************************************
        private string HandleCSTest(List <string> words)
        //***************************************************************
        {
            var    cse    = new CSEMail(_config, _userManager);
            String report = "";
            var    eList  = cse.ReadEMails();

            foreach (var e in eList)
            {
                report += e.Subject + ".\n";

                if ((e.HtmlBody != null) && (e.HtmlBody.Length > 5))
                {
                    e.AddHtmlAsPDFAttachment();
                }

                if (e.Attachments.Count > 0)
                {
                    var dbox     = new CSDropBox(Startup.CSConfig);
                    var destPath = "/Memorandums";
                    foreach (var a in e.Attachments)
                    {
                        string FileName = e.GetFinalFileName(Path.GetFileName(a));
                        if (dbox.FileExists(destPath + "/" + FileName))
                        {
                            var fBody = Path.GetFileNameWithoutExtension(FileName);
                            var fExt  = Path.GetExtension(FileName);
                            for (char j = 'B'; j < 'Z'; ++j)
                            {
                                FileName = fBody + "_Rev_" + j.ToString() + fExt;
                                if (!dbox.FileExists(destPath + "/" + FileName))
                                {
                                    break;
                                }
                            }
                        }
                        dbox.UploadFile(a, destPath, FileName);
                        File.Delete(a);
                    }
                }
            }
            return(report);
        }
Example #2
0
 public DocsModel(IWebHostEnvironment hstEnv)
 {
     hostEnv = hstEnv;
     dbox    = new CSDropBox(Startup.CSConfig);
 }