コード例 #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);
            }
        }
コード例 #2
0
        private string GetFavoriteRestName(Employments RestType, YearStats statsType)
        {
            string restName;

            if (rest.MainEmployment == "отсутствует")
            {
                restName = "отсутствует";
            }
            else
            {
                string restCode = Management.GetValueByIndex(statsType.MainEmployment, 1);
                employments = RestType;
                employments.SetEmploymentValuesByCode(restCode);
                restName = employments.Name;
            }

            return(restName);
        }
コード例 #3
0
        public static Employments GetEmploymentType(string employmentLine)
        {
            string                 empType        = Management.GetValueByIndex(employmentLine);
            string                 code           = Management.GetValueByIndex(employmentLine, 1);
            Employments            employment     = null;
            IEmploymentsOtherTypes employmentType = null;

            switch (code)
            {
            case Codes.anotherEmpCode:
                employmentType = new EmploymentsTypeOther();
                break;

            case Codes.sleep:
                employmentType = new EmploymentsTypeSleep();
                break;
            }

            switch (empType)
            {
            case "Business":
                employment = new EmploymentsBusiness(employmentType);
                break;

            case "Goals":
                employment = new EmploymentsGoals(employmentType);
                break;

            case "Rest":
                employment = new EmploymentsRest(employmentType);
                break;

            case "Fun":
                employment = new EmploymentsFun(employmentType);
                break;
            }

            employment.SetEmploymentValuesByCode(code);
            return(employment);
        }
コード例 #4
0
ファイル: AddEmployments.cs プロジェクト: ZirockZ/PathPointer
 private void BtnFun_Click(object sender, EventArgs e)
 {
     employments = new EmploymentsFun();
     FillGrid();
 }
コード例 #5
0
ファイル: AddEmployments.cs プロジェクト: ZirockZ/PathPointer
 private void BtnRest_Click(object sender, EventArgs e)
 {
     employments = new EmploymentsRest();
     FillGrid();
 }
コード例 #6
0
ファイル: AddEmployments.cs プロジェクト: ZirockZ/PathPointer
 public void BtnGoals_Click(object sender, EventArgs e)
 {
     employments = new EmploymentsGoals();
     FillGrid();
 }
コード例 #7
0
ファイル: AddEmployments.cs プロジェクト: ZirockZ/PathPointer
 private void BtnBusiness_Click(object sender, EventArgs e)
 {
     employments = new EmploymentsBusiness();
     FillGrid();
 }