public static SPDataProxy.SPLookupDataTable GetSearchResults(string SearchType, string SubType, string SearchFor, string SearchItem, string ConnectionString) { if (string.IsNullOrEmpty(ConnectionString)) { using (SoftLogik.Win.SPDataProxyTableAdapters.taSPLookup lookupAdapter = new SoftLogik.Win.SPDataProxyTableAdapters.taSPLookup()) { return lookupAdapter.GetSearchResults(SearchType, SubType, SearchFor, SearchItem); } } else { SoftLogik.Win.Data.ISPDataStore lookupAdapter = new SQLDataStore(new System.Data.SqlClient.SqlConnection(ConnectionString)); SPDataParamCollection objParams = new SPDataParamCollection(); objParams.Add("@SearchType", SearchType); objParams.Add("@SubType", SubType); objParams.Add("@SearchFor", SearchFor); objParams.Add("@SearchItem", SearchItem); DataTable genericSearchTable = lookupAdapter.GetTable("SPLookup_Search", ref objParams, false); SPDataProxy.SPLookupDataTable searchTable = new SPDataProxy.SPLookupDataTable(); searchTable.Load(genericSearchTable.CreateDataReader()); return searchTable; } }
public IDataStore<TStoreType> Create<TStoreType>(TStoreType obj) { if (obj.GetType() == typeof(SqlConnection)) { var store = new SQLDataStore((SqlConnection)(Object)obj); return (IDataStore<TStoreType>)store; } if (obj.GetType() == typeof(XmlDocument)) { //... and so on } } }
public void GetRides() { SQLDataStore ds = new SQLDataStore(); var dbRides = ds.GetRides(); dbRides.Sort((x, y) => TimeSpan.Parse(y.Hour).CompareTo(TimeSpan.Parse(x.Hour))); dbRides.ForEach((ride) => { rides.Add(ride); }); UpdateList(); }