/// <summary> /// 数据保存 /// </summary> /// <param name="p">药理分类对象</param> /// <returns>返回结果</returns> public bool SavePharmacy(DG_Pharmacology p) { List <Tuple <string, string, SqlOperator> > lst = new List <Tuple <string, string, SqlOperator> >(); lst.Add(Tuple.Create("PharmName", p.PharmName, SqlOperator.Equal)); lst.Add(Tuple.Create("delflag", "0", SqlOperator.Equal)); lst.Add(Tuple.Create("parentid", p.ParentID.ToString(), SqlOperator.Equal)); IEnumerable <DG_Pharmacology> objs = NewObject <IDGDao>().GetEntityType <DG_Pharmacology>(lst, null); var vp = objs.FirstOrDefault(i => i.PharmID == p.PharmID); if (vp != null) { p.save(); return(true); } if (objs != null && objs.Any()) { //同名记录存在 return(false); } p.save(); return(true); }
/// <summary> /// 更新为删除状态 /// </summary> /// <param name="p">药理分类对象</param> public void UpdatePharmacy(DG_Pharmacology p) { p.Delflag = 1; p.save(); }