/// <summary>
 /// ��������б�
 /// </summary>
 public List<wgiAdUnionSystem.Model.wgi_noticestat> DataTableToList(DataTable dt)
 {
     List<wgiAdUnionSystem.Model.wgi_noticestat> modelList = new List<wgiAdUnionSystem.Model.wgi_noticestat>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         wgiAdUnionSystem.Model.wgi_noticestat model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new wgiAdUnionSystem.Model.wgi_noticestat();
             if (dt.Rows[n]["id"].ToString() != "")
             {
                 model.id = int.Parse(dt.Rows[n]["id"].ToString());
             }
             if (dt.Rows[n]["noticeid"].ToString() != "")
             {
                 model.noticeid = int.Parse(dt.Rows[n]["noticeid"].ToString());
             }
             if (dt.Rows[n]["usertype"].ToString() != "")
             {
                 model.usertype = int.Parse(dt.Rows[n]["usertype"].ToString());
             }
             if (dt.Rows[n]["userid"].ToString() != "")
             {
                 model.userid = int.Parse(dt.Rows[n]["userid"].ToString());
             }
             if (dt.Rows[n]["unread"].ToString() != "")
             {
                 model.unread = int.Parse(dt.Rows[n]["unread"].ToString());
             }
             if (dt.Rows[n]["deleted"].ToString() != "")
             {
                 model.deleted = int.Parse(dt.Rows[n]["deleted"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
    private void getmsgs()
    {
        Response.ContentType = "txt/html";
        Response.Clear();

        int id;
        if(!int.TryParse(Request["id"],out id))
        {
            Response.Write("读取数据失败!");
            Response.End();
        }

        wgiAdUnionSystem.BLL.wgi_notice bll=new wgiAdUnionSystem.BLL.wgi_notice ();
        wgiAdUnionSystem.Model.wgi_notice model=bll.GetModel(id);

        //取出消息内容
        string cont=model.notice;

        //更改阅读状态
        try
        {
            string utype = Request.QueryString["utype"];
            if (utype == "none")
            {
                bll.UpdateReadStatus(id.ToString(), 1);
            }
            else
            {
                int usertype = int.Parse(utype);
                int userid = int.Parse(Request.QueryString["uid"]);

                wgiAdUnionSystem.BLL.wgi_noticestat bllstat = new wgiAdUnionSystem.BLL.wgi_noticestat();
                wgiAdUnionSystem.Model.wgi_noticestat modelstat = new wgiAdUnionSystem.Model.wgi_noticestat();

                if (bllstat.GetList(" userid=" + userid + " and usertype=" + usertype + " and noticeid=" + id).Tables[0].Rows.Count == 0)
                {
                    modelstat.deleted = 0;
                    modelstat.noticeid = id;
                    modelstat.unread = 1;
                    modelstat.userid = userid;
                    modelstat.usertype = usertype;
                    bllstat.Add(modelstat);
                }
                else
                {
                    bllstat.UpdateRead(id, 1, userid, 0);
                }
            }
        }
        catch (Exception)
        {
            Response.Write("读取数据失败!");
            Response.End();
        }

        Response.Write(cont);
        Response.End();
    }