Esempio n. 1
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));
     }
 }
Esempio n. 2
0
 public virtual bool Update(SMC_Role role)
 {
     try
     {
         int i = SMC_RoleDao.Update(role);
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Update失败", ex);
     }
 }
Esempio n. 3
0
        public virtual bool InsertOrUpdate(SMC_Role role)
        {
            try
            {
                int i = 0;
                if (SMC_RoleDao.Get(role.Role_ID) == null)
                {
                    //i = SMC_RoleDao.Insert(role);
                    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;
                    }
                    i = SMC_RoleDao.Insert(role);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_Role");
                    }
                }
                else
                {
                    i = SMC_RoleDao.Update(role);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }