/// <summary> /// 绑定RetailDetail数据源并设置下方的Label值 /// </summary> private void BindingDataSource( CostumeRetailAnalysisPage listPage) { this.dataGridViewDetail.DataSource = null; if (listPage != null && listPage.CostumeRetailAnalysisList != null) { foreach (CostumeRetailAnalysis item in listPage.CostumeRetailAnalysisList) { Costume costume = GlobalCache.GetCostume(item.CostumeID); //按款查询需要前端补充颜色信息 if (string.IsNullOrEmpty(item.ColorName)) { item.ColorName = costume.Colors; } item.Price = costume.Price; item.BigClass = costume.BigClass; item.SmallClass = costume.SmallClass; item.Season = costume.Season; item.Year = costume.Year; item.CostumeName = costume.Name; item.BrandName = GlobalCache.GetBrandName(costume.BrandID); item.ShopName = GlobalCache.GetShopName(item.ShopID); decimal totalPrice = item.Price * item.QuantityOfSale; if (totalPrice == 0) { item.AvgDiscount = 100; } else { item.AvgDiscount = MathHelper.Rounded(item.MoneyOfSale / totalPrice, 2); } } this.dataGridViewDetail.DataSource = listPage?.CostumeRetailAnalysisList; } }
/// <summary> /// 将集合中GuideName赋值 /// </summary> /// <param name="memberList"></param> private void SetOtherValue(List <Costume> list) { foreach (Costume item in list) { String name = GlobalCache.GetSupplierName(item.SupplierID); item.SupplierName = name; item.BrandName = GlobalCache.GetBrandName(item.BrandID); } }
private void BindingOutboundDetailSource() { if (this.curDetailList != null && this.curDetailList.Count > 0) { foreach (BoundDetail detail in this.curDetailList) { Costume curCostume = GlobalCache.GetCostume(detail.CostumeID); detail.CostumeName = curCostume.Name; detail.BrandName = GlobalCache.GetBrandName(curCostume.BrandID); detail.Year = curCostume.Year; detail.Season = curCostume.Season; } } dataGridViewPagingSumCtrl2.BindingDataSource <BoundDetail>(DataGridViewUtil.ListToBindingList(curDetailList)); }
private void SkinTxt_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } try { string costumeID = this.SkinTxt.Text.Trim(); if (string.IsNullOrEmpty(costumeID)) { if (this.CostumeSelected != null) { this.CostumeSelected(null); } return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } //条形码,先根据条形码获取款号 //List<BarCode> barCodes = GlobalCache.BarCodeList?.FindAll(t => t.BarCodeValue.ToUpper().Contains(costumeID.ToUpper())); ////,条形码为一条,找到这个款号 //if (barCodes != null && barCodes.Count == 1) //{ // costumeID = barCodes[0].CostumeID; // this.SkinTxt.Text = barCodes[0].BarCodeValue; // isBarCode = true; //} if (costumeID.Length == 15) { BarCode4Costume costume = CommonGlobalUtil.GetBarCode(costumeID); if (costume != null) { costumeID = costume.CostumeID; SkinTxt.Text = costume.BarCode; isBarCode = true; } } List <Costume> resultList = GlobalCache.CostumeList.FindAll(t => (t.ID.ToUpper().Contains(costumeID.ToUpper()) || t.Name.ToUpper().Contains(costumeID.ToUpper())) && t.PfShowOnline == EmOnline); if (filterValid) { resultList = resultList.FindAll(t => t.IsValid); } if (resultList == null || resultList.Count == 0) { if (this.CostumeSelected != null) { this.CostumeSelected(null); } this.SkinTxt.Text = ""; return; } if (resultList.Count == 1) { resultList[0].BrandName = GlobalCache.GetBrandName(resultList[0].BrandID); resultList[0].SupplierName = GlobalCache.GetSupplierName(resultList[0].SupplierID); if (!isBarCode) { this.SkinTxt.Text = resultList[0].ID; } if (this.CostumeSelected != null) { this.CostumeSelected(resultList[0]); } } else { EmPfCostumeForm costumeForm = new EmPfCostumeForm(resultList, costumeID, filterValid, EmOnline); costumeForm.CostumeSelected += CostumeForm_CostumeSelected; costumeForm.ShowDialog(); } } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }