Пример #1
0
        protected void submitBtn_Click(object sender, EventArgs e)
        {
            string q1 = TextBoxq1.Text;
            string q2 = TextBoxq2.Text;
            string q3 = TextBoxq3.Text;
            string q4 = TextBoxq4.Text;

            SurveyQ    surveyObj = new SurveyQ();
            SurveyQDAO surDAO    = new SurveyQDAO();

            surDAO.InsertSurveyAnswers(q1, q2, q3, q4);
            Response.Redirect("TripManagement.aspx");
        }
Пример #2
0
        protected void updateBtn_Click(object sender, EventArgs e)
        {
            string q1 = TextBoxq1.Text;
            string q2 = TextBoxq2.Text;
            string q3 = TextBoxq3.Text;
            string q4 = TextBoxq4.Text;

            int        id      = Convert.ToInt32(Session["SurveyID"]);
            SurveyQ    newS    = new SurveyQ();
            SurveyQDAO updateS = new SurveyQDAO();
            int        result;

            result = updateS.updateSurvey(id, q1, q2, q3, q4);
            if (result == 1)
            {
                Label2.Text = "Survey updated!";
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SurveyQ        tdList     = new SurveyQ();
            SurveyQDAO     tdDAO      = new SurveyQDAO();
            List <SurveyQ> surveyList = new List <SurveyQ>();

            surveyList           = tdDAO.getSurveyID();
            GridView1.DataSource = surveyList;
            GridView1.DataBind();
            BtnSurvey.Visible = false;
            if (GridView1.Rows.Count < 1)
            {
                Label1.Text       = "<h1 style='text-align:center;'>There are no Surveys at the moment. Create a Survey below!</h1>";
                BtnSurvey.Visible = true;
                GridView1.Enabled = false;
            }
            else
            {
                Label1.Text = "<h2> Current List of Surveys </h2>";
            }
        }
Пример #4
0
        protected void Click_Delete(object sender, GridViewDeleteEventArgs e)
        {
            string        DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
            SqlConnection myConn    = new SqlConnection(DBConnect);
            string        Id        = GridView1.Rows[e.RowIndex].Cells[0].Text;
            int           result;

            myConn.Open();
            SqlCommand cmd = new SqlCommand("DELETE FROM SurveyQns WHERE SurveyQID ='" + Id + "'", myConn);

            result = cmd.ExecuteNonQuery();
            myConn.Close();
            if (result == 1)
            {
                SurveyQ        surveyObj = new SurveyQ();
                SurveyQDAO     tdDAO     = new SurveyQDAO();
                List <SurveyQ> tdList    = new List <SurveyQ>();
                tdList = tdDAO.getSurveyID();
                GridView1.DataSource = tdList;
                GridView1.DataBind();
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null)
            {
                Session["new"] = "Survey";
                Response.Redirect("LoginStudent.aspx");
            }
            StudList    studList = new StudList();
            StudListDAO studDAO  = new StudListDAO();
            SurveyQ     tdList   = new SurveyQ();
            SurveyQDAO  tdDAO    = new SurveyQDAO();

            studList   = studDAO.getRegbyStudAdmin(Session["Username"].ToString());
            LblNo.Text = studList.studentAdmin.ToString();
            tdList     = tdDAO.getSurveyQuestions();
            if (tdList == null)
            {
                tbQ1.Visible      = false;
                tbQ2.Visible      = false;
                tbQ3.Visible      = false;
                tbQ4.Visible      = false;
                LblQ2.Visible     = false;
                LblQ3.Visible     = false;
                LblQ4.Visible     = false;
                submitBtn.Visible = false;
                resetBtn.Visible  = false;
                LblQ1.Text        = "<h1>No survey has been loaded for the moment. Please check back again later!</h1>";
            }
            else
            {
                LblQ1.Text = tdList.q1.ToString();
                LblQ2.Text = tdList.q2.ToString();
                LblQ3.Text = tdList.q3.ToString();
                LblQ4.Text = tdList.q4.ToString();
            }
        }