Example #1
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<LearnSite.Model.WorksDiscuss> DataTableToList(DataTable dt)
 {
     List<LearnSite.Model.WorksDiscuss> modelList = new List<LearnSite.Model.WorksDiscuss>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         LearnSite.Model.WorksDiscuss model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new LearnSite.Model.WorksDiscuss();
             if(dt.Rows[n]["Did"].ToString()!="")
             {
                 model.Did=int.Parse(dt.Rows[n]["Did"].ToString());
             }
             if(dt.Rows[n]["Dwid"].ToString()!="")
             {
                 model.Dwid=int.Parse(dt.Rows[n]["Dwid"].ToString());
             }
             model.Dsnum=dt.Rows[n]["Dsnum"].ToString();
             model.Dwords=dt.Rows[n]["Dwords"].ToString();
             if(dt.Rows[n]["Dtime"].ToString()!="")
             {
                 model.Dtime=DateTime.Parse(dt.Rows[n]["Dtime"].ToString());
             }
             model.Dip=dt.Rows[n]["Dip"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }
Example #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.WorksDiscuss> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.WorksDiscuss> modelList = new List <LearnSite.Model.WorksDiscuss>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.WorksDiscuss model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.WorksDiscuss();
                    if (dt.Rows[n]["Did"].ToString() != "")
                    {
                        model.Did = int.Parse(dt.Rows[n]["Did"].ToString());
                    }
                    if (dt.Rows[n]["Dwid"].ToString() != "")
                    {
                        model.Dwid = int.Parse(dt.Rows[n]["Dwid"].ToString());
                    }
                    model.Dsnum  = dt.Rows[n]["Dsnum"].ToString();
                    model.Dwords = dt.Rows[n]["Dwords"].ToString();
                    if (dt.Rows[n]["Dtime"].ToString() != "")
                    {
                        model.Dtime = DateTime.Parse(dt.Rows[n]["Dtime"].ToString());
                    }
                    model.Dip = dt.Rows[n]["Dip"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #3
0
 protected void Btnword_Click(object sender, EventArgs e)
 {
     string mynum = Request.Cookies["StudentCookies"].Values["Snum"].ToString();
     string LoginIp = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString();
     string worknum = LabelWnum.Text;
     string workWords = Request.Form["textareaWord"].Trim();
     string Wid = Request.QueryString["Wid"].ToString();
     if (workWords != "")
     {
         if (workWords.Length > 10)
         {
             if (workWords.Length < 200)
             {
                 string txtWords = HttpUtility.HtmlEncode(workWords);
                 if (mynum == worknum)
                 {
                     LearnSite.BLL.Works bll = new LearnSite.BLL.Works();
                     bll.UpdateWself(Int32.Parse(Wid), txtWords);
                 }
                 else
                 {
                     LearnSite.Model.WorksDiscuss dmodel = new LearnSite.Model.WorksDiscuss();
                     LearnSite.BLL.WorksDiscuss dbll = new LearnSite.BLL.WorksDiscuss();
                     dmodel.Dip = LoginIp;
                     dmodel.Dsnum = mynum;
                     dmodel.Dtime = DateTime.Now;
                     dmodel.Dwid = Int32.Parse(Wid);
                     dmodel.Dwords = txtWords;
                     dbll.Add(dmodel);
                 }
                 Btnword.Enabled = false;
                 System.Threading.Thread.Sleep(500);
                 Labeldiscuss.Text = "添加作品评价成功!";
                 ShowWork();
                 showGVworkDiscuss();
             }
             else
             {
                 Labeldiscuss.Text = "作品评价字数不能超过100个汉字!";
             }
         }
         else
         {
             Labeldiscuss.Text = "作品评价字数不能少于6个汉字!";
         }
     }
 }
Example #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LearnSite.Model.WorksDiscuss model)
 {
     dal.Update(model);
 }
Example #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LearnSite.Model.WorksDiscuss model)
 {
     return(dal.Add(model));
 }