AutoLayouterLib第一版基本完成

来源:互联网 发布:php imagepng 乱码 编辑:程序博客网 时间:2024/06/03 16:46

经过几个月的业余时间,终于把autolayouterlib的基本功能实现了,基本实现了单表及简单视图的操作,权且归为0.01版吧,这跟其它的框架不同的一点是,只要根据一个xml配置文件 就可以实现crud.非常的省时省力。在winform上跑的非常给力,web的项目正在实现中,等到合适的时机,我会把代码发布出来,大家共勉励。在此简单的描述下此框架的思路:

1,配置好xml文件,示例如下:

<?xml version="1.0" encoding="utf-8" ?>
<form name="TestForm" caption="测试窗口" tbOrViewName="tableDemo" primaryKey="id" primaryKeyType="int_type" identify="manual"  connStr="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=e:\\layoutDemo.accdb">
<panel name="pnel1" width="600" height="500">
<field name="txtCaption" caption="caption标题" ctrlType="extextbox" fieldName="caption" 
           fieldType="string_type" left="30" top="20" sourceSql=""></field>
    <field name="txtContent" caption="测试字段1" ctrlType="extextbox" fieldName="content" 
           fieldType="string_type" left="290" top="90" sourceSql=""></field>
    
<field name="txtClassify" caption="类别" ctrlType="excombobox" fieldName="classify" 
           fieldType="int_type" left="30" top="80" sourceSql="select classname,[id] from classifytable"></field>
    <field name="dtArriveTime" caption="日期" ctrlType="exdatetimepicker" fieldName="arrivetime"
       fieldType="datetime_type" left="290" top="40" sourceSql=""></field>
    
    <field name="txtIntDemo" caption="intDemo标题" ctrlType="exnumericupdown" fieldName="intDemo"
         fieldType="int_type" left="30" top="200" sourceSql=""></field>
    <field name="memoDemo" caption="memodemo" ctrlType="exmemo" fieldName="memodemo"
        fieldType="string_type" left="30" top="250" width="300" height="50" sourceSql=""></field>
  </panel>
  <!--以下为字段常用类型
  string_type,
  int_type,
  long_type,
  bool_type,
  numeric_type,
  datetime_type,
  text_type,
  object_type,
  ref_type,
  enum_type-->
 
  <!--Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\Transaction_Record.accdb
  Provider=SQLOLEDB.1;Password=123456;Persist Security Info=true;User ID=sa;Initial Catalog=ErpCore;Data Source=DC-PC\SQLINSTANCE;
  -->
</form>

2,用AutoLayoutBaseForm  
AutoLayoutBaseForm a = new AutoLayoutBaseForm("xml//FormXml.xml",DbStatus.dsUpdate, 2);a.Show();
DbStatus有crud,四种操作,AutoLayoutBaseForm是一个基本的容器窗口,你也可以继承此类,创建适合自己的容器窗口。
3,关键是 AutoLayoutInterpreter类,这个是一个xml文件的解释器,根据xml文件动态生成控件,且关联相关的数据库,目前支持sqlserver,access,sqlite,mysql,但还不支持oracle。

原创粉丝点击