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(); }
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(); } }
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(); }
public static void ChooseAction(IMember header) { Console.Clear(); HeaderMessage.GreetMessageForHeader(header); int act = int.Parse(Console.ReadLine()); Console.Clear(); switch (act) { case 1: AddingMember.AddMember(); Continue.AskToContinue(header); break; case 2: ReadingAllReports.ReadAllReport(); Continue.AskToContinue(header); break; case 3: ReadingMemberReport.ReadMemberReport(); Continue.AskToContinue(header); break; case 4: AddingHoursForMember.AddHoursForMember(); Continue.AskToContinue(header); break; case 5: Environment.Exit(0); break; default: ErrorMessage.WrongAction(); break; } }