/// <summary> /// Returns a new PollOptionDetails instance filled with the DataReader's current record data /// </summary> protected virtual PollOptionDetails GetOptionFromReader(IDataReader reader) { PollOptionDetails option = new PollOptionDetails( (int)reader["OptionID"], (DateTime)reader["AddedDate"], reader["AddedBy"].ToString(), (int)reader["PollID"], reader["OptionText"].ToString(), (int)reader["Votes"], Convert.ToDouble(reader["Percentage"])); return(option); }
/// <summary> /// Returns a new PollOptionDetails instance filled with the DataReader's current record data /// </summary> protected virtual PollOptionDetails GetOptionFromReader(IDataReader reader) { PollOptionDetails option = new PollOptionDetails( (int)reader["OptionID"], (DateTime)reader["AddedDate"], reader["AddedBy"].ToString(), (int)reader["PollID"], reader["OptionText"].ToString(), (int)reader["Votes"], Convert.ToDouble(reader["Percentage"])); return option; }
public abstract bool UpdateOption(PollOptionDetails option);
public abstract int InsertOption(PollOptionDetails option);
/// <summary> /// Returns a Option object filled with the data taken from the input PollOptionDetails /// </summary> private static Option GetOptionFromPollOptionDetails(PollOptionDetails record) { if (record == null) return null; else { return new Option(record.ID, record.AddedDate, record.AddedBy, record.PollID, record.OptionText, record.Votes, record.Percentage); } }
/// <summary> /// Updates an existing option /// </summary> public static bool UpdateOption(int id, string optionText) { PollOptionDetails record = new PollOptionDetails(id, DateTime.Now, "", 0, optionText, 0, 0.0); bool ret = SiteProvider.Polls.UpdateOption(record); BizObject.PurgeCacheItems("polls_option"); return ret; }
/// <summary> /// Creates a new poll option /// </summary> public static int InsertOption(int pollID, string optionText) { PollOptionDetails record = new PollOptionDetails(0, DateTime.Now, BizObject.CurrentUserName, pollID, optionText, 0, 0.0); int ret = SiteProvider.Polls.InsertOption(record); BizObject.PurgeCacheItems("polls_poll_" + pollID.ToString()); BizObject.PurgeCacheItems("polls_option"); return ret; }