private void bwPrint_DoWork(object sender, DoWorkEventArgs e) { object[] arguments = e.Argument as object[]; int? year = arguments[0] as int?; int? month = arguments[1] as int?; linePerformanceList = LinePerformanceController.SelectBySection(section.SectionId, month.Value, year.Value); object[] results = { year, month }; e.Result = results; }
private void bwSpecialIncentive_DoWork(object sender, DoWorkEventArgs e) { linePerformanceList = LinePerformanceController.SelectBySection(section.SectionId, monthSearch, yearSearch); lineModelList = LineController.Select(section.SectionId).OrderBy(o => o.Ordinal).ToList(); foreach (var lineModel in lineModelList) { LinePerformanceModel linePerformanceModel = linePerformanceList.Where(w => w.LineId == lineModel.LineId).FirstOrDefault(); if (linePerformanceModel != null) { AssemblySpecialIncentiveModel assySpecialIncentive = new AssemblySpecialIncentiveModel(); assySpecialIncentive.Line = "Line " + lineModel.Name; assySpecialIncentive.Output = linePerformanceList.Where(w => w.LineId == lineModel.LineId).Select(s => s.Output).Sum(); assySpecialIncentive.QuotaTarget = linePerformanceList.Where(w => w.LineId == lineModel.LineId).Select(s => s.QuotaTarget).Sum(); assySpecialIncentive.Lacking = assySpecialIncentive.QuotaTarget - assySpecialIncentive.Output; assySpecialIncentive.PercentOutput = Math.Round((double)assySpecialIncentive.Output * 100 / (double)assySpecialIncentive.QuotaTarget, 2, MidpointRounding.AwayFromZero); assemblySpecialIncentiveList.Add(assySpecialIncentive); } } }