/// <summary> /// 获取毛利率下限 /// </summary> public void GetMargin() { Margin = new Dictionary <MinMarginDays, MinMarginKPIVM>(); if (M1 == null) { M1 = new MinMarginKPIVM(); } AddMargin(MinMarginDays.Thirty, M1); if (M2 == null) { M2 = new MinMarginKPIVM(); } AddMargin(MinMarginDays.Sixty, M2); if (M3 == null) { M3 = new MinMarginKPIVM(); } AddMargin(MinMarginDays.Ninety, M3); if (M4 == null) { M4 = new MinMarginKPIVM(); } AddMargin(MinMarginDays.OneHundredAndTwenty, M4); if (M5 == null) { M5 = new MinMarginKPIVM(); } AddMargin(MinMarginDays.OneHundredAndEighty, M5); if (M6 == null) { M6 = new MinMarginKPIVM(); } AddMargin(MinMarginDays.Other, M6); }
/// <summary> /// 初始化毛利率 /// </summary> public void InitMargin() { if (Margin == null) { Margin = new Dictionary <MinMarginDays, MinMarginKPIVM>(); } if (Margin.ContainsKey(MinMarginDays.Thirty)) { M1 = Margin[MinMarginDays.Thirty]; } else if (M1 == null) { M1 = new MinMarginKPIVM(); } if (Margin.ContainsKey(MinMarginDays.Sixty)) { M2 = Margin[MinMarginDays.Sixty]; } else if (M2 == null) { M2 = new MinMarginKPIVM(); } if (Margin.ContainsKey(MinMarginDays.Ninety)) { M3 = Margin[MinMarginDays.Ninety]; } else if (M3 == null) { M3 = new MinMarginKPIVM(); } if (Margin.ContainsKey(MinMarginDays.OneHundredAndTwenty)) { M4 = Margin[MinMarginDays.OneHundredAndTwenty]; } else if (M4 == null) { M4 = new MinMarginKPIVM(); } if (Margin.ContainsKey(MinMarginDays.OneHundredAndEighty)) { M5 = Margin[MinMarginDays.OneHundredAndEighty]; } else if (M5 == null) { M5 = new MinMarginKPIVM(); } if (Margin.ContainsKey(MinMarginDays.Other)) { M6 = Margin[MinMarginDays.Other]; } else if (M6 == null) { M6 = new MinMarginKPIVM(); } }
private void AddMargin(MinMarginDays days, MinMarginKPIVM value) { if (Margin.ContainsKey(days)) { Margin[days].MinMargin = value.MinMargin; Margin[days].MaxMargin = value.MaxMargin; } else { var tempValue = new MinMarginKPIVM { MinMargin = value.MinMargin, MaxMargin = value.MaxMargin }; Margin.Add(days, tempValue); } }