//物料领(返)记录 public class MaterialRecord { public int MatID {get;set;} public Amount {get;set;} } //领料 public class Draw { public int DrawId {get;set;} public MaterialRecord Record {get;set;} public List<Withdraw> WithdrawRecords {get;set;} } //返料 public class Withdraw { public MaterialRecord Record {get;set;} public int WithDrawId {get;set;} }
public class MaterialRecord
{
public int MatID
{get;set;} public Amount
{get;set;}
}
//领料
public class Draw
{
public int DrawId
{get;set;} public MaterialRecord Record
{get;set;} public List<Withdraw> WithdrawRecords
{get;set;}
}
//返料
public class Withdraw
{
public MaterialRecord Record
{get;set;} public int WithDrawId
{get;set;}
}
如果我要把
select a.领料数量,sum(b.返料数量) from 领料表 a,返料表 b where a.领料ID=b.领料ID
我现在要把它映射到实体类上应该怎么做啊
select a.领料数量,sum(b.返料数量) from 领料表 a,返料表 b where a.领料ID=b.领料ID
我现在要把它映射到实体类上应该怎么做啊
===========
// DataReader 读取数据
// ...
while(MyDataReader.Read()) {
领料类 a = new 领料类();
a.属性1 = a.GetXXX(columnIndex); // columnIndex 对应列索引
// 读取更多的属性
}
{
get
{
int wAmount = 0;
foreach(Withdraw item in WithdrawRecords)
{
wAmount + = item == null?0:item.Record.Amount;
}
return wAmount;
}
}