Пример #1
0
        public int GetFirstFolderId(string UserId, int MailBoxId = 0)
        {
            long Id         = Convert.ToInt32(UserId);
            int  _MailBoxId = Convert.ToInt32(MailBoxId);
            int  FolderId   = 0;

            if (_MailBoxId == 0)
            {
                using (var Entity = new WebMailEntities())
                {
                    _MailBoxId = Entity.MailBoxes.Where(s => s.UserId == Id).OrderBy(s => s.MailBoxSequence).Take(1).Select(z => z.MailBoxId).FirstOrDefault();
                }
            }
            using (var Entity = new WebMailEntities())
            {
                FolderId = Entity.MailBoxFolders.Where(s => s.MailBoxId == _MailBoxId).OrderBy(s => s.Sequence).Take(1).Select(z => z.MailBoxFolderId).FirstOrDefault();
            }
            return(FolderId);
        }
Пример #2
0
        public void Update(MailViewModel mail)
        {
            UpdateDatabase = true;

            using (var Entity = new WebMailEntities())
            {
                var target = Entity.Mails.Where(x => x.MessageID == mail.ID).FirstOrDefault();

                if (target != null)
                {
                    int _Category = Convert.ToInt32(mail.Category);
                    target.From     = mail.From;
                    target.Subject  = mail.Subject;
                    target.IsRead   = mail.IsRead;
                    target.To       = mail.To;
                    target.Category = _Category;
                    target.Email    = mail.Email;
                    Entity.SaveChanges();
                }
            }
        }
Пример #3
0
 public bool UpdateEmailSubject(MailViewModel mail, string UpdateOnlyDisable = null)
 {
     try
     {
         using (var Entity = new WebMailEntities())
         {
             Mail Mail = Entity.Mails.Where(s => s.MessageID == mail.ID).FirstOrDefault();
             if (UpdateOnlyDisable == "Disable")
             {
                 if (Mail != null)
                 {
                     Mail.Status = "D";
                     Entity.SaveChanges();
                 }
             }
             else if (UpdateOnlyDisable == "Deleted")
             {
                 if (Mail != null)
                 {
                     Entity.Mails.Remove(Mail);
                     Entity.SaveChanges();
                 }
             }
             else
             {
                 if (Mail != null)
                 {
                     Mail.Subject = mail.Subject;
                     Mail.Status  = mail.Status;
                     Entity.SaveChanges();
                 }
             }
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #4
0
 public TasksService(WebMailEntities entities)
 {
     this.entities = entities;
 }
Пример #5
0
 public ContactsService(WebMailEntities entities)
 {
     this.entities = entities;
 }
Пример #6
0
 public EventsService(WebMailEntities entities)
 {
     this.entities = entities;
 }