示例#1
0
    private void SaveData()
    {
        CheckInput();
        if (this.PopupMessage1.Length == 0)
        {
            YPSCS.Class.Survey sv = new YPSCS.Class.Survey();
            if (Session["svid"] != null || !String.IsNullOrEmpty(Session["svid"].ToString()))
            {
                sv.ID = Session["svid"].ToString();
            }

            DataTable dt = new DataTable();
            dt.Columns.Add("seq");
            dt.Columns.Add("ans");

            #region CheckBox

            DataRow[] drc = dtq.Select("type='C'");

            for (int x = 0; x < drc.Length; x++)
            {
                CheckBox cb = Panel_Ans.FindControl("Q" + drc[x]["seq"].ToString()) as CheckBox;
                if (cb != null && cb.Checked)
                {
                    AddItem(ref dt, drc[x]["seq"].ToString(), "1");
                }
            }


            #endregion

            #region DropDownList

            DataRow[] drd = dtq.Select("type='D'");

            for (int x = 0; x < drd.Length; x++)
            {
                DropDownList ddl = Panel_Ans.FindControl("Q" + drd[x]["seq"].ToString()) as DropDownList;
                if (ddl != null && !String.IsNullOrEmpty(ddl.SelectedValue))
                {
                    AddItem(ref dt, drd[x]["seq"].ToString(), ddl.Text);
                }
            }

            #endregion

            #region Text

            DataRow[] drt = dtq.Select("type='T'");

            for (int x = 0; x < drt.Length; x++)
            {
                TextBox tb = Panel_Ans.FindControl("Q" + drt[x]["seq"].ToString()) as TextBox;
                if (tb != null && !String.IsNullOrEmpty(tb.Text))
                {
                    AddItem(ref dt, drt[x]["seq"].ToString(), tb.Text);
                }
            }

            #endregion

            #region Radio

            DataRow[] drr = dtq.Select("type='R'");

            for (int x = 0; x < drr.Length; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    RadioButton rb = Panel_Ans.FindControl("Q" + drr[x]["seq"].ToString() + "_" + y.ToString()) as RadioButton;
                    if (rb != null && rb.Checked)
                    {
                        AddItem(ref dt, drr[x]["seq"].ToString(), y.ToString());
                        break;
                    }
                }
            }

            #endregion

            sv.SurveyData = dt;
            sv.SaveDetail(seqs, seqe);
        }
    }
示例#2
0
    private void LoadData()
    {
        if (Session["svid"] != null)
        {
            YPSCS.Class.Survey sv = new YPSCS.Class.Survey();
            if (sv.Load(Session["svid"].ToString(), ""))
            {
                #region Load Data

                DataRow[] drs = sv.SurveyData.Select("seq>='" + seqs.ToString() + "' AND seq<='" + seqe.ToString() + "'");
                DataRow[] drc = dtq.Select("type='C'");
                DataRow[] drd = dtq.Select("type='D'");
                DataRow[] drt = dtq.Select("type='T'");
                DataRow[] drr = dtq.Select("type='R'");

                for (int x = 0; x < drs.Length; x++)
                {
                    #region Items

                    for (int y = 0; y < drc.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == drc[y]["seq"].ToString())
                        {
                            CheckBox cb = Panel_Ans.FindControl("Q" + drc[y]["seq"].ToString()) as CheckBox;
                            if (cb != null && drs[x]["ans"].ToString() == "1")
                            {
                                cb.Checked = true;
                            }
                        }
                    }
                    for (int y = 0; y < drd.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == drd[y]["seq"].ToString())
                        {
                            DropDownList ddl = Panel_Ans.FindControl("Q" + drd[y]["seq"].ToString()) as DropDownList;
                            if (ddl != null)
                            {
                                ddl.SelectedValue = drs[x]["ans"].ToString();
                            }
                            break;
                        }
                    }
                    for (int y = 0; y < drt.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == drt[y]["seq"].ToString())
                        {
                            TextBox tb = Panel_Ans.FindControl("Q" + drt[y]["seq"].ToString()) as TextBox;
                            if (tb != null)
                            {
                                tb.Text = drs[x]["ans"].ToString();
                            }
                            break;
                        }
                    }
                    for (int y = 0; y < drr.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == drr[y]["seq"].ToString())
                        {
                            RadioButton rb = Panel_Ans.FindControl("Q" + drr[y]["seq"].ToString() + "_" + drs[x]["ans"].ToString()) as RadioButton;
                            if (rb != null)
                            {
                                rb.Checked = true;
                            }
                            break;
                        }
                    }

                    #endregion
                }

                #endregion
            }
        }
    }
