<%@ WebService Language="C#" Class="checkmsg" %> using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Data; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] //若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 [System.Web.Script.Services.ScriptService] public class checkmsg : System.Web.Services.WebService { [WebMethod(EnableSession = true)] public string getmsg() { Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); int juese = user.juese; int zhid=user.id; //html语句 string htmlyj = ""; } //根据参数查询数据库返回相应数据 protected string chckmsgdata(int msgtype,int userid,int ts,string url) { DataTable msgdt = new DataTable(); msgdt = DBHlper.Execute("select id,msgval,msgtype,riqi,isview from view_nr_z_sysmsg where msgtypeid=" + msgtype + " and userid=" + userid).Tables[0]; string htmlyj = ""; string msgtypestr = ""; if (msgdt.Rows.Count > 0) { int ddtjval = Convert.ToInt32(msgdt.Rows[0]["msgval"]); msgtypestr = msgdt.Rows[0]["msgtype"].ToString(); if (msgdt.Rows[0]["isview"].ToString() == "0") { htmlyj += "
  • 有" + ts + msgtypestr + "
  • "; } else { htmlyj += "
  • 有" + ts + msgtypestr + "
  • "; } } else { htmlyj += "
  • 有" + ts + msgtypestr + "
  • "; } return htmlyj; } [WebMethod(EnableSession = true)] public void setzt() { Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); DBHlper.excutecmd("update nr_z_sysmsg set isview=1 where userid="+user.id); } [WebMethod(EnableSession = true)] public void setonezt(int id) { DBHlper.excutecmd("update nr_z_sysmsg set isview=1 where id="+id); } }