Exemplo n.º 1
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         CLS    entity  = (CLS)p_BE;
         CLSCtl control = new CLSCtl(sqlTrans);
         string sql     = string.Empty;
         //string sql="SELECT CLSIDC FROM Data_CLS WHERE CLSIDC="+SysString.ToDBString(entity.CLSIDC);
         //sql+=" AND CLSListID="+SysString.ToDBString(entity.CLSListID);
         //sql+=" AND ID<>"+SysString.ToDBString(entity.ID);
         //DataTable dt=SysUtils.Fill(sql);
         //if(dt.Rows.Count!=0)
         //{
         //    throw new Exception("该编码已经存在,请重新输入!");
         //}
         sql  = "SELECT CLSNM FROM Data_CLS WHERE CLSNM=" + SysString.ToDBString(entity.CLSNM);
         sql += " AND CLSListID=" + SysString.ToDBString(entity.CLSListID);
         sql += " AND ID<>" + SysString.ToDBString(entity.ID);
         DataTable dt = SysUtils.Fill(sql);
         if (dt.Rows.Count != 0)
         {
             throw new Exception("该内容已经存在,请重新输入!");
         }
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         CLS    entity  = (CLS)p_BE;
         CLSCtl control = new CLSCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }