Esempio n. 1
0
        protected void btnClone_Click(object sender, ImageClickEventArgs e)
        {
            var so = Survey.FetchObject(int.Parse(SID.Text));
            var sn = Survey.FetchObject(int.Parse(SID.Text));

            sn.SID    = 0;
            sn.Name   = txtNewName.Text;
            sn.Status = 1;
            sn.Insert();

            var ds1 = SurveyQuestion.GetAll(so.SID);

            foreach (DataRow r1 in ds1.Tables[0].Rows)
            {
                var QID = Convert.ToInt32(r1["QID"]);

                var q = SurveyQuestion.FetchObject(QID);
                q.SID = sn.SID;
                q.QID = 0;
                q.Insert();

                var ds2 = SQChoices.GetAll(QID);
                foreach (DataRow r2 in ds2.Tables[0].Rows)
                {
                    var SQCID = Convert.ToInt32(r2["SQCID"]);
                    var c     = SQChoices.FetchObject(SQCID);
                    c.SQCID = 0;
                    c.QID   = q.QID;
                    c.Insert();
                }

                var ds3 = SQMatrixLines.GetAll(QID);
                foreach (DataRow r3 in ds3.Tables[0].Rows)
                {
                    var SQMLID = Convert.ToInt32(r3["SQMLID"]);
                    var l      = SQMatrixLines.FetchObject(SQMLID);
                    l.SQMLID = 0;
                    l.QID    = q.QID;
                    l.Insert();
                }
            }
            Session["SID"] = sn.SID;
            Response.Redirect("SurveyList.aspx");
            Response.Redirect("SurveyAddEdit.aspx");
        }
Esempio n. 2
0
        protected void btnAddLines4_Click(object sender, EventArgs e)
        {
            if (Session["tmpL4"] == null)
            {
                Session["tmpL4"] = SQMatrixLines.GetAll(-1);
            }
            var tmpLC4 = (int)Session["tmpLC4"];

            tmpLC4++;
            var     ds     = (DataSet)Session["tmpL4"];
            DataRow newRow = ds.Tables[0].NewRow();

            newRow["LineOrder"] = tmpLC4;
            newRow["LineText"]  = LineText4.Text;
            ds.Tables[0].Rows.Add(newRow);

            Session["tmpL4"]  = ds;
            Session["tmpLC4"] = tmpLC4;

            rptrLines4.DataSource = ds;
            rptrLines4.DataBind();

            LineText4.Text = "";
        }