2007年的最后的几笔
很长时间没有来园子里逛了!
园子里.NET的技术文章依然是那么热闹,看来微软的技术确实给我们的生活增添了不少乐趣。由于过去的一年里一直为公司整合Java的Web开发框架,所以一直没有动手写下感想。前两个月把那个框架移植到.NET上了。本来希望用NBear4的,不过好像Teddy一直忙,所以暂时用了Castle的ActiveRecord作为后台,前台则选用了有点感觉的EXT2.0,感觉dojo简直象玩具,所以没有选择。新的集成框架我叫它llano(大草原),希望能让更多的朋友享受自由奔跑的感觉,开年后我慢慢给大家介绍使用llano如何快速写出相当简洁的代码,下面用一个简单的会员管理界面让大家先感受一下:
界面:
后台服务测试代码:
前台Exj js:
希望年底每个辛苦的程序员都有好收成!
2008年见!
--再次感谢dudu为我找回了密码:-)
园子里.NET的技术文章依然是那么热闹,看来微软的技术确实给我们的生活增添了不少乐趣。由于过去的一年里一直为公司整合Java的Web开发框架,所以一直没有动手写下感想。前两个月把那个框架移植到.NET上了。本来希望用NBear4的,不过好像Teddy一直忙,所以暂时用了Castle的ActiveRecord作为后台,前台则选用了有点感觉的EXT2.0,感觉dojo简直象玩具,所以没有选择。新的集成框架我叫它llano(大草原),希望能让更多的朋友享受自由奔跑的感觉,开年后我慢慢给大家介绍使用llano如何快速写出相当简洁的代码,下面用一个简单的会员管理界面让大家先感受一下:
界面:
后台服务测试代码:
[Test]
public void TC02_Query()
{
IMemberMgr service = (IMemberMgr)container["serviceMember"];
NameValueCollection ns = new NameValueCollection();
ns.Clear();
ns.Add("s_method", "list");
ns.Add("query", "GradYear=2007");
Console.WriteLine(service.Execute(ns));
ns.Clear();
ns.Add("s_method", "list");
ns.Add("query", "679");
Console.WriteLine(service.Execute(ns));
ns.Clear();
ns.Add("s_method", "list");
ns.Add("start", "0");
ns.Add("limit", "3");
Console.WriteLine(service.Execute(ns));
}
[Test]
public void TC03_Execute()
{
IMemberMgr service = (IMemberMgr)container["serviceMember"];
NameValueCollection ns = new NameValueCollection();
string data = "{\"Name\":\"demo\",\"Mobile\":\"13922666720\",\"Email\":\"lsj@21cn.com\",\"GradYear\":2007,\"Score\":0}";
ns.Clear();
ns.Add("s_method", "save");
ns.Add("id", "");
ns.Add("data", data);
Console.WriteLine(service.Execute(ns));
ns.Clear();
ns.Add("s_method", "delete");
ns.Add("id", service.GetEntityDao().Load("Name='demo'", null)[0].id);
Console.WriteLine(service.Execute(ns));
}
public void TC02_Query()
{
IMemberMgr service = (IMemberMgr)container["serviceMember"];
NameValueCollection ns = new NameValueCollection();
ns.Clear();
ns.Add("s_method", "list");
ns.Add("query", "GradYear=2007");
Console.WriteLine(service.Execute(ns));
ns.Clear();
ns.Add("s_method", "list");
ns.Add("query", "679");
Console.WriteLine(service.Execute(ns));
ns.Clear();
ns.Add("s_method", "list");
ns.Add("start", "0");
ns.Add("limit", "3");
Console.WriteLine(service.Execute(ns));
}
[Test]
public void TC03_Execute()
{
IMemberMgr service = (IMemberMgr)container["serviceMember"];
NameValueCollection ns = new NameValueCollection();
string data = "{\"Name\":\"demo\",\"Mobile\":\"13922666720\",\"Email\":\"lsj@21cn.com\",\"GradYear\":2007,\"Score\":0}";
ns.Clear();
ns.Add("s_method", "save");
ns.Add("id", "");
ns.Add("data", data);
Console.WriteLine(service.Execute(ns));
ns.Clear();
ns.Add("s_method", "delete");
ns.Add("id", service.GetEntityDao().Load("Name='demo'", null)[0].id);
Console.WriteLine(service.Execute(ns));
}
前台Exj js:
Ext.onReady(
function(){
Ext.BLANK_IMAGE_URL="http://www.cnblogs.com/resources/default/s.gif";
Ext.QuickTips.init();
var member_meta_def =[ 'id',
{fieldLabel:'姓名',name: 'Name',type: 'string',allowBlank: false,minLength:3,maxLength:8,anchor:'90%',width:50},
{fieldLabel:'邮件',name: 'Email',type: 'string',anchor:'90%',width:80},
{fieldLabel:'手机',name: 'Mobile',type: 'string',anchor:'90%',width:80},
{fieldLabel:'毕业年份',name: 'GradYear',type: 'int',anchor:'90%',width:20},
{fieldLabel:'登记日期',name: 'sCreatedDate', type: 'date',dateFormat: 'Y-m-d H:i:s', anchor:'60%',width:30}
];
var member_meta_rec= Ext.data.Record.create(member_meta_def);
var new_member=new member_meta_rec({
Name: '?',Email: '?',Mobile: '13600000000',GradYear:2008,
sCreatedDate: new Date()});
CRUD({entityName:'member',showEditBox:true,
list_id:'list1',edit_id:'edit1',list_title:'list',edit_title:'edit',list_width:800,list_height:400,editt_width:300,
confirmShowColumName:'Name',
meta:member_meta_def,facade:'facade.aspx',sortFld:'Name',sortDir:'ASC',
new_record:new_member});
}
);
function(){
Ext.BLANK_IMAGE_URL="http://www.cnblogs.com/resources/default/s.gif";
Ext.QuickTips.init();
var member_meta_def =[ 'id',
{fieldLabel:'姓名',name: 'Name',type: 'string',allowBlank: false,minLength:3,maxLength:8,anchor:'90%',width:50},
{fieldLabel:'邮件',name: 'Email',type: 'string',anchor:'90%',width:80},
{fieldLabel:'手机',name: 'Mobile',type: 'string',anchor:'90%',width:80},
{fieldLabel:'毕业年份',name: 'GradYear',type: 'int',anchor:'90%',width:20},
{fieldLabel:'登记日期',name: 'sCreatedDate', type: 'date',dateFormat: 'Y-m-d H:i:s', anchor:'60%',width:30}
];
var member_meta_rec= Ext.data.Record.create(member_meta_def);
var new_member=new member_meta_rec({
Name: '?',Email: '?',Mobile: '13600000000',GradYear:2008,
sCreatedDate: new Date()});
CRUD({entityName:'member',showEditBox:true,
list_id:'list1',edit_id:'edit1',list_title:'list',edit_title:'edit',list_width:800,list_height:400,editt_width:300,
confirmShowColumName:'Name',
meta:member_meta_def,facade:'facade.aspx',sortFld:'Name',sortDir:'ASC',
new_record:new_member});
}
);
希望年底每个辛苦的程序员都有好收成!
2008年见!
--再次感谢dudu为我找回了密码:-)