374 lines
12 KiB
C#
374 lines
12 KiB
C#
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();
|
||
|
||
DataService.BLL.pro_first_cooper bll_first_cooper = new DataService.BLL.pro_first_cooper();
|
||
DataService.BLL.pro_com_about bll_com_about= new DataService.BLL.pro_com_about();
|
||
|
||
DataService.BLL.pro_com_certif bll_com_certif = new DataService.BLL.pro_com_certif();
|
||
|
||
DataService.BLL.pro_com_history bll_com_history = new DataService.BLL.pro_com_history();
|
||
|
||
/// <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;
|
||
|
||
//查询公司历程年份
|
||
case "comhistoryyears":
|
||
QueryComHistoryYears(context);
|
||
break;
|
||
|
||
//查询某一年公司历程详情
|
||
case "comhistorydetails":
|
||
QueryComHistoryDetails(context);
|
||
break;
|
||
|
||
//公司认证
|
||
case "comrenzheng":
|
||
QueryComRenZheng(context);
|
||
break;
|
||
|
||
//公司资质
|
||
case "comzizhi":
|
||
QueryComZizhi(context);
|
||
break;
|
||
|
||
//关于我们
|
||
case "comabout":
|
||
QueryComAbout(context);
|
||
break;
|
||
//合作厂商
|
||
case "firstcooper":
|
||
QueryFirstCooper(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();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询公司资质
|
||
/// </summary>
|
||
/// <param name="context"></param>
|
||
public void QueryComZizhi(HttpContext context)
|
||
{
|
||
var list = bll_com_certif.GetModelList(" type='资质' ").OrderBy(s => s.id).ToList();
|
||
var result = GetResult(true, list);
|
||
context.Response.Write(result);
|
||
context.Response.End();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询公司认证
|
||
/// </summary>
|
||
/// <param name="context"></param>
|
||
public void QueryComRenZheng(HttpContext context)
|
||
{
|
||
var list = bll_com_certif.GetModelList("type='认证'").OrderBy(s => s.id).ToList();
|
||
var result = GetResult(true, list);
|
||
context.Response.Write(result);
|
||
context.Response.End();
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询合作厂商
|
||
/// </summary>
|
||
/// <param name="context"></param>
|
||
public void QueryFirstCooper(HttpContext context)
|
||
{
|
||
var list = bll_first_cooper.GetModelList("").OrderBy(s => s.pos).ToList();
|
||
var result = GetResult(true, list);
|
||
context.Response.Write(result);
|
||
context.Response.End();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询关于我们
|
||
/// </summary>
|
||
/// <param name="context"></param>
|
||
public void QueryComAbout(HttpContext context)
|
||
{
|
||
var model = bll_com_about.GetModelList("").FirstOrDefault();
|
||
if (null != model)
|
||
{
|
||
var result = GetResult(true, model, "");
|
||
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 QueryComHistoryYears(HttpContext context)
|
||
{
|
||
var list = bll_com_history.GetModelList("").Select(s => s.year_info).Distinct().OrderBy(s => s).ToList();
|
||
var result = GetResult(true, list);
|
||
context.Response.Write(result);
|
||
context.Response.End();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询公司历程详情
|
||
/// </summary>
|
||
/// <param name="context"></param>
|
||
public void QueryComHistoryDetails(HttpContext context)
|
||
{
|
||
string year_info = context.Request["year_info"];
|
||
if (string.IsNullOrEmpty(year_info))
|
||
{
|
||
context.Response.Write(GetResult(false, "参数year_info 年份不能为空"));
|
||
context.Response.End();
|
||
}
|
||
var list = bll_com_history.GetModelList(" year_info='"+ year_info + "' ").ToList();
|
||
var result = GetResult(true, list);
|
||
context.Response.Write(result);
|
||
context.Response.End();
|
||
}
|
||
|
||
public bool IsReusable
|
||
{
|
||
get
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
} |