1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
Class SalarieRh
{
# Propriétés
[string] $matriculeRh
[string] $nomRh
[string] $prenomRh
[string] $nomPrenomRh
[string] $qualificationRh
[string] $numServiceRh
[string] $serviceRh
# Constructeur
SalarieRh([string] $ligne, [string] $colonne){
# Ouverture du fichier RH
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $true
$excel.DisplayAlerts = $false
$workbook = $excel.Workbook.open("../fichierRH/*")
$worksheet = $workbook.Worksheets.item("Feuil1")
$worksheet.Activate()
# Instanciation des propriétés
$this.matricule = $worksheet.Cells.Item($ligne, $colonne).Value()
$this.nomRh = $worksheet.Cells.Item($ligne, ($colonne + 1)).Value()
$this.prenomRh = $worksheet.Cells.Item($ligne, ($colonne + 2)).Value()
$this.nomPrenomRh = $worksheet.Cells.Item($ligne, ($colonne + 3)).Value()
$this.qualificationRh = $worksheet.Cells.Item($ligne, ($colonne + 5)).Value()
$this.numServiceRh = $worksheet.Cells.Item($ligne, ($colonne + 6)).Value()
$this.serviceRh = $worksheet.Cells.Item($ligne, ($colonne + 7)).Value()
# Fermeture du fichier RH
$excel.Quit()
}
# Accesseurs
[string] GetMatriculeRh($matriculeRh){
return $matriculeRh
}
[string] GetNomRh($nomRh){
return $nomRh
}
[string] GetPrenomRh($prenomRh){
return $prenomRh
}
[string] GetNomPrenomRh($nomPrenomRh){
return $nomPrenomRh
}
[string] GetQualificationRh($qualificationRh){
return $qualificationRh
}
[string] GetNumService($numServiceRh){
return $numServiceRh
}
[string] GetServiceRh($serviceRh){
return $serviceRh
}
[string] ToString($matriculeRh, $nomRh, $prenomRh, $nomPrenomRh, $qualificationRh, $numServiceRh, $serviceRh){
return "Salarié : Matricule = " + $matriculeRh + " ; Nom = " + $nomRh + " ; Prénom = " + $prenomRh + " ; NomPrénom = " + $nomPrenomRh + " ; Qualification = " + $qualificationRh + " ; numéroService = " + $numServiceRh + " ; Service = " + $serviceRh
}
} |
Partager