| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using HySoft.Common;
- using System.Data;
- using System.Text;
- namespace HySoft.BaseCallCenter.Web.workordermanage.ajax
- {
- /// <summary>
- /// ligerComboBox1 的摘要说明
- /// </summary>
- public class ligerComboBox1 : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/plain";
- string action = CommonRequest.GetQueryString("action");
- switch (action)
- {
- case "getF_Namelist":
- context.Response.Write(getF_Namelist(context));
- break;
- case "getF_TypeNamelist":
- context.Response.Write(getF_TypeNamelist(context));
- break;
- case "gettreelist":
- context.Response.Write(gettreelist(context));
- break;
- case "getSERVICEMETHODtree":
- context.Response.Write(getSERVICEMETHODtree(context));
- break;
- case "getSERVICETYPElist":
- context.Response.Write(getSERVICETYPElist(context));
- break;
- case "getVISITOPINIONlist":
- context.Response.Write(getVISITOPINIONlist(context));
- break;
- case "getCUSTOMEROPINIONlist":
- context.Response.Write(getCUSTOMEROPINIONlist(context));
- break;
- case "getSOLVElist":
- context.Response.Write(getSOLVElist(context));
- break;
- case "getSTANDARDADDRESSlist":
- context.Response.Write(getSTANDARDADDRESSlist(context));
- break;
- case "getORDERTYPElist":
- context.Response.Write(getORDERTYPElist(context));
- break;
- case "getF_RoleName":
- context.Response.Write(getF_RoleNamelist(context));
- break;
- }
- }
- #region 获取数据
- private string getF_Namelist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Wo_WorkOrderState().GetList(" ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = BindZXZTree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getSERVICEMETHODtree(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='fwfs' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getSERVICETYPElist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='fwllx' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getVISITOPINIONlist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='hfjy' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getCUSTOMEROPINIONlist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='khyjfl' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getSOLVElist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='jjqk' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getSTANDARDADDRESSlist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='bxrxz' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getORDERTYPElist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='wtlb' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string gettreelist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='fwlx' ").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getF_TypeNamelist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Wo_WorkOrderType().GetList(" F_ParentId=1").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = BindTree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- private string getF_RoleNamelist(HttpContext context)
- {
- string res = "";
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- dt = new BLL.T_Sys_RoleInfo().GetList(" F_RoleId in (30,31)").Tables[0];
- System.Collections.Generic.List<Model.TreeModel> modelList = RoleNameBindTree(dt, "0");
- System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
- 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;
- }
- public List<Model.TreeModel> BindZXZTree(DataTable tab, string parentid)
- {
- if (tab != null && tab.Rows.Count > 0)
- {
- System.Collections.Generic.List<Model.T_Wo_WorkOrderState> categorylist = new BLL.T_Wo_WorkOrderState().DataTableToList(tab);
- System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
- for (int i = 0; i < categorylist.Count; i++)
- {
- Model.TreeModel model = new Model.TreeModel();
- string currentID = categorylist[i].F_WorkOrderStateId.ToString();//当前功能ID
- model.id = currentID;
- model.IconCls = categorylist[i].F_Des;
- model.text = categorylist[i].F_Name;
- modelList.Add(model);
- }
- return modelList;
- }
- else
- {
- return null;
- }
- }
- public List<Model.TreeModel> Tree(DataTable tab, string parentid)
- {
- if (tab != null && tab.Rows.Count > 0)
- {
- System.Collections.Generic.List<Model.T_Sys_DictionaryValue> categorylist = new BLL.T_Sys_DictionaryValue().DataTableToList(tab);
- System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
- for (int i = 0; i < categorylist.Count; i++)
- {
- Model.TreeModel model = new Model.TreeModel();
- string currentID = categorylist[i].F_DictionaryValueId.ToString();//当前功能ID
- model.id = currentID;
- model.IconCls = categorylist[i].F_DictionaryFlag;
- model.text = categorylist[i].F_Name;
- modelList.Add(model);
- }
- return modelList;
- }
- else
- {
- return null;
- }
- }
- public List<Model.TreeModel> RoleNameBindTree(DataTable tab, string parentid)
- {
- if (tab != null && tab.Rows.Count > 0)
- {
- System.Collections.Generic.List<Model.T_Sys_RoleInfo> categorylist = new BLL.T_Sys_RoleInfo().DataTableToList(tab);
- System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
- for (int i = 0; i < categorylist.Count; i++)
- {
- Model.TreeModel model = new Model.TreeModel();
- string currentID = categorylist[i].F_RoleId.ToString();//当前功能ID
- model.id = currentID;
- model.text = categorylist[i].F_RoleName;
- modelList.Add(model);
- }
- return modelList;
- }
- else
- {
- return null;
- }
- }
- public List<Model.TreeModel> BindTree(DataTable tab, string parentid)
- {
- if (tab != null && tab.Rows.Count > 0)
- {
- System.Collections.Generic.List<Model.T_Wo_WorkOrderType> categorylist = new BLL.T_Wo_WorkOrderType().DataTableToList(tab);
- System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
- for (int i = 0; i < categorylist.Count; i++)
- {
- Model.TreeModel model = new Model.TreeModel();
- string currentID = categorylist[i].F_WorkOrderTypeId.ToString();//当前功能ID
- model.id = currentID;
- model.IconCls = categorylist[i].F_Ename;
- model.text = categorylist[i].F_Name;
- modelList.Add(model);
- }
- return modelList;
- }
- else
- {
- return null;
- }
- }
- #endregion
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
- }
|