public SqlDataReader freeStyleSelect(string cmd) { try { return(realMarketDB.freeStyleSelect(cmd)); } catch (InvalidOperationException e) { if (!IsConnected(e.Message) || MarketDB.ToDisable) { throw new DataException(); } throw; } catch (SqlException e) { if (!IsConnected(e.Message) || MarketDB.ToDisable) { throw new DataException(); } throw; } }
public string[] GetPromotionHistory(string store) { dbConnection.CheckInput(store); var historyRecords = new LinkedList <string>(); using (var dbReader = dbConnection.freeStyleSelect("SELECT * FROM PromotionHistory WHERE Store = '" + store + "' ORDER BY PromotionDate ASC")) { while (dbReader.Read()) { historyRecords.AddLast("Store: " + dbReader.GetString(0) + " Promoter: " + dbReader.GetString(1) + " Promoted: " + dbReader.GetString(2) + " Permissions: " + dbReader.GetString(3) + " Date: " + dbReader.GetDateTime(4).ToString("dd/MM/yyyy") + " Description: " + dbReader.GetString(5)); } } return(historyRecords.ToArray()); }
public string[] FindSolelyOwnedStores() { List <string> solelyOwnedStores = new List <string>(); string cmd = @"SELECT Name FROM Store AS T1 LEFT JOIN (SELECT Store FROM StoreManagerPolicy WHERE Action = 'StoreOwner') AS T2 ON T1.Name = T2.Store WHERE T2.Store IS NULL"; using (var dbReader = dbConnection.freeStyleSelect(cmd)) { while (dbReader.Read()) { solelyOwnedStores.Add(dbReader.GetString(0)); } } return(solelyOwnedStores.ToArray()); }