目前拥有的框架是基于DataSet的,支持多表关联,已经可以彻底的摆脱Insert/Update/Delete语句了,后来又增加了UpdateObject 和 DeleteObject 来减少基于DataSet而能导致的Sql语句执行的次数烦多的缘故。现在为了减少程序员编码的痛苦,同时,又能得到编译时类型控制,往Data层增加Entity,一般是贫血Object,纯粹拥有属性,没有方法的。
原来是一个DataSet 囊括了构建DataTable的功能。现在增加BaseEntity ,BaseDataTable类。BaseEntity 有一个属性RowIndex ,用来保存对应的行号,如果是新增RowIndex=-1 否则对应行号。BaseDataTable 有3个虚方法:1。获取实体类 public virtual BaseEntity GetEntity(int rowIndex) 2。创建一个实体类 public virtual BaseEntity CreateEntity() 3。 把实体值转入DataRow中 public virtual bool SetEntity(BaseEntity entity)
这样,我们就可以使用代码生成器来构建我们需要的对象。
比如
OrdersDataSet 需要拥有 OrdersTable ItemsTable DeliveriesTable OrdersEntity ItemsEntity DeliveriesEntity
OrdersDataSet 只需要拥有3个Public 的 OrdersTable ItemsTable DeliveriesTable
OrdersTable 需要Override那三个方法,然后 使用OrdersEntity
ItemsTable以此类推.....
1.获取实体以及修改保存
OrdersEntity entity=ordersDataSet.OrdersTable.GetEntity(0) as OrdersEntity ;
Console.WirteLine("Order ID is"+entity.OrderID);
entity.Quantity=20;
ordersDataSet.OrdersTable.SetEntity(entity);
2.新增一个实体,并设置值以及保存入表格
OrdersEntity newEntity=ordersDataSet.OrdersTable.CreateEntity() as OrdersEntity;
newEntity.OrderID="xxxxx";
ordersDataSet.OrdersTable.SetEntity(newEntity);
当然了,如上的代码,如果移植到.Net2.0就可以充分的利用泛型,但是还有几个网站在1.1下, 不敢一下子更换。.........
通过这种封装,我们可以减少原本基于DataRow的赋值和获取值的麻烦,而且类型也是编译时安全的。
当然了,我知道这不可能时ORM :)因为我是使用硬编码,只是通过代码生成器可以减少编写这么多麻烦的重复的代码。事实也证明了这种方式的开发的快速性,不过,不够OO,因为是基于Table的。相对来说,对于大企业的大系统不适合,中小企业还可以吧,个人觉得:)
呵呵,虽然自己的框架不是优秀的,但是,用的习惯了,觉得还是很快的,虽然没有拥有那么多令人骄傲的特色,没有那么OO,但是也足够我自己用了~_~ ! 自己是多么的不求上进,但是依然要写很多Select语句来获取复杂的查询数据。
sample code 如下:
using
System;
using FishSky.Data.Base;
namespace FishSky.Data.Chateau
{
/**////<summary>
/// SendOutEntity实体类
///</summary>
public class SendOutEntity : BaseEntity
{
构造函数#region 构造函数
/**////<summary>
// 构造函数
/**////</summary>
public SendOutEntity()
{
}
#endregion
出库单#region 出库单
private String mSendOutNo;
/**////<summary>
// 出库单
/**////</summary>
public String SendOutNo
{
get { return mSendOutNo; }
set { mSendOutNo = value; }
}
#endregion
发票号#region 发票号
private String mInvoiceNo;
/**////<summary>
// 发票号
/**////</summary>
public String InvoiceNo
{
get { return mInvoiceNo; }
set { mInvoiceNo = value; }
}
#endregion
总计#region 总计
private Decimal mAmount;
/**////<summary>
// 总计
/**////</summary>
public Decimal Amount
{
get { return mAmount; }
set { mAmount = value; }
}
#endregion
操作员#region 操作员
private String mUserName;
/**////<summary>
// 操作员
/**////</summary>
public String UserName
{
get { return mUserName; }
set { mUserName = value; }
}
#endregion
操作员中文名#region 操作员中文名
private String mChineseName;
/**////<summary>
// 操作员中文名
/**////</summary>
public String ChineseName
{
get { return mChineseName; }
set { mChineseName = value; }
}
#endregion
客户代码#region 客户代码
private String mCustomerCode;
/**////<summary>
// 客户代码
/**////</summary>
public String CustomerCode
{
get { return mCustomerCode; }
set { mCustomerCode = value; }
}
#endregion
客户中文名#region 客户中文名
private String mCustomerName;
/**////<summary>
// 客户中文名
/**////</summary>
public String CustomerName
{
get { return mCustomerName; }
set { mCustomerName = value; }
}
#endregion
备注#region 备注
private String mRemark;
/**////<summary>
// 备注
/**////</summary>
public String Remark
{
get { return mRemark; }
set { mRemark = value; }
}
#endregion
货款付讫#region 货款付讫
private String mIsPaid;
/**////<summary>
// 货款付讫
/**////</summary>
public String IsPaid
{
get { return mIsPaid; }
set { mIsPaid = value; }
}
#endregion
出售日期#region 出售日期
private DateTime mSendOutDate;
/**////<summary>
// 出售日期
/**////</summary>
public DateTime SendOutDate
{
get { return mSendOutDate; }
set { mSendOutDate = value; }
}
#endregion
}
}
using FishSky.Data.Base;
namespace FishSky.Data.Chateau
{
/**////<summary>
/// SendOutEntity实体类
///</summary>
public class SendOutEntity : BaseEntity
{
构造函数#region 构造函数
/**////<summary>
// 构造函数
/**////</summary>
public SendOutEntity()
{
}
#endregion
出库单#region 出库单
private String mSendOutNo;
/**////<summary>
// 出库单
/**////</summary>
public String SendOutNo
{
get { return mSendOutNo; }
set { mSendOutNo = value; }
}
#endregion
发票号#region 发票号
private String mInvoiceNo;
/**////<summary>
// 发票号
/**////</summary>
public String InvoiceNo
{
get { return mInvoiceNo; }
set { mInvoiceNo = value; }
}
#endregion
总计#region 总计
private Decimal mAmount;
/**////<summary>
// 总计
/**////</summary>
public Decimal Amount
{
get { return mAmount; }
set { mAmount = value; }
}
#endregion
操作员#region 操作员
private String mUserName;
/**////<summary>
// 操作员
/**////</summary>
public String UserName
{
get { return mUserName; }
set { mUserName = value; }
}
#endregion
操作员中文名#region 操作员中文名
private String mChineseName;
/**////<summary>
// 操作员中文名
/**////</summary>
public String ChineseName
{
get { return mChineseName; }
set { mChineseName = value; }
}
#endregion
客户代码#region 客户代码
private String mCustomerCode;
/**////<summary>
// 客户代码
/**////</summary>
public String CustomerCode
{
get { return mCustomerCode; }
set { mCustomerCode = value; }
}
#endregion
客户中文名#region 客户中文名
private String mCustomerName;
/**////<summary>
// 客户中文名
/**////</summary>
public String CustomerName
{
get { return mCustomerName; }
set { mCustomerName = value; }
}
#endregion
备注#region 备注
private String mRemark;
/**////<summary>
// 备注
/**////</summary>
public String Remark
{
get { return mRemark; }
set { mRemark = value; }
}
#endregion
货款付讫#region 货款付讫
private String mIsPaid;
/**////<summary>
// 货款付讫
/**////</summary>
public String IsPaid
{
get { return mIsPaid; }
set { mIsPaid = value; }
}
#endregion
出售日期#region 出售日期
private DateTime mSendOutDate;
/**////<summary>
// 出售日期
/**////</summary>
public DateTime SendOutDate
{
get { return mSendOutDate; }
set { mSendOutDate = value; }
}
#endregion
}
}
using
System;
using System.Data;
using FishSky.Data.Base;
namespace FishSky.Data.Chateau
{
public class SendOutDataTable : BaseDataTable
{
表格常量#region 表格常量
/**//// <summary>
/// 定义对象数据集表名:SendOut
/// </summary>
public const String TBL_SendOut = "SendOut";
/**//// <summary>
///出库单
/// </summary>
public const String SendOutNo_SendOut = "SendOutNo";
/**//// <summary>
///发票号
/// </summary>
public const String InvoiceNo_SendOut = "InvoiceNo";
/**//// <summary>
///总计
/// </summary>
public const String Amount_SendOut = "Amount";
/**//// <summary>
///操作员
/// </summary>
public const String UserName_SendOut = "UserName";
/**//// <summary>
///操作员中文名
/// </summary>
public const String ChineseName_SendOut = "ChineseName";
/**//// <summary>
///客户代码
/// </summary>
public const String CustomerCode_SendOut = "CustomerCode";
/**//// <summary>
///客户中文名
/// </summary>
public const String CustomerName_SendOut = "CustomerName";
/**//// <summary>
///备注
/// </summary>
public const String Remark_SendOut = "Remark";
/**//// <summary>
///货款付讫
/// </summary>
public const String IsPaid_SendOut = "IsPaid";
/**//// <summary>
///出售日期
/// </summary>
public const String SendOutDate_SendOut = "SendOutDate";
#endregion
构造函数#region 构造函数
/**////<summary>
/// 构造函数
///</summary>
public SendOutDataTable()
{
this.TableName = TBL_SendOut;
DataColumnCollection columns = this.Columns;
DataColumn column;
column = new DataColumn(SendOutNo_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, true);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(InvoiceNo_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(Amount_SendOut, typeof (Decimal));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.DefaultValue = 0;
columns.Add(column);
column = new DataColumn(UserName_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 20;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(ChineseName_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(CustomerCode_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 20;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(CustomerName_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(Remark_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 100;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(IsPaid_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 1;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(SendOutDate_SendOut, typeof (DateTime));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.DefaultValue = DateTime.Now;
columns.Add(column);
}
#endregion
创建实体#region 创建实体
/**////<summary>
/// 创建实体
///</summary>
///<returns>实体</returns>
public override BaseEntity CreateEntity()
{
return new SendOutEntity();
}
#endregion
获取指定行号的实体#region 获取指定行号的实体
/**////<summary>
/// 获取指定行号的实体
///</summary>
/// <param name="rowIndex">行号</param>
/// <returns>实体</returns>
public override BaseEntity GetEntity(int rowIndex)
{
if (rowIndex >= 0 && rowIndex <= this.Rows.Count)
{
SendOutEntity entity = new SendOutEntity();
entity.RowIndex = rowIndex;
DataRow dr = this.Rows[rowIndex];
entity.SendOutNo = dr[SendOutNo_SendOut].ToString();
entity.InvoiceNo = dr[InvoiceNo_SendOut].ToString();
entity.Amount = Convert.ToDecimal(dr[Amount_SendOut]);
entity.UserName = dr[UserName_SendOut].ToString();
entity.ChineseName = dr[ChineseName_SendOut].ToString();
entity.CustomerCode = dr[CustomerCode_SendOut].ToString();
entity.CustomerName = dr[CustomerName_SendOut].ToString();
entity.Remark = dr[Remark_SendOut].ToString();
entity.IsPaid = dr[IsPaid_SendOut].ToString();
entity.SendOutDate = Convert.ToDateTime(dr[SendOutDate_SendOut]);
return entity;
}
else
{
throw new ApplicationException("提示:您输入的行号有误!");
}
}
#endregion
设置实体值到DataTable#region 设置实体值到DataTable
/**////<summary>
/// 设置实体值到DataTable
///</summary>
///<param name="baseEntity">实体</param>
///<returns>是否设置成功</returns>
public override bool SetEntity(BaseEntity baseEntity)
{
int rowIndex = baseEntity.RowIndex;
SendOutEntity entity = baseEntity as SendOutEntity;
if (entity == null)
return false;
DataRow dr;
if (rowIndex == -1)
{
dr = this.NewRow();
dr[SendOutNo_SendOut] = entity.SendOutNo;
dr[InvoiceNo_SendOut] = entity.InvoiceNo;
dr[Amount_SendOut] = entity.Amount;
dr[UserName_SendOut] = entity.UserName;
dr[ChineseName_SendOut] = entity.ChineseName;
dr[CustomerCode_SendOut] = entity.CustomerCode;
dr[CustomerName_SendOut] = entity.CustomerName;
dr[Remark_SendOut] = entity.Remark;
dr[IsPaid_SendOut] = entity.IsPaid;
dr[SendOutDate_SendOut] = entity.SendOutDate;
this.Rows.Add(dr);
return true;
}
else
{
if (rowIndex >= 0 && rowIndex < this.Rows.Count)
{
try
{
dr = this.Rows[rowIndex];
//只要是Key的值都不可以更改
dr[InvoiceNo_SendOut] = entity.InvoiceNo;
dr[Amount_SendOut] = entity.Amount;
dr[UserName_SendOut] = entity.UserName;
dr[ChineseName_SendOut] = entity.ChineseName;
dr[CustomerCode_SendOut] = entity.CustomerCode;
dr[CustomerName_SendOut] = entity.CustomerName;
dr[Remark_SendOut] = entity.Remark;
dr[IsPaid_SendOut] = entity.IsPaid;
dr[SendOutDate_SendOut] = entity.SendOutDate;
return true;
}
catch
{
return false;
}
}
else
{
return false;
}
}
}
#endregion
}
}
using System.Data;
using FishSky.Data.Base;
namespace FishSky.Data.Chateau
{
public class SendOutDataTable : BaseDataTable
{
表格常量#region 表格常量
/**//// <summary>
/// 定义对象数据集表名:SendOut
/// </summary>
public const String TBL_SendOut = "SendOut";
/**//// <summary>
///出库单
/// </summary>
public const String SendOutNo_SendOut = "SendOutNo";
/**//// <summary>
///发票号
/// </summary>
public const String InvoiceNo_SendOut = "InvoiceNo";
/**//// <summary>
///总计
/// </summary>
public const String Amount_SendOut = "Amount";
/**//// <summary>
///操作员
/// </summary>
public const String UserName_SendOut = "UserName";
/**//// <summary>
///操作员中文名
/// </summary>
public const String ChineseName_SendOut = "ChineseName";
/**//// <summary>
///客户代码
/// </summary>
public const String CustomerCode_SendOut = "CustomerCode";
/**//// <summary>
///客户中文名
/// </summary>
public const String CustomerName_SendOut = "CustomerName";
/**//// <summary>
///备注
/// </summary>
public const String Remark_SendOut = "Remark";
/**//// <summary>
///货款付讫
/// </summary>
public const String IsPaid_SendOut = "IsPaid";
/**//// <summary>
///出售日期
/// </summary>
public const String SendOutDate_SendOut = "SendOutDate";
#endregion
构造函数#region 构造函数
/**////<summary>
/// 构造函数
///</summary>
public SendOutDataTable()
{
this.TableName = TBL_SendOut;
DataColumnCollection columns = this.Columns;
DataColumn column;
column = new DataColumn(SendOutNo_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, true);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(InvoiceNo_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(Amount_SendOut, typeof (Decimal));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.DefaultValue = 0;
columns.Add(column);
column = new DataColumn(UserName_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 20;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(ChineseName_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(CustomerCode_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 20;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(CustomerName_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 50;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(Remark_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 100;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(IsPaid_SendOut, typeof (String));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.MaxLength = 1;
column.DefaultValue = " ";
columns.Add(column);
column = new DataColumn(SendOutDate_SendOut, typeof (DateTime));
column.ExtendedProperties.Add(BaseConst.isPrimaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isSecondaryKeyColumn, false);
column.ExtendedProperties.Add(BaseConst.isValidColumn, true);
column.DefaultValue = DateTime.Now;
columns.Add(column);
}
#endregion
创建实体#region 创建实体
/**////<summary>
/// 创建实体
///</summary>
///<returns>实体</returns>
public override BaseEntity CreateEntity()
{
return new SendOutEntity();
}
#endregion
获取指定行号的实体#region 获取指定行号的实体
/**////<summary>
/// 获取指定行号的实体
///</summary>
/// <param name="rowIndex">行号</param>
/// <returns>实体</returns>
public override BaseEntity GetEntity(int rowIndex)
{
if (rowIndex >= 0 && rowIndex <= this.Rows.Count)
{
SendOutEntity entity = new SendOutEntity();
entity.RowIndex = rowIndex;
DataRow dr = this.Rows[rowIndex];
entity.SendOutNo = dr[SendOutNo_SendOut].ToString();
entity.InvoiceNo = dr[InvoiceNo_SendOut].ToString();
entity.Amount = Convert.ToDecimal(dr[Amount_SendOut]);
entity.UserName = dr[UserName_SendOut].ToString();
entity.ChineseName = dr[ChineseName_SendOut].ToString();
entity.CustomerCode = dr[CustomerCode_SendOut].ToString();
entity.CustomerName = dr[CustomerName_SendOut].ToString();
entity.Remark = dr[Remark_SendOut].ToString();
entity.IsPaid = dr[IsPaid_SendOut].ToString();
entity.SendOutDate = Convert.ToDateTime(dr[SendOutDate_SendOut]);
return entity;
}
else
{
throw new ApplicationException("提示:您输入的行号有误!");
}
}
#endregion
设置实体值到DataTable#region 设置实体值到DataTable
/**////<summary>
/// 设置实体值到DataTable
///</summary>
///<param name="baseEntity">实体</param>
///<returns>是否设置成功</returns>
public override bool SetEntity(BaseEntity baseEntity)
{
int rowIndex = baseEntity.RowIndex;
SendOutEntity entity = baseEntity as SendOutEntity;
if (entity == null)
return false;
DataRow dr;
if (rowIndex == -1)
{
dr = this.NewRow();
dr[SendOutNo_SendOut] = entity.SendOutNo;
dr[InvoiceNo_SendOut] = entity.InvoiceNo;
dr[Amount_SendOut] = entity.Amount;
dr[UserName_SendOut] = entity.UserName;
dr[ChineseName_SendOut] = entity.ChineseName;
dr[CustomerCode_SendOut] = entity.CustomerCode;
dr[CustomerName_SendOut] = entity.CustomerName;
dr[Remark_SendOut] = entity.Remark;
dr[IsPaid_SendOut] = entity.IsPaid;
dr[SendOutDate_SendOut] = entity.SendOutDate;
this.Rows.Add(dr);
return true;
}
else
{
if (rowIndex >= 0 && rowIndex < this.Rows.Count)
{
try
{
dr = this.Rows[rowIndex];
//只要是Key的值都不可以更改
dr[InvoiceNo_SendOut] = entity.InvoiceNo;
dr[Amount_SendOut] = entity.Amount;
dr[UserName_SendOut] = entity.UserName;
dr[ChineseName_SendOut] = entity.ChineseName;
dr[CustomerCode_SendOut] = entity.CustomerCode;
dr[CustomerName_SendOut] = entity.CustomerName;
dr[Remark_SendOut] = entity.Remark;
dr[IsPaid_SendOut] = entity.IsPaid;
dr[SendOutDate_SendOut] = entity.SendOutDate;
return true;
}
catch
{
return false;
}
}
else
{
return false;
}
}
}
#endregion
}
}
using
System;
using System.Runtime.Serialization;
using FishSky.Data.Base;
namespace FishSky.Data.Chateau
{
[Serializable]
public class SendOutDataSet : BaseDataSet
{
表格常量及数据表#region 表格常量及数据表
/**//// <summary>
/// 定义对象数据集表:SendOutDataTable
/// </summary>
public SendOutDataTable SendOutTable = new SendOutDataTable();
#endregion
构造函数#region 构造函数
/**//// <summary>
/// 构造函数
/// </summary>
public SendOutDataSet() : base()
{
}
#endregion
序列化的构造函数#region 序列化的构造函数
/**//// <summary>
/// 序列化的构造函数
/// </summary>
public SendOutDataSet(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
建立数据集的表格#region 建立数据集的表格
/**//// <summary>
/// 建立数据集的表格
/// </summary>
protected override void BuildDataTables()
{
this.Tables.Add(SendOutTable);
//设置新增自动生成key字段
this.KeyTypeID = "SendOutNo";
}
#endregion
}
}
using System.Runtime.Serialization;
using FishSky.Data.Base;
namespace FishSky.Data.Chateau
{
[Serializable]
public class SendOutDataSet : BaseDataSet
{
表格常量及数据表#region 表格常量及数据表
/**//// <summary>
/// 定义对象数据集表:SendOutDataTable
/// </summary>
public SendOutDataTable SendOutTable = new SendOutDataTable();
#endregion
构造函数#region 构造函数
/**//// <summary>
/// 构造函数
/// </summary>
public SendOutDataSet() : base()
{
}
#endregion
序列化的构造函数#region 序列化的构造函数
/**//// <summary>
/// 序列化的构造函数
/// </summary>
public SendOutDataSet(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
建立数据集的表格#region 建立数据集的表格
/**//// <summary>
/// 建立数据集的表格
/// </summary>
protected override void BuildDataTables()
{
this.Tables.Add(SendOutTable);
//设置新增自动生成key字段
this.KeyTypeID = "SendOutNo";
}
#endregion
}
}