
// requires
// /js/LpiWebservice.js
//

//
// This file contains several model classes:
// function Rbpi_Model
// function Lpi_Model
// function RbpiList_Model
// function Gemeente_Model
// function LpiList_Model
// function PlaatsModel
//

var rbpiModel;
var lpiModel;
var gemeenteModel;
var plaatsModel;
var rbpiListModel;
var lpiListModel;
var schoolModel;

AppendToWindowOnload(function()
{
    rbpiModel = new Rbpi_Model();

    lpiModel = new Lpi_Model();
    rbpiListModel = new RbpiList_Model();

    gemeenteModel = new Gemeente_Model();
    lpiListModel = new LpiList_Model();

    plaatsModel = new Plaats_Model();

    schoolModel = new School_Model();
});


/*****************************************************************************/
/*
 * Error handling
 */
function showMessage(msg)
{
//    document.getElementById('warningMessage').innerText = msg;
//    document.getElementById('warningMessage').style.display = "";
}
function hideMessage()
{
//    document.getElementById('warningMessage').style.display = "none";
}

/*****************************************************************************/
/*
 * RBPI Model
 */
function Rbpi_Model()
{
    this.ModelChangedEvent = new ApplicationEvent();
    this.ModelReloadedEvent = new ApplicationEvent();
    
    this._reset();
}

Rbpi_Model.prototype.loadFromMap = function(mapImageX, mapImageY)
{
    this._reset();
    
    WebserviceLpi_SelectRbpi(mapImageX, mapImageY, this._update.bind2(this));
}
Rbpi_Model.prototype.loadFromGuid = function(rbpiGuid)
{
    this._reset();
    
    WebserviceLpi_SelectRbpiByGuid(rbpiGuid, this._update.bind2(this));
}

Rbpi_Model.prototype._update = function(rbpiRecord)
{
    if(rbpiRecord.IsNull == "true")
    {
        if(rbpiRecord.Postcode != null && rbpiRecord.Postcode != "")
        {
            this.ModelReloadedEvent.NotifyListeners(false, "Er is geen RBPI gevonden voor postcode " + rbpiRecord.Postcode);
        }
        else
        {
            this.ModelReloadedEvent.NotifyListeners(false, null);
        }
        return;
    }
    
    this._rbpiRecord = rbpiRecord;
    this._id = rbpiRecord.LpiId;
    this.setNaam(rbpiRecord.Name);
    this.setNumber(rbpiRecord.Number);
    this.ModelReloadedEvent.NotifyListeners(true);
}

Rbpi_Model.prototype.save = function()
{
    if(this._rbpiRecord != null)
    {
        this._rbpiRecord.Name = this.getNaam();
        this._rbpiRecord.Number = this.getNumber();
    
        WebserviceLpi_UpdateLpi(this._rbpiRecord);
    }
}

Rbpi_Model.prototype._reset = function()
{
    this._rbpiRecord = null;
    this._id = "";
    this.setNaam("");
    this.setNumber("");

    this._cacheLpis = [];
    this.ModelChangedEvent.NotifyListeners('LPI');

    this._cacheGemeentes = [];
    this.ModelChangedEvent.NotifyListeners('Gemeente');

    this._cachePlaatsen = [];
    this.ModelChangedEvent.NotifyListeners('Plaats');

}

Rbpi_Model.prototype.isValid = function()
{
    return (this._id != "");
}


Rbpi_Model.prototype.getNaam = function()
{
    return this._naam;
}
Rbpi_Model.prototype.setNaam = function(naam)
{
    this._naam = naam;
    this.ModelChangedEvent.NotifyListeners('Naam');
}

Rbpi_Model.prototype.getNumber = function()
{
    return this._number;
}
Rbpi_Model.prototype.setNumber = function(number)
{
    this._number = number;
    this.ModelChangedEvent.NotifyListeners('Number');
}


