private void deleteLithologyRecord(string mapUnit) { if (m_theWorkspace == null) { MessageBox.Show("Please open a working space!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } /// Connect with the Lithology table StandardLithologyAccess lithAccess = new StandardLithologyAccess(m_theWorkspace); /// Search for the lithology record for this map unit lithAccess.AddStandardLithology("MapUnit = '" + mapUnit + "'"); Dictionary<string, StandardLithologyAccess.StandardLithology> thisDictionary = new Dictionary<string, StandardLithologyAccess.StandardLithology>(); foreach (KeyValuePair<string, StandardLithologyAccess.StandardLithology> aLithEntry in lithAccess.StandardLithologyDictionary) { thisDictionary.Add(aLithEntry.Key, aLithEntry.Value); } foreach (KeyValuePair<string, StandardLithologyAccess.StandardLithology> aDelLith in thisDictionary) { lithAccess.DeleteStandardLithology(aDelLith.Value); } }
private void saveLithology() { if (m_theWorkspace == null) { MessageBox.Show("Please open a working space!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtMapUnitAbbreviation.Text == "") { MessageBox.Show("Please select a valid map unit!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } updateLithology4MapUnit(); string mapUnit = txtMapUnitAbbreviation.Text; StandardLithologyAccess lithAccess = new StandardLithologyAccess(m_theWorkspace); lithAccess.AddStandardLithology("MapUnit = '" + mapUnit + "'"); lithAccess.StandardLithologyDictionary = m_StandardLithologyDictionary; lithAccess.SaveStandardLithology(); foreach (KeyValuePair<string, StandardLithologyAccess.StandardLithology> aDictionaryEntry in m_StandardLithologyDeleteDictionary) { lithAccess.DeleteStandardLithology(aDictionaryEntry.Value); } ClearLithologyInput(); }
private void btnAcceptLith_Click(object sender, EventArgs e) { if (m_theWorkspace != null && cboLith.SelectedIndex != -1) { string mapUnit = txtMapUnitAbbreviation.Text; string lithology = cboLith.SelectedItem.ToString(); string partType = cboPartType.SelectedItem.ToString(); string propTerm = cboPropTerm.SelectedItem.ToString(); double propValue = getPropValue(propTerm); string resourceID = commonFunctions.GetCurrentDataSourceID(); if (m_isLithUpdate) { foreach (KeyValuePair<string, StandardLithologyAccess.StandardLithology> aDictionaryEntry in m_StandardLithologyDictionary) { string aLithology = aDictionaryEntry.Value.Lithology; if (aLithology == lithology) { StandardLithologyAccess.StandardLithology aLithValue = aDictionaryEntry.Value; aLithValue.Lithology = lithology; aLithValue.PartType = partType; aLithValue.ProportionTerm = propTerm; aLithValue.ProportionValue = propValue; aLithValue.RequiresUpdate = true; m_StandardLithologyDictionary.Remove(aLithValue.StandardLithology_ID); m_StandardLithologyDictionary.Add(aLithValue.StandardLithology_ID, aLithValue); break; } } } else { StandardLithologyAccess lithAccess = new StandardLithologyAccess(m_theWorkspace); lithAccess.NewStandardLithology(mapUnit, partType, lithology, propTerm, propValue, null, resourceID); string thisKey = lithAccess.StandardLithologyDictionary.First().Key; StandardLithologyAccess.StandardLithology thisLith = lithAccess.StandardLithologyDictionary.First().Value; m_StandardLithologyDictionary.Add(thisKey, thisLith); liLith.Items.Add(thisLith.Lithology); } ClearLithologyInput(); } }
private void initLithListBox(string mapUnit) { if (m_theWorkspace == null) { MessageBox.Show("Please open a working space!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } liLith.Items.Clear(); ClearLithologyInput(); m_StandardLithologyDictionary.Clear(); m_StandardLithologyDeleteDictionary.Clear(); StandardLithologyAccess lithAccess = new StandardLithologyAccess(m_theWorkspace); lithAccess.AddStandardLithology("MapUnit = '" + mapUnit + "'"); foreach (KeyValuePair<string, StandardLithologyAccess.StandardLithology> aDictionaryEntry in lithAccess.StandardLithologyDictionary) { string aKey = aDictionaryEntry.Key; StandardLithologyAccess.StandardLithology aDictionaryValue = aDictionaryEntry.Value; liLith.Items.Add(aDictionaryValue.Lithology); m_StandardLithologyDictionary.Add(aKey, aDictionaryValue); } }