private List<AnswerCEF> Save(List<AnswerBase> baseAnswers)
        {
            List<AnswerCEF> answers = new List<AnswerCEF>();
            foreach (AnswerBase baseAnswer in baseAnswers)
            {
                AnswerCEF answer = new AnswerCEF();
                answer.Copy(baseAnswer);
                answer.EventDateId = EventDateId;
                answers.Add(answer);
            }

            AnswerCEF.DeleteAll(User.Identity.Name, EventDateId);
            AnswerCEF.Save(answers);
            return answers;
        }
示例#2
0
        internal static List<AnswerCEF> GetAll(string username, int eventDateId)
        {
            List<AnswerCEF> output = new List<AnswerCEF>();
            using (SqlConnection conn = UtilityDb.GetConnectionESS())
            {
                string sql = string.Format("SELECT * FROM ASM_AnswersCEF WHERE Username='******' AND eventDateId={1}",
                    username, eventDateId);

                SqlDataReader dr = UtilityDb.GetDataReader(sql, conn);
                while (dr.Read())
                {
                    AnswerCEF ans = new AnswerCEF();
                    ans.LoadFromReader(dr);
                    output.Add(ans);
                }
            }
            return output;
        }