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应用程序开发之应用间的跳转(用着微信等第三方分享登陆)

    简介 配置和实现 判断应用启动方式 一.简介 最实际项目开发中,我们难免会遇到需要从一个应用跳转到另一个应用的情况.比如微信分享,实际就是一种应用间的跳转.但是有时候我们需要实现自己的两个应用间的跳转 ...

  2. Xcode 插件失效的临时解决方案

    每当Xcode升级之后,都会导致原有的Xcode插件不能使用,这是因为每个插件的Info.plist中记录了该插件兼容的Xcode版本的DVTPlugInCompatibilityUUID,而每个版本 ...

  3. WPF-拖动面板移动窗口&设置窗口状态

    在需要去掉窗口边框的情景下往往需要有拖动面板直接移动窗口和自定义按钮改变窗口状态和关闭的功能 拖动面板移动窗口 为面板控件添加MouseMove事件, 面板控件指的是用来当面板的控件,可以是grid. ...

  4. 【mysql】关于innodb中MVCC的一些理解

    一.MVCC简介 MVCC (Multiversion Concurrency Control),即多版本并发控制技术,它使得大部分支持行锁的事务引擎,不再单纯的使用行锁来进行数据库的并发控制,取而代 ...

  5. cocos2d-x之value

    bool HelloWorld::init() { if ( !Layer::init() ) { return false; } Size visibleSize = Director::getIn ...

  6. tomcat发布记录

    web项目发布详细步骤 服务器 tomcat服务器1.删除webapps文件夹里面的项目war包-->ifm.war(项目war名称)2.把项目的ifm.war放到webapps里面3.删除we ...

  7. redis master配置了密码进行主从同步

    1.如果master不设置密码,那么直接在slave服务器配置slaveof即可 配置如下 #slaveof ip 端口 slaveof 配置好我们看下redis的日志 看是否同步成功 :S Jan ...

  8. AngularJS跨域请求

    本文主要针对网上各种跨域请求的总结,并加入自己的验证判断,实现工作中遇到的跨域问题.所涉及到的领域很小,仅仅局限于:AngularJS CORS post 并同时需要实现json数据传送给服务器. 首 ...

  9. TableViewer使用

    1.自定义编辑器激活方式   /**     * Create a customized editor whose activation process is customized     *    ...

  10. USACO section1.2 Transformation

    /* ID: vincent63 LANG: C TASK: transform */ #include <stdio.h> #include<stdlib.h> #inclu ...