示例#3
0
    private void SaveData()
    {
        CheckInput();
        if (this.PopupMessage1.Length == 0)
        {
            YPSCS.Class.Survey sv = new YPSCS.Class.Survey();
            if (Session["svid"] != null || !String.IsNullOrEmpty(Session["svid"].ToString()))
            {
                sv.ID = Session["svid"].ToString();
            }

            DataTable dt = new DataTable();
            dt.Columns.Add("seq");
            dt.Columns.Add("ans");

            #region CheckBox

            for (int x = 0; x < chkitem.Length; x++)
            {
                CheckBox cb = Panel_Ans.FindControl("Q" + chkitem[x]) as CheckBox;
                if (cb != null && cb.Checked)
                {
                    AddItem(ref dt, chkitem[x], "1");
                }
            }


            #endregion

            #region DropDownList

            for (int x = 0; x < ddlitem.Length; x++)
            {
                DropDownList ddl = Panel_Ans.FindControl("Q" + ddlitem[x]) as DropDownList;
                if (ddl != null && !String.IsNullOrEmpty(ddl.SelectedValue))
                {
                    AddItem(ref dt, ddlitem[x], ddl.Text);
                }
            }

            #endregion

            #region Text

            for (int x = 0; x < txtitem.Length; x++)
            {
                TextBox tb = Panel_Ans.FindControl("Q" + txtitem[x]) as TextBox;
                if (tb != null && !String.IsNullOrEmpty(tb.Text))
                {
                    AddItem(ref dt, txtitem[x], tb.Text);
                }
            }

            #endregion

            #region Radio


            for (int x = 0; x < rdoitem.Length; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    RadioButton rb = Panel_Ans.FindControl("Q" + rdoitem[x] + "_" + y.ToString()) as RadioButton;
                    if (rb != null && rb.Checked)
                    {
                        AddItem(ref dt, rdoitem[x], y.ToString());
                        break;
                    }
                }
            }

            #endregion

            sv.SurveyData = dt;
            sv.SaveDetail(72, 96);
        }
    }
示例#4
0
    private void LoadData()
    {
        if (Session["svid"] != null)
        {
            YPSCS.Class.Survey sv = new YPSCS.Class.Survey();
            if (sv.Load(Session["svid"].ToString(), ""))
            {
                #region Load Data

                DataRow[] drs = sv.SurveyData.Select("seq>='72' AND seq<='96'");

                for (int x = 0; x < drs.Length; x++)
                {
                    for (int y = 0; y < ddlitem.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == ddlitem[y])
                        {
                            DropDownList ddl = Panel_Ans.FindControl("Q" + ddlitem[y]) as DropDownList;
                            if (ddl != null)
                            {
                                ddl.SelectedValue = drs[x]["ans"].ToString();
                            }
                            break;
                        }
                    }

                    for (int y = 0; y < txtitem.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == txtitem[y])
                        {
                            TextBox tb = Panel_Ans.FindControl("Q" + txtitem[y]) as TextBox;
                            if (tb != null)
                            {
                                tb.Text = drs[x]["ans"].ToString();
                            }
                            break;
                        }
                    }
                    for (int y = 0; y < rdoitem.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == rdoitem[y])
                        {
                            RadioButton rb = Panel_Ans.FindControl("Q" + rdoitem[y] + "_" + drs[x]["ans"].ToString()) as RadioButton;
                            if (rb != null)
                            {
                                rb.Checked = true;
                            }
                            break;
                        }
                    }
                    for (int y = 0; y < chkitem.Length; y++)
                    {
                        if (drs[x]["seq"].ToString() == chkitem[y])
                        {
                            CheckBox cb = Panel_Ans.FindControl("Q" + chkitem[y]) as CheckBox;
                            if (cb != null && drs[x]["ans"].ToString() == "1")
                            {
                                cb.Checked = true;
                            }
                        }
                    }
                }

                #endregion
            }
        }
    }
