Exemplo n.º 1
0
 public void Add(Report entity, List <ReportDetail> details)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         if (entity != null)
         {
             plus_report _report = new plus_report {
                 Id           = entity.Id,
                 InputDate    = entity.InputDate,
                 InputUser    = entity.InputUser,
                 FlowState    = entity.FlowState,
                 Note         = entity.Note,
                 ProVersionId = entity.ProVersionId
             };
             entities.AddToplus_report(_report);
             ReportDetail.Add(_report, details, entities);
             entities.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
 public void Update(Report entity, List <ReportDetail> details)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         if (entity != null)
         {
             plus_report report = (from m in entities.plus_report
                                   where m.Id == entity.Id
                                   select m).FirstOrDefault <plus_report>();
             if (report != null)
             {
                 report.InputUser = entity.InputUser;
                 report.InputDate = entity.InputDate;
                 report.Note      = entity.Note;
                 ReportDetail.Del(report.Id, entities);
                 ReportDetail.Add(report, details, entities);
                 entities.SaveChanges();
             }
         }
     }
 }