Rbpi_Model.prototype.loadList = function(listId)
{
    if(this._id == "") return;
    
    switch(listId)
    {
        case 'LPI' :
            if(this._cacheLpis.length > 0) return;
            
            WebserviceLpi_ListLpisForRbpi(this._id, this._addLpi.bind2(this),
                this.ModelChangedEvent.NotifyListeners.bind2(this.ModelChangedEvent, 'LPI')
            );
            break;
        case 'Gemeente' :
            if(this._cacheGemeentes.length > 0) return;

            WebserviceLpi_ListGemeentesForRbpi(this._id, this._addGemeente.bind2(this),
                this.ModelChangedEvent.NotifyListeners.bind2(this.ModelChangedEvent, 'Gemeente')
            );

            break;
        case 'Plaats' :
            if(this._cachePlaatsen.length > 0) return;
            
            WebserviceLpi_ListPlaatsenForRbpi(this._id, this._addPlaats.bind2(this),
                this.ModelChangedEvent.NotifyListeners.bind2(this.ModelChangedEvent, 'Plaats')
            );
            break;
        default :
            throw listId + ' is unknown';
            break;        
    }
    
}

Rbpi_Model.prototype.getLpis = function()
{
    return this._cacheLpis;
}

Rbpi_Model.prototype._addLpi = function(lpi)
{
    this._cacheLpis.push(lpi); // check IE
}

Rbpi_Model.prototype.getGemeentes = function()
{
    return this._cacheGemeentes;
}

Rbpi_Model.prototype._addGemeente = function(gemeente)
{
    this._cacheGemeentes.push(gemeente);
}

Rbpi_Model.prototype.getPlaatsen = function()
{
    return this._cachePlaatsen;
}

Rbpi_Model.prototype._addPlaats = function(plaats)
{
    this._cachePlaatsen.push(plaats);
}



/*****************************************************************************/
/*
 * LPI Model
 */
function Lpi_Model()
{
    this.ModelChangedEvent = new ApplicationEvent();
    this.ModelReloadedEvent = new ApplicationEvent();
    
    this._reset();
}

Lpi_Model.prototype.loadFromMap = function(mapImageX, mapImageY)
{
    this._reset();
    
    WebserviceLpi_SelectLpi(mapImageX, mapImageY, this._update.bind2(this));
}
Lpi_Model.prototype.loadFromGuid = function(lpiGuid)
{
    this._reset();
    
    WebserviceLpi_SelectLpiByGuid(lpiGuid, this._update.bind2(this));
}
Lpi_Model.prototype._update = function(lpiRecord)
{
    if(lpiRecord.IsNull == "true")
    {
        if(lpiRecord.Postcode != null && lpiRecord.Postcode != "")
        {
            this.ModelReloadedEvent.NotifyListeners(false, "Er is geen LPI gevonden voor postcode " + lpiRecord.Postcode);
        }
        else
        {
            this.ModelReloadedEvent.NotifyListeners(false, null);
        }
        return;
    }
    this._lpiRecord = lpiRecord;
    this._id = lpiRecord.LpiId;
    this.setNaam(lpiRecord.Name);
    this.setNumber(lpiRecord.Number);
    this.setRbpi(lpiRecord.RbpiId);
    this.ModelReloadedEvent.NotifyListeners(true);
}

Lpi_Model.prototype.save = function()
{
    if(this._lpiRecord != null)
    {
        this._lpiRecord.Name = this.getNaam();
        this._lpiRecord.Number = this.getNumber();
        this._lpiRecord.RbpiId = this.getRbpi();
    
        WebserviceLpi_UpdateLpi(this._lpiRecord);
    }
}

Lpi_Model.prototype._reset = function()
{
    this._lpiRecord = null;
    this._id = "";
    this.setNaam("");
    this.setNumber("");
    this.setRbpi("");

    this._cacheGemeentes = [];
    this.ModelChangedEvent.NotifyListeners('Gemeente');

    this._cachePlaatsen = [];
    this.ModelChangedEvent.NotifyListeners('Plaats');

    this._cacheScholen = [];
    this.ModelChangedEvent.NotifyListeners('School');
}

Lpi_Model.prototype.isValid = function()
{
    return (this._id != "");
}

Lpi_Model.prototype.getNaam = function()
{
    return this._naam;
}
Lpi_Model.prototype.setNaam = function(naam)
{
    this._naam = naam;
    this.ModelChangedEvent.NotifyListeners('Naam');
}

Lpi_Model.prototype.getNumber = function()
{
    return this._number;
}
Lpi_Model.prototype.setNumber = function(number)
{
    this._number = number;
    this.ModelChangedEvent.NotifyListeners('Number');
}

