dlmh_system/VRS/Handler/Data.ashx.cs

255 lines
7.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using VRS.Util;
namespace VRS.Handler
{
/// <summary>
/// Data 的摘要说明
/// </summary>
public class Data : BaseHandler, IHttpHandler
{
DataService.BLL.admin_user bll = new DataService.BLL.admin_user();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
DataService.BLL.pro_app bll_app = new DataService.BLL.pro_app();
/// <summary>
/// 终端类型
/// </summary>
DataService.BLL.admin_soft bll_sof_type = new DataService.BLL.admin_soft();
/// <summary>
/// 业务场景
/// </summary>
DataService.BLL.admin_major bll_scene = new DataService.BLL.admin_major();
/// <summary>
/// 专业分类
/// </summary>
DataService.BLL.admin_subject bll_scene_zy = new DataService.BLL.admin_subject();
public void ProcessRequest(HttpContext context)
{
//context.Response.ContentType = "text/plain";
baseContext = context;
context.Response.ContentType = "application/json";
CrossDomain();
if (null == context.Request["action"])
{
var result = GetResult(false, "缺少参数action");
context.Response.Write(result);
context.Response.End();
}
string action = context.Request["action"];
switch (action)
{
//版本
case "version":
QueryVersion(context);
break;
//查询单位
case "queryunit":
QueryUnit(context);
break;
//查询部门
case "querydepart":
QueryDepart(context);
break;
//查询终端类型
case "softtype":
QuerySoftType(context);
break;
//查询业务场景
case "scene":
QueryScene(context);
break;
//查询业务场景专业分类
case "scenezy":
QuerySceneZy(context);
break;
default:
var result = GetResult(false, "方法名不存在:" + action);
context.Response.Write(result);
break;
}
}
/// <summary>
/// 查询版本
/// </summary>
/// <param name="context"></param>
public void QueryVersion(HttpContext context)
{
var version = new
{
version = 1.0,
downloadurl = "www.baidu.com"
};
var result = GetResult(true, version);
context.Response.Write(result);
context.Response.End();
}
/// <summary>
/// 查询版本
/// </summary>
/// <param name="context"></param>
public void UpdateDsc(HttpContext context)
{
string id = context.Request["id"];
string soft_dsc = context.Request["soft_dsc"];
string yw_dsc = context.Request["yw_dsc"];
string func_dsc = context.Request["func_dsc"];
var model = bll_app.GetModel(id);
if (null == model)
{
var result = GetResult(false, null, "对象不存在");
context.Response.Write(result);
context.Response.End();
}
else
{
model.soft_dsc = soft_dsc;
model.yw_dsc = yw_dsc;
model.func_dsc = func_dsc;
if (bll_app.Update(model))
{
var result = GetResult(true, null);
context.Response.Write(result);
context.Response.End();
}
else
{
var result = GetResult(false, null, "保存失败!");
context.Response.Write(result);
context.Response.End();
}
}
}
/// <summary>
/// 查询单位
/// </summary>
/// <param name="context"></param>
public void QueryUnit(HttpContext context)
{
/*
string city_id = context.Request["city_id"];
if (string.IsNullOrEmpty(city_id))
{
context.Response.Write(GetResult(false, "参数city_id不能为空"));
context.Response.End();
}
DataService.BLL.admin_unit bll = new DataService.BLL.admin_unit();
var majors = bll.GetModelList(string.Format(" city_id = '{0}' ", city_id));
var result = GetResult(true, majors);
context.Response.Write(result);
context.Response.End();
DataService.BLL.pro_type_manage bll = new DataService.BLL.pro_type_manage();
var majors = bll.GetModelList(string.Format(" parent_id = 'sign_dep' "));
List<string> list_result = new List<string>();
if (majors.Count > 0)
{
majors.ForEach(s => { list_result.Add(s.type_name); });
}
var result = GetResult(true, list_result.ToArray());
context.Response.Write(result);
context.Response.End();
*/
}
/// <summary>
/// 查询部门
/// </summary>
/// <param name="context"></param>
public void QueryDepart(HttpContext context)
{
}
/// <summary>
/// 查询终端类型
/// </summary>
/// <param name="context"></param>
public void QuerySoftType(HttpContext context)
{
var majors = bll_sof_type.GetModelList("");
var result = GetResult(true, majors);
context.Response.Write(result);
context.Response.End();
}
/// <summary>
/// 查询业务场景
/// </summary>
/// <param name="context"></param>
public void QueryScene(HttpContext context)
{
string major_id = context.Request["major_id"];
var query = " 1=1";
if (!string.IsNullOrEmpty(major_id))
{
query = query + " and major_id='" + major_id + "' ";
}
var list = bll_scene.GetModelList(query);
var result = GetResult(true, list);
context.Response.Write(result);
context.Response.End();
}
/// <summary>
/// 查询业务场景专业分类
/// </summary>
/// <param name="context"></param>
public void QuerySceneZy(HttpContext context)
{
string major_id = context.Request["major_id"];
var query = " 1=1";
if (!string.IsNullOrEmpty(major_id))
{
query = query + " and major_id='" + major_id + "' ";
}
var list = bll_scene_zy.GetModelList(query);
var result = GetResult(true, list);
context.Response.Write(result);
context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}
}