zoukankan      html  css  js  c++  java
  • Wojilu学习笔记 (01)

    “我记录”开发框架(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直接传入

    public void Show(int id)
            {
               
    
            }

    数据分页组件

    public void Show(int id)
          {
              set("siteleft", qjw.Web.siteleft());
    
              using (MAction action = new MAction(TableNames.zt_article))
              {
                  int page = ctx.route.page;
                  int rowcount = 0;
                  int pagesize = 10;
                  MDataTable table = action.Select(page, pagesize, "IsDel=0 and classid="+ id +" order by posttime desc", out rowcount);
                  //MDataTable table = action.Select("IsDel=0 order by posttime desc");
    
                  IBlock block = getBlock("Article");
                  foreach (MDataRow row in table.Rows)
                  {
                      block.Set("article.id", row["id"]);
                      block.Set("article.title", row["title"]);
                      block.Next();
                  }
    
                  //生成分页条
                  int recordCount = rowcount;
                  int pageSize = pagesize;
                  int currentPage = ctx.route.page;
                  wojilu.PageHelper op = new wojilu.PageHelper(recordCount, pageSize, currentPage);
                  set("page", op.PageBar);
    
              }
    
          }

    CyqData数据

    单条记录操作

    using (MAction action = new MAction(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 = new MAction(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 row in table.Rows)
                    {
                        cblock.Set("ztclass.id", row["id"]);
                        cblock.Set("ztclass.classname", row["classname"]);
                        cblock.Set("ztclass.url", row["url"]);
                        cblock.Next();
                    }
                }

    using

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

  • 相关阅读:
    复杂对象类型的WebService高级部分
    linux 免输入密码脚本
    查看端口是否被占用
    shell将脚本输出结果记录到日志文件
    多线程注意点
    apache Tomcat配置SSL(https)步骤
    常用的web安全处理
    SQL 中的 UNION 和UNION ALL 的区别
    数据库和数据仓库区别
    Oracle数据库创建表是有两个约束带有默认索引
  • 原文地址:https://www.cnblogs.com/quejuwen/p/3705201.html
Copyright © 2011-2022 走看看