AddCal.ashx
上传用户:szhf331
上传日期:2022-06-22
资源大小:1032k
文件大小:1k
- <%@ WebHandler Language="C#" Class="AddCal" %>
- using System;
- using System.Web;
- using student.BLL;
- using System.Data;
- using System.Text;
- public class AddCal : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/plain";
- string lj = context.Request.QueryString["Ljid"];
- string col = context.Request.QueryString["Colid"];
- string pro = context.Request.QueryString["Proid"];
- DataTable dt;
- if (lj == "")
- {
- dt = new res_cla().GetList("Col_id=" + col + " and pro_id=" + pro + "").Tables[0];
- }
- else
- {
- dt = new res_cla().GetList("lj_id=" + lj + " and Col_id=" + col + " and pro_id=" + pro + "").Tables[0];
- }
- StringBuilder sb = new StringBuilder();
- foreach (DataRow var in dt.Rows)
- {
- sb.AppendFormat("({0}name:'{1}',value:'{2}'{3}),", "{", var["cla"].ToString(), var["id"].ToString(), "}");
- }
- if (sb.Length == 0)
- {
- context.Response.Write("");
- return;
- }
- string result = sb.ToString().Substring(0, sb.Length - 1);
- result = "[" + result + "]";
- context.Response.Write(result);
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }