private ResourceClass GetClassFromFragmentQS(Dictionary <string, string> fragmentQS)
        {
            if (!fragmentQS.ContainsKey("Class"))
            {
                return(null);
            }

            int materialClassID;

            try
            {
                materialClassID = Convert.ToInt32(fragmentQS["Class"]);
            }
            catch (FormatException ex)
            {
                return(null);
            }

            // will always hit db !!!!!!!!!!!!!
            if (ResourceClasses.Where(m => m.ResourceClassID == materialClassID).Count() != 1)
            {
                return(null);
            }

            return(ResourceClasses.Where(m => m.ResourceClassID == materialClassID).First());
        }
Example #2
0
 private void UpdateData()
 {
     lbResourceClasses.ItemsSource = new ObservableCollection <ResourceClass>(ResourceClasses.Where(m => m.ParentClassID == CurrentResourceClassID).ToList());
     hlResourceClass.Visibility    = (CurrentResourceClass == null) ? Visibility.Collapsed : Visibility.Visible;
     hlResourceClass.Content       = (CurrentResourceClass == null) ? String.Empty : CurrentResourceClass.Name;
 }