/// <summary> /// 初始化数据 /// </summary> private void InitCommodityData() { ClearPage(); SetSizeAndColorItems(); string errText = ""; if (_commodityInfoService == null) { _commodityInfoService = new CommodityInfoService(); } List <CommodityInfo> list; if (_currentTypeId == Guid.Empty) { this.dataGridView1.DataSource = CreateDtTemplate(); return; } list = _commodityInfoService.GetEntityList(out errText, _currentTypeId); if (list == null || list.Count == 0) { this.dataGridView1.DataSource = CreateDtTemplate(); return; } this.dataGridView1.DataSource = list; }
/// <summary> /// 初始化数据 /// </summary> private void InitCommodityData() { string errText = ""; if (_commodityInfoService == null) { _commodityInfoService = new CommodityInfoService(); } List <CommodityInfo> list; list = _commodityInfoService.GetEntityList(out errText); if (list == null || list.Count == 0) { this.dataGridView1.DataSource = CreateDtTemplate(); return; } var data = GetDistinctData(_currentDt, list); this.dataGridView1.DataSource = EntityHelper.CreateInstanceCollection(data); }