private void LinkConsultantandManager(String filename) { File linkfile = new File(filename); // Extract each line of the file foreach (string l in linkfile.Load) { Regex rg = new Regex(@"^(?<manager>[a-zA-Z]+)/(?<consultantslist>[a-zA-Z\-]+)$"); Match m = rg.Match(l); if (m.Success) { Console.WriteLine("[TEST] Link"); String managername = m.Groups["manager"].Value; try { // find the Consultant and putt it in his Manager Manager manager = this.Entreprise.GetManagers()[managername]; string[] consultants = m.Groups["consultantslist"].Value.Split('-'); foreach (String consultantname in consultants) { Consultant consultant = this.Entreprise.GetConsultants()[consultantname]; manager.AddConsultant(consultant); } } catch { String msgERROR = "The manager :" + managername + "in the file LinkFile.txt is not find in the Entreprise"; Console.WriteLine(msgERROR); } } } }
public Consultant(string firstname, string lastname, Manager subOf, int yearIn, string matricule, Client entreprise) : base(firstname, lastname) { this.matricule = matricule; this.yearIn = yearIn; this.subOf = subOf; subOf.AddConsultant(this); this.entreprise = entreprise; }