public static void Main() { Approver teamLead = new TeamLead(); Approver vicePresident = new VicePresident(); Approver president = new President(); teamLead.SetSuccessor(vicePresident); vicePresident.SetSuccessor(president); Purchase purchase = new Purchase(2019, 90000.00); teamLead.ProcessRequest(purchase); }
internal static void Main() { Approver teamLead = new TeamLead(); Approver vicePresident = new VicePresident(); Approver president = new President(); teamLead.SetSuccessor(vicePresident); vicePresident.SetSuccessor(president); var purchase = new Purchase(2034, 350.00); teamLead.ProcessRequest(purchase); purchase = new Purchase(2035, 32590.10); teamLead.ProcessRequest(purchase); purchase = new Purchase(2036, 122100.00); teamLead.ProcessRequest(purchase); }
public static void Main() { Approver teamLead = new TeamLead(); Approver vp = new VicePresident(); Approver ceo = new President(); teamLead.SetSuccessor(vp); vp.SetSuccessor(ceo); var purchase = new Purchase(2034, 350.00); teamLead.ProcessRequest(purchase); purchase = new Purchase(2035, 32590.10); teamLead.ProcessRequest(purchase); purchase = new Purchase(2036, 122100.00); teamLead.ProcessRequest(purchase); }
/// <summary> /// Read every message that gets sent /// </summary> public async void ReadmessagesAsync(SocketMessage message) { // Set up the Socket User Message so we can use it for context for later var usermessage = message as SocketUserMessage; var chnl = message.Channel as SocketGuildChannel; bool GuildCheck = true; // Make sure we don't do anything in RTX-London try { if (chnl.Guild.Id == 358283239053590528) { GuildCheck = false; } } catch { } if (GuildCheck == true) { try { if (Validation.Istext(message)) { // Check if the message is a command based off if a bang is the first letter if (Validation.Iscommand(message)) { // Set up Command Context var context = new CommandContext(discordclient, usermessage); // Check if the message sent matches an actual command in the approved or public commands bool found = false; if (Validation.CheckCommand(message, "help") && found == false) { found = await Help.HelpCommands(message, context); } if (message.Channel.Name.ToLower() == "landing" && found == false) { found = await Landing.LandingCommands(message, context, discordclient); } else { // Head Guardian/Admin Commands if (Validation.IsHGorAdmin(message, discordclient) && found == false) { found = await Admins.AdminCommands(message, context, discordclient); } // Team Lead Commands if (Validation.IsTL(message) && found == false) { found = await TeamLead.TeamCommand(message, context); } if (found == false) { found = await Fun.FunCommands(message, context, discordclient); } if (found == false) { found = await Music.MusicCommands(message, context, discordclient, _lavaNode); } if (found == false) { found = await Phone.PhoneCommands(message, discordclient); } } } // Check if there were any mentions else if (Validation.BotMentioned(message, discordclient)) { // Set up Command Context var context = new CommandContext(discordclient, usermessage); if (message.Content.Replace("<@!503445217530085396>", "").Trim() == "") { // If so send a gif await context.Channel.SendMessageAsync(Angela.RandomAngela()); } } // Log all text WriteLog(message.Channel + ": " + message.Author + " - " + message.Content); if (!reg.IsMatch(message.Content) && message.Author.IsBot == false) { try { using (var db = new LiteDatabase(@"Guardians.db")) { var Guardians = db.GetCollection <UserData>("Guardians"); var Guardian = Guardians.Find(x => x.GroupMeGroup != null && x.Channels.Contains(message.Channel.Name.ToLower()) && x.GroupMeTime == null); foreach (var notify in Guardian) { if (notify.DiscordUsername.ToLower() != message.Author.Username.ToLower() + "#" + message.Author.Discriminator.ToString()) { GroupMe.SendMessage(notify.GroupMeBot, message.Channel.Name, message.Author.Username, message.Content, creds.GroupMe); } } } } catch { } } } } catch { Console.WriteLine("Parsing Commands timed out: " + message.Channel.Name + " " + message.Content); } } }
public static void Call(TeamLead teamLead) { var exit = false; var command = 0; while (!exit) { PrintEmployeeMenu(); try { command = int.Parse(ReadLine()); } catch { WriteLine("Invalid command"); } switch (command) { case 0: exit = true; break; case 1: foreach (var task in TaskData.TasksById.Values) { WriteLine(task.ToString()); } break; case 2: WriteLine("What is the name of the task?"); var name = ReadLine(); WriteLine("What is the description of the task?"); var description = ReadLine(); var id = teamLead.CreateTask(name, description); WriteLine($"New task id: {id}"); break; case 3: WriteLine("What is the id of the task?"); var taskId = ReadLine(); WriteLine("Write your comment:"); var comment = ReadLine(); teamLead.CreateCommit(taskId, comment); break; case 4: WriteLine("What is the id of the task?"); taskId = ReadLine(); teamLead.OpenTask(taskId); break; case 5: WriteLine("What is the id of the task?"); taskId = ReadLine(); teamLead.ActiveTask(taskId); break; case 6: WriteLine("What is the id of the task?"); taskId = ReadLine(); teamLead.ResolveTask(taskId); break; case 7: WriteLine("What is the name for the report?"); name = ReadLine(); teamLead.CreateDayReport(name); break; case 8: WriteLine("What is the name for the report?"); name = ReadLine(); teamLead.CreateSprintReport(name); break; case 9: teamLead.UpdateSprintReport(); break; case 10: WriteLine("What is the id of the task?"); taskId = ReadLine(); var resultSubordinate = SearchSubordinate(teamLead); teamLead.UpdateTaskEmployee(taskId, resultSubordinate); break; case 11: resultSubordinate = SearchSubordinate(teamLead); teamLead.AddNewSubordinate(resultSubordinate); break; case 12: foreach (var subordinate in teamLead.Subordinates()) { WriteLine(subordinate.ToString()); } break; case 13: teamLead.CloseCurrentSprintReport(); break; default: WriteLine("Wrong command!"); break; } } }
public static void Call() { var exit = false; var command = 0; while (!exit) { PrintCreateEmployeeMenu(); try { command = int.Parse(ReadLine()); } catch { WriteLine("Invalid command"); } switch (command) { case 0: exit = true; break; case 1: WriteLine("Write your name:"); var name = ReadLine(); var director = DirectorSearch(); if (name == null || director == null) { break; } var employee = new Employee(name, director); EmployeeMenu.Call(employee); break; case 2: WriteLine("Write your name:"); name = ReadLine(); director = DirectorSearch(); var subordinates = SubordinatesSearch(); if (name == null || director == null) { break; } var dir = new Director(name, director, subordinates); DirectorMenu.Call(dir); break; case 3: WriteLine("Write your name:"); name = ReadLine(); subordinates = SubordinatesSearch(); if (name == null) { break; } var teamLead = new TeamLead(name, subordinates); TeamLeadMenu.Call(teamLead); break; case 4: WriteLine("Write Employee Id:"); var employeeId = ReadLine(); if (EmployeesManager.AllOrdinaryEmployees.ContainsKey(employeeId)) { employee = EmployeesManager.AllOrdinaryEmployees[employeeId]; } else { throw new ManagerException(); } EmployeeMenu.Call(employee); break; case 5: WriteLine("Write Director Id:"); var directorId = ReadLine(); if (EmployeesManager.AllDirectors.ContainsKey(directorId)) { dir = EmployeesManager.AllDirectors[directorId]; } else { throw new ManagerException(); } DirectorMenu.Call(dir); break; case 6: WriteLine("Write Team Lead Id:"); var teamLeadId = ReadLine(); if (EmployeesManager.AllTeamLeads.ContainsKey(teamLeadId)) { teamLead = EmployeesManager.AllTeamLeads[teamLeadId]; } else { throw new ManagerException(); } TeamLeadMenu.Call(teamLead); break; case 7: foreach (var employeesValue in EmployeeData.AllEmployees.Values) { WriteLine(employeesValue.ToString()); } break; case 8: AllEmployeesMenu.Call(); break; } } }