using System; using System.Collections.Generic; using System.Web; using System.Data; namespace Com.Jpsoft.Hospital.Web.Module.EmployeeGroup { /// /// GetData 的摘要说明 /// public class GetData : IHttpHandler { public void ProcessRequest(HttpContext context) { string act; if (!string.IsNullOrEmpty(context.Request.QueryString["act"])) { act = context.Request.QueryString["act"]; switch (act) { case "getBMList": GetBMList(context); break; case "getEmployeeList": GetEmployeeList(context); break; case "postData": PostData(context); break; case "delData": DelData(context); break; } } } private void GetBMList(HttpContext context) { System.Text.StringBuilder html = new System.Text.StringBuilder(); Com.Jpsoft.Hospital.BLL.rs_ksdm ksdm = new BLL.rs_ksdm(); DataTable dt = ksdm.GetAllList().Tables[0]; foreach (DataRow row in dt.Rows) { html.AppendFormat("
{1}
", row["ksdm"].ToString(), row["ksmc"].ToString()); html.AppendFormat("
", row["ksdm"].ToString()); } context.Response.ContentType = "text/plain"; context.Response.Write(html.ToString()); } private void GetEmployeeList(HttpContext context) { System.Text.StringBuilder html = new System.Text.StringBuilder(); //Com.Jpsoft.Hospital.BLL.rs_ygxx ygxx = new BLL.rs_ygxx(); Com.Jpsoft.Hospital.BLL.jp_employee_group_detailEx detailEx = new BLL.jp_employee_group_detailEx(); string id = context.Request.QueryString["id"].Split('_')[1]; string gid = context.Request.QueryString["gid"]; DataTable dt = detailEx.GetNotExistEmployee(gid, id).Tables[0];//ygxx.GetList(" ksdm=" + id).Tables[0]; int rowCount = 0; foreach (DataRow row in dt.Rows) { if (rowCount == 0) { html.Append(""); } html.AppendFormat("{1}", row["ygdm"].ToString(), row["ygxm"].ToString()); rowCount++; if (rowCount == 5) { rowCount = 0; html.Append(""); } } context.Response.ContentType = "text/plain"; context.Response.Write(html.ToString()); } private void PostData(HttpContext context) { string result; string id = context.Request.QueryString["ids"]; string gid = context.Request.QueryString["gid"]; Com.Jpsoft.Hospital.BLL.jp_employee_group_detailEx detailEx = new BLL.jp_employee_group_detailEx(); if (detailEx.Add2(id,gid)) result = "1"; else result = "0"; context.Response.ContentType = "text/plain"; context.Response.Write(result); } private void DelData(HttpContext context) { string result = "0"; string id = context.Request.QueryString["id"]; Com.Jpsoft.Hospital.BLL.jp_employee_group_detailEx detailEx = new BLL.jp_employee_group_detailEx(); if (detailEx.Delete(int.Parse(id))) result = "1"; context.Response.ContentType = "text/plain"; context.Response.Write(result); } public bool IsReusable { get { return false; } } } }