public void TestSelectSupplierSaleReportInfos() { _stubISupplierSaleRecord.SelectSupplierSaleReportInfosInt32 = i => new List <SupplierSaleReportInfo> { new SupplierSaleReportInfo { CompanyID = new Guid("32CB5565-6EED-4F78-BC82-0571738FD771") }, new SupplierSaleReportInfo { CompanyID = Guid.NewGuid() } }; _stubICompanyCussent.GetCompanyCussentListByCompanyNameString = s => new List <CompanyCussentInfo> { new CompanyCussentInfo { CompanyId = new Guid("32CB5565-6EED-4F78-BC82-0571738FD771"), CompanyName = "测试" } }; var result = _supplierSaleRecordBll.SelectSupplierSaleReportInfos(DateTime.Now.Year, string.Empty); Assert.IsTrue(result.Count > 0); _stubICompanyCussent.GetCompanyCussentListByCompanyNameString = s => new List <CompanyCussentInfo>(); _supplierSaleRecordBll = new SupplierSaleRecordBll(_stubISupplierSaleRecord, _stubICompanyCussent, _stubIPurchaseSet, _stubIGoodsStockRecord, _stuIStorageRecordDao); var result1 = _supplierSaleRecordBll.SelectSupplierSaleReportInfos(DateTime.Now.Year, string.Empty); Assert.IsTrue(result1.Count == 0); }
/// <summary> /// 绑定数据原 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void RgSupplierSaleOnNeedDataSource(object source, GridNeedDataSourceEventArgs e) { _dicSum = new Dictionary <int, decimal>(); var list = _supplierSaleRecordBll.SelectSupplierSaleReportInfos(Year, CompanyName); for (int i = 1; i <= 12; i++) { decimal data = 0; switch (i) { case 1: data = list.Sum(act => act.January); break; case 2: data = list.Sum(act => act.February); break; case 3: data = list.Sum(act => act.March); break; case 4: data = list.Sum(act => act.April); break; case 5: data = list.Sum(act => act.May); break; case 6: data = list.Sum(act => act.June); break; case 7: data = list.Sum(act => act.July); break; case 8: data = list.Sum(act => act.August); break; case 9: data = list.Sum(act => act.September); break; case 10: data = list.Sum(act => act.October); break; case 11: data = list.Sum(act => act.November); break; case 12: data = list.Sum(act => act.December); break; } _dicSum.Add(i, data); } list = list.OrderByDescending(act => act.January + act.February + act.March + act.April + act.May + act.June + act.July + act.August + act.September + act.October + act.November + act.December).ToList(); ShowFooterText(); RgSupplierSale.DataSource = list; }