#region
|
|
using System;
|
using System.Data;
|
using System.Data.Common;
|
using CSFrameworkV5.Core;
|
using CSFrameworkV5.Core.CodeGenerator;
|
using CSFrameworkV5.Models;
|
|
#endregion
|
|
/*===================================================================
|
* 程序说明: BusinessTables的数据访问层源码
|
* 作者资料: 孙中吕
|
* 创建日期: 2017-12-29 04:26:27
|
* 最后修改: 2017-12-29 04:26:27
|
*
|
* 注: 本文件由代码生成器(Code Generator)自动生成。
|
* (此源码文件请放置在 YourProject.DataAccess 模块)
|
* 版权所有 Copyright 2006~2017, C/S框架网(www.cscode.net)
|
*===================================================================*/
|
|
namespace CSFrameworkV5.DataAccess
|
{
|
/// <summary>
|
/// DAL数据层:dalBusinessTables
|
/// </summary>
|
[DefaultORM_UpdateMode(typeof(sys_BusinessTables), true)]
|
public class dalBusinessTables : dalBaseDataDict
|
{
|
/// <summary>
|
/// 构造器
|
/// </summary>
|
/// <param name="loginer">当前登录用户</param>
|
public dalBusinessTables(Loginer loginer) : base(loginer)
|
{
|
_KeyName = sys_BusinessTables.__KeyName; //主键字段
|
_TableName = sys_BusinessTables.__TableName; //表名
|
_ModelType = typeof(sys_BusinessTables); //指定ORM模型
|
_UpdateSummaryKeyMode =
|
UpdateKeyMode.OnlyGuid; //自动生成GUID号
|
_Database = DatabaseProvider.SystemDatabase;
|
}
|
|
/// <summary>
|
/// 根据表名获取该表的SQL命令生成器
|
/// </summary>
|
/// <param name="tableName">表名</param>
|
/// <returns></returns>
|
protected override IGenerateSqlCommand CreateSqlGenerator(
|
DataTable table)
|
{
|
Type ORM = null;
|
if (table.TableName == sys_BusinessTables.__TableName)
|
ORM = typeof(sys_BusinessTables); //指定表与ORM模型的对应关系
|
|
if (ORM == null) throw new Exception(table.TableName + "表没有ORM模型!");
|
|
return new GenerateSqlCmdByTableFields(ORM, table,
|
GeneratorFactory);
|
}
|
|
/// <summary>
|
//获取流水号码
|
/// </summary>
|
protected override string GetNumber(DbTransaction tran)
|
{
|
var SN =
|
DocNoTool.GetDataSN(_Database, tran, "ST", true,
|
6); //注意修改流水号字头!
|
return SN;
|
}
|
|
public DataTable Query()
|
{
|
var sql = "SELECT * FROM sys_BusinessTables WHERE ORDER BY RowID ";
|
var cmd = _Database.CreateCommand(sql);
|
return _Database.GetTable(cmd.Command,
|
sys_BusinessTables.__TableName);
|
}
|
} //public class
|
} //namespace
|