public class BisController : Controller
{
//
// GET: /Bis/ protected string GetJson(object obj)
{
IsoDateTimeConverter dtConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
//http://www.cnblogs.com/litian/p/3870975.html
return JsonConvert.SerializeObject(obj, dtConverter);
} protected new JsonResult Json(object data)
{
return new HYJosnResult { Data = data };
} }
//http://www.cnblogs.com/chongsha/archive/2013/04/14/3019990.html
public class HYJosnResult : JsonResult
{
public override void ExecuteResult(ControllerContext context)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
if ((this.JsonRequestBehavior == JsonRequestBehavior.DenyGet) && string.Equals(context.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException("");
}
HttpResponseBase response = context.HttpContext.Response;
if (!string.IsNullOrEmpty(this.ContentType))
{
response.ContentType = this.ContentType;
}
else
{
response.ContentType = "application/json";
}
if (this.ContentEncoding != null)
{
response.ContentEncoding = this.ContentEncoding;
}
if (this.Data != null)
{ IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
response.Write(JsonConvert.SerializeObject(this.Data, Newtonsoft.Json.Formatting.Indented, timeFormat)); }
}
}

bisController的更多相关文章

  1. Angular权威指南学习笔记(转)

    http://www.cnblogs.com/lzhp/p/4000741.html 第一章.        初识Angular——Angular是MVW的Js框架. 第二章.        数据绑定 ...

随机推荐

  1. IOS常用的系统文件目录介绍

    iOS常用目录整理说明是本文要介绍的内容,虽然不同API全面,也算是在编程中常用到的存放目录,所以是必备文档,不多说,来看详细内容讲解. 1.[/Applications] 常用软件的安装目录 内建软 ...

  2. 使用OLE DB读写Excel

    说明: 使用这种技术的好处是无需引用对象,坏处是无法处理类似合并单元格这样的复杂情况 一些更新: 为了使用Office 2010,需要安装Microsoft Access 2010 数据库引擎可再发行 ...

  3. LightSpeed 相关问题处理

    1. 关于KeyTable 配置文件中有一个节点 lightSpeedContexts  该节点下存放的是一些使用LightSpeed的配置,如 <add name="myDB&quo ...

  4. MFC 网络编程 -- 总结

    原文链接:http://www.cnblogs.com/lidabo/archive/2012/07/19/2598734.html 1.基于 TCP 的 socket 编程 /* 服务器端程序流程: ...

  5. oracle数据库ORA-01654 错误的解决方法

    引言: 数据库突然报: ORA-01654: unable to extend index BO.INDEX_indexname by 311072 in tablespace 错误,上网查原因,发现 ...

  6. 烂泥:KVM虚拟机克隆

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 上一篇文章介绍了有关KVM虚拟机快照的创建与恢复,这篇文章我们来介绍有关KVM虚拟机克隆. KVM虚拟机的克隆,我们可以分以下几步: 1. 使用virt ...

  7. Class to connect postgres with python in psycopg2

    For we need to connect the postgres db in project very frequently, so write the follows class: impor ...

  8. shell exit 0 exit 1

    其实都一样,都是退出,只不过返回这个0和1是返回给操作系统的错误或者正确代码. exit 1 指的是脚本运行的返回值,用来指示成功或失败,以及失败的原因. exit 0 表示成功,exit 1表示失败 ...

  9. BI测试工具之跨数据库数据对比,支持oracle,sqlserver

    应用场景: 本周在进行SIT,我帮助仅有的一个测试妹妹对部分表进行数据质量验证,第一步需要做的就是比对source与stage表的table definition 与 数据内容的一致性. 本项目使用的 ...

  10. 【Android 我的博客APP】1.抓取博客首页文章列表内容——网页数据抓取

    打算做个自己在博客园的博客APP,首先要能访问首页获取数据获取首页的文章列表,第一步抓取博客首页文章列表内容的功能已实现,在小米2S上的效果图如下: 思路是:通过编写的工具类访问网页,获取页面源代码, ...