Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 protected override bool CountHours(DayEfficiency employment)
 {
     spentHours++;
     if (MainEmployment == null)
     {
         SetMainEmployment();
     }
     else if (employment.Code == Management.GetValueByIndex(MainEmployment, 1))
     {
         MainEmploymentHrs++;
     }
     return(true);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 protected override bool CountHours(DayEfficiency employment)
 {
     MainEmploymentHrs++;
     return(true);
 }
Exemplo n.º 6
0
 protected abstract bool CountHours(DayEfficiency employment);