//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
namespace Modelo
{
public partial class RESERVA
{
#region Primitive Properties
public virtual int ID_RESERVA
{
get;
set;
}
public virtual int IDCLIENTE
{
get { return _iDCLIENTE; }
set
{
if (_iDCLIENTE != value)
{
if (CLIENTE != null && CLIENTE.IDCLIENTE != value)
{
CLIENTE = null;
}
_iDCLIENTE = value;
}
}
}
private int _iDCLIENTE;
public virtual Nullable<int> DIA_RESERVA
{
get;
set;
}
public virtual Nullable<int> ANO_RESERVA
{
get;
set;
}
public virtual Nullable<int> MES_RESERVA
{
get;
set;
}
public virtual Nullable<int> PERSONAS_RES
{
get;
set;
}
public virtual Nullable<int> GARANTIA
{
get;
set;
}
public virtual Nullable<int> NUMERO_BOLETA
{
get;
set;
}
public virtual string ACOTACION
{
get;
set;
}
public virtual Nullable<bool> RESERVA_EFECTIVA
{
get;
set;
}
public virtual Nullable<int> HORA_INICIO_RESERVA
{
get;
set;
}
public virtual Nullable<int> MINUTO_INICIO_RESERVA
{
get;
set;
}
public virtual Nullable<int> HORA_FIN_RESERVA
{
get;
set;
}
public virtual Nullable<int> MINUTO_FIN_RESERVA
{
get;
set;
}
#endregion
#region Navigation Properties
public virtual CLIENTE CLIENTE
{
get { return _cLIENTE; }
set
{
if (!ReferenceEquals(_cLIENTE, value))
{
var previousValue = _cLIENTE;
_cLIENTE = value;
FixupCLIENTE(previousValue);
}
}
}
private CLIENTE _cLIENTE;
public virtual ICollection<DETALLE_PLATOS_RESERVA> DETALLE_PLATOS_RESERVA
{
get
{
if (_dETALLE_PLATOS_RESERVA == null)
{
var newCollection
= new FixupCollection
<DETALLE_PLATOS_RESERVA
>(); newCollection.CollectionChanged += FixupDETALLE_PLATOS_RESERVA;
_dETALLE_PLATOS_RESERVA = newCollection;
}
return _dETALLE_PLATOS_RESERVA;
}
set
{
if (!ReferenceEquals(_dETALLE_PLATOS_RESERVA, value))
{
var previousValue = _dETALLE_PLATOS_RESERVA as FixupCollection<DETALLE_PLATOS_RESERVA>;
if (previousValue != null)
{
previousValue.CollectionChanged -= FixupDETALLE_PLATOS_RESERVA;
}
_dETALLE_PLATOS_RESERVA = value;
var newValue = value as FixupCollection<DETALLE_PLATOS_RESERVA>;
if (newValue != null)
{
newValue.CollectionChanged += FixupDETALLE_PLATOS_RESERVA;
}
}
}
}
private ICollection<DETALLE_PLATOS_RESERVA> _dETALLE_PLATOS_RESERVA;
public virtual ICollection<VISTA_RESERVA> VISTA_RESERVA
{
get
{
if (_vISTA_RESERVA == null)
{
var newCollection
= new FixupCollection
<VISTA_RESERVA
>(); newCollection.CollectionChanged += FixupVISTA_RESERVA;
_vISTA_RESERVA = newCollection;
}
return _vISTA_RESERVA;
}
set
{
if (!ReferenceEquals(_vISTA_RESERVA, value))
{
var previousValue = _vISTA_RESERVA as FixupCollection<VISTA_RESERVA>;
if (previousValue != null)
{
previousValue.CollectionChanged -= FixupVISTA_RESERVA;
}
_vISTA_RESERVA = value;
var newValue = value as FixupCollection<VISTA_RESERVA>;
if (newValue != null)
{
newValue.CollectionChanged += FixupVISTA_RESERVA;
}
}
}
}
private ICollection<VISTA_RESERVA> _vISTA_RESERVA;
public virtual ICollection<MESA> MESA
{
get
{
if (_mESA == null)
{
var newCollection
= new FixupCollection
<MESA
>(); newCollection.CollectionChanged += FixupMESA;
_mESA = newCollection;
}
return _mESA;
}
set
{
if (!ReferenceEquals(_mESA, value))
{
var previousValue = _mESA as FixupCollection<MESA>;
if (previousValue != null)
{
previousValue.CollectionChanged -= FixupMESA;
}
_mESA = value;
var newValue = value as FixupCollection<MESA>;
if (newValue != null)
{
newValue.CollectionChanged += FixupMESA;
}
}
}
}
private ICollection<MESA> _mESA;
#endregion
#region Association Fixup
private void FixupCLIENTE(CLIENTE previousValue)
{
if (previousValue != null && previousValue.RESERVA.Contains(this))
{
previousValue.RESERVA.Remove(this);
}
if (CLIENTE != null)
{
if (!CLIENTE.RESERVA.Contains(this))
{
CLIENTE.RESERVA.Add(this);
}
if (IDCLIENTE != CLIENTE.IDCLIENTE)
{
IDCLIENTE = CLIENTE.IDCLIENTE;
}
}
}
private void FixupDETALLE_PLATOS_RESERVA(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null)
{
foreach (DETALLE_PLATOS_RESERVA item in e.NewItems)
{
item.RESERVA = this;
}
}
if (e.OldItems != null)
{
foreach (DETALLE_PLATOS_RESERVA item in e.OldItems)
{
if (ReferenceEquals(item.RESERVA, this))
{
item.RESERVA = null;
}
}
}
}
private void FixupVISTA_RESERVA(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null)
{
foreach (VISTA_RESERVA item in e.NewItems)
{
item.RESERVA = this;
}
}
if (e.OldItems != null)
{
foreach (VISTA_RESERVA item in e.OldItems)
{
if (ReferenceEquals(item.RESERVA, this))
{
item.RESERVA = null;
}
}
}
}
private void FixupMESA(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null)
{
foreach (MESA item in e.NewItems)
{
if (!item.RESERVA.Contains(this))
{
item.RESERVA.Add(this);
}
}
}
if (e.OldItems != null)
{
foreach (MESA item in e.OldItems)
{
if (item.RESERVA.Contains(this))
{
item.RESERVA.Remove(this);
}
}
}
}
#endregion
}
}