//更新 public void Update(FutherStudy fur) { try { FutherStudy newFur = dbcontext.FutherStudyContext.Find(fur.FutherStudyID); newFur.AgencyID = fur.AgencyID; newFur.Birthday = fur.Birthday; newFur.DocuType = fur.DocuType; newFur.Email = fur.Email; newFur.EntryPerson = fur.EntryPerson; newFur.Hometown = fur.Hometown; newFur.IDNum = fur.IDNum; newFur.IsPass = fur.IsPass; newFur.LearnBeginTime = fur.LearnBeginTime; newFur.LearnContent = fur.LearnContent; newFur.LearnEndTime = fur.LearnEndTime; newFur.LearnPlace = fur.LearnPlace; newFur.LearnSchool = fur.LearnSchool; newFur.Name = fur.Name; newFur.Profile = fur.Profile; newFur.Remark = fur.Remark; newFur.SecrecyLevel = fur.SecrecyLevel; newFur.Sex = fur.Sex; dbcontext.SaveChanges(); } catch { throw; } }
//录入进修学习(接受)信息 public void Insert(FutherStudy futherStudy) { try { dbcontext.FutherStudyContext.Add(futherStudy); dbcontext.SaveChanges(); } catch (DbEntityValidationException dbEx) { throw dbEx; } }
//更新IsPass状态UpdateIsPass(bool) public void UpdateIsPass(int furID, bool Ispass) { try { FutherStudy futherStudy = dbcontext.FutherStudyContext.Find(furID); if (futherStudy == null) { return; } futherStudy.IsPass = Ispass; dbcontext.SaveChanges(); } catch { throw; } }
//根据FutherStudyID删除信息 public bool Delete(int futherStudyID) { try { FutherStudy futherStudy = new FutherStudy { FutherStudyID = futherStudyID }; dbcontext.FutherStudyContext.Attach(futherStudy); dbcontext.FutherStudyContext.Remove(futherStudy); dbcontext.SaveChanges(); return(true); } catch { throw; } }