//To Edit Group void CtlGrid_btnEditClicked(int rowID) { try { CtlGrid.IsEnabled = false; tbcUserGroup.Visibility = Visibility.Visible; btnGroupSave.Visibility = Visibility.Visible; btnGroupCancel.Visibility = Visibility.Visible; varID = _MyGroups[rowID].ID; txtName.Text = _MyGroups[rowID].GroupName; txtDescription.Text = _MyGroups[rowID].Description; if ((bool)_MyGroups[rowID].IsActive == true) { chkIsActive.IsChecked = true; } else { chkIsActive.IsChecked = false; } ClsUserCollection AllUsers = new ClsUserCollection(); AllUsers = ClsUserCollection.GetAll(varID); for (int i = 0; i < AllUsers.Count; i++) { ListBoxItem newItem = new ListBoxItem(); newItem.Content = AllUsers[i].AgentName; newItem.Tag = AllUsers[i].ID; lstSelectedAgents.Items.Add(newItem); for (int j = 0; j < lstAvailableAgents.Items.Count; j++) { if (((ListBoxItem)lstAvailableAgents.Items[j]).Tag.ToString() == AllUsers[i].ID.ToString()) { lstAvailableAgents.Items.Remove(lstAvailableAgents.Items[j]); } } } varState = 1; } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "CtlGrid_btnEditClicked", "ctlUserGroup.xaml.cs"); } }
//set data in AvailableAgents listbox and SelectedAgents listbox void funSetComboboxes() { try { lstAvailableAgents.Items.Clear(); lstSelectedAgents.Items.Clear(); //Calling GetAll function for getting users which are not assigned to group ClsUserCollection AllUser = ClsUserCollection.GetAll(-1); for (int i = 0; i < AllUser.Count; i++) { ListBoxItem newItem = new ListBoxItem(); newItem.Content = AllUser[i].AgentName; newItem.Tag = AllUser[i].ID; lstAvailableAgents.Items.Add(newItem); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "fncSetComboboxes", "ctlUserGroup.xaml.cs"); } }