コード例 #1
0
 public Consultant(string firstname, string lastname, int salary, string company, Manager manager, Consultation consultation) : base(firstname, lastname, salary, company)
 {
     this.consultation = consultation;
     this.manager      = manager;
     this.AddConsultation(consultation);
     this.salaryYear = salary;
 }
コード例 #2
0
        public void GetReport(string company, string year, string path)
        {
            string report = "";

            foreach (Consultant consult in consultants)
            {
                Consultation consultation = consult.GetConsultation();

                if (consultation.GetClient().Name == company)
                {
                    report += String.Format("{0} {1}:\n", consult.Lastname, consult.Firstname);
                    report += "     *Client : " + consult.GetClient().Name + "\n";
                    report += "     *Periode : " + consult.GetConsultation().StartPeriode + "-" +
                              consult.GetConsultation().EndPeriode + "\n";
                }
            }

            try
            {
                //Pass the filepath and filename to the StreamWriter Constructor
                StreamWriter sw = new StreamWriter(path + @"\DRH_Report_" + year + ".txt");

                //Write a line of text
                sw.WriteLine(report);

                //Close the file
                sw.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
            finally
            {
                Console.WriteLine("[Console] Le rapport du Directeur des ressources humaines a été généré\n");
            }
        }
コード例 #3
0
 public void AddConsultation(Consultation consult)
 {
     listConsultation.Add(consult);
 }