Lpi_Model.prototype.getRbpi = function()
{
    return this._rbpi;
}
Lpi_Model.prototype.setRbpi = function(rbpi)
{
    this._rbpi = rbpi;
    this.ModelChangedEvent.NotifyListeners('RBPI');
}


Lpi_Model.prototype.loadList = function(listId)
{
    if(this._id == "") return;
    
    switch(listId)
    {
        case 'Gemeente' :
            if(this._cacheGemeentes.length > 0) return;

            WebserviceLpi_ListGemeentesForLpi(this._id, this._addGemeente.bind2(this),
                this.ModelChangedEvent.NotifyListeners.bind2(this.ModelChangedEvent, 'Gemeente')
            );

            break;
        case 'Plaats' :
            if(this._cachePlaatsen.length > 0) return;
            
            WebserviceLpi_ListPlaatsenForLpi(this._id, this._addPlaats.bind2(this),
                this.ModelChangedEvent.NotifyListeners.bind2(this.ModelChangedEvent, 'Plaats')
            );
            break;
        case 'School':
            if (this._cacheScholen.length > 0) return;

            WebserviceLpi_ListScholenForLpi(this._id, this._addSchools.bind2(this));
            break;
        default:
            throw listId + ' is unknown';
            break;        
    }
    
}


Lpi_Model.prototype.getGemeentes = function()
{
    return this._cacheGemeentes;
}

Lpi_Model.prototype._addGemeente = function(gemeente)
{
    this._cacheGemeentes.push(gemeente);
}

Lpi_Model.prototype.getPlaatsen = function()
{
    return this._cachePlaatsen;
}

Lpi_Model.prototype._addPlaats = function(plaats)
{
    this._cachePlaatsen.push(plaats);
}

Lpi_Model.prototype.getScholen = function()
{
    return this._cacheScholen.map(function(item) { return "<span class=\"lpi_list_school_item\" onclick=\"setActiveLpiSchoolMarker(this," + item.id + "," + item.lat + "," + item.lon + ");\">" + item.name + "</span>" });
}

Lpi_Model.prototype._addSchools = function(arrSchools)
{
    this._cacheScholen = arrSchools;
    this.ModelChangedEvent.NotifyListeners('School');

}


/*****************************************************************************/
/*
 * RBPI ListModel
 */
function RbpiList_Model()
{
    this.ModelReloadedEvent = new ApplicationEvent();
    this.rbpis = [];
}


RbpiList_Model.prototype.getRbpis = function()
{
    return this.rbpis;
}

RbpiList_Model.prototype.reload = function()
{
    this.rbpis = [];
    WebserviceLpi_ListRbpis(
        this._addRbpi.bind2(this),
        this._rbpisLoaded.bind2(this)
    );
}

RbpiList_Model.prototype._addRbpi = function(idNameObject)
{
    this.rbpis.push(idNameObject);
}

RbpiList_Model.prototype._rbpisLoaded = function()
{
    this.ModelReloadedEvent.NotifyListeners();
}



/*****************************************************************************/
/*
 * Gemeente Model
 */
function Gemeente_Model()
{
    this.ModelChangedEvent = new ApplicationEvent();
    this.ModelReloadedEvent = new ApplicationEvent();
    
    this._reset();
}

Gemeente_Model.prototype.loadFromMap = function(mapImageX, mapImageY)
{
    this._reset();
    
    WebserviceLpi_SelectGemeente(mapImageX, mapImageY, this._update.bind2(this));
}

Gemeente_Model.prototype._update = function(gemeenteRecord)
{
    if(gemeenteRecord.IsNull == "true")
    {
        if(gemeenteRecord.Postcode != null && gemeenteRecord.Postcode != "")
        {
            this.ModelReloadedEvent.NotifyListeners(false, "Er is geen LPI gevonden voor postcode " + gemeenteRecord.Postcode);
        }
        else
        {
            this.ModelReloadedEvent.NotifyListeners(false, null);
        }
        return;
    }
    
    this._gemeenteRecord = gemeenteRecord;
    this.setNaam(gemeenteRecord.Gemeente);
    this.setProvincie(gemeenteRecord.Provincie);
    this.setLpi(gemeenteRecord.LpiId);
    
    this._setLpiNames(gemeenteRecord.LpiNames.string);
    
    this.ModelReloadedEvent.NotifyListeners(true);
}

