public StatisticsDetailsForm(ProductionStatisticsValidator validator) { InitializeComponent(); this.validator = validator; SetTexts(); }
private bool CloseProductionShift(ProductionShift shift) { using (StatisticsDetailsForm form = new StatisticsDetailsForm(_currentValidator)) { if (form.ShowDialog() == DialogResult.OK) { if (shift != null && form.UpdateTime > shift.ProductionStart.Add(Settings.Default.MaximumLegLength)) { if (QuestionForm.ShowQuestion(Strings.ProductionShiftWarning, string.Format(Strings.ProductionLengthIsLong, Math.Floor((form.UpdateTime - shift.ProductionStart).TotalHours))) == DialogResult.Cancel) { return false; } } try { shift.CurrentLeg.UpdateStatistics(form.UpdateTime, form.ProductionCounter, form.DiscardedItems); SaveLeg(shift.CurrentLeg); SaveShift(_currentShift); _currentValidator = new ProductionStatisticsValidator(form.UpdateTime, form.ProductionCounter, form.DiscardedItems); return true; } catch (Exception ex) { log.Error("An exception were caught while updating production counters.", ex); MessageForm.ShowMessage(Strings.ExceptionCaught, Strings.CouldNotUpdateProductionCounters); } } } return false; }
private void StartDataEntry() { _currentShift = StartProductionShift(); if (_currentShift == null) { if (!started) Application.Exit(); return; } started = true; LastOrder = _currentShift.Order; _currentValidator = new ProductionStatisticsValidator(_currentShift.CurrentLeg.ProductionStart, _currentShift.CurrentLeg.CounterStart, 0); UpdateHeader(_currentShift.Production); UpdateDisplay(); UpdateButtons(); }