/// <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); } } } }
protected void form_OnAfterDataLoad(object sender, EventArgs e) { // Assign selected site name for filtering UniSelector usClasses = (UniSelector)form.FieldControls["ScopeClasses"]; if (usClasses != null) { usClasses.ObjectSiteName = SiteInfoProvider.GetSiteName(SiteID); } // Load current bindings if ((Scope != null) && (Scope.ScopeID > 0)) { DataSet ds = DocumentTypeScopeClassInfoProvider.GetScopeClasses("ScopeID = " + Scope.ScopeID, "ScopeID", 0, "ClassID"); currentValues = TextHelper.Join(";", DataHelper.GetStringValues(ds.Tables[0], "ClassID")); form.FieldControls["ScopeClasses"].Value = currentValues; } }