private void zonecomboBox_DropDownOpened(object sender, EventArgs e) { Zone_Context.Dispose(); Zone_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource ZoneListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ZoneListViewSource"))); decimal SelectedStream = System.Convert.ToDecimal(streamcombobox.SelectedValue.ToString()); decimal SelectedLake = System.Convert.ToDecimal(lakecomboBox.SelectedValue.ToString()); var Zones = Zone_Context.QRY_ZONE_LIST_WITH_LAKE_STREAM_GEO .Where(STATIONS => STATIONS.LAKE == SelectedLake) .Where(STATIONS => STATIONS.STREAM == SelectedStream) .ToList(); ZoneListViewSource.Source = Zone_Context.QRY_ZONE_LIST_WITH_LAKE_STREAM_GEO.Local; }
private void stationcomboBox_DropDownOpened(object sender, EventArgs e) { Station_Context.Dispose(); Station_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource StationListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("StationListViewSource"))); decimal SelectedStream = System.Convert.ToDecimal(streamcombobox.SelectedValue.ToString()); decimal SelectedLake = System.Convert.ToDecimal(lakecomboBox.SelectedValue.ToString()); decimal SelectedZone = System.Convert.ToDecimal(zonecomboBox.SelectedValue.ToString()); var Stations = Station_Context.STATIONS_GEO .Where(STATIONS => STATIONS.LAKE == SelectedLake) .Where(STATIONS => STATIONS.STREAM == SelectedStream) .Where(STATIONS => STATIONS.ZONE == SelectedZone) .ToList(); StationListViewSource.Source = Station_Context.STATIONS_GEO.Local; }
private void employeeofficecomboBox_DropDownOpened(object sender, EventArgs e) { Last_Name_Context.Dispose(); Last_Name_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource LastNameListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("LastNameListViewSource"))); LastNameListViewSource.Source = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_GEO.Local; Employee_Context.Dispose(); Employee_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource EmployeeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("EmployeeListViewSource"))); EmployeeListViewSource.Source = Employee_Context.EMPLOYEES_GEO.Local; System.Windows.Data.CollectionViewSource OfficeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("OfficeListViewSource"))); var Office = Office_Context.OFFICES_GEO.ToList(); OfficeListViewSource.Source = Office_Context.OFFICES_GEO.Local; EMPIDTextBox.Text = null; }
private void employeefirstnamecomboBox_DropDownOpened(object sender, EventArgs e) { if (employeelastnamecomboBox.SelectedValue != null && employeeofficecomboBox.SelectedValue != null) { String SelectedOffice = employeeofficecomboBox.SelectedValue.ToString(); String SelectedLastName = employeelastnamecomboBox.Text.ToString(); Employee_Context.Dispose(); Employee_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource EmployeeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("EmployeeListViewSource"))); var EmployeeFirst = Employee_Context.EMPLOYEES_GEO .Where(EMPLOYEES => EMPLOYEES.OFFICE == SelectedOffice) .Where(EMPLOYEES => EMPLOYEES.LASTNAME == SelectedLastName) .OrderBy(EMPLOYEES => EMPLOYEES.FIRSTNAME) .ToList(); EmployeeListViewSource.Source = Employee_Context.EMPLOYEES_GEO.Local; EMPIDTextBox.Text = null; } }
private void lakecomboBox_DropDownClosed(object sender, EventArgs e) { StreamTextBox.Text = null; Stream_Context.Dispose(); Stream_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource StreamListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("StreamListViewSource"))); decimal SelectedLake = System.Convert.ToDecimal(lakecomboBox.SelectedValue.ToString()); lakecomboBox.Items.Refresh(); var Stream = Stream_Context.STREAMS_GEO .Where(STREAMS => STREAMS.LAKE == SelectedLake) .OrderBy(STREAMS => STREAMS.STREAM_NAME) .ToList(); StreamListViewSource.Source = Stream_Context.STREAMS_GEO.Local; StreamTextBox.Text = null; streamcombobox.Text = null; zonecomboBox.Text = null; stationcomboBox.Text = null; }
private void employeelastnamecomboBox_DropDownOpened(object sender, EventArgs e) { if (employeeofficecomboBox.SelectedValue != null) { String SelectedOffice = employeeofficecomboBox.SelectedValue.ToString(); Employee_Context.Dispose(); Employee_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource EmployeeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("EmployeeListViewSource"))); EmployeeListViewSource.Source = Employee_Context.EMPLOYEES_GEO.Local; System.Windows.Data.CollectionViewSource LastNameListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("LastNameListViewSource"))); var Employee = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_GEO .Where(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.OFFICE == SelectedOffice) .OrderBy(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.LASTNAME) .ToList(); LastNameListViewSource.Source = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_GEO.Local; employeeofficecomboBox.SelectedValue = SelectedOffice; EMPIDTextBox.Text = null; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { System.Windows.Data.CollectionViewSource gEOGRAPHIC_FEATURESViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("gEOGRAPHIC_FEATURESViewSource"))); var GeoFeature = Geo_Features_Context.GEOGRAPHIC_FEATURES .Where(GEOGRAPHIC_FEATURES => GEOGRAPHIC_FEATURES.ID == SelectedID) .ToList(); gEOGRAPHIC_FEATURESViewSource.Source = Geo_Features_Context.GEOGRAPHIC_FEATURES.Local; bool isIDNotEmpty; isIDNotEmpty = Geo_Features_Context.GEOGRAPHIC_FEATURES.Any(x => x.ID == SelectedID); if (isIDNotEmpty == false) { Geo_Features_Context.Dispose(); Geo_Features_Context = new Data_Model.Geographic_Features_Entities(); //Data_Model.Geographic_Features_Entities Geo_Features_Context = new Data_Model.Geographic_Features_Entities(); Geo_Features_Context.GEOGRAPHIC_FEATURES.Local.Add(new Data_Model.GEOGRAPHIC_FEATURES() { ID = SelectedID }); gEOGRAPHIC_FEATURESViewSource.Source = Geo_Features_Context.GEOGRAPHIC_FEATURES.Local; WaypointIDTextBox.Text = null; StreamTextBox.Text = null; CollectionDateTextBox.SelectedDate = DateTime.Today; System.Windows.Data.CollectionViewSource LakeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("LakeListViewSource"))); LakeListViewSource.Source = Lake_Context.LAKES_GEO.Local; System.Windows.Data.CollectionViewSource StreamListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("StreamListViewSource"))); StreamListViewSource.Source = Stream_Context.STREAMS_GEO.Local; System.Windows.Data.CollectionViewSource ZoneListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ZoneListViewSource"))); ZoneListViewSource.Source = Zone_Context.STATIONS_GEO.Local; System.Windows.Data.CollectionViewSource StationListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("StationListViewSource"))); StationListViewSource.Source = Station_Context.STATIONS_GEO.Local; System.Windows.Data.CollectionViewSource FeatureTypeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("FeatureTypeListViewSource"))); FeatureTypeListViewSource.Source = Feature_Type_Context.GEOGRAPHIC_FEATURE_TYPES.Local; System.Windows.Data.CollectionViewSource OfficeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("OfficeListViewSource"))); OfficeListViewSource.Source = Office_Context.OFFICES_GEO.Local; System.Windows.Data.CollectionViewSource EmployeeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("EmployeeListViewSource"))); EmployeeListViewSource.Source = Employee_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO.Local; } else { System.Windows.Data.CollectionViewSource LakeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("LakeListViewSource"))); var Lakes = Lake_Context.LAKES_GEO.ToList(); LakeListViewSource.Source = Lake_Context.LAKES_GEO.Local; System.Windows.Data.CollectionViewSource StreamListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("StreamListViewSource"))); decimal SelectedLake = System.Convert.ToDecimal(lakecomboBox.SelectedValue.ToString()); lakecomboBox.Items.Refresh(); var Stream = Stream_Context.STREAMS_GEO .Where(STREAMS => STREAMS.LAKE == SelectedLake) .ToList(); StreamListViewSource.Source = Stream_Context.STREAMS_GEO.Local; System.Windows.Data.CollectionViewSource ZoneListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ZoneListViewSource"))); decimal SelectedStream = System.Convert.ToDecimal(streamcombobox.SelectedValue.ToString()); var Zones = Zone_Context.STATIONS_GEO .Where(STATIONS => STATIONS.LAKE == SelectedLake) .Where(STATIONS => STATIONS.STREAM == SelectedStream) .ToList(); ZoneListViewSource.Source = Zone_Context.STATIONS_GEO.Local; System.Windows.Data.CollectionViewSource StationListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("StationListViewSource"))); decimal SelectedZone = System.Convert.ToDecimal(zonecomboBox.SelectedValue.ToString()); var Stations = Station_Context.STATIONS_GEO .Where(STATIONS => STATIONS.LAKE == SelectedLake) .Where(STATIONS => STATIONS.STREAM == SelectedStream) .Where(STATIONS => STATIONS.ZONE == SelectedZone) .ToList(); StationListViewSource.Source = Station_Context.STATIONS_GEO.Local; System.Windows.Data.CollectionViewSource FeatureTypeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("FeatureTypeListViewSource"))); var Features = Feature_Type_Context.GEOGRAPHIC_FEATURE_TYPES.ToList(); FeatureTypeListViewSource.Source = Feature_Type_Context.GEOGRAPHIC_FEATURE_TYPES.Local; System.Windows.Data.CollectionViewSource OfficeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("OfficeListViewSource"))); var Office = Office_Context.OFFICES_GEO.ToList(); OfficeListViewSource.Source = Office_Context.OFFICES_GEO.Local; System.Windows.Data.CollectionViewSource EmployeeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("EmployeeListViewSource"))); Decimal SelectedEMPID = System.Convert.ToDecimal(EMPIDTextBox.Text.ToString()); var Employee = Employee_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO .Where(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.EMPID == SelectedEMPID) .ToList(); EmployeeListViewSource.Source = Employee_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO.Local; System.Windows.Data.CollectionViewSource LastNameListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("LastNameListViewSource"))); String SelectedOffice = employeeofficecomboBox.SelectedValue.ToString(); var EmployeeLastName = Last_Name_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO .Where(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.EMPID == SelectedEMPID) .OrderBy(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.LASTNAME) .ToList(); LastNameListViewSource.Source = Last_Name_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO.Local; WaypointIDTextBox.IsEnabled = false; Validation.ClearInvalid(WaypointIDTextBox.GetBindingExpression(TextBox.TextProperty)); } }
private void EMPIDTextBox_SelectionChanged(object sender, RoutedEventArgs e) { bool IsValidEMPID; if (EMPIDTextBox.Text != "") { Decimal EMPID = Convert.ToDecimal(EMPIDTextBox.Text.ToString()); using (Data_Model.Geographic_Features_Entities context = new Data_Model.Geographic_Features_Entities()) IsValidEMPID = context.EMPLOYEES_GEO.Any(x => x.EMPID == EMPID); if (IsValidEMPID == true) { Employee_Context.Dispose(); Last_Name_Context.Dispose(); Office_Context.Dispose(); Employee_Context = new Data_Model.Geographic_Features_Entities(); Last_Name_Context = new Data_Model.Geographic_Features_Entities(); Office_Context = new Data_Model.Geographic_Features_Entities(); System.Windows.Data.CollectionViewSource EmployeeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("EmployeeListViewSource"))); Decimal SelectedEMPID = System.Convert.ToDecimal(EMPIDTextBox.Text.ToString()); var Employee = Employee_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO .Where(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.EMPID == SelectedEMPID) .ToList(); EmployeeListViewSource.Source = Employee_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO.Local; System.Windows.Data.CollectionViewSource LastNameListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("LastNameListViewSource"))); //String SelectedOffice = employeeofficecomboBox.Text.ToString(); var EmployeeLastName = Last_Name_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO .Where(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.EMPID == SelectedEMPID) .OrderBy(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.LASTNAME) .ToList(); LastNameListViewSource.Source = Last_Name_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO.Local; System.Windows.Data.CollectionViewSource OfficeListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("OfficeListViewSource"))); var Office = Office_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO .Where(QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME => QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME.EMPID == SelectedEMPID) .ToList(); OfficeListViewSource.Source = Office_Context.QRY_EMPLOYEE_LIST_WITH_OFFICE_NAME_GEO.Local; //if (employeelastnamecomboBox.SelectedValue != null && employeeofficecomboBox.SelectedValue != null) //{ // String SelectedOfficeChar = employeeofficecomboBox.SelectedValue.ToString(); // String SelectedFirstName = employeelastnamecomboBox.SelectedValue.ToString(); //Employee_Context.Dispose(); //Last_Name_Context.Dispose(); //Office_Context.Dispose(); //Employee_Context = new Data_Model.Geographic_Features_Entities(); //Last_Name_Context = new Data_Model.Geographic_Features_Entities(); //Office_Context = new Data_Model.Geographic_Features_Entities(); // var OfficeChar = Office_Context.OFFICES // .Where(Office_Content => Office_Content.OFFICE_CHAR == SelectedOfficeChar) // .ToList(); // OfficeListViewSource.Source = Office_Context.OFFICES.Local; // var EmployeeLast = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS //.Where(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.OFFICE == SelectedOfficeChar) //.Where(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.LASTNAME == SelectedLastName) //.OrderBy(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.LASTNAME) //.ToList(); // LastNameListViewSource.Source = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.Local; // var EmployeeFirst = Employee_Context.EMPLOYEES // .Where(EMPLOYEES => EMPLOYEES.OFFICE == SelectedOfficeChar) // .Where(EMPLOYEES => EMPLOYEES.LASTNAME == SelectedLastName) // .OrderBy(EMPLOYEES => EMPLOYEES.FIRSTNAME) // .ToList(); // EmployeeListViewSource.Source = Employee_Context.EMPLOYEES.Local; // } //if (employeelastnamecomboBox.SelectedValue != null && employeeofficecomboBox.SelectedValue != null && employeefirstnamecomboBox.SelectedValue == null) //{ // String SelectedOfficeChar = employeeofficecomboBox.SelectedValue.ToString(); // String SelectedLastName = employeelastnamecomboBox.SelectedValue.ToString(); // Employee_Context.Dispose(); // Last_Name_Context.Dispose(); // Office_Context.Dispose(); // Employee_Context = new Data_Model.Geographic_Features_Entities(); // Last_Name_Context = new Data_Model.Geographic_Features_Entities(); // Office_Context = new Data_Model.Geographic_Features_Entities(); // var OfficeChar = Office_Context.OFFICES // .Where(Office_Content => Office_Content.OFFICE_CHAR == SelectedOfficeChar) // .ToList(); // OfficeListViewSource.Source = Office_Context.OFFICES.Local; // var EmployeeLast = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS // .Where(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.OFFICE == SelectedOfficeChar) // .Where(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.LASTNAME == SelectedLastName) // .OrderBy(QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS => QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.LASTNAME) // .ToList(); // LastNameListViewSource.Source = Last_Name_Context.QRY_EMPLOYEES_LAST_NAME_LIST_WITH_OFFICE_TRAPS.Local; // var EmployeeFirst = Employee_Context.EMPLOYEES // .Where(EMPLOYEES => EMPLOYEES.OFFICE == SelectedOfficeChar) // .Where(EMPLOYEES => EMPLOYEES.LASTNAME == SelectedLastName) // .OrderBy(EMPLOYEES => EMPLOYEES.FIRSTNAME) // .ToList(); // EmployeeListViewSource.Source = Employee_Context.EMPLOYEES.Local; //} } else { employeelastnamecomboBox.Text = null; employeeofficecomboBox.Text = null; employeefirstnamecomboBox.Text = null; } } else { //employeelastnamecomboBox.Text = null; //employeeofficecomboBox.Text = null; } }
public string this[string columnName] { get { string result = null; if (columnName == "WAYPOINT_ID") { bool _IsDuplicateGeo; bool _ISDuplicateLarval; using (Geographic_Features_Entities contextg = new Geographic_Features_Entities()) _IsDuplicateGeo = contextg.GEOGRAPHIC_FEATURES.Any(x => x.WAYPOINT_ID == WAYPOINT_ID); using (Geographic_Features_Entities contextl = new Geographic_Features_Entities()) _ISDuplicateLarval = contextl.LL_LARVAL_ASSESSMENTS_GEO.Any(x => x.WAYPOINT_ID == WAYPOINT_ID); if (_IsDuplicateGeo == true) { result = "Duplicate Waypoint ID in Geographic Features!"; } else if (_ISDuplicateLarval == true) { result = "Duplicate Waypoint ID in Larval Assessments!"; } } if (columnName == "LAKE") { bool _ISValidLake; string lakedec = System.Convert.ToString(LAKE); string streamstring = System.Convert.ToString(STREAM); decimal?streamdec = System.Convert.ToDecimal(STREAM); using (Geographic_Features_Entities context = new Geographic_Features_Entities()) _ISValidLake = context.LAKES_GEO.Any(x => x.LAKE1 == LAKE); if (_ISValidLake == false) { result = "Invalid Lake Code!"; } } if (columnName == "STREAM") { bool _ISValidStream; using (Geographic_Features_Entities context = new Geographic_Features_Entities()) _ISValidStream = context.STREAMS_GEO.Any(x => x.LAKE == LAKE && x.STREAM1 == STREAM); if (_ISValidStream == false) { result = "Invalid Stream Code!"; } } if (columnName == "ZONE") { bool _ISValidZone; using (Geographic_Features_Entities context = new Geographic_Features_Entities()) _ISValidZone = context.STATIONS_GEO.Any(x => x.LAKE == LAKE && x.STREAM == STREAM && x.ZONE == ZONE); if (_ISValidZone == false) { result = "Invalid Zone!"; } } if (columnName == "STATION") { bool _ISValidZone; using (Geographic_Features_Entities context = new Geographic_Features_Entities()) _ISValidZone = context.STATIONS_GEO.Any(x => x.LAKE == LAKE && x.STREAM == STREAM && x.ZONE == ZONE && x.STATION1 == STATION); if (_ISValidZone == false) { result = "Invalid Zone!"; } } if (columnName == "FEATURE_TYPE") { bool _ISValidFeature; string lakedec = System.Convert.ToString(LAKE); string streamstring = System.Convert.ToString(STREAM); decimal?streamdec = System.Convert.ToDecimal(STREAM); using (Geographic_Features_Entities context = new Geographic_Features_Entities()) _ISValidFeature = context.GEOGRAPHIC_FEATURE_TYPES.Any(x => x.FEATURE_TYPE == FEATURE_TYPE); if (_ISValidFeature == false) { result = "Invalid Feature Type!"; } } return(result); } }