public static VoteAnswerCollection GetVoteAnswerCollectionByVoteQuestion(VoteQuestion voteQuestion) { Database database = new Database(ConnectionStringName); DbCommand command = database.GetCommand(); VoteAnswerCollection result = new VoteAnswerCollection(); result.Parent = voteQuestion; using (DbConnection connection = database.GetConnection()) { command.Connection = connection; DbParameter prVoteAnswerId = database.GetParameter(); prVoteAnswerId.DbType = System.Data.DbType.Guid; prVoteAnswerId.Direction = System.Data.ParameterDirection.InputOutput; prVoteAnswerId.ParameterName = "@VoteQuestionId"; prVoteAnswerId.Value = voteQuestion.Id; command.Parameters.Add(prVoteAnswerId); command.CommandText = "SELECT [VoteAnswerId],[VoteAnswerName],[VoteAnswerNumber],[VoteAnswerOrder] FROM dbo.VoteAnswer WHERE VoteQuestionId=@VoteQuestionId order by VoteAnswerOrder"; connection.Open(); DbDataReader reader = command.ExecuteReader(); while (reader.Read()) { VoteAnswer item = new VoteAnswer(reader); result.Add(item); } } return(result); }
public VoteQuestionArgs(VoteQuestion voteQuestion, bool isEdit) { _voteQuestion = voteQuestion; _isEdit = isEdit; }