示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserOK"] == null || Session["UserOK"].ToString() != "OK")
            {
                Response.Redirect("Logon.aspx");
            }

            if (Request.QueryString["SurveyID"] != null)
            {
                SurveyID = new Guid(Request.QueryString["SurveyID"].ToString());
            }
            else
            {
                Response.Redirect("Index.aspx");
            }
            //if (!Page.IsPostBack)
            //{
            LoadQuestionTypes();
            LoadQuestions(SurveyID);
            classes.SQLCode mySQL    = new classes.SQLCode();
            classes.Survey  mySurvey = mySQL.GetSurvey(SurveyID);
            lblSurveyName.Text     = mySurvey.SurveyName;
            lblSurveyName.CssClass = "surveyName";
            pnlBoilerplate.Controls.Add(new LiteralControl("<label>" + mySurvey.SurveyBoilerplate + "</label>"));
            LayoutPage();
            //}
        }
示例#2
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            classes.Survey thisSurvey = new classes.Survey();
            if (string.IsNullOrEmpty(txtSurveyID.Text) || ddlSurveys.Text == "New Survey" || txtSurveyID.Text == "00000000-0000-0000-0000-000000000000")
            {
                thisSurvey.SurveyID = Guid.NewGuid();
            }
            else
            {
                thisSurvey.SurveyID = new Guid(txtSurveyID.Text);
            }
            thisSurvey.SurveyName  = txtSurveyName.Text;
            thisSurvey.CreatedBy   = txtCreatedBy.Text;
            thisSurvey.DateCreated = Convert.ToDateTime(txtDateCreated.Text);
            string   ModifiedBy;
            DateTime dtModified;

            if (!string.IsNullOrEmpty(txtModifiedBy.Text))
            {
                ModifiedBy = txtModifiedBy.Text;
            }
            else
            {
                ModifiedBy = txtCreatedBy.Text;
            }
            if (!string.IsNullOrEmpty(txtDateModified.Text))
            {
                dtModified = Convert.ToDateTime(txtDateModified.Text);
            }
            else
            {
                dtModified = Convert.ToDateTime(txtDateCreated.Text);
            }
            thisSurvey.ModifiedBy        = ModifiedBy;
            thisSurvey.DateModified      = dtModified;
            thisSurvey.SurveyNotes       = txtSurveyNotes.Text;
            thisSurvey.SurveyBoilerplate = txtSurveyBoilerplate.Text;
            classes.SQLCode thisSQL = new classes.SQLCode();
            thisSQL.PostSurvey(thisSurvey);
            LoadSurveyList();
            Response.Write("Survey data persisted");
        }
示例#3
0
        protected void btnLoad_Click(object sender, EventArgs e)
        {
            //classes.SQLCode thisSQL = new classes.SQLCode();
            XmlSerializer ser = new XmlSerializer(theseSurveys.GetType());

            using (StringReader reader = new StringReader(surveyList.Value))
            {
                theseSurveys = (List <classes.Survey>)ser.Deserialize(reader);
            }
            if (ddlSurveys.Text != "New Survey")
            {
                classes.Survey thisSurvey = theseSurveys.Find(delegate(classes.Survey mySurvey) { return(mySurvey.SurveyID == new Guid(ddlSurveys.SelectedValue)); });

                /*
                 * classes.SQLCode thisSQL = new classes.SQLCode();
                 * classes.Survey thisSurvey = thisSQL.GetSurvey(new Guid(ddlSurveys.SelectedValue));
                 *                  * */
                if (thisSurvey != null)
                {
                    txtSurveyID.Text          = thisSurvey.SurveyID.ToString();
                    txtSurveyName.Text        = thisSurvey.SurveyName;
                    txtCreatedBy.Text         = thisSurvey.CreatedBy;
                    txtDateCreated.Text       = thisSurvey.DateCreated.ToString();
                    txtDateModified.Text      = thisSurvey.DateModified.ToString();
                    txtModifiedBy.Text        = thisSurvey.ModifiedBy;
                    txtSurveyNotes.Text       = thisSurvey.SurveyNotes;
                    txtSurveyBoilerplate.Text = thisSurvey.SurveyBoilerplate;
                }
            }
            else
            {
                txtSurveyID.Text          = "";
                txtSurveyName.Text        = "";
                txtCreatedBy.Text         = "";
                txtDateCreated.Text       = "";
                txtDateModified.Text      = "";
                txtModifiedBy.Text        = "";
                txtSurveyNotes.Text       = "";
                txtSurveyBoilerplate.Text = "";
            }
        }