private void BaseOptionsInit() { _respondentId = CheckOrInsertRespondentAndGetId(); _interviewThemeId = GetInterviewThemeId(InterView.GetInterviewTheme()); var maxInterviewNum = GetMaxInterviewNum(); _nextInterviewNum = maxInterviewNum == 0 ? 1 : maxInterviewNum; }
private DataTable GetQuestionsAnswersOrResults(GetDataType getDataType) { var selectionField = string.Empty; // SELECT BLOCK var query = "Select distinct "; switch (getDataType) { case GetDataType.Answers: selectionField = "main.Answers.Name"; break; case GetDataType.Questions: selectionField = "main.Questions.Name"; break; case GetDataType.QuestionsAnswersScores: selectionField = "main.Questions.Name, main.Answers.Name, main.Interview.Score"; break; case GetDataType.Theme: selectionField = "main.Themes.Name"; break; } if (selectionField != string.Empty) { // FROM BLOCK query += selectionField + " from main.Interview, " + "main.Questions, " + "main.Answers, " + "main.Themes "; // WHERE BLOCK query += "where main.Interview.QUESTION_ID = main.Questions.ID " + "and main.Interview.ANSWER_ID = main.Answers.ID " + "and main.Interview.theme_id = main.Themes.ID"; if (getDataType != GetDataType.Theme) { query += " and main.Themes.Name = " + "'" + InterView.GetInterviewTheme() + "'"; } query += " order by main.Questions.ID, main.Answers.ID "; try { var result = DbConnection.SelectFromDb(query); return(result); } catch (Exception exp) { throw new Exception(exp.ToString()); } } return(null); }
private int GetCurrThemeId() { var query = " select Themes.id " + " from main.Themes " + " where Themes.name = '" + InterView.GetInterviewTheme() + "'"; try { var themeId = DbConnection.SelectScalarFromDb(query); return(Convert.ToInt32(themeId)); } catch (Exception exp) { throw new Exception(exp.ToString()); } }
private DataTable GetInteviewId(Question question, int score) { var query = "select distinct main.Interview.id " + " from main.Interview, main.Themes, main.Questions "; query += " where main.Questions.Name = '" + question.Name + "'" + " and main.Interview.score = '" + score + "'" + " and main.Themes.Name = '" + InterView.GetInterviewTheme() + "'" + " and main.Interview.theme_id = main.Themes.Id " + " and main.Interview.Question_id = main.Questions.id "; try { var result = DbConnection.SelectFromDb(query); return(result); } catch (Exception exp) { throw new Exception(exp.ToString()); } }