Пример #1
0
    protected void Btnadd_Click(object sender, EventArgs e)
    {
        string Mitem = LearnSite.Common.WordProcess.ClearPP(mcontent.InnerText);

        if (Request.QueryString["Qid"] != null && Request.QueryString["Qvid"] != null && Mitem.Length > 0)
        {
            string Mqid = Request.QueryString["Qid"].ToString();
            string Mvid = Request.QueryString["Qvid"].ToString();
            string Mcid = Request.QueryString["Qcid"].ToString();
            LearnSite.Model.SurveyItem model = new LearnSite.Model.SurveyItem();
            model.Mcount = 0;
            model.Mitem  = HttpUtility.HtmlEncode(Mitem);
            model.Mqid   = Int32.Parse(Mqid);
            model.Mscore = Int32.Parse(DDLscore.SelectedValue);
            model.Mvid   = Int32.Parse(Mvid);
            model.Mcid   = Int32.Parse(Mcid);
            LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem();
            if (Btnadd.Text == "添加")
            {
                mbll.Add(model);
            }
            else
            {
                model.Mid = Int32.Parse(LabelMid.Text);
                mbll.Update(model);
                Btnadd.Text   = "添加";
                LabelMid.Text = "";
            }
            System.Threading.Thread.Sleep(200);
            showitem();
            mcontent.InnerText = "";
        }
    }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.SurveyItem> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.SurveyItem> modelList = new List <LearnSite.Model.SurveyItem>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.SurveyItem model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.SurveyItem();
                    if (dt.Rows[n]["Mid"] != null && dt.Rows[n]["Mid"].ToString() != "")
                    {
                        model.Mid = int.Parse(dt.Rows[n]["Mid"].ToString());
                    }
                    if (dt.Rows[n]["Mqid"] != null && dt.Rows[n]["Mqid"].ToString() != "")
                    {
                        model.Mqid = int.Parse(dt.Rows[n]["Mqid"].ToString());
                    }
                    if (dt.Rows[n]["Mvid"] != null && dt.Rows[n]["Mvid"].ToString() != "")
                    {
                        model.Mvid = int.Parse(dt.Rows[n]["Mvid"].ToString());
                    }
                    if (dt.Rows[n]["Mitem"] != null && dt.Rows[n]["Mitem"].ToString() != "")
                    {
                        model.Mitem = dt.Rows[n]["Mitem"].ToString();
                    }
                    if (dt.Rows[n]["Mscore"] != null && dt.Rows[n]["Mscore"].ToString() != "")
                    {
                        model.Mscore = int.Parse(dt.Rows[n]["Mscore"].ToString());
                    }
                    if (dt.Rows[n]["Mcount"] != null && dt.Rows[n]["Mcount"].ToString() != "")
                    {
                        model.Mcount = int.Parse(dt.Rows[n]["Mcount"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #3
0
    protected void GVSurveyItem_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string Mid = e.CommandArgument.ToString();

        LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem();

        if (e.CommandName == "Del")
        {
            mbll.Delete(Int32.Parse(Mid));
        }
        if (e.CommandName == "Edt")
        {
            LabelMid.Text = Mid;
            LearnSite.Model.SurveyItem model = new LearnSite.Model.SurveyItem();
            model = mbll.GetModel(Int32.Parse(Mid));
            mcontent.InnerText     = HttpUtility.HtmlDecode(model.Mitem);//暂时从数据库获取选项内容,不会直接从表格中获取
            DDLscore.SelectedValue = model.Mscore.Value.ToString();
            Btnadd.Text            = "修改";
        }
        System.Threading.Thread.Sleep(200);
        showitem();
    }
Пример #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LearnSite.Model.SurveyItem model)
 {
     return(dal.Update(model));
 }
Пример #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LearnSite.Model.SurveyItem model)
 {
     return(dal.Add(model));
 }