protected override object GetObjectFromRequest(DataRequest request) { LOG.DebugEnter(MethodBase.GetCurrentMethod(), request); IObjectsFromDatabase objectsFromDatabase; GetServiceImplementation(out objectsFromDatabase); List <GeographicInformationSubmissionDataType> dataList = objectsFromDatabase.LoadFromDatabase <GeographicInformationSubmissionDataType>(_baseDao, null); if (CollectionUtils.IsNullOrEmpty(dataList)) { throw new InvalidOperationException("The staging database does not contain any RCRA GIS data."); } else if (dataList.Count > 1) { throw new InvalidOperationException(string.Format("The staging database contains more that one set of RCRA GIS data ({0} sets).", dataList.Count)); } else { GeographicInformationSubmissionDataType data = dataList[0]; if (CollectionUtils.IsNullOrEmpty(data.GISFacilitySubmission)) { throw new InvalidOperationException("The staging database does not contain any RCRA GIS facility submission data."); } AppendAuditLogEvent("Found {0} RCRA GIS facility submission(s)", data.GISFacilitySubmission.Length); return(data); } }
public IList <IDynamicClass> GetList(string sql, params object[] args) { LOG.DebugEnter(MethodBase.GetCurrentMethod(), sql, args); IDbParameters pars = null; sql = LoadGenericParameters(sql, out pars, args); IList <IDynamicClass> list = new List <IDynamicClass>(); AdoTemplate.QueryWithRowCallbackDelegate(CommandType.Text, sql, delegate(IDataReader reader) { DynamicClass dic = new DynamicClass(); for (int i = 0; i < reader.FieldCount; i++) { dic.Add(reader.GetName(i), reader.GetValue(i)); } list.Add(dic); }, pars); return(list); }
public DaoTemplateHelper(IDbProvider provider, string name) : base(provider, typeof(RealNullDataMapper)) { LOG.DebugEnter(MethodBase.GetCurrentMethod(), provider, name); if (String.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (name.Contains(" ") || !Char.IsLetter(name.ToCharArray()[0])) { throw new FormatException("name must start with a letter and it can't have spaces"); } _name = name; }
public IDynamicClass GetObject(string sql, params object[] args) { LOG.DebugEnter(MethodBase.GetCurrentMethod(), sql, args); IList <IDynamicClass> list = GetList(sql, args); if (list == null || list.Count == 0) { return(null); } if (list.Count > 1) { throw new ApplicationException("More than one row returned"); } return(list[0]); }