//更新AgencyID = agencyID的机构信息为agency public void Update(UnitLectures unitLectures) { try { UnitLectures NewUnitLectures = dbcontext.UnitLecturesContext.Find(unitLectures.UnitLecturesID); NewUnitLectures.LecturesName = unitLectures.LecturesName; NewUnitLectures.AgencyID = unitLectures.AgencyID; NewUnitLectures.UReportName = unitLectures.UReportName; NewUnitLectures.LecturesTime = unitLectures.LecturesTime; NewUnitLectures.LecturesPlace = unitLectures.LecturesPlace; NewUnitLectures.listenerNumber = unitLectures.listenerNumber; NewUnitLectures.WorkUnit = unitLectures.WorkUnit; NewUnitLectures.AttachmentID = unitLectures.AttachmentID; NewUnitLectures.SecrecyLevel = unitLectures.SecrecyLevel; NewUnitLectures.EntryPerson = unitLectures.EntryPerson; NewUnitLectures.IsPass = unitLectures.IsPass; NewUnitLectures.WorkTitle = unitLectures.WorkTitle; NewUnitLectures.Identity = unitLectures.Identity; //NewUnitLectures.Identity = "123"; NewUnitLectures.Telephone = unitLectures.Telephone; NewUnitLectures.Remark = unitLectures.Remark; dbcontext.SaveChanges(); } catch (Exception e) { throw e; } }
//录入单位讲学信息 public void Insert(UnitLectures unitLectures) { try { dbcontext.UnitLecturesContext.Add(unitLectures); dbcontext.SaveChanges(); } catch { throw; } }
public bool Delete(int UnitLecturesID) { try { //UnitLectures unitLectures = new UnitLectures { UnitLecturesID = UnitLecturesID }; UnitLectures unitLectures = dbcontext.UnitLecturesContext.Find(UnitLecturesID); dbcontext.UnitLecturesContext.Attach(unitLectures); dbcontext.UnitLecturesContext.Remove(unitLectures); dbcontext.SaveChanges(); return(true); } catch { throw; } }
//将改变表中的审核 public bool ChangePass(int UnitLecturesID, bool ispass) { try { UnitLectures unitLectures = dbcontext.UnitLecturesContext.Find(UnitLecturesID); if (unitLectures == null) { return(false); } unitLectures.IsPass = ispass; dbcontext.SaveChanges(); return(true); } catch (System.Data.SqlClient.SqlException e) { throw e; } }