public DayEfficiency[] FillStatsArray(int weekNumber, int dayOfWeek, bool pickedCurrentDay = false) //вывод массива данных об определенной недели { DayEfficiency[] statsArray = new DayEfficiency[24]; string readLine; bool weekExists = false; int arrayIndex = 0; weekNumber--; using (StreamReader reader = new StreamReader(EfficiencyFile)) { for (int i = 0; (readLine = reader.ReadLine()) != null; i++) { if (24 * weekNumber <= i) //вывод конкретной недели { readLine = Management.GetValueByIndex(readLine, dayOfWeek, ";"); if (pickedCurrentDay == true && arrayIndex == DateTime.Now.Hour) { statsArray[arrayIndex] = new EmploymentsSkip(new DayEfficiencyNow()); } else if (pickedCurrentDay == true && arrayIndex > DateTime.Now.Hour) { statsArray[arrayIndex] = new EmploymentsSkip(new DayEfficiencyFuture()); } else if (readLine == " " || readLine == "") { statsArray[arrayIndex] = new EmploymentsSkip(new DayEfficiencySkip()); } else { statsArray[arrayIndex] = Employments.GetEmploymentType(readLine); } arrayIndex++; weekExists = true; if (arrayIndex == 24) { break; } } } } if (weekExists == false) { return(null); } else { return(statsArray); } }
protected override bool CountHours(DayEfficiency employment) { spentHours++; if (MainEmployment == null) { SetMainEmployment(); } else if (employment.Code == Management.GetValueByIndex(MainEmployment, 1)) { MainEmploymentHrs++; } return(true); }
protected override bool CountHours(DayEfficiency employment) { MainEmploymentHrs++; if (employment.Code != Codes.anotherEmpCode) //пропуск варианта "другое" из опросника { if (allFunEmps.ContainsKey(employment.Name)) { allFunEmps[employment.Name] += 1; } else { allFunEmps[employment.Name] = 1; } } return(true); }
protected override bool CountHours(DayEfficiency employment) { bool countEmployment = false; if (employment.Code != Codes.sleep) //пропуск сна { MainEmploymentHrs++; countEmployment = true; if (employment.Code != Codes.anotherEmpCode) //пропуск варианта "другое" { if (allRestEmps.ContainsKey(employment.Name)) { allRestEmps[employment.Name] += 1; } else { allRestEmps[employment.Name] = 1; } } } return(countEmployment); }
protected override bool CountHours(DayEfficiency employment) { MainEmploymentHrs++; return(true); }
protected abstract bool CountHours(DayEfficiency employment);