//录入学术报告信息 public void Insert(ScienceReport scienceReport) { try { dbcontext.ScienceReportContext.Add(scienceReport); dbcontext.SaveChanges(); } catch { throw; } }
//删除附件 public void UpdateAttachment(int ID) { try { ScienceReport scienceReport = dbcontext.ScienceReportContext.Find(ID); scienceReport.AccessoryID = null; dbcontext.SaveChanges(); } catch { throw; } }
//审核状态的改变 public void ChangePass(int ReportID, bool IsPass) { //bool? isPass = dbcontext.ScienceReportContext.Find(ReportID).IsPass; //isPass = IsPass; ScienceReport sci = dbcontext.ScienceReportContext.Find(ReportID); if (sci == null) { return; } sci.IsPass = IsPass; dbcontext.SaveChanges(); }
//根据ScienceReportID删除学术报告信息 public int?Delete(int scienceReportID) { try { //ScienceReport scienceReport = new ScienceReport { ScienceReportID = scienceReportID }; ScienceReport scienceReport = dbcontext.ScienceReportContext.Find(scienceReportID); dbcontext.ScienceReportContext.Attach(scienceReport); dbcontext.ScienceReportContext.Remove(scienceReport); dbcontext.SaveChanges(); return(scienceReport.AccessoryID); } catch { return(0); } }
//删除学术会议的所有学术报告 public bool DeleteReportByMeetingID(int MeetingID) { try { List <int> listReportID = dbcontext.ScienceReportContext.Where(p => p.MeetingID == MeetingID).Select(p => p.ScienceReportID).ToList(); for (int i = 0; i < listReportID.Count(); i++) { ScienceReport sc = dbcontext.ScienceReportContext.Find(listReportID[i]); dbcontext.ScienceReportContext.Attach(sc); dbcontext.ScienceReportContext.Remove(sc); } dbcontext.SaveChanges(); return(true); } catch { return(false); } }
public bool Delete(int[] scienceReportID) { try { int count = scienceReportID.Count(); for (int i = 0; i < count; i++) { ScienceReport scienceReport = new ScienceReport { ScienceReportID = scienceReportID[i] }; dbcontext.ScienceReportContext.Attach(scienceReport); dbcontext.ScienceReportContext.Remove(scienceReport); } dbcontext.SaveChanges(); return(true); } catch { throw; } }