Beispiel #1
0
 public void RemoveCurrentField(string fieldName)
 {
     if (CurrentColumns.Count == 1 && CurrentColumns.First().FieldName == fieldName)
     {
         ApplicationController.UserMessage("There Must Be At Least One View Column");
     }
     else
     {
         //if removed field active for the current selected link then add it as an option
         if ((!fieldName.Contains(".") && SelectedLink.Key == RecordType) ||
             (fieldName.Contains(".") && fieldName.Split('.')[0] == SelectedLink.Key))
         {
             var selectedResults = CurrentColumns.Where(c => c.FieldName == fieldName).ToArray();
             foreach (var result in selectedResults)
             {
                 CurrentColumns.Remove(result);
                 foreach (var item in SelectableColumns)
                 {
                     if (item.FieldLabel != null && item.FieldLabel.CompareTo(result.FieldLabel) > 0)
                     {
                         SelectableColumns.Insert(SelectableColumns.IndexOf(item), result);
                         break;
                     }
                 }
                 if (!SelectableColumns.Contains(result))
                 {
                     SelectableColumns.Add(result);
                 }
             }
         }
     }
 }
 public void RemoveCurrentField(string fieldName)
 {
     if (CurrentColumns.Count == 1 && CurrentColumns.First().FieldName == fieldName)
     {
         ApplicationController.UserMessage("The Must Be At Least One View Column");
     }
     else
     {
         var selectedResults = CurrentColumns.Where(c => c.FieldName == fieldName).ToArray();
         foreach (var result in selectedResults)
         {
             CurrentColumns.Remove(result);
             foreach (var item in SelectableColumns)
             {
                 if (item.FieldLabel != null && item.FieldLabel.CompareTo(result.FieldLabel) > 0)
                 {
                     SelectableColumns.Insert(SelectableColumns.IndexOf(item), result);
                     break;
                 }
             }
             if (!SelectableColumns.Contains(result))
             {
                 SelectableColumns.Add(result);
             }
         }
     }
 }