Exemplo n.º 1
0
 /// <summary>
 ///     Loads in the lists of fields that can be edited
 /// </summary>
 public void LoadFields(bool includeRequests)
 {
     Categories  = new ObservableCollection <string>();
     Licenses    = new ObservableCollection <string>();
     Territories = new ObservableCollection <string>();
     try
     {
         List <string> CategoryList        = GlobalData.ReturnWebCategoryListValues();
         List <string> LicenseList         = ItemService.RetrieveLicensePropertyList();
         List <string> TerritoryList       = GlobalData.Territories;
         List <string> MetaDescriptionList = GlobalData.MetaDescriptions;
         CategoryList.Sort();
         TerritoryList.Sort();
         foreach (string i in CategoryList)
         {
             Categories.Add(i);
         }
         foreach (string i in MetaDescriptionList)
         {
             MetaDescriptions.Add(i);
         }
         foreach (string i in LicenseList)
         {
             Licenses.Add(i);
         }
         foreach (string i in TerritoryList)
         {
             Territories.Add(i);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.LogError("Odin was unable to retrieve editable field values.", ex.ToString());
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Adds 'categoryInput' to categories table and reloads the table
        /// </summary>
        public void CreateField(string field)
        {
            FieldEditWindowView window = new FieldEditWindowView();

            window.DataContext = new FieldEditWindowViewModel(fieldType: field, fieldValue: "", fieldStatus: "Add", itemService: ItemService, emailService: EmailService);
            window.ShowDialog();
            if (window.DialogResult == true)
            {
                string newValue = "";
                switch (field)
                {
                case "Category":
                    newValue = (window.DataContext as FieldEditWindowViewModel).NewFieldValue;
                    Categories.Add(newValue);
                    Categories = new ObservableCollection <string>(Categories.OrderBy(i => i));
                    break;

                case "License":
                    newValue = (window.DataContext as FieldEditWindowViewModel).NewFieldValue;
                    Licenses.Add(newValue);
                    Licenses = new ObservableCollection <string>(Licenses.OrderBy(i => i));
                    break;

                case "Meta Description":
                    newValue = (window.DataContext as FieldEditWindowViewModel).NewFieldValue;
                    MetaDescriptions.Add(newValue);
                    MetaDescriptions = new ObservableCollection <string>(MetaDescriptions.OrderBy(i => i));
                    break;

                case "Territory":
                    newValue = (window.DataContext as FieldEditWindowViewModel).NewFieldValue;
                    Territories.Add(newValue);
                    Territories = new ObservableCollection <string>(Territories.OrderBy(i => i));
                    break;
                }
            }
        }