using

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

“我记录”开发框架(wojilu framework) 是 .net 平台下的综合开发框架,主要用于 web 方面的快速开发。

官方网址:http://www.wojilu.com

源码托管网址: https://github.com/wojilu/wojilu

授权协议:Apache License,可免费用于商业环境

路由配置

~/{controller}/{id};requirements:{id=int}

默认Controller的Show(int id)方法,此处id直接传入

publicvoidShow(intid)

{}

数据分页组件

publicvoidShow(intid)

{set("siteleft", qjw.Web.siteleft());using(MAction action =newMAction(TableNames.zt_article))

{intpage =ctx.route.page;introwcount =0;intpagesize =10;

MDataTable table= action.Select(page, pagesize,"IsDel=0 and classid="+ id +"order by posttime desc",outrowcount);//MDataTable table = action.Select("IsDel=0 order by posttime desc");IBlock block= getBlock("Article");foreach(MDataRow rowintable.Rows)

{

block.Set("article.id", row["id"]);

block.Set("article.title", row["title"]);

block.Next();

}//生成分页条intrecordCount =rowcount;intpageSize =pagesize;intcurrentPage =ctx.route.page;

wojilu.PageHelper op=newwojilu.PageHelper(recordCount, pageSize, currentPage);set("page", op.PageBar);

}

}

CyqData数据

单条记录操作

using(MAction action =newMAction(TableNames.zt_class))

{if(action.Fill(id))

{set("ztclass.id", action.Get<string>(zt_class.ID));set("ztclass.classname", action.Get<string>(zt_class.ClassName));set("ztclass.content", action.Get<string>(zt_class.Content));

}

}

多条记录操作

using(MAction action =newMAction(TableNames.zt_class))

{

MDataTable table= action.Select("IsDel=0 and FatherId=0 and IsNav=1 and SystemId=1 and id>1 order by orderflag asc");

IBlock cblock= getBlock("Nav");foreach(MDataRow rowintable.Rows)

{

cblock.Set("ztclass.id", row["id"]);

cblock.Set("ztclass.classname", row["classname"]);

cblock.Set("ztclass.url", row["url"]);

cblock.Next();

}

}

using变量使用后就会释放,变量名可以重复

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航