Пример #1
0
 public virtual bool Insert(SMC_Role role)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_Role"))
         {
             int max_id = autoDao.GetMaxID("SMC_Role");
             role.Role_ID = max_id + 1;
         }
         else
         {
             role.Role_ID = 1;
         }
         int i = SMC_RoleDao.Insert(role);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_Role");
         }
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Insert失败", ex);
     }
 }
Пример #2
0
 public virtual int Save(SMC_Role entity)
 {
     if (SMC_RoleDao.Get(entity.Role_ID) == null)
     {
         return(SMC_RoleDao.Insert(entity));
     }
     else
     {
         return(SMC_RoleDao.Update(entity));
     }
 }