Ejemplo n.º 1
0
 private void cmbUser_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (!(RoleUtil.AllUsers.Contains((sender as ComboBox).Text)) || (sender as ComboBox).SelectedItem == null)
         {
             lblMessage.Content    = "Enter valid user ID.";
             lblMessage.Foreground = new SolidColorBrush(Colors.Red);
         }
         else
         {
             GetUserDetails(sender, (sender as ComboBox).Text);
         }
     }
     else
     {
         if (!isListsCleared)
         {
             lstUnassignedRoles.ItemsSource = null;
             lstAssignedRoles.ItemsSource   = null;
             lblMessage.Content             = "";
             RoleUtil.ClearAll();
             isListsCleared = true;
         }
     }
 }
Ejemplo n.º 2
0
 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     lstUnassignedRoles.ItemsSource = null;
     lstAssignedRoles.ItemsSource   = null;
     lblMessage.Content             = "";
     cmbUser.Text = "";
     RoleUtil.ClearAll();
 }
Ejemplo n.º 3
0
        private void ShowToolTip(object sender, ListBox lstBox)
        {
            int currentindex;
            var result = sender as ListBoxItem;

            for (int i = 0; i < lstBox.Items.Count; i++)
            {
                if (lstBox.Items[i].ToString().Equals(result.Content.ToString()))
                {
                    currentindex   = i;
                    result.ToolTip = RoleUtil.GetDesrForRoleCode(result.Content.ToString());
                    break;
                }
            }
        }
Ejemplo n.º 4
0
 private void GetUserDetails(object sender, string userID)
 {
     if (string.IsNullOrEmpty(userID))
     {
         isListsCleared = false;
         return;
     }
     else if (userRoles.IsUserIdValid(userID))
     {
         RoleUtil.GetUserRoles(userID);
         lstUnassignedRoles.ItemsSource = RoleUtil.userUnassignedRoles;
         lstAssignedRoles.ItemsSource   = RoleUtil.userAssignedRoles;
         lblMessage.Content             = "";
         isListsCleared = false;
     }
     else
     {
         lblMessage.Content    = "User id: '" + (sender as ComboBox).Text + "' does not exist in the database.";
         lblMessage.Foreground = new SolidColorBrush(Colors.Red);
         isListsCleared        = false;
     }
 }