public void UpdateMonograph([FromBody] Monograph monograph) { new Business.Logic.Monograph(monograph.Id).Researcher.UpdateMonograph( new Business.Logic.Monograph(monograph.Id, monograph.Name, monograph.CoauthorLastName, monograph.CoauthorFirstName, monograph.CoauthorMiddleName, monograph.ReleaseDate, monograph.PageCount)); }
//根据MonographID修改著作信息 public void Update(Monograph aMonograph) { Monograph monograph = dbcontext.MonographContext.Find(aMonograph.MonographID); monograph.BookNuber = aMonograph.BookNuber; monograph.IssueRegin = aMonograph.IssueRegin; monograph.MonographName = aMonograph.MonographName; monograph.PaperUnit = aMonograph.PaperUnit;; //所属机构 monograph.PUblicationTime = aMonograph.PUblicationTime; monograph.WriterIdentity = aMonograph.WriterIdentity; //第一作者身份 monograph.Publisher = aMonograph.Publisher; monograph.Remark = aMonograph.Remark; monograph.Revision = aMonograph.Revision; monograph.AchievementID = aMonograph.AchievementID; monograph.BAttachmentID = aMonograph.BAttachmentID; monograph.FAttachmentID = aMonograph.FAttachmentID; monograph.SecrecyLevel = aMonograph.SecrecyLevel; monograph.Sort = aMonograph.Sort; monograph.MonographPeople = aMonograph.MonographPeople; monograph.MonographType = aMonograph.MonographType; monograph.FirstWriter = aMonograph.FirstWriter; monograph.EntryPerson = aMonograph.EntryPerson; monograph.IsPass = aMonograph.IsPass; dbcontext.SaveChanges(); }
//录入著作信息 public void Insert(Monograph monograph) { try { dbcontext.MonographContext.Add(monograph); dbcontext.SaveChanges(); } catch { throw; } }
public int Add(string name, string coauthorLastName, string coauthorFirstName, string coauthorMiddleName, int releaseDate, int pageCount, int researcherId) { using (var context = new ResDbContext()) { var monograph = new Monograph { Name = name, CoauthorLastName = coauthorLastName, CoauthorFirstName = coauthorFirstName, CoauthorMiddleName = coauthorMiddleName, ReleaseDate = releaseDate, PageCount = pageCount }; context.Researchers.First(i => i.Id == researcherId).Monographs.Add(monograph); context.SaveChanges(); return(monograph.Id); } }
//更新IsPass状态 public void UpdateIsPass(int ID, bool isPass) { try { Monograph NewMonograph = dbcontext.MonographContext.Find(ID); if (NewMonograph == null) { return; } NewMonograph.IsPass = isPass; dbcontext.SaveChanges(); } catch { throw; } }
//分人员查看专著信息 public List <Monograph> FindByMonographPeople(string MonographPeople, int?SecrecyLevel) { List <Monograph> res = new List <Monograph>(); List <Monograph> Monographlist = dbcontext.MonographContext.Where(m => m.SecrecyLevel <= SecrecyLevel).ToList(); for (int i = 0; i < Monographlist.Count; i++) { Monograph mo = Monographlist[i]; string People = mo.MonographPeople.Replace(",", ","); string[] str = People.Split(','); foreach (string ss in str) { if (ss.Contains(MonographPeople)) { res.Add(mo); break; } } } return(res); }
//删除著作信息 public bool Delete(int monographID) { try { Monograph monograph = dbcontext.MonographContext.Where(u => u.MonographID == monographID).FirstOrDefault(); if (monograph != null) { dbcontext.MonographContext.Attach(monograph); dbcontext.MonographContext.Remove(monograph); dbcontext.SaveChanges(); return(true); } else { return(true); } } catch { throw; } }
public int AddMonograph(int researcherId, [FromBody] Monograph monograph) { return(Business.Logic.ResearcherManager.Instance().GetResearcher(researcherId).AddMonograph(monograph.Name, monograph.CoauthorLastName, monograph.CoauthorFirstName, monograph.CoauthorMiddleName, monograph.ReleaseDate, monograph.PageCount)); }