public virtual bool Insert(SMC_FunctionRole functionRole) { try { SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey); if (autoDao.HasMaxID("SMC_FunctionRole")) { int max_id = autoDao.GetMaxID("SMC_FunctionRole"); functionRole.FR_ID = max_id + 1; } else { functionRole.FR_ID = 1; } int i = SMC_FunctionRoleDao.Insert(functionRole); if (i > 0) { autoDao.UpdateMaxID("SMC_FunctionRole"); } return(i > 0); } catch (DalException ex) { throw new BOException("调用方法Insert失败", ex); } }
public JsonResult SaveFunctionsTree(string ids, string ids_changed, int roleId) { string[] idsArray = ids.Split(",".ToCharArray()); string[] idsArray_changed = ids_changed.Split(",".ToCharArray()); foreach (string sId in idsArray) { if (!String.IsNullOrEmpty(sId)) { SMC_FunctionRole fr = new SMC_FunctionRole(); fr.FN_ID = int.Parse(sId); fr.Role_ID = roleId; fr.FR_CreatedTime = DateTime.Now; fr.FR_CreatedUser = ""; fr.FR_UpdateTime = DateTime.Now; fr.FR_UpdateUser = ""; fr.FR_Sequence = 0; BoFactory.GetSMC_FunctionRoleBo.InsertOrUpdate(fr); } } foreach (string sId in idsArray_changed) { if (!String.IsNullOrEmpty(sId)) { BoFactory.GetSMC_FunctionRoleBo.Delete(int.Parse(sId), roleId); } } return(Json(new { result = true, d = "保存成功!" })); }
public virtual void Delete(SMC_FunctionRole entity) { try { SMC_FunctionRoleDao.Delete(entity); } catch (DalException ex) { throw new BOException("调用方法Delete失败", ex); } }
public virtual bool Update(SMC_FunctionRole functionRole) { try { int i = SMC_FunctionRoleDao.Update(functionRole); return(i > 0); } catch (DalException ex) { throw new BOException("调用方法Update失败", ex); } }
public virtual bool InsertOrUpdate(SMC_FunctionRole functionRole) { try { int i = 0; if (!SMC_FunctionRoleDao.Exists(functionRole.FR_ID) && !SMC_FunctionRoleDao.Exists(functionRole.FN_ID, functionRole.Role_ID)) { //i = SMC_FunctionRoleDao.Insert(functionRole); SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey); if (autoDao.HasMaxID("SMC_FunctionRole")) { int max_id = autoDao.GetMaxID("SMC_FunctionRole"); functionRole.FR_ID = max_id + 1; } else { functionRole.FR_ID = 1; } i = SMC_FunctionRoleDao.Insert(functionRole); if (true) { autoDao.UpdateMaxID("SMC_FunctionRole"); } } else { i = SMC_FunctionRoleDao.Update(functionRole); } return(true); } catch (DalException ex) { throw new BOException("调用方法InsertOrUpdate失败", ex); } }