/// <summary> /// OnAfterSave event handler. /// </summary> protected void form_OnAfterSave(object sender, EventArgs e) { // Remove old items string newValues = ValidationHelper.GetString(form.FieldControls["ScopeClasses"].Value, null); string items = DataHelper.GetNewItemsInList(newValues, currentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); // Add all new items to site foreach (string item in newItems) { DocumentTypeScopeClassInfoProvider.RemoveClassFromScope(Scope.ScopeID, ValidationHelper.GetInteger(item, 0)); } } // Add new items items = DataHelper.GetNewItemsInList(currentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); // Add all new items to site foreach (string item in newItems) { DocumentTypeScopeClassInfoProvider.AddClassToScope(Scope.ScopeID, ValidationHelper.GetInteger(item, 0)); } } }
protected void usScopes_OnSelectionChanged(object sender, EventArgs e) { // Remove old items string newValues = ValidationHelper.GetString(usScopes.Value, null); string items = DataHelper.GetNewItemsInList(newValues, currentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Remove document types from scope foreach (string item in newItems) { DocumentTypeScopeClassInfoProvider.RemoveClassFromScope(ValidationHelper.GetInteger(item, 0), DocumentType.ClassID); } } } // Add new items items = DataHelper.GetNewItemsInList(currentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new document types to scope foreach (string item in newItems) { DocumentTypeScopeClassInfoProvider.AddClassToScope(ValidationHelper.GetInteger(item, 0), DocumentType.ClassID); } } } }