private void CompareStatBaseInfoBySum(ref StatInfoBase compoundSib, StatInfoBase compareSib, enumStatCompoundType statCompoundType) { int rowLength = compoundSib.DayStatResult.Rows.Length; int colLength = compoundSib.DayStatResult.Columns.Length;; string[] tempSib = null; float areaTemp = 0; float compoundSum = 0; float compareSum = 0; for (int row = 0; row < rowLength; row++) { tempSib = compoundSib.DayStatResult.Rows[row]; for (int col = 0; col < colLength; col++) { compoundSum += float.TryParse(tempSib[col], out areaTemp) ? areaTemp : 0; } tempSib = compareSib.DayStatResult.Rows[row]; for (int col = 0; col < colLength; col++) { compareSum += float.TryParse(tempSib[col], out areaTemp) ? areaTemp : 0; } } switch (statCompoundType) { case enumStatCompoundType.全部: break; case enumStatCompoundType.最大: if (compareSum > compoundSum) { compoundSib = compareSib; } break; case enumStatCompoundType.最小: if (compareSum < compoundSum) { compoundSib = compareSib; } break; } }
public StatDimClass(enumStatDimType dimType, enumStatCompoundType compoundType, enumStatDayMosaicType dayMosaicType) { DimType = dimType; CompoundType = compoundType; DayMosaicType = dayMosaicType; }
private void GetDstResultByCompoundArea(Dictionary <string, Dictionary <string, StatInfoBase[]> > srcResult, Dictionary <string, Dictionary <enumStatCompoundType, IStatResult> > dstResult, string dimKey, enumStatCompoundType statCompoundType) { Dictionary <enumStatCompoundType, IStatResult> tempResult = null;; Dictionary <enumStatCompoundType, StatInfoBase> sibDic = new Dictionary <enumStatCompoundType, StatInfoBase>(); StatInfoBase daySibTemp = null; Dictionary <string, StatInfoBase[]> daysInfoTemp = srcResult[dimKey]; StatInfoBase dimSibTemp = srcResult[dimKey].First().Value[0]; foreach (var dayKey in daysInfoTemp.Keys) { if (daysInfoTemp[dayKey].Length > 1) { daySibTemp = daysInfoTemp[dayKey][0]; for (int index = 1; index < daysInfoTemp[dayKey].Length; index++) { CompareStatBaseInfoBySum(ref daySibTemp, daysInfoTemp[dayKey][index - 1], statCompoundType); } } else { CompareStatBaseInfoBySum(ref dimSibTemp, daysInfoTemp[dayKey][0], statCompoundType); } } tempResult = new Dictionary <enumStatCompoundType, IStatResult>(); tempResult.Add(statCompoundType, dimSibTemp.DayStatResult); if (dstResult.ContainsKey(dimKey)) { dstResult[dimKey].Add(statCompoundType, dimSibTemp.DayStatResult); } else { dstResult.Add(dimKey, tempResult); } }