Exemplo n.º 1
0
    protected void ViewSurveybtn_OnClick(object sender, EventArgs e)
    {
        Button btn      = (Button)sender;
        int    SurveyID = Convert.ToInt32(btn.CommandArgument);

        if (sqlconnector.getSurveyResponses(SurveyID))
        {
            TitleLbl.Controls.Add(new Literal()
            {
                Text = sqlconnector.getUser().getSurvey(SurveyID).getTittle()
            });
        }



        Survey    survey   = sqlconnector.getUser().getSurvey(SurveyID);
        DataTable surveydt = survey.getSurveyResponsesDT();

        if (surveydt != null)
        {
            ViewSurveyGridView.DataSource = surveydt;
            ViewSurveyGridView.DataBind();
            ViewSurveyMessageLbl.Visible = false;
        }
        else
        {
            ViewSurveyMessageLbl.Text    = "No one has taken your survey yet. Please wait for responses.";
            ViewSurveyMessageLbl.Visible = true;
        }
    }
    protected void ViewSurveybtn_OnClick(object sender, EventArgs e)
    {
        Button btn      = (Button)sender;
        int    SurveyID = Convert.ToInt32(btn.CommandArgument);

        if (sqlconnector.getSurveyResponses(SurveyID))
        {
            TitleLbl.Controls.Add(new Literal()
            {
                Text = sqlconnector.getUser().getSurvey(SurveyID).getTittle()
            });
        }

        Survey    survey   = sqlconnector.getUser().getSurvey(SurveyID);
        DataTable surveydt = survey.getSurveyResponsesDT();

        if (surveydt != null)
        {
            ViewSurveyGridView.DataSource = surveydt;
            ViewSurveyGridView.DataBind();
            ViewSurveyMessageLbl.Visible    = false;
            ViewSurveyPlaceholder.Visible   = true;
            ViewResponsePlaceholder.Visible = false;
        }
        else
        {
            ViewSurveyMessageLbl.Text    = "No one has taken your survey yet. Please wait for responses.";
            ViewSurveyMessageLbl.Visible = true;
        }

        bool hasNPS = false;

        foreach (Question q in survey.getQuestions())
        {
            if (q.isNPS())
            {
                hasNPS = true;
            }
        }

        if (hasNPS)
        {
            displayNPS(survey);
        }
        Session["ViewedSurvey"] = survey;
    }