/// <summary> /// Gets all campaigns /// </summary> /// <returns>Campaign collection</returns> public static CampaignCollection GetAllCampaigns() { DBCampaignCollection dbCollection = DBProviderManager <DBCampaignProvider> .Provider.GetAllCampaigns(); CampaignCollection campaigns = DBMapping(dbCollection); return(campaigns); }
private static CampaignCollection DBMapping(DBCampaignCollection dbCollection) { if (dbCollection == null) return null; CampaignCollection collection = new CampaignCollection(); foreach (DBCampaign dbItem in dbCollection) { Campaign item = DBMapping(dbItem); collection.Add(item); } return collection; }
/// <summary> /// Gets all campaigns /// </summary> /// <returns>Campaign collection</returns> public override DBCampaignCollection GetAllCampaigns() { var result = new DBCampaignCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CampaignLoadAll"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetCampaignFromReader(dataReader); result.Add(item); } } return(result); }
private static CampaignCollection DBMapping(DBCampaignCollection dbCollection) { if (dbCollection == null) { return(null); } var collection = new CampaignCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); collection.Add(item); } return(collection); }
/// <summary> /// Gets all campaigns /// </summary> /// <returns>Campaign collection</returns> public override DBCampaignCollection GetAllCampaigns() { DBCampaignCollection campaignCollection = new DBCampaignCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CampaignLoadAll"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBCampaign campaign = GetCampaignFromReader(dataReader); campaignCollection.Add(campaign); } } return campaignCollection; }