Gemeente_Model.prototype.save = function()
{
    if(this._gemeenteRecord != null)
    {
        this._gemeenteRecord.LpiId = this.getLpi();
    
        WebserviceLpi_UpdateGemeente(this._gemeenteRecord);
    }
}

Gemeente_Model.prototype._reset = function()
{
    this._gemeenteRecord = null;
    this._lpiNames = [];
    this.setNaam("");
    this.setProvincie("");
    this.setLpi("");
    this._setLpiNames([]);
    

    this._cachePlaatsen = [];
    this.ModelChangedEvent.NotifyListeners('Plaats');
}
Gemeente_Model.prototype.getLpiId = function()
{
    return this._gemeenteRecord.LpiId;
}
Gemeente_Model.prototype.isValid = function()
{
    return (this._naam != "");
}

Gemeente_Model.prototype.getNaam = function()
{
    return this._naam;
}
Gemeente_Model.prototype.setNaam = function(naam)
{
    this._naam = naam;
    this.ModelChangedEvent.NotifyListeners('Naam');
}

Gemeente_Model.prototype.getProvincie = function()
{
    return this._provincie;
}
Gemeente_Model.prototype.setProvincie = function(provincie)
{
    this._provincie = provincie;
    this.ModelChangedEvent.NotifyListeners('Provincie');
}

Gemeente_Model.prototype.getLpi = function()
{
    return this._lpi;
}
Gemeente_Model.prototype.setLpi = function(lpi)
{
    this._lpi = lpi;
    this.ModelChangedEvent.NotifyListeners('LPI');
}
Gemeente_Model.prototype.getLpiNames = function()
{
    return this._lpiNames;
}
Gemeente_Model.prototype._setLpiNames = function(arrayOrString)
{
    this._lpiNames = [];
    if(IsArray(arrayOrString))
    {
        for(var i=0; i<arrayOrString.length; i++)
        {
            this._lpiNames.push(arrayOrString[i]);
        }
    }
    else
    {
        this._lpiNames.push(arrayOrString);        
    }
    this.ModelChangedEvent.NotifyListeners('LpiNames');
}

Gemeente_Model.prototype.loadList = function(listId)
{
    if(this._id == "") return;
    
    switch(listId)
    {
        case 'Plaats' :
            if(this._cachePlaatsen.length > 0) return;
            
            WebserviceLpi_ListPlaatsenForGemeente(this.getNaam(), this._addPlaats.bind2(this),
                this.ModelChangedEvent.NotifyListeners.bind2(this.ModelChangedEvent, 'Plaats')
            );
            break;
        default :
            throw listId + ' is unknown';
            break;        
    }
    
}

Gemeente_Model.prototype.getPlaatsen = function()
{
    return this._cachePlaatsen;
}

Gemeente_Model.prototype._addPlaats = function(plaats)
{
    this._cachePlaatsen.push(plaats);
}



/*****************************************************************************/
/*
 * LPI ListModel
 */
function LpiList_Model()
{
    this.ModelReloadedEvent = new ApplicationEvent();
    this.lpis = [];
}


LpiList_Model.prototype.getLpis = function()
{
    return this.lpis;
}

LpiList_Model.prototype.reload = function()
{
    this.lbpis = [];
    WebserviceLpi_ListLpis(
        this._addLpi.bind2(this),
        this._lpisLoaded.bind2(this)
    );
}

LpiList_Model.prototype._addLpi = function(groupIdNameObject)
{
    this.lpis.push(groupIdNameObject);
}

LpiList_Model.prototype._lpisLoaded = function()
{
    this.ModelReloadedEvent.NotifyListeners();
}



/*****************************************************************************/
/*
 * Plaats Model
 */
function Plaats_Model()
{
    this.ModelChangedEvent = new ApplicationEvent();
    this.ModelReloadedEvent = new ApplicationEvent();
    
    this._reset();
}

Plaats_Model.prototype.loadFromMap = function(mapImageX, mapImageY)
{
    this._reset();
    
    WebserviceLpi_SelectPlaats(mapImageX, mapImageY, this._update.bind2(this));
}

