public override void SetContent(List<Tuple<string, string>> data) { foreach (Tuple<string, string> t in data) { switch (t.Item1) { case "taskname": Name = t.Item2; break; case "Location": Place = t.Item2; break; case "Description": Description = t.Item2; break; case "Workers Per Shift": NoWorkersPerShift = t.Item2; break; case "Joint Task": JointTask = t.Item2; break; case "Shift interval": MinTaskInterval = t.Item2; break; case "Exceed Allowed": ExceedingAllowed = t.Item2; break; case "Responsible": Responsible = t.Item2; break; case "Need Vehicle": NeedVehicle = t.Item2; break; case "Experience Required": ExperienceRequired = t.Item2; break; default: ShiftsSpecification shiftSpec = new ShiftsSpecification(t.Item1, t.Item2, this); AddShiftsSpecification(shiftSpec); break; } } /*List<ShiftsSpecification> shiftSpecList = new List<ShiftsSpecification>(); foreach (Tuple<string, string> t in data) { ShiftsSpecification shiftSpec = new ShiftsSpecification(t.Item1, t.Item2, this); shiftSpecList.Add(shiftSpec); } AddShiftsSpecifications(shiftSpecList);*/ }
public static void LogErrorInvalidDateFormat(ShiftsSpecification specification) { var messageContent = messageContentProvider.GetMessageInvalidDateFormat(specification.Date); LoggedErrors.Add(new ErrorMessage(messageContent)); }
public void AddShiftsSpecification(ShiftsSpecification specification) { if (ShiftsSpecifications == null) ShiftsSpecifications = new List<ShiftsSpecification>(); this.ShiftsSpecifications.Add(specification); }
private List<Task> CreateTaskList() { //Initializing a list for the newly created tasks List<Task> newTaskList = new List<Task>(); //Hardcoded name of the sheet in the resource file which contains information about tasks //TODO: Implemented dynamic solution string sheetname = "Tasks"; try { //Update CurrentWorkSheet by accessing the sheet using the sheetname CurrentWorkSheet = (Excel.Worksheet)CurrentWorkBook.Sheets[sheetname]; //Update CurrentWorkBook as above CurrentWorkBook.Sheets[sheetname].Select(); } //TODO: find correct exception catch (Exception) { //Write to log if sheet couldn't be opened EventShiftPlanGenerator.ErrorLogger.LogErrorSheetMissing(sheetname); } //Find the start cell in on the sheet (we do not assume A1 is the start cell) Excel.Range sheetStart = FindCellWithStringInRange("Opgave navn", "A1", "J10"); //Find the number of rows to go through to go through int rowsToGoThrough = sheetStart.Row + CurrentWorkSheet.UsedRange.Rows.Count - 1; int columnsToGoThrough = 9 + numberOfDays; //Loop through rows and run them through the intepretor //i is set to sheetStart.Row + 1 because the first row contains the column names for (int i = sheetStart.Row + 1; i < rowsToGoThrough; i++) { Console.WriteLine(" "); //TODO: hardcoding of dates to be changed when implementation of day parser is done string[] dateInfo = { "05/09/2015", "06/09/2015", "07/09/2015", "08/09/2015" }; ShiftsSpecification[] shiftSpecs = new ShiftsSpecification[numberOfDays]; /*for (int j = 3, k = 0; j < 3+numberOfDays; j++, k++) { ShiftsSpecification newShiftSpec = new ShiftsSpecification(dateInfo[k], CurrentWorkSheet.Cells[sheetStart.Column + 3 + numberOfDays][i].text, CurrentWorkSheet.Cells[j + 2][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 4 + numberOfDays][i].text); shiftSpecs[k] = newShiftSpec; } TaskSpecification taskSpec = new TaskSpecification( CurrentWorkSheet.Cells[sheetStart.Column][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 1][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 2][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 3 + numberOfDays][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 4 + numberOfDays][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 5 + numberOfDays][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 6 + numberOfDays][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 7 + numberOfDays][i].Text, CurrentWorkSheet.Cells[sheetStart.Column + 8 + numberOfDays][i].Text, shiftSpecs); EventShiftPlanGenerator.EventSpecificationProcessing.Tasks.TaskFactory taskFactory = new EventShiftPlanGenerator.EventSpecificationProcessing.Tasks.TaskFactory(); newTaskList.Add(taskFactory.MakeTask(taskSpec));*/ } return newTaskList; }