/// <summary>修改角色信息 /// </summary> /// <param name="roleEntity"></param> /// <returns></returns> public bool UpdateRole(RoleEntity roleEntity) { RoleDal roleDal = new RoleDal(); return roleDal.UpdateRole(roleEntity); }
/// <summary>添加角色 /// </summary> /// <param name="roleEntity"></param> /// <returns></returns> public bool AddRole(RoleEntity roleEntity) { RoleDal roleDal = new RoleDal(); return roleDal.AddRole(roleEntity); }
/// <summary>修改角色 /// </summary> /// <param name="roleEntity"></param> /// <returns></returns> public ActionResult UpdateRole(RoleEntity roleEntity) { RoleBll roleBll = new RoleBll(); bool result = roleBll.UpdateRole(roleEntity); return Json(result); }
/// <summary>转换为实体类 /// </summary> /// <param name="dataRow"></param> /// <returns></returns> private RoleEntity Conver2Entity(DataRow dataRow) { RoleEntity roleEntity = new RoleEntity(); roleEntity.Id = Int32.Parse(dataRow["Id"].ToString()); roleEntity.IsSuper = Int32.Parse(dataRow["IsSuper"].ToString()); roleEntity.Name = dataRow["Name"].ToString(); roleEntity.RightIds = dataRow["RightIds"].ToString(); //roleEntity.Rights = new List<RightEntity>(); return roleEntity; }
/// <summary>修改角色信息 /// </summary> /// <param name="roleEntity"></param> /// <returns></returns> public bool UpdateRole(RoleEntity roleEntity) { string sql = "update t_roles set Name = @Name , IsSuper = @issuper where Id = @Id;"; //roleEntity.Name, roleEntity.RightIds, roleEntity.IsSuper, roleEntity.Id); SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@Name", roleEntity.Name) , new SQLiteParameter("@issuper", roleEntity.IsSuper) , new SQLiteParameter("@Id", roleEntity.Id) , }; int result = new SqlLiteHelper().RunSQL(sql, para); return result > 0; }
/// <summary>添加角色 /// </summary> /// <param name="roleEntity"></param> /// <returns></returns> public bool AddRole(RoleEntity roleEntity) { string sql = "insert into t_roles (Name,IsSuper) values (@Name,@IsSuper);";//, roleEntity.Name, roleEntity.IsSuper); SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@Name", roleEntity.Name), new SQLiteParameter("@IsSuper", roleEntity.IsSuper) }; int result = new SqlLiteHelper().RunSQL(sql, para); return result > 0; }