示例#1
0
 public string updateCustomer(Mail mail, int id)
 {
     try
     {
         using (var context = new MailRecorderDBEntities())
         {
             MAIL mailUp = context.MAILs.Where(x => x.Id == id).FirstOrDefault <MAIL>();
             mailUp.Id            = mail.getmailID();
             mailUp.DIARY_NO      = mail.getDiaryNo();
             mailUp.MRDIARY_NO    = mail.getmrDiary();
             mailUp.SUBJECT       = mail.getSubject();
             mailUp.DATE_SENT     = mail.getDateSent();
             mailUp.DATE_TODAY    = mail.getDateToday();
             mailUp.INITIATOR     = mail.getInitiator();
             mailUp.RECEIVED_FROM = mail.getRecievedFrom();
             mailUp.SENT_TO       = mail.getSentTo();
             mailUp.CC            = mail.getCc();
             mailUp.REMARKS       = mail.getRemarks();
             context.SaveChanges();
             return(mailUp.DIARY_NO.ToString());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#2
0
 public string addMail(Mail tempMail)
 {
     try
     {
         using (var context = new MailRecorderDBEntities())
         {
             var mail = new MAIL()
             {
                 Id            = tempMail.getmailID(),
                 DIARY_NO      = tempMail.getDiaryNo(),
                 MRDIARY_NO    = tempMail.getmrDiary(),
                 SUBJECT       = tempMail.getSubject(),
                 DATE_SENT     = tempMail.getDateSent(),
                 DATE_TODAY    = tempMail.getDateToday(),
                 INITIATOR     = tempMail.getInitiator(),
                 RECEIVED_FROM = tempMail.getRecievedFrom(),
                 SENT_TO       = tempMail.getSentTo(),
                 CC            = tempMail.getCc(),
                 REMARKS       = tempMail.getRemarks()
             };
             context.MAILs.Add(mail);
             context.SaveChanges();
             return(mail.SUBJECT);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#3
0
 public string deleteMail(int id)
 {
     using (var context = new MailRecorderDBEntities())
     {
         var author = new MAIL {
             Id = id
         };
         context.Entry(author).State = EntityState.Deleted;
         context.SaveChanges();
         return(author.Id.ToString());
     }
 }