Plaats_Model.prototype._update = function(plaatsRecord)
{
    if(plaatsRecord.IsNull == "true")
    {
        if(plaatsRecord.Postcode != null && plaatsRecord.Postcode != "")
        {
            this.ModelReloadedEvent.NotifyListeners(false, "Er is geen LPI gevonden voor postcode " + plaatsRecord.Postcode);
        }
        else
        {
            this.ModelReloadedEvent.NotifyListeners(false, null);
        }
        return;
    }
    
    this._plaatsRecord = plaatsRecord;
    this.setNaam(plaatsRecord.Plaats);
    this.setGemeente(plaatsRecord.Gemeente);
    this.setProvincie(plaatsRecord.Provincie);
    this.setLpi(plaatsRecord.LpiId);
    this._setLpiNames(plaatsRecord.LpiNames.string);
    
    this.ModelReloadedEvent.NotifyListeners(true);
}

Plaats_Model.prototype.save = function()
{
    if(this._plaatsRecord != null)
    {
        this._plaatsRecord.LpiId = this.getLpi();
    
        WebserviceLpi_UpdatePlaats(this._plaatsRecord);
    }
}

Plaats_Model.prototype._reset = function()
{
    this._plaatsRecord = null;
    this._lpiNames = [];
    this.setNaam("");
    this.setGemeente("");
    this.setProvincie("");
    this.setLpi("");
    this._setLpiNames([]);
}

Plaats_Model.prototype.isValid = function()
{
    return (this._naam != "");
}

Plaats_Model.prototype.getNaam = function()
{
    return this._naam;
}
Plaats_Model.prototype.setNaam = function(naam)
{
    this._naam = naam;
    this.ModelChangedEvent.NotifyListeners('Naam');
}

Plaats_Model.prototype.getGemeente = function()
{
    return this._gemeente;
}
Plaats_Model.prototype.setGemeente = function(gemeente)
{
    this._gemeente = gemeente;
    this.ModelChangedEvent.NotifyListeners('Gemeente');
}

Plaats_Model.prototype.getProvincie = function()
{
    return this._provincie;
}
Plaats_Model.prototype.setProvincie = function(provincie)
{
    this._provincie = provincie;
    this.ModelChangedEvent.NotifyListeners('Provincie');
}

Plaats_Model.prototype.getLpiId = function()
{
    return this._plaatsRecord.LpiId;
}
Plaats_Model.prototype.getLpi = function()
{
    return this._lpi;
}
Plaats_Model.prototype.setLpi = function(lpi)
{
    this._lpi = lpi;
    this.ModelChangedEvent.NotifyListeners('LPI');
}
Plaats_Model.prototype.getLpiNames = function()
{
    return this._lpiNames;
}
Plaats_Model.prototype._setLpiNames = function(arrayOrString)
{
    this._lpiNames = [];
    if(IsArray(arrayOrString))
    {
        for(var i=0; i<arrayOrString.length; i++)
        {
            this._lpiNames.push(arrayOrString[i]);
        }
    }
    else
    {
        this._lpiNames.push(arrayOrString);        
    }
    this.ModelChangedEvent.NotifyListeners('LpiNames');
}



/*****************************************************************************/
/*
* School Model
*/
function School_Model()
{
    this.ModelChangedEvent = new ApplicationEvent();
    this.ModelReloadedEvent = new ApplicationEvent();
    this.MarkerChanged = new ApplicationEvent();

    this._reset();
}

School_Model.prototype.addNew = function()
{
    this._reset();
    this._update(
        {
                Id : null,
                Naam : "",
                Adres : "",
                Postcode : "",
                Plaats : "",
                WebsiteUrl : "",
                Programmas : [],
                Niveau : "0",
                Notities : ""
        }
    );
}
School_Model.prototype.loadFromId = function(id)
{
    this._reset();
    WebserviceLpi_SelectSchoolById(id, this._update.bind2(this));
}
/*
School_Model.prototype.loadFromMap = function(mapImageX, mapImageY)
{
    this._reset();

    WebserviceLpi_SelectSchool(mapImageX, mapImageY, this._update.bind2(this));
}
*/

School_Model.prototype._update = function(schoolRecord)
{
    if (schoolRecord.IsNull == "true")
    {
        this.ModelReloadedEvent.NotifyListeners(false, null);
        return;
    }

    this._schoolRecord = schoolRecord;
    this._id = schoolRecord.Id;
    this.setNaam(schoolRecord.Naam);
    this.setAdres(schoolRecord.Adres);
    this.setPostcode(schoolRecord.Postcode);
    this.setPlaats(schoolRecord.Plaats);
    this.setWebsiteUrl(schoolRecord.WebsiteUrl);
    this.setProgrammas(schoolRecord.Programmas);
    this.setNiveau(schoolRecord.Niveau);
    this.setNotities(schoolRecord.Notities);
    this.ModelReloadedEvent.NotifyListeners(true);
}

School_Model.prototype.save = function()
{
    if (this._schoolRecord != null)
    {
        this._schoolRecord.Naam = this.getNaam();
        this._schoolRecord.Adres = this.getAdres();
        this._schoolRecord.Postcode = this.getPostcode();
        this._schoolRecord.WebsiteUrl = this.getWebsiteUrl();
        this._schoolRecord.Niveau = this.getNiveau();
        this._schoolRecord.Programmas = this.getProgrammas();
        this._schoolRecord.Notities = this.getNotities();
    
        WebserviceLpi_UpdateSchool(this._schoolRecord, this._afterSave.bind(this));
    }
}

School_Model.prototype.deleteSchool = function()
{
    WebserviceLpi_DeleteSchool(this._schoolRecord.Id);
    this._reset();
}


School_Model.prototype._afterSave = function(schoolLocationData)
{
    this._schoolRecord.Id = schoolLocationData[0];
    this._id = schoolLocationData[0];

    this.setPlaats(schoolLocationData[4]);
    this.MarkerChanged.NotifyListeners(schoolLocationData[0], schoolLocationData[1], schoolLocationData[2], schoolLocationData[3]);
}

School_Model.prototype._reset = function()
{
    this._schoolRecord = null;
    this.setNaam("");
    this.setAdres("");
    this.setPostcode("");
    this.setPlaats("");
    this.setWebsiteUrl("");
    this.setProgrammas([]);
    this.setNiveau("");
    this.setNotities("");
}

School_Model.prototype.isValid = function()
{
    return (this._schoolRecord != null);
}
School_Model.prototype.isNew = function()
{
    return this.isValid() && (this._schoolRecord == null || this._schoolRecord.Id == null);
}
School_Model.prototype.getId = function()
{
    return this._schoolRecord.Id;
}
School_Model.prototype.getNaam = function()
{
    return this._naam;
}
School_Model.prototype.setNaam = function(naam, supressModelChangedEvent)
{
    this._naam = naam;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Naam');
}

School_Model.prototype.getAdres = function()
{
    return this._adres;
}
School_Model.prototype.setAdres = function(adres, supressModelChangedEvent)
{
    this._adres = adres;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Adres');
}

School_Model.prototype.getPostcode = function()
{
    return this._postcode;
}
School_Model.prototype.setPostcode = function(postcode, supressModelChangedEvent)
{
    this._postcode = postcode;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Postcode');
}


School_Model.prototype.getPlaats = function()
{
    return this._plaats;
}
School_Model.prototype.setPlaats = function(plaats, supressModelChangedEvent)
{
    this._plaats = plaats;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Plaats');
}

School_Model.prototype.getWebsiteUrl = function()
{
    return this._websiteUrl;
}
School_Model.prototype.setWebsiteUrl = function(websiteUrl, supressModelChangedEvent)
{
    this._websiteUrl = websiteUrl;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('WebsiteUrl');
}

School_Model.prototype.getProgrammas = function()
{
    return this._programmas;
}
School_Model.prototype.setProgrammas = function(programmas, supressModelChangedEvent)
{
    if(Object.isArray(programmas))
    {
        this._programmas = programmas;
    }
    else if(programmas == "")
    {
        this._programmas = [];
    }
    else
    {
        this._programmas = $A(programmas);
    }

    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Programmas');
}

School_Model.prototype.getNiveau = function()
{
    return this._niveau;
}
School_Model.prototype.setNiveau = function(niveau, supressModelChangedEvent)
{
    this._niveau = niveau;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Niveau');
}


School_Model.prototype.getNotities = function()
{
    return this._notities;
}
School_Model.prototype.setNotities = function(notities, supressModelChangedEvent)
{
    this._notities = notities;
    if(!supressModelChangedEvent) this.ModelChangedEvent.NotifyListeners('Notities');
}

