private void Statistic(string assignmentType, IAssignment term, DateTime dateKey, int adding) { if (!_dateIndexer.ContainsKey(dateKey)) { } var indexOfDate = _dateIndexer[Convert.ToDateTime(dateKey)]; if (_assignmentTypes.ContainsKey(assignmentType)) { _assignmentTypes[assignmentType][indexOfDate].SaftyInvoke(o => o.Value += adding); // 增加某天结算班次 PlanningShifts[indexOfDate].Value += adding; if (term.Is <OvertimeAssignment>()) { if (adding < 0) { PlanningOtHours[indexOfDate].Value -= term.OvertimeTotals.TotalHours; } else { PlanningOtHours[indexOfDate].Value += term.OvertimeTotals.TotalHours; } } else if (term.Is <Assignment>()) { if (adding < 0) { PlanningWorkingHours[indexOfDate].Value -= term.WorkingTotals.TotalHours; } else { PlanningWorkingHours[indexOfDate].Value += term.WorkingTotals.TotalHours; } } } //以下如出现unknownAssignement, 则workingHours和adding都会是负数(减去) }
private void Statistic(string assignmentType, IAssignment term, DateTime dateKey, int adding) { if (!_dateIndexer.ContainsKey(dateKey)) { } var indexOfDate = _dateIndexer[Convert.ToDateTime(dateKey)]; if (_assignmentTypes.ContainsKey(assignmentType)) { _assignmentTypes[assignmentType][indexOfDate].SaftyInvoke(o => o.Value += adding); // 增加某天结算班次 PlanningShifts[indexOfDate].Value += adding; if (term.Is<OvertimeAssignment>()) { if (adding < 0) PlanningOtHours[indexOfDate].Value -= term.OvertimeTotals.TotalHours; else PlanningOtHours[indexOfDate].Value += term.OvertimeTotals.TotalHours; } else if (term.Is<Assignment>()) { if (adding < 0) PlanningWorkingHours[indexOfDate].Value -= term.WorkingTotals.TotalHours; else PlanningWorkingHours[indexOfDate].Value += term.WorkingTotals.TotalHours; } } //以下如出现unknownAssignement, 则workingHours和adding都会是负数(减去) }