private void InsertFractionatedOrder(int newQty, int newMembers) { var loadingJob = new LoadingJob(false); var jobModel = new JobModel(); var task = Central.TaskList.Where(x => x.Id == _bar.Id).FirstOrDefault(); var duration = jobModel.CalculateJobDuration(cboLine.Text, newQty, _bar.QtyH, _bar.Department, newMembers); var startDate = !Store.Default.manualDate ? JobModel.GetLineNextDate(cboLine.Text, _bar.Department) : dtpStart.Value; var dailyProd = jobModel.CalculateDailyQty(cboLine.Text, _bar.QtyH, _bar.Department, newMembers, newQty); var newRowText = string.Empty; if (_bar.RowText.Contains('_')) { int.TryParse(_bar.RowText.Split('_')[1], out var newIndex); newRowText = _bar.RowText.Split('_')[0] + '_' + (newIndex + 1).ToString(); var newTask = Central.TaskList.Where(x => x.Name == newRowText && x.Department == _bar.Department).FirstOrDefault(); if (newTask != null) { int.TryParse(newTask.Name.Split('_')[1], out var n); newRowText = _bar.RowText.Split('_')[0] + '_' + (n + 1).ToString(); } } else { newRowText = _bar.RowText + "_1"; } loadingJob.InsertNewProgram(newRowText, cboLine.Text, _bar.Article, newQty, _bar.QtyH, startDate, duration, dailyProd, task.ArtPrice, _bar.Department, newMembers, dtpStart.Checked, false); }
private void GetLineNextDate() { var suggDate = JobModel.GetLineNextDate(cboLine.Text, _bar.Department); dtpStart.Value = suggDate; }