Пример #1
0
    protected void sub_click(object sender, EventArgs e)
    {
        wgiAdUnionSystem.BLL.wgi_notice bll = new wgiAdUnionSystem.BLL.wgi_notice();
        wgiAdUnionSystem.Model.wgi_notice model = new wgiAdUnionSystem.Model.wgi_notice();
        if (Request.QueryString["act"]=="edit")
        {
            model = bll.GetModel(int.Parse(hidnid.Value));
            model.title = Server.HtmlEncode(txttitle.Text);
            model.notice = txtcontent.Value;
            model.objtype = int.Parse(ddlobjtype.Text);
            model.publisher = base.user.id;
            //model.pubdate = DateTime.Now;//真有重要更新应发新消息

            bll.Update(model);

            ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('修改公告成功!');parent.closepop();parent.location=parent.location;", true);
            return;
        }
        model.notice = txtcontent.Value;
        model.objid = -1;//-1表示公告,私人消息会有用户id
        model.objtype = int.Parse(ddlobjtype.Text);
        model.pubdate = DateTime.Now;
        model.publisher = base.user.id;
        model.title = Server.HtmlEncode(txttitle.Text);
        model.unread = 0;

        bll.Add(model);
        ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('发布公告成功!');parent.closepop();parent.location=parent.location;", true);
    }
Пример #2
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<wgiAdUnionSystem.Model.wgi_notice> DataTableToList(DataTable dt)
 {
     List<wgiAdUnionSystem.Model.wgi_notice> modelList = new List<wgiAdUnionSystem.Model.wgi_notice>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         wgiAdUnionSystem.Model.wgi_notice model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new wgiAdUnionSystem.Model.wgi_notice();
             if (dt.Rows[n]["id"].ToString() != "")
             {
                 model.id = int.Parse(dt.Rows[n]["id"].ToString());
             }
             model.title = dt.Rows[n]["title"].ToString();
             model.notice = dt.Rows[n]["notice"].ToString();
             if (dt.Rows[n]["pubdate"].ToString() != "")
             {
                 model.pubdate = DateTime.Parse(dt.Rows[n]["pubdate"].ToString());
             }
             if (dt.Rows[n]["unread"].ToString() != "")
             {
                 model.unread = int.Parse(dt.Rows[n]["unread"].ToString());
             }
             if (dt.Rows[n]["publisher"].ToString() != "")
             {
                 model.publisher = int.Parse(dt.Rows[n]["publisher"].ToString());
             }
             if (dt.Rows[n]["objid"].ToString() != "")
             {
                 model.objid = int.Parse(dt.Rows[n]["objid"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }