/DMS/Implementacion/PaucarpataSolution/PPR.Data/t_turnos.cs
http://ppp-eym.googlecode.com/ · C# · 346 lines · 302 code · 28 blank · 16 comment · 54 complexity · de06a15ad1d164a4922957754e53abd7 MD5 · raw file
- //------------------------------------------------------------------------------
- // <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.Generic;
- using System.Collections.ObjectModel;
- using System.Collections.Specialized;
- using System.ComponentModel;
- using System.Globalization;
- using System.Runtime.Serialization;
-
- namespace PPR.Data
- {
- [DataContract(IsReference = true)]
- [KnownType(typeof(dat_trab))]
- public partial class t_turnos: IObjectWithChangeTracker, INotifyPropertyChanged
- {
- #region Primitive Properties
-
- [DataMember]
- public int cod_tur
- {
- get { return _cod_tur; }
- set
- {
- if (_cod_tur != value)
- {
- if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
- {
- throw new InvalidOperationException("The property 'cod_tur' is part of the object's key and cannot be changed. Changes to key properties can only be made when the object is not being tracked or is in the Added state.");
- }
- _cod_tur = value;
- OnPropertyChanged("cod_tur");
- }
- }
- }
- private int _cod_tur;
-
- [DataMember]
- public System.TimeSpan ingreso
- {
- get { return _ingreso; }
- set
- {
- if (_ingreso != value)
- {
- _ingreso = value;
- OnPropertyChanged("ingreso");
- }
- }
- }
- private System.TimeSpan _ingreso;
-
- [DataMember]
- public System.TimeSpan salida
- {
- get { return _salida; }
- set
- {
- if (_salida != value)
- {
- _salida = value;
- OnPropertyChanged("salida");
- }
- }
- }
- private System.TimeSpan _salida;
-
- [DataMember]
- public Nullable<System.TimeSpan> tardanza
- {
- get { return _tardanza; }
- set
- {
- if (_tardanza != value)
- {
- _tardanza = value;
- OnPropertyChanged("tardanza");
- }
- }
- }
- private Nullable<System.TimeSpan> _tardanza;
-
- [DataMember]
- public Nullable<System.TimeSpan> falta
- {
- get { return _falta; }
- set
- {
- if (_falta != value)
- {
- _falta = value;
- OnPropertyChanged("falta");
- }
- }
- }
- private Nullable<System.TimeSpan> _falta;
-
- [DataMember]
- public string sabado
- {
- get { return _sabado; }
- set
- {
- if (_sabado != value)
- {
- _sabado = value;
- OnPropertyChanged("sabado");
- }
- }
- }
- private string _sabado;
-
- [DataMember]
- public string domingo
- {
- get { return _domingo; }
- set
- {
- if (_domingo != value)
- {
- _domingo = value;
- OnPropertyChanged("domingo");
- }
- }
- }
- private string _domingo;
-
- [DataMember]
- public string descripcion
- {
- get { return _descripcion; }
- set
- {
- if (_descripcion != value)
- {
- _descripcion = value;
- OnPropertyChanged("descripcion");
- }
- }
- }
- private string _descripcion;
-
- [DataMember]
- public string refrigerio
- {
- get { return _refrigerio; }
- set
- {
- if (_refrigerio != value)
- {
- _refrigerio = value;
- OnPropertyChanged("refrigerio");
- }
- }
- }
- private string _refrigerio;
-
- #endregion
- #region Navigation Properties
-
- [DataMember]
- public TrackableCollection<dat_trab> dat_trab
- {
- get
- {
- if (_dat_trab == null)
- {
- _dat_trab = new TrackableCollection<dat_trab>();
- _dat_trab.CollectionChanged += Fixupdat_trab;
- }
- return _dat_trab;
- }
- set
- {
- if (!ReferenceEquals(_dat_trab, value))
- {
- if (ChangeTracker.ChangeTrackingEnabled)
- {
- throw new InvalidOperationException("Cannot set the FixupChangeTrackingCollection when ChangeTracking is enabled");
- }
- if (_dat_trab != null)
- {
- _dat_trab.CollectionChanged -= Fixupdat_trab;
- // This is the principal end in an association that performs cascade deletes.
- // Remove the cascade delete event handler for any entities in the current collection.
- foreach (dat_trab item in _dat_trab)
- {
- ChangeTracker.ObjectStateChanging -= item.HandleCascadeDelete;
- }
- }
- _dat_trab = value;
- if (_dat_trab != null)
- {
- _dat_trab.CollectionChanged += Fixupdat_trab;
- // This is the principal end in an association that performs cascade deletes.
- // Add the cascade delete event handler for any entities that are already in the new collection.
- foreach (dat_trab item in _dat_trab)
- {
- ChangeTracker.ObjectStateChanging += item.HandleCascadeDelete;
- }
- }
- OnNavigationPropertyChanged("dat_trab");
- }
- }
- }
- private TrackableCollection<dat_trab> _dat_trab;
-
- #endregion
- #region ChangeTracking
-
- protected virtual void OnPropertyChanged(String propertyName)
- {
- if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
- {
- ChangeTracker.State = ObjectState.Modified;
- }
- if (_propertyChanged != null)
- {
- _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- protected virtual void OnNavigationPropertyChanged(String propertyName)
- {
- if (_propertyChanged != null)
- {
- _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
- private event PropertyChangedEventHandler _propertyChanged;
- private ObjectChangeTracker _changeTracker;
-
- [DataMember]
- public ObjectChangeTracker ChangeTracker
- {
- get
- {
- if (_changeTracker == null)
- {
- _changeTracker = new ObjectChangeTracker();
- _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
- }
- return _changeTracker;
- }
- set
- {
- if(_changeTracker != null)
- {
- _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
- }
- _changeTracker = value;
- if(_changeTracker != null)
- {
- _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
- }
- }
- }
-
- private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
- {
- if (e.NewState == ObjectState.Deleted)
- {
- ClearNavigationProperties();
- }
- }
-
- protected bool IsDeserializing { get; private set; }
-
- [OnDeserializing]
- public void OnDeserializingMethod(StreamingContext context)
- {
- IsDeserializing = true;
- }
-
- [OnDeserialized]
- public void OnDeserializedMethod(StreamingContext context)
- {
- IsDeserializing = false;
- ChangeTracker.ChangeTrackingEnabled = true;
- }
-
- protected virtual void ClearNavigationProperties()
- {
- dat_trab.Clear();
- }
-
- #endregion
- #region Association Fixup
-
- private void Fixupdat_trab(object sender, NotifyCollectionChangedEventArgs e)
- {
- if (IsDeserializing)
- {
- return;
- }
-
- if (e.NewItems != null)
- {
- foreach (dat_trab item in e.NewItems)
- {
- item.t_turnos = this;
- if (ChangeTracker.ChangeTrackingEnabled)
- {
- if (!item.ChangeTracker.ChangeTrackingEnabled)
- {
- item.StartTracking();
- }
- ChangeTracker.RecordAdditionToCollectionProperties("dat_trab", item);
- }
- // This is the principal end in an association that performs cascade deletes.
- // Update the event listener to refer to the new dependent.
- ChangeTracker.ObjectStateChanging += item.HandleCascadeDelete;
- }
- }
-
- if (e.OldItems != null)
- {
- foreach (dat_trab item in e.OldItems)
- {
- if (ReferenceEquals(item.t_turnos, this))
- {
- item.t_turnos = null;
- }
- if (ChangeTracker.ChangeTrackingEnabled)
- {
- ChangeTracker.RecordRemovalFromCollectionProperties("dat_trab", item);
- }
- // This is the principal end in an association that performs cascade deletes.
- // Remove the previous dependent from the event listener.
- ChangeTracker.ObjectStateChanging -= item.HandleCascadeDelete;
- }
- }
- }
-
- #endregion
- }
- }