コード例 #1
0
        static public void AddMember()
        {
            HeaderMessage.EnterNameOfMember();
            string nameOfMember = ValidInputValue.GetName();

            foreach (var member in ReaderMembersAndReports.members)
            {
                bool isMemberExist = member.Name.Contains(nameOfMember);
                if (isMemberExist)
                {
                    ErrorMessage.MemberIsWritten();
                    AddMember();
                }
            }

            HeaderMessage.EnterPostOfMember();
            string postOfMember = ValidInputValue.GetPost();

            if (postOfMember == "header" || postOfMember == "employee" || postOfMember == "freelancer")
            {
                using (StreamWriter sw = new StreamWriter(Path.toMembers, true))
                {
                    sw.WriteLine($"{nameOfMember},{postOfMember}");
                }
                HeaderMessage.MemberAdded();
            }
            else
            {
                ErrorMessage.PostNotExist();
            }
        }
コード例 #2
0
        public static void ReadMemberReport()
        {
            HeaderMessage.EnterNameOfMember();
            string name = ValidInputValue.GetName();

            foreach (var member in ReaderMembersAndReports.members)
            {
                if (member.Name == name)
                {
                    StandardMessage.ReportForPeriod();

                    foreach (var report in ReaderMembersAndReports.reportOfMembers)
                    {
                        string[] dataOfReport = report.Split(new char[] { ',' });

                        if (dataOfReport[1].Contains(member.Name))
                        {
                            CalcSalary.GetSalaryOfMember(member);
                        }
                    }
                    StandardMessage.MemberHoursAndSalaryForPeriod(member);
                    return;
                }
            }

            ErrorMessage.MemberIsNotExists();
            ReadMemberReport();
        }
コード例 #3
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();
        }