////改 // //更新报告信息 public void Update(NewAcademicReporting newAcademicReporting) { try { NewAcademicReporting NewNAReporting = dbcontext.NewAcademicReportingContext.Find(newAcademicReporting.NewAcademicReportingID); NewNAReporting.ReportPeople = newAcademicReporting.ReportPeople; NewNAReporting.JobName = newAcademicReporting.JobName; NewNAReporting.JobMission = newAcademicReporting.JobMission; NewNAReporting.ReportUnit = newAcademicReporting.ReportUnit; NewNAReporting.Report = newAcademicReporting.Report; NewNAReporting.ReportTele = newAcademicReporting.ReportTele; NewNAReporting.Remark = newAcademicReporting.Remark; NewNAReporting.AcademicTitle = newAcademicReporting.AcademicTitle; NewNAReporting.ReportName = newAcademicReporting.ReportName; NewNAReporting.ReportTime = newAcademicReporting.ReportTime; NewNAReporting.ReportPlace = newAcademicReporting.ReportPlace; NewNAReporting.ApplyFund = newAcademicReporting.ApplyFund; NewNAReporting.PeopleCount = newAcademicReporting.PeopleCount; NewNAReporting.Organizers = newAcademicReporting.Organizers; NewNAReporting.Coorganizer = newAcademicReporting.Coorganizer; NewNAReporting.AttachmentID = newAcademicReporting.AttachmentID; NewNAReporting.ReportType = newAcademicReporting.ReportType; NewNAReporting.MajorPeople = newAcademicReporting.MajorPeople; dbcontext.SaveChanges(); } catch { throw; } }
////增 // //插入新学术报告信息 public void Insert(NewAcademicReporting newAcademicReporting) { try { dbcontext.NewAcademicReportingContext.Add(newAcademicReporting); dbcontext.SaveChanges(); } catch { throw; } }
//删除附件 public void UpdateAttachment(int ID) { try { NewAcademicReporting NewNAReporting = dbcontext.NewAcademicReportingContext.Find(ID); NewNAReporting.AttachmentID = null; dbcontext.SaveChanges(); } catch { throw; } }
////删 // //根据newAcademicReportingID删除报告信息 public bool Delete(int newAcademicReportingID) { try { NewAcademicReporting newAcademicReporting = dbcontext.NewAcademicReportingContext.Find(newAcademicReportingID); dbcontext.NewAcademicReportingContext.Attach(newAcademicReporting); dbcontext.NewAcademicReportingContext.Remove(newAcademicReporting); dbcontext.SaveChanges(); return(true); } catch { throw; } }
//更新IsPass状态 public void UpdatePass(int ID, bool isPass) { try { NewAcademicReporting newAcademicReporting = dbcontext.NewAcademicReportingContext.Find(ID); if (newAcademicReporting == null) { return; } newAcademicReporting.IsPass = isPass; dbcontext.SaveChanges(); } catch { throw; } }
public bool Delete(int[] newAcademicReportingID) { try { int count = newAcademicReportingID.Count(); for (int i = 0; i < count; i++) { NewAcademicReporting newAcademicReporting = dbcontext.NewAcademicReportingContext.Find(newAcademicReportingID); dbcontext.NewAcademicReportingContext.Attach(newAcademicReporting); dbcontext.NewAcademicReportingContext.Remove(newAcademicReporting); } dbcontext.SaveChanges(); return(true); } catch { throw; } }