页面代码 :
TextAlignment="Center"
DataMemberBinding="{Binding Query_TC}"
IsReadOnly="True"/>
TextAlignment="Center"
DataMemberBinding="{Binding Query_MC}"
IsReadOnly="True"/>
TextAlignment="Center"
DataMemberBinding="{Binding Query_QC}"
IsReadOnly="True"/>
后台代码:
public class Query
{
public string Query_NAME { get; set; }
public long Query_TC { get; set; }
public long Query_MC { get; set; }
public long Query_QC { get; set; }
public long Query_WC { get; set; }
public long Query_CC { get; set; }
public long Query_EC { get; set; }
public long Query_PC { get; set; }
}
//public void Query()
//{
// DataTable dt = new DataTable();
// DataColumn dc1 = new DataColumn("NAME", Type.GetType("System.String"));
// DataColumn dc2 = new DataColumn("TC", Type.GetType("System.Int16"));
// DataColumn dc3 = new DataColumn("MC", Type.GetType("System.Int16"));
// DataColumn dc4 = new DataColumn("QC", Type.GetType("System.Int16"));
// DataColumn dc5 = new DataColumn("WC", Type.GetType("System.Int16"));
// DataColumn dc6 = new DataColumn("CC", Type.GetType("System.Int16"));
// DataColumn dc7 = new DataColumn("EC", Type.GetType("System.Int16"));
// DataColumn dc8 = new DataColumn("PC", Type.GetType("System.Int16"));
// dt.Columns.Add(dc1);
// dt.Columns.Add(dc2);
// dt.Columns.Add(dc3);
// dt.Columns.Add(dc4);
// dt.Columns.Add(dc5);
// dt.Columns.Add(dc6);
// dt.Columns.Add(dc7);
// dt.Columns.Add(dc8);
//}
public void QueryInventoryInfo(string areaId)
{
Query qu = new Query();
string locType = "2";
qu.Query_TC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)).LongCount();
qu.Query_MC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)
&& c.STATUS.Contains("m")).LongCount();
qu.Query_QC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)
&& c.STATUS.Contains("q")).LongCount();
qu.Query_WC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)
&& c.STATUS.Contains("w")).LongCount();
qu.Query_CC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)
&& c.STATUS.Contains("c")).LongCount();
qu.Query_EC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)
&& c.STATUS.Contains("e")).LongCount();
qu.Query_PC = this.WMSServiceContext.MD_LOCATION.Where(c => c.LOC_TYPE != locType && c.AREA_ID.StartsWith(areaId)
&& c.STATUS.Contains("p")).LongCount();
}
Query是自己建的实体类 qu.Query_TC 、qu.Query_MC .... 接收了查询结果。刚开始是想绑定实体类