private DateTimeAnswer MatchDateTimeAnswer(Question question, IEnumerable <ResponseAnswer> responseAnswers)
        {
            var reply = new DateTimeAnswer
            {
                Rows = new List <DateTimeAnswerRow>()
            };

            foreach (var responseAnswer in responseAnswers)
            {
                var dateTimeAnswerReply = new DateTimeAnswerRow
                {
                    RowName   = question.AnswersLookup[responseAnswer.Row].Text,
                    TimeStamp = DateTime.MinValue
                };

                DateTime timeStamp = DateTime.Parse(responseAnswer.Text, CultureInfo.CreateSpecificCulture("en-US"));
                if (question.Type.Subtype == QuestionSubtype.TimeOnly) //Where only a time is given, use date component from DateTime.MinValue
                {
                    dateTimeAnswerReply.TimeStamp = dateTimeAnswerReply.TimeStamp.AddHours(timeStamp.Hour);
                    dateTimeAnswerReply.TimeStamp = dateTimeAnswerReply.TimeStamp.AddMinutes(timeStamp.Minute);
                }
                else
                {
                    dateTimeAnswerReply.TimeStamp = timeStamp;
                }

                reply.Rows.Add(dateTimeAnswerReply);
            }

            return(reply);
        }
        private DateTimeAnswer MatchDateTimeAnswer(Question question, IEnumerable <ResponseAnswer> responseAnswers)
        {
            var reply = new DateTimeAnswer
            {
                Rows = new List <DateTimeAnswerRow>()
            };

            foreach (var responseAnswer in responseAnswers)
            {
                if (responseAnswer.RowId.HasValue)
                {
                    var row = question.Answers.ItemLookup.ContainsKey(responseAnswer.RowId.Value) ? question.Answers.ItemLookup[responseAnswer.RowId.Value] : null;
                    var dateTimeAnswerReply = new DateTimeAnswerRow
                    {
                        RowName   = row,
                        TimeStamp = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc)
                    };

                    DateTime timeStamp    = DateTime.Parse(responseAnswer.Text, CultureInfo.CreateSpecificCulture("en-US"));
                    DateTime utcTimeStamp = DateTime.SpecifyKind(timeStamp, DateTimeKind.Utc);
                    if (question.Subtype == QuestionSubtype.TimeOnly) //Where only a time is given, use date component from DateTime.MinValue
                    {
                        dateTimeAnswerReply.TimeStamp = dateTimeAnswerReply.TimeStamp.AddHours(utcTimeStamp.Hour);
                        dateTimeAnswerReply.TimeStamp = dateTimeAnswerReply.TimeStamp.AddMinutes(utcTimeStamp.Minute);
                    }
                    else
                    {
                        dateTimeAnswerReply.TimeStamp = utcTimeStamp;
                    }
                    reply.Rows.Add(dateTimeAnswerReply);
                }
            }

            return(reply);
        }
        private DateTimeAnswer MatchDateTimeAnswer(Question question, IEnumerable<ResponseAnswer> responseAnswers)
        {
            var reply = new DateTimeAnswer
            {
                Rows = new List<DateTimeAnswerRow>()
            };

            foreach (var responseAnswer in responseAnswers)
            {
                var dateTimeAnswerReply = new DateTimeAnswerRow
                {
                    RowName = question.AnswersLookup[responseAnswer.Row].Text,
                    TimeStamp = DateTime.MinValue
                };

                DateTime timeStamp = DateTime.Parse(responseAnswer.Text, CultureInfo.CreateSpecificCulture("en-US"));
                if (question.Type.Subtype == QuestionSubtype.TimeOnly) //Where only a time is given, use date component from DateTime.MinValue
                {
                    dateTimeAnswerReply.TimeStamp = dateTimeAnswerReply.TimeStamp.AddHours(timeStamp.Hour);
                    dateTimeAnswerReply.TimeStamp = dateTimeAnswerReply.TimeStamp.AddMinutes(timeStamp.Minute);
                }
                else
                {
                    dateTimeAnswerReply.TimeStamp = timeStamp;
                }

                reply.Rows.Add(dateTimeAnswerReply);
            }

            return reply;
        }