private AqsRawResults GetValueMappings(string format) { //windsor.commons.spring.springbasedao is a morass of spaghetti that doesn't make a lot of sense to me. //using stored proc for consistency with getColumnMappings System.Data.DataTable mappingValues = new System.Data.DataTable(); var map = new AqsRawResults(_baseDao, format);// _action, if (_baseDao.FillTableFromStoredProc(mappingValues, "aqs_getValueMappings", "") > 0) { var valueMap = new Dictionary <string, string>(); foreach (System.Data.DataRow row in mappingValues.Rows) { string mapKey = row["DESTINATION_COLUMN"].ToString(); string valueKey = mapKey + "!value:" + row["SOURCE_CODE"].ToString(); if (!valueMap.ContainsKey(valueKey)) { valueMap.Add(valueKey, row["DESTINATION_CODE"].ToString()); } if (!map.ContainsKey(mapKey)) { map.Add(mapKey, (p, c) => valueMap.ContainsKey(mapKey + "!value:" + c) ? valueMap[mapKey + "!value:" + c] : c); } } } return(map); }
public IAbstractHeader <AirQualitySubmissionType> Materialize(IAbstractHeader <AirQualitySubmissionType> concrete) { var materializedFormat = new AqsRawResults(_baseDao, _format);//_action, foreach (string destinationColumn in Keys) { if (concrete.ContainsKey(destinationColumn)) { materializedFormat.Add(destinationColumn, (p, c) => base[destinationColumn](p, concrete[destinationColumn](p, c)) ); } else { materializedFormat.Add(destinationColumn, base[destinationColumn]); } } return(materializedFormat); }
private AqsRawResults GetColumnMappings(string format) { //windsor.commons.spring.springbasedao is a morass of spaghetti that doesn't make a lot of sense to me. System.Data.DataTable mappingValues = new System.Data.DataTable(); _baseDao.FillTableFromStoredProc(mappingValues, "aqs_getColumnMappings", "template", format); var columnMappings = new AqsRawResults(_baseDao, format);// _action, foreach (System.Data.DataRow row in mappingValues.Rows) { if (row.IsNull("HARDCODED_VALUE")) { columnMappings.Add(row["DESTINATION_COLUMN"].ToString(), (p, c) => p.GetValue <string>(row["SOURCE_COLUMN"].ToString())); } else { columnMappings.Add(row["DESTINATION_COLUMN"].ToString(), (p, c) => row["HARDCODED_VALUE"].ToString()); } } return(columnMappings); }