private DBPollAnswer GetPollAnswerFromReader(IDataReader dataReader) { DBPollAnswer pollAnswer = new DBPollAnswer(); pollAnswer.PollAnswerID = NopSqlDataHelper.GetInt(dataReader, "PollAnswerID"); pollAnswer.PollID = NopSqlDataHelper.GetInt(dataReader, "PollID"); pollAnswer.Name = NopSqlDataHelper.GetString(dataReader, "Name"); pollAnswer.Count = NopSqlDataHelper.GetInt(dataReader, "Count"); pollAnswer.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder"); return pollAnswer; }
/// <summary> /// Gets a poll answer /// </summary> /// <param name="PollAnswerID">Poll answer identifier</param> /// <returns>Poll answer</returns> public static PollAnswer GetPollAnswerByID(int PollAnswerID) { if (PollAnswerID == 0) { return(null); } DBPollAnswer dbItem = DBProviderManager <DBPollProvider> .Provider.GetPollAnswerByID(PollAnswerID); PollAnswer pollAnswer = DBMapping(dbItem); return(pollAnswer); }
/// <summary> /// Updates the poll answer /// </summary> /// <param name="PollAnswerID">The poll answer identifier</param> /// <param name="PollID">The poll identifier</param> /// <param name="Name">The poll answer name</param> /// <param name="Count">The current count</param> /// <param name="DisplayOrder">The display order</param> /// <returns>Poll answer</returns> public static PollAnswer UpdatePoll(int PollAnswerID, int PollID, string Name, int Count, int DisplayOrder) { DBPollAnswer dbItem = DBProviderManager <DBPollProvider> .Provider.UpdatePollAnswer(PollAnswerID, PollID, Name, Count, DisplayOrder); PollAnswer pollAnswer = DBMapping(dbItem); if (PollManager.CacheEnabled) { NopCache.RemoveByPattern(POLLS_PATTERN_KEY); NopCache.RemoveByPattern(POLLANSWERS_PATTERN_KEY); } return(pollAnswer); }
private static PollAnswer DBMapping(DBPollAnswer dbItem) { if (dbItem == null) return null; PollAnswer item = new PollAnswer(); item.PollAnswerID = dbItem.PollAnswerID; item.PollID = dbItem.PollID; item.Name = dbItem.Name; item.Count = dbItem.Count; item.DisplayOrder = dbItem.DisplayOrder; return item; }
private static PollAnswer DBMapping(DBPollAnswer dbItem) { if (dbItem == null) { return(null); } PollAnswer item = new PollAnswer(); item.PollAnswerID = dbItem.PollAnswerID; item.PollID = dbItem.PollID; item.Name = dbItem.Name; item.Count = dbItem.Count; item.DisplayOrder = dbItem.DisplayOrder; return(item); }