Esempio n. 1
0
 private void SaveToDB()
 {
     if (allMail.Count <= 0)
     {
         return;
     }
     try
     {
         IContentManage    MailContentMng = new ContentManage();
         IAttachmentManage MailAttachMng  = new AttachmentManage();
         int mailId;
         int mailCount = hmail.MailCount - currMailCount;
         allMail.ToList().ForEach(s =>
         {
             mailId = MailMng.CreateMail(HMConvert.ConvertMailEntity.ConvertToDbMailEntity((int)AppMain.currUser.Id, s));
             HMConvert.ConvertMailEntity.ConvertToDbContentEntity(mailId, s).ToList().ForEach(v =>
             {
                 MailContentMng.CreateContent(v);
             });
             HMConvert.ConvertMailEntity.ConvertToDbAttachEntity(mailId, s).ToList().ForEach(n =>
             {
                 MailAttachMng.CreateAttactment(n);
             });
             this.Invoke(new MethodInvoker(() =>
             {
                 this.progressBar1.Value--;
                 TestLaber.Text = mailCount.ToString();
                 mailCount--;
             }));
         });
     }
     catch (Exception e)
     {
         AppLog.SysLog(e.ToString());
     }
 }