示例#5
0
文件: A.aspx.cs 项目: nitroxyu/ypscs
    private void SaveData()
    {
        CheckInput();
        if (this.PopupMessage1.Length == 0)
        {
            YPSCS.Class.Survey sv = new YPSCS.Class.Survey();
            sv.SurveyCode = Session["svcode"].ToString();
            if (Session["svid"] == null || String.IsNullOrEmpty(Session["svid"].ToString()))
            {
                sv.ID           = Guid.NewGuid().ToString().ToUpper();
                Session["svid"] = sv.ID;
            }
            else
            {
                sv.ID = Session["svid"].ToString();
            }
            sv.Email      = this.Q2.Text;
            sv.Company    = this.Q4.Text;
            sv.Department = this.Q5.Text;
            sv.Name       = this.Q6.Text;
            sv.Tel        = (String.IsNullOrEmpty(this.Q7_0.Text) ? "" : "(" + this.Q7_0.Text + ")") + this.Q7_1.Text + (String.IsNullOrEmpty(this.Q7_2.Text) ? "" : " #" + this.Q7_2.Text);
            sv.Title      = this.Q8.Text;
            sv.People     = this.Q9.Text;
            sv.Language   = System.Web.HttpContext.Current.Request.UserLanguages[0].ToString();
            sv.Create();

            DataTable dt = new DataTable();
            dt.Columns.Add("seq");
            dt.Columns.Add("ans");

            #region A.2

            string Q10 = "";
            for (int x = 1; x <= 10; x++)
            {
                CheckBox cb = Panel_Ans.FindControl("Q10_" + x.ToString()) as CheckBox;
                if (cb != null && cb.Checked)
                {
                    AddString(ref Q10, x.ToString());
                }
            }
            for (int x = 11; x <= 20; x++)
            {
                TextBox tb = Panel_Ans.FindControl("Q" + x.ToString()) as TextBox;
                if (tb != null && !String.IsNullOrEmpty(tb.Text))
                {
                    AddItem(ref dt, x.ToString(), tb.Text);
                }
            }

            if (!String.IsNullOrEmpty(Q10))
            {
                AddItem(ref dt, "10", Q10);
            }

            #endregion

            #region A.3

            string Q21 = "";
            for (int x = 1; x <= 8; x++)
            {
                CheckBox cb = Panel_Ans.FindControl("Q21_" + x.ToString()) as CheckBox;
                if (cb != null && cb.Checked)
                {
                    AddString(ref Q21, x.ToString());
                }
            }
            if (!String.IsNullOrEmpty(Q10))
            {
                AddItem(ref dt, "21", Q21);
            }
            if (!String.IsNullOrEmpty(this.Q22.Text))
            {
                AddItem(ref dt, "22", this.Q22.Text);
            }

            #endregion

            #region A.4

            for (int x = 1; x <= 6; x++)
            {
                RadioButton rb = Panel_Ans.FindControl("Q23_" + x.ToString()) as RadioButton;
                if (rb != null && rb.Checked)
                {
                    AddItem(ref dt, "23", x.ToString());
                    break;
                }
            }

            #endregion

            #region A.5

            for (int x = 1; x <= 5; x++)
            {
                RadioButton rb = Panel_Ans.FindControl("Q24_" + x.ToString()) as RadioButton;
                if (rb != null && rb.Checked)
                {
                    AddItem(ref dt, "24", x.ToString());
                    break;
                }
            }

            #endregion

            sv.SurveyData = dt;
            sv.SaveDetail(10, 24);
        }
    }
示例#6
0
    private void LoadData()
    {
        if (Session["svid"] != null)
        {
            YPSCS.Class.Survey sv = new YPSCS.Class.Survey();
            if (sv.Load(Session["svid"].ToString(), ""))
            {
                this.Q2.Text = sv.Email;
                this.Q4.Text = sv.Company;
                this.Q5.Text = sv.Department;
                this.Q6.Text = sv.Name;
                this.Q8.Text = sv.Title;
                this.Q9.Text = sv.People;
                string tel = sv.Tel, tel1 = "", tel2 = "";

                if (tel.IndexOf(")") > -1)
                {
                    tel1 = tel.Substring(1, tel.IndexOf(")") - 1);
                    tel  = tel.Substring(tel.IndexOf(")") + 1);
                }
                if (tel.IndexOf("#") > -1)
                {
                    tel2 = tel.Substring(tel.IndexOf("#") + 1);
                    tel  = tel.Substring(0, tel.IndexOf("#") - 1);
                }
                this.Q7_0.Text = tel1;
                this.Q7_1.Text = tel;
                this.Q7_2.Text = tel2;

                #region Load Data

                DataRow[] drs = sv.SurveyData.Select("seq>='10' AND seq<='21'");
                for (int x = 0; x < drs.Length; x++)
                {
                    int seq = int.Parse(drs[x]["seq"].ToString());
                    if (seq == 10 || seq == 17)
                    {
                        string[] items = drs[x]["ans"].ToString().Split(';');
                        for (int y = 0; y < items.Length; y++)
                        {
                            CheckBox cb = Panel_Ans.FindControl("Q" + seq.ToString() + "_" + items[y].ToString()) as CheckBox;
                            if (cb != null)
                            {
                                cb.Checked = true;
                            }
                        }
                    }
                    else if ((seq >= 11 && seq <= 15) || seq == 18)
                    {
                        TextBox tb = Panel_Ans.FindControl("Q" + seq.ToString()) as TextBox;
                        tb.Text = drs[x]["ans"].ToString();
                    }
                    else
                    {
                        RadioButton rb = Panel_Ans.FindControl("Q" + seq.ToString() + "_" + drs[x]["ans"].ToString()) as RadioButton;
                        rb.Checked = true;
                    }
                }

                #endregion
            }
        }
    }