| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using HySoft.Common;
- using System.Data;
- namespace HySoft.BaseCallCenter.Web.tools
- {
- /// <summary>
- /// basedata 的摘要说明
- /// </summary>
- public class basedata : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/plain";
- //取得处事类型
- string action = CommonRequest.GetQueryString("action");
- switch (action)
- {
- case "getlist":
- context.Response.Write(LoadList(context));
- break;
- case "delete":
- break;
- case "clear":
- break;
- }
- }
- #region 获取数据
- private string LoadList(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- string key = HttpUtility.UrlDecode(CommonRequest.GetQueryString("key"));
- if (key.Trim() != "")
- {
- sql += " F_DictionaryFlag = '" + key.Trim() + "' ";
- }
- dt = new BLL.T_Sys_DictionaryValue().GetList(sql).Tables[0];
- System.Collections.Generic.List<Model.T_Sys_DictionaryValue> modelList = new BLL.T_Sys_DictionaryValue().DataTableToList(dt);
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.T_Sys_DictionaryValue>));
- using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
- {
- //JSON序列化
- serializer.WriteObject(stream, modelList);
- res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
- }
- }
- catch (Exception err)
- {
- //res = err.ToString();
- }
- finally
- {
- dt.Clear();
- dt.Dispose();
- }
- return res;
- }
- #endregion
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
- }
|