Пример #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
 private void editNotice()
 {
     int nid = int.Parse(Request.QueryString["noticeid"]);
     hidnid.Value = nid.ToString();
     wgiAdUnionSystem.Model.wgi_notice model = new wgiAdUnionSystem.BLL.wgi_notice().GetModel(nid);
     if(object.Equals(model,null))
     {
         Response.Write("参数错误");
         Response.End();
     }
     txtcontent.Value=model.notice;
     txttitle.Text=model.title;
     ddlobjtype.SelectedValue=model.objtype.ToString();
 }
Пример #3
0
    private void initData(int uid)
    {
        DataSet ds = new wgiAdUnionSystem.BLL.wgi_notice().getLIstOfPrivate(uid, 0);
        int page;
        if (!int.TryParse(Request["page"], out page))
        {
            page = 1;
        }

        PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables[0].DefaultView;
        ps.AllowPaging = true;
        ps.PageSize = pagesize;
        if (page > ps.PageCount) page = 1;
        ps.CurrentPageIndex = page-1;

        this.rptpager.DataSource = ps;
        this.rptpager.DataBind();

        //生成分页代码
        string url = Request.Url.ToString();

        lblpager.Text = Pager.getPagerstring(ps,url,1,3);
    }
Пример #4
0
    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();
    }