/// <summary>
        /// Will remove a distribution from distribution list
        /// </summary>
        /// <param name="inDist"></param>
        public void RemoveSelectedDistribution(object inDist)
        {
            Themes.ComboBoxItem oldDist = inDist as Themes.ComboBoxItem;
            _mineralAltDistValues.Remove(oldDist);

            RaisePropertyChanged("MineralAltDistValues");
        }
        /// <summary>
        /// Will add to the list of purposes a selected purpose by the user.
        /// </summary>
        public void AddADistribution(string distToAdd)
        {
            Themes.ComboBoxItem newDist = new Themes.ComboBoxItem();
            newDist.itemValue = distToAdd;
            foreach (Themes.ComboBoxItem cb in MineralAltDist)
            {
                if (cb.itemValue == distToAdd)
                {
                    newDist.itemName = cb.itemName;
                    break;
                }
            }
            if (newDist.itemName != null && newDist.itemValue != string.Empty)
            {
                bool foundValue = false;
                foreach (Themes.ComboBoxItem existingItems in _mineralAltDistValues)
                {
                    if (distToAdd == existingItems.itemName)
                    {
                        foundValue = true;
                    }
                }
                if (!foundValue)
                {
                    _mineralAltDistValues.Add(newDist);
                }
            }

            RaisePropertyChanged("MineralAltDistValues");
        }
Beispiel #3
0
 /// <summary>
 /// Will add to the list of purposes a selected purpose by the user.
 /// </summary>
 public void AddAPurpose(string purposeToAdd)
 {
     #region NEW METHOD
     Themes.ComboBoxItem newPurp = new Themes.ComboBoxItem();
     newPurp.itemValue = purposeToAdd;
     foreach (Themes.ComboBoxItem cb in SamplePurpose)
     {
         if (cb.itemValue == purposeToAdd)
         {
             newPurp.itemName = cb.itemName;
             break;
         }
     }
     if (newPurp.itemName != null && newPurp.itemValue != string.Empty)
     {
         bool foundValue = false;
         foreach (Themes.ComboBoxItem existingItems in _purposeValues)
         {
             if (purposeToAdd == existingItems.itemName)
             {
                 foundValue = true;
             }
         }
         if (!foundValue)
         {
             _purposeValues.Add(newPurp);
         }
     }
     #endregion
     RaisePropertyChanged("PurposeValues");
 }
Beispiel #4
0
        /// <summary>
        /// Will remove a purpose from purpose list
        /// </summary>
        /// <param name="inPurpose"></param>
        public void RemoveSelectedPurpose(object inPurpose)
        {
            Themes.ComboBoxItem oldPurp = inPurpose as Themes.ComboBoxItem;
            _purposeValues.Remove(oldPurp);

            RaisePropertyChanged("PurposeValues");
        }
Beispiel #5
0
        public void MineralModeBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox senderBox = sender as ComboBox;

            if (senderBox.SelectedIndex != -1)
            {
                Themes.ComboBoxItem senderItem = senderBox.SelectedItem as Themes.ComboBoxItem;
                CalculateResidual(senderItem.itemValue);
            }
        }
        /// <summary>
        /// Will fill the list box with items coming from user selected picklist to edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void picklistSelector_SelectionChangedAsync(object sender, SelectionChangedEventArgs e)
        {
            //Save current list if needed
            await picklistVM.SaveDialogInfo();

            //Cast
            ComboBox senderBox = sender as ComboBox;

            Themes.ComboBoxItem selectedVocab = senderBox.SelectedItem as Themes.ComboBoxItem;

            //Fill the list box with selected value
            picklistVM.FillListBoxPicklistValues(selectedVocab.itemValue);
        }
