/// <summary> /// Loads the specified roles. /// </summary> /// <param name="roles">The roles.</param> internal void Load(string[] roles) { string list = String.Empty; foreach (string role in roles) { if (String.IsNullOrEmpty(list)) { list = role; } else { list = list + "," + role; } } DataCommand cmd = ProfileDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_RolePermission"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", ProfileConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("Roles", list, DataParameterType.NVarChar)); cmd.DataSet = this.CurrentDto; cmd.TableMapping = DataHelper.MapTables("RolePermission"); DataService.LoadDataSet(cmd); }
/// <summary> /// Updates the permissions. /// </summary> internal void Save() { if (CurrentDto.RolePermission == null) { return; } if (CurrentDto.RolePermission.Count == 0) { return; } DataCommand cmd = ProfileDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(ProfileContext.MetaDataContext, cmd, CurrentDto, "RolePermission"); scope.Complete(); } }