/// <summary> /// Allowed parent types selector event. /// </summary> protected void selParent_OnSelectionChanged(object sender, EventArgs e) { bool reloadSecond = false; // Remove old items string newValues = ValidationHelper.GetString(selParent.Value, null); string items = DataHelper.GetNewItemsInList(newValues, parentValues); if (!String.IsNullOrEmpty(items)) { var newItems = items.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); // Add all new items to site foreach (string item in newItems) { int parentId = ValidationHelper.GetInteger(item, 0); AllowedChildClassInfoProvider.RemoveAllowedChildClass(parentId, classId); if (classId == parentId) { reloadSecond = true; } } } // Add new items items = DataHelper.GetNewItemsInList(parentValues, newValues); if (!String.IsNullOrEmpty(items)) { var newItems = items.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); // Add all new items to site foreach (string item in newItems) { int parentId = ValidationHelper.GetInteger(item, 0); AllowedChildClassInfoProvider.AddAllowedChildClass(parentId, classId); if (classId == parentId) { reloadSecond = true; } } } // Reload second unigrid if (reloadSecond) { LoadChildData(true); uniSelector.Reload(true); } ShowChangesSaved(); }
protected void uniSelector_OnSelectionChanged(object sender, EventArgs e) { // Remove old items string newValues = ValidationHelper.GetString(uniSelector.Value, null); string items = DataHelper.GetNewItemsInList(newValues, currentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items to site foreach (string item in newItems) { int childId = ValidationHelper.GetInteger(item, 0); AllowedChildClassInfoProvider.RemoveAllowedChildClass(classId, childId); } } } // 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 items to site foreach (string item in newItems) { int childId = ValidationHelper.GetInteger(item, 0); AllowedChildClassInfoProvider.AddAllowedChildClass(classId, childId); } } } lblInfo.Visible = true; lblInfo.Text = GetString("general.changessaved"); }
protected void selParent_OnSelectionChanged(object sender, EventArgs e) { // Remove old items string newValues = ValidationHelper.GetString(selParent.Value, null); string items = DataHelper.GetNewItemsInList(newValues, parentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items to site foreach (string item in newItems) { int parentId = ValidationHelper.GetInteger(item, 0); AllowedChildClassInfoProvider.RemoveAllowedChildClass(parentId, classId); } } } // Add new items items = DataHelper.GetNewItemsInList(parentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items to site foreach (string item in newItems) { int parentId = ValidationHelper.GetInteger(item, 0); AllowedChildClassInfoProvider.AddAllowedChildClass(parentId, classId); } } } ShowChangesSaved(); }