Esempio n. 1
0
        /// <summary>
        /// Survey search by answer option id and last name or given Names
        /// </summary>
        /// <param name="answerOptionIdList">List<int> answerOptionIdList</param>
        /// <param name="lastName">String lastName</param>
        /// <param name="givenNames">String givenNames</param>
        /// <returns>DataTable</returns>
        /// <exception cref="AppControlException">AppControlException</exception>
        public DataTable searchSurveyByAnswerIDLastNameOrGivenNames(List <int> answerOptionIdList, String lastName, String givenNames)
        {
            try
            {
                if (answerOptionIdList.Count == 0)
                {
                    throw new AppControlException(AppConstants.errorSearchParamBankAndService);
                }

                DataTable searchResult = new DataTable();
                SurveyDAO surveyDAO    = new SurveyDAO();

                searchResult = surveyDAO.searchSurveyByAnswerIDLastNameOrGivenNames(answerOptionIdList, lastName, givenNames);

                return(searchResult);
            }
            catch (AppDAOException ex)
            {
                //Error log simulated
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());

                throw new AppControlException(ex.Message);
            }
            catch (Exception ex)
            {
                //Error log simulated
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Insert a answered pageSurvey.
        /// </summary>
        /// <param name="surveyQuestionAnswerList">List<SurveyQuestionAnswer> surveyQuestionAnswerList</param>
        /// <returns>int</returns>
        /// <exception cref="AppControlException">AppControlException</exception>
        public void insertAnsweredSurvey(List <SurveyQuestionAnswer> surveyQuestionAnswerList)
        {
            try
            {
                SurveyDAO surveyDAO = new SurveyDAO();

                foreach (SurveyQuestionAnswer surveyQuestionAnswer in surveyQuestionAnswerList)
                {
                    surveyDAO.insertSurveyQuestionAnswer(surveyQuestionAnswer);
                }
            }
            catch (AppControlException ex)
            {
                //Error log simulated
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());

                throw new AppControlException(ex.Message);
            }
            catch (Exception ex)
            {
                //Error log simulated
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                throw;
            }
        }
        public void GetAllSurveysTest()
        {
            SurveyDAO     test     = new SurveyDAO(connectionString);
            List <Survey> testList = new List <Survey>();

            testList = test.GetAllSurveys();
            Assert.IsTrue(testList.Count > 0);
        }
Esempio n. 4
0
        protected void submitBtn_Click(object sender, EventArgs e)
        {
            string    SurveyID     = String.Format("S{0}", LblNo.Text);
            string    studentAdmin = LblNo.Text;
            string    q1Ans        = tbQ1.Text;
            string    q2Ans        = tbQ2.Text;
            string    q3Ans        = tbQ3.Text;
            string    q4Ans        = tbQ4.Text;
            string    q5Ans        = "";
            string    q6Ans        = "";
            string    q7Ans        = "";
            Survey    surveyObj    = new Survey();
            SurveyDAO surDAO       = new SurveyDAO();

            surDAO.InsertSurveyAnswers(SurveyID, studentAdmin, q1Ans, q2Ans, q3Ans, q4Ans, q5Ans, q6Ans, q7Ans);
            Response.Redirect("Statistics.aspx");
        }