public void Run(string runItem, string count) { checkIfExists = new CheckIfExists(_checkIfExistRepository); startTime = new StartTime(_startTimeRepository, _pauseTimesRepository, _timeRepository, _dataForInLineTable); foreach (DataRow row in _startAllOperations.Operations(runItem).Rows) { isBusyCheck = new IsBusyCheck(_isBusyCheckRepository); if (isBusyCheck.GetOperationBool(row["OperationId"].ToString()) == false) { startTime.AddStartTime(row, count); _operationConditionRepository.OperationIsBusy(runItem, row["OperationId"].ToString()); } else { if (checkIfExists.IfInLineItemExists(runItem, row["OperationId"].ToString()) == false) { startTime.AddInLineStartTime(row, count); } else { startTime.AddInLineStartTimeIfEntryExist(row, count); } } } }
private int getDuplicateRow(DataRow row, string runItem, string count) { int key = 0; int num = 0; int placeNum1 = 0; DateTime b = new DateTime(); DateTime z = new DateTime(3000, 1, 1, 1, 1, 1); DateTime timeNow = DateTime.Now; List <MethodValues> valueList = new List <MethodValues>(); isBusyCheck = new IsBusyCheck(_isBusyCheckRepository); foreach (DataRow row1 in _startAllOperations.SpecificOperationsWithDuplicates(row, runItem).Rows) { if (isBusyCheck.GetOperationBool(row1["OperationId"].ToString()) == false) { placeNum1 = 1; MethodValues methodValues = new MethodValues(int.Parse(row1["OperationId"].ToString()), timeNow, placeNum1); valueList.Add(methodValues); } else { if (checkIfExists.IfInLineItemExists(runItem, row1["OperationId"].ToString()) == false) { placeNum1 = 2; MethodValues methodValues = new MethodValues(int.Parse(row1["OperationId"].ToString()), time.GetMaxEndTimeFromItemsOperations(_timeRepository, row1), placeNum1); valueList.Add(methodValues); } else { placeNum1 = 3; MethodValues methodValues = new MethodValues(int.Parse(row1["OperationId"].ToString()), time.GetMaxEndTimeFromInLine(_timeRepository, row1), placeNum1); valueList.Add(methodValues); } } foreach (var item in valueList) { b = item.dateTime; if ((num = DateTime.Compare(z, b)) > 0) { z = item.dateTime; key = item.key; PlaceNum = item.selectedNr; } z = item.dateTime; } } return(key); }