Beispiel #7
0
        /// <summary>
        /// Will fill the combobox that shows available picklist for selected theme
        /// </summary>
        private void FillPicklistCombobox()
        {
            //Get the current project type
            string fieldworkType = string.Empty;

            if (localSettings.GetSettingValue(Dictionaries.DatabaseLiterals.FieldUserInfoFWorkType) != null)
            {
                fieldworkType = localSettings.GetSettingValue(Dictionaries.DatabaseLiterals.FieldUserInfoFWorkType).ToString();
            }

            //Retrieve list of picklist from user selected theme
            VocabularyManager vocManager      = new VocabularyManager();
            List <object>     vocabManagerRaw = accessData.ReadTable(vocManager.GetType(), null);
            IEnumerable <VocabularyManager> vocManagerTable = vocabManagerRaw.Cast <VocabularyManager>(); //Cast to proper list type
            IEnumerable <VocabularyManager> vocThemeID      = from vm in vocManagerTable where vm.ThemeTable.ToLower().Contains(picklistTheme) && vm.ThemeEditable == Dictionaries.DatabaseLiterals.boolYes && (vm.ThemeProjectType == fieldworkType || vm.ThemeProjectType == "") select vm;

            //Special case for mineral table
            if (picklistTheme == Dictionaries.DatabaseLiterals.KeywordMineral)
            {
                vocThemeID = from vm in vocManagerTable where vm.ThemeTable.ToLower().Contains(picklistTheme) && !vm.ThemeTable.ToLower().Contains(Dictionaries.DatabaseLiterals.KeywordMA) && vm.ThemeEditable == Dictionaries.DatabaseLiterals.boolYes && (vm.ThemeProjectType == fieldworkType || vm.ThemeProjectType == "") select vm;
            }

            //Add theme list to dialog or a default NA value if nothing is available yet
            if (vocThemeID.Count() > 0)
            {
                foreach (VocabularyManager themeID in vocThemeID)
                {
                    Themes.ComboBoxItem picklistTheme = new Themes.ComboBoxItem();
                    picklistTheme.itemName  = themeID.ThemeNameDesc;
                    picklistTheme.itemValue = themeID.ThemeName;
                    _picklists.Add(picklistTheme);
                }
            }
            else
            {
                ResourceLoader appResources = ResourceLoader.GetForCurrentView();
                string         emptyTheme   = appResources.GetString("PicklistDialogEmptyList/Text");

                Themes.ComboBoxItem emptyPicklist = new Themes.ComboBoxItem();
                emptyPicklist.itemName  = emptyTheme;
                emptyPicklist.itemValue = string.Empty;
                _picklists.Add(emptyPicklist);
            }

            RaisePropertyChanged("Picklists");
        }
Beispiel #8
0
        /// <summary>
        /// Will fill the parent combobox if any parent is found inside a list of terms.
        /// </summary>
        /// <param name="selectedChildID"></param>
        public void FillParentCombobox(string selectedChildID)
        {
            //Build query to retrieve unique parents
            //select * from M_DICTIONARY m WHERE m.CODETHEME in
            string querySelect_1 = "select * from " + Dictionaries.DatabaseLiterals.TableDictionary + " m ";
            string queryWhere_1  = " WHERE m." + Dictionaries.DatabaseLiterals.FieldDictionaryCodedTheme + " in ";

            //(select m.CODETHEME from M_DICTIONARY m join M_DICTIONARY_MANAGER mdm on m.CODETHEME = mdm.CODETHEME WHERE m.CODE in
            string querySelect_2      = "(select m." + Dictionaries.DatabaseLiterals.FieldDictionaryCodedTheme + " from " + Dictionaries.DatabaseLiterals.TableDictionary + " m ";
            string querySelect_2_join = "join " + Dictionaries.DatabaseLiterals.TableDictionaryManager + " mdm on m." + Dictionaries.DatabaseLiterals.FieldDictionaryCodedTheme + " = mdm." + Dictionaries.DatabaseLiterals.FieldDictionaryCodedTheme + " ";
            string queryWhere_2       = " WHERE m." + Dictionaries.DatabaseLiterals.FieldDictionaryCode + " in ";

            //(select distinct(m.RELATEDTO) from M_DICTIONARY m WHERE m.CODETHEME = 'MODTEXTURE' ORDER BY m.RELATEDTO ) and mdm.ASSIGNTABLE in
            string querySelect_3  = "(select distinct(m." + Dictionaries.DatabaseLiterals.FieldDictionaryRelatedTo + ") from " + Dictionaries.DatabaseLiterals.TableDictionary + " m ";
            string queryWhere_3   = " WHERE m." + Dictionaries.DatabaseLiterals.FieldDictionaryCodedTheme + " = '" + selectedChildID + "'";
            string queryOrderBy_3 = " ORDER BY m." + Dictionaries.DatabaseLiterals.FieldDictionaryRelatedTo + " ) and mdm." + Dictionaries.DatabaseLiterals.FieldDictionaryManagerAssignTable + " in ";

            //(select mdm2.ASSIGNTABLE from M_DICTIONARY_MANAGER mdm2 where mdm2.CODETHEME = 'MODTEXTURE'))  AND m.VISIBLE = 'Y' ORDER BY m.DESCRIPTIONEN ASC
            string queryWhere_1_2 = "(select mdm2." + Dictionaries.DatabaseLiterals.FieldDictionaryManagerAssignTable +
                                    " from " + Dictionaries.DatabaseLiterals.TableDictionaryManager + " mdm2 where mdm2." + Dictionaries.DatabaseLiterals.FieldDictionaryCodedTheme +
                                    " = '" + selectedChildID + "'))";
            string queryWhere_1_3 = " AND m." + Dictionaries.DatabaseLiterals.FieldDictionaryVisible + " = '" + Dictionaries.DatabaseLiterals.boolYes + "'";
            string queryOrderby_1 = " ORDER BY m." + Dictionaries.DatabaseLiterals.FieldDictionaryDescription + " ASC";

            string queryFinal = querySelect_1 + queryWhere_1 + querySelect_2 + querySelect_2_join + queryWhere_2 + querySelect_3 + queryWhere_3 + queryOrderBy_3 + queryWhere_1_2 + queryWhere_1_3 + queryOrderby_1;

            //Get a unique list of all parents
            List <object> parentRaw = accessData.ReadTable(voc.GetType(), queryFinal);
            IEnumerable <Vocabularies> parentTable = parentRaw.Cast <Vocabularies>();

            //Add theme list to dialog or a default NA value if nothing is available yet
            _parentPicklist.Clear();
            foreach (Vocabularies parents in parentTable)
            {
                Themes.ComboBoxItem picklistParents = new Themes.ComboBoxItem();
                picklistParents.itemName  = parents.Description;
                picklistParents.itemValue = parents.Code;
                _parentPicklist.Add(picklistParents);
            }

            RaisePropertyChanged("PicklistParents");
        }
Beispiel #9
0
        /// <summary>
        /// Will fill the related combobox with a list f all structures from the database.
        /// </summary>
        public void FillStructureRelated(string lithoClass = "")
        {
            //Init.
            if (lithoClass != string.Empty)
            {
                _structRel.Clear();
                RaisePropertyChanged("StructRelated");
            }


            string querySelect = "SELECT * FROM " + Dictionaries.DatabaseLiterals.TableStructure;
            string queryWhere  = " WHERE " + Dictionaries.DatabaseLiterals.FieldStructureParentID;

            //For new structures or editing existing structures
            if (existingDataDetailStructure.GenericTableName == Dictionaries.DatabaseLiterals.TableEarthMat)
            {
                queryWhere = queryWhere + " = '" + existingDataDetailStructure.GenericID + "'";
            }
            else if (existingDataDetailStructure.GenericTableName == Dictionaries.DatabaseLiterals.TableStructure)
            {
                queryWhere = queryWhere + " = '" + existingDataDetailStructure.ParentID + "'";
            }

            //Extra where clause to select only counterpart and not same structure types
            if (existingDataDetailStructure.structure.StructureClass != null && existingDataDetailStructure.structure.StructureClass != string.Empty && existingDataDetailStructure.structure.StructureClass.Contains(DatabaseLiterals.KeywordPlanar))
            {
                queryWhere = queryWhere + " AND " + DatabaseLiterals.FieldStructureClass + " LIKE '%" + DatabaseLiterals.KeywordLinear + "%'";
            }
            else
            {
                queryWhere = queryWhere + " AND " + DatabaseLiterals.FieldStructureClass + " LIKE '%" + DatabaseLiterals.KeywordPlanar + "%'";
            }

            string finalQuery = querySelect + queryWhere;

            List <object>           allStructures = accessData.ReadTable(structureModel.GetType(), finalQuery);
            IEnumerable <Structure> strucTable    = allStructures.Cast <Structure>();

            if (strucTable.Count() != 0)
            {
                foreach (Structure st in strucTable)
                {
                    if (st.StructureID != _structID && st.StructureID != _structParentID)
                    {
                        Themes.ComboBoxItem structItem = new Themes.ComboBoxItem();
                        structItem.itemName  = st.StructureName;
                        structItem.itemValue = st.StructureID;
                        _structRel.Add(structItem);
                    }
                }
            }

            //Add a dumb value if nothing is found
            if (_structRel.Count == 0)
            {
                Themes.ComboBoxItem structItem = new Themes.ComboBoxItem();
                structItem.itemName  = Dictionaries.DatabaseLiterals.picklistNADescription;
                structItem.itemValue = Dictionaries.DatabaseLiterals.picklistNACode;
                _structRel.Add(structItem);
            }
            else
            {
                //Add default emtpy so user can unselect
                Themes.ComboBoxItem structItem = new Themes.ComboBoxItem();
                structItem.itemName  = string.Empty;
                structItem.itemValue = string.Empty;
                _structRel.Insert(0, structItem);

                //Reselect user value
                _selectedStructRel = existingDataDetailStructure.structure.StructureRelated;
                RaisePropertyChanged("SelectedStructRelated");
            }

            //Update UI
            RaisePropertyChanged("StructRelated");
        }