-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSeccion.cpp
149 lines (126 loc) · 3.63 KB
/
Seccion.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include "Seccion.h"
#include "OfertaLaboral.h"
#include "String.h"
#include "ManejadorEstudiante.h"
#include "collections/List.h"
#include "collections/OrderedDictionary.h"
#include "ManejadorOfertaLaboral.h"
Seccion::Seccion()
{
this->nombre = '\0';
this->interno = '\0';
this->sucursal = NULL;
this->encargado = NULL;
this->observers = new List();
this->ofertasLaborales = new OrderedDictionary();
}
Seccion::Seccion(string nombre, string interno, Sucursal *sucursal)
{
this->nombre = nombre;
this->interno = interno;
if (this->sucursal != NULL)
this->sucursal = sucursal;
else
this->sucursal = NULL;
this->encargado = NULL;
this->observers = new List();
this->ofertasLaborales = new OrderedDictionary();
}
Seccion::Seccion(const Seccion &s)
{
this->nombre = s.nombre;
this->interno = s.interno;
this->sucursal = s.sucursal;
this->encargado = s.encargado;
this->observers = s.observers;
this->ofertasLaborales = s.ofertasLaborales;
}
string Seccion::getNombre()
{
return this->nombre;
}
string Seccion::getInterno()
{
return this->interno;
}
Sucursal* Seccion::getSucursal()
{
return this->sucursal;
}
Encargado* Seccion::getEncargado()
{
return this->encargado;
}
IDictionary *Seccion::getOfertasLaborales()
{
return this->ofertasLaborales;
}
void Seccion::setNombre(string nombre)
{
this->nombre = nombre;
}
void Seccion::setInterno(string interno)
{
this->interno = interno;
}
void Seccion::setEncargado(Encargado* encargado)
{
this->encargado = encargado;
}
void Seccion::setSucursal(Sucursal *sucursal)
{
this->sucursal = sucursal;
}
DataSeccion *Seccion::getDataSeccion()
{
DataEncargado *de = this->encargado->getDataEncargado();
return new DataSeccion(this->nombre, this->interno, de, this->sucursal,
this->observers, this->ofertasLaborales);
}
DataEmpresa *Seccion::getDataEmpresa()
{
return this->sucursal->getDataEmpresa();
}
OfertaLaboral *Seccion::addOferta(string numExpediente, string titulo, string descripcion, int cantidadHorasSemanales, Rango *rangoSalarial, Date *fechaComienzo, Date *fechaFin, int cantidadPuestosNecesarios, IDictionary *asignaturas)
{
//Debo llamar al constructor de OfertaLaboral
//con los datos de la oferta pasados como parametros
//y de alguna manera asociar esta nueva oferta a las asignaturas pasadas en el set.
OfertaLaboral *oferta = new OfertaLaboral(numExpediente, titulo, descripcion, cantidadHorasSemanales, rangoSalarial, fechaComienzo, fechaFin, cantidadPuestosNecesarios, asignaturas);
String *numExp = new String(numExpediente.c_str());
this->ofertasLaborales->add(numExp,oferta);
ManejadorOfertaLaboral *mol = ManejadorOfertaLaboral::getInstance();
IDictionary *ofertas = mol->getOfertasLaborales();
ofertas->add(numExp, oferta);
ManejadorEstudiante* mEstu = ManejadorEstudiante::getInstance();
//Se notifica a los observadores
IIterator * it = this->observers->getIterator();
while(it->hasCurrent())
{
Estudiante *student;
if( (student = dynamic_cast<Estudiante*> (it->getCurrent())) != NULL )
{
if(mEstu->EstudianteCumpleRequisitos(student, asignaturas))
{
student->enviarMail(numExpediente);
}
} else
{
throw "Seccion -> El objeto no es de la clase Estudiante.";
}
it->next();
}
delete it;
return oferta;
}
void Seccion::addObserver(IObserver *obs)
{
this->observers->add(obs);
}
void Seccion::removeObserver(IObserver *obs)
{
this->observers->remove(obs);
}
Seccion::~Seccion()
{
}