bisController
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的更多相关文章
- Angular权威指南学习笔记(转)
http://www.cnblogs.com/lzhp/p/4000741.html 第一章. 初识Angular——Angular是MVW的Js框架. 第二章. 数据绑定 ...
随机推荐
- eval 为什么加括号
<!DOCTYPE html> <html> <head> <title>eval学习</title> <script type=&q ...
- andorid开发eclipse常见问题
1.报错: BUILD FAILED D:\workspace\ganji\build.xml:144: The following error occurred while executing th ...
- 高质量c/c++里的strcpy()
已知strcpy函数的原型是: char * strcpy(char * strDest,const char * strSrc); 1.不调用库函数,实现strcpy函数. ...
- dubbo学习之服务消费者
1.简介 上节讲了如何发布一个dubbo服务,这节主要讲如何进行消费,创建一个消费者. 2.详细步骤 2.1 项目目录结构 2.2 创建maven项目 这里演示时其实通过一个main方法就可以了,没必 ...
- 魔改——MDI多视图模板Tab/标签页 初始化/操作控件
==================================声明================================== 本文原创,转载在正文中显要的注明作者和出处,并保证文章的完 ...
- 对象复制问题 && lvalue-rvalue && 引用
按值传递实参到函数和函数返回临时变量的副本,函数的效率对执行性能来说至关重要 如果避免这样的复制操作,则执行时间可能会大大缩短. class CMessage { private: char * m_ ...
- C# 遍历枚举类
framework 4.0 环境下 方法 定义枚举类 判断枚举类中是否存在,若存在则输出 例子: Defined.QrCode.QrCodeType type;//枚举类 if (!Enum.TryP ...
- IOS版本被拒的经历
IOS版本被拒的经历: 1,登陆方式依赖外部平台 因为我们的APP是只用微博登陆,想做成类似meerkat类型的,也能各种消息都同步微博. 结果当然行不通,这个确实是不听好人言,网上多个人都说过这个问 ...
- Mathout 安装部署
安装Mahout,并运行测试样例,抓图测试实验过程 证明已部署成功 Mahout 下载地址:http://apache.dataguru.cn/mahout/0.9/mahout-distributi ...
- [转]SQLServer SQL执行效率和性能测试方法总结
本文转自:http://www.zhixing123.cn/net/27495.html 对于做管理系统和分析系统的程序员,复杂SQL语句是不可避免的,面对海量数据,有时候经过优化的某一条语句,可以提 ...