Ejemplo n.º 1
0
        public static void AddHoursForMember()
        {
            HeaderMessage.EnterNameOfMember();
            string name = ValidInputValue.GetName();

            foreach (var memb in ReaderMembersAndReports.members)
            {
                if (memb.Name == name)
                {
                    StandardMessage.EnterDateToAddHours();
                    DateTime enterDate = ValidInputValue.GetDate();
                    ReportWriter.Date = enterDate.ToShortDateString();

                    StandardMessage.EnterAmountOfHours();
                    ReportWriter.Hours = ValidInputValue.GetHours();

                    HeaderMessage.EnterWhatMemberDid();
                    ReportWriter.Doing = Console.ReadLine();

                    ReportWriter.WriteHoursOfMember(name, memb.Post);
                    return;
                }
            }

            ErrorMessage.MemberIsNotExists();
            AddHoursForMember();
        }
Ejemplo n.º 2
0
        public static void AddHours(IMember member)
        {
            bool isDateCorrect = false;

            while (!isDateCorrect)
            {
                StandardMessage.EnterDateToAddHours();
                DateTime enterDate = ValidInputValue.GetDate();
                ReportWriter.Date = enterDate.ToShortDateString();

                if (member.Post == "freelancer")
                {
                    isDateCorrect = DateTime.Now.AddDays(-3) < enterDate && enterDate < DateTime.Now;

                    if (!isDateCorrect)
                    {
                        ErrorMessage.CanNotAddHoursBeforeTwoDays();
                        continue;
                    }
                }
                else
                {
                    isDateCorrect = true;
                }
            }

            StandardMessage.EnterAmountOfHours();
            ReportWriter.Hours = ValidInputValue.GetHours();

            StandardMessage.EnterWhatYouDid();
            ReportWriter.Doing = Console.ReadLine();

            ReportWriter.WriteHoursOfMember(member.Name, member.Post);
        }