/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

  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated from a template.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.Collections.Specialized;
  13. using System.ComponentModel;
  14. using System.Globalization;
  15. using System.Runtime.Serialization;
  16. namespace PPR.Data
  17. {
  18. [DataContract(IsReference = true)]
  19. [KnownType(typeof(dat_trab))]
  20. public partial class t_turnos: IObjectWithChangeTracker, INotifyPropertyChanged
  21. {
  22. #region Primitive Properties
  23. [DataMember]
  24. public int cod_tur
  25. {
  26. get { return _cod_tur; }
  27. set
  28. {
  29. if (_cod_tur != value)
  30. {
  31. if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
  32. {
  33. 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.");
  34. }
  35. _cod_tur = value;
  36. OnPropertyChanged("cod_tur");
  37. }
  38. }
  39. }
  40. private int _cod_tur;
  41. [DataMember]
  42. public System.TimeSpan ingreso
  43. {
  44. get { return _ingreso; }
  45. set
  46. {
  47. if (_ingreso != value)
  48. {
  49. _ingreso = value;
  50. OnPropertyChanged("ingreso");
  51. }
  52. }
  53. }
  54. private System.TimeSpan _ingreso;
  55. [DataMember]
  56. public System.TimeSpan salida
  57. {
  58. get { return _salida; }
  59. set
  60. {
  61. if (_salida != value)
  62. {
  63. _salida = value;
  64. OnPropertyChanged("salida");
  65. }
  66. }
  67. }
  68. private System.TimeSpan _salida;
  69. [DataMember]
  70. public Nullable<System.TimeSpan> tardanza
  71. {
  72. get { return _tardanza; }
  73. set
  74. {
  75. if (_tardanza != value)
  76. {
  77. _tardanza = value;
  78. OnPropertyChanged("tardanza");
  79. }
  80. }
  81. }
  82. private Nullable<System.TimeSpan> _tardanza;
  83. [DataMember]
  84. public Nullable<System.TimeSpan> falta
  85. {
  86. get { return _falta; }
  87. set
  88. {
  89. if (_falta != value)
  90. {
  91. _falta = value;
  92. OnPropertyChanged("falta");
  93. }
  94. }
  95. }
  96. private Nullable<System.TimeSpan> _falta;
  97. [DataMember]
  98. public string sabado
  99. {
  100. get { return _sabado; }
  101. set
  102. {
  103. if (_sabado != value)
  104. {
  105. _sabado = value;
  106. OnPropertyChanged("sabado");
  107. }
  108. }
  109. }
  110. private string _sabado;
  111. [DataMember]
  112. public string domingo
  113. {
  114. get { return _domingo; }
  115. set
  116. {
  117. if (_domingo != value)
  118. {
  119. _domingo = value;
  120. OnPropertyChanged("domingo");
  121. }
  122. }
  123. }
  124. private string _domingo;
  125. [DataMember]
  126. public string descripcion
  127. {
  128. get { return _descripcion; }
  129. set
  130. {
  131. if (_descripcion != value)
  132. {
  133. _descripcion = value;
  134. OnPropertyChanged("descripcion");
  135. }
  136. }
  137. }
  138. private string _descripcion;
  139. [DataMember]
  140. public string refrigerio
  141. {
  142. get { return _refrigerio; }
  143. set
  144. {
  145. if (_refrigerio != value)
  146. {
  147. _refrigerio = value;
  148. OnPropertyChanged("refrigerio");
  149. }
  150. }
  151. }
  152. private string _refrigerio;
  153. #endregion
  154. #region Navigation Properties
  155. [DataMember]
  156. public TrackableCollection<dat_trab> dat_trab
  157. {
  158. get
  159. {
  160. if (_dat_trab == null)
  161. {
  162. _dat_trab = new TrackableCollection<dat_trab>();
  163. _dat_trab.CollectionChanged += Fixupdat_trab;
  164. }
  165. return _dat_trab;
  166. }
  167. set
  168. {
  169. if (!ReferenceEquals(_dat_trab, value))
  170. {
  171. if (ChangeTracker.ChangeTrackingEnabled)
  172. {
  173. throw new InvalidOperationException("Cannot set the FixupChangeTrackingCollection when ChangeTracking is enabled");
  174. }
  175. if (_dat_trab != null)
  176. {
  177. _dat_trab.CollectionChanged -= Fixupdat_trab;
  178. // This is the principal end in an association that performs cascade deletes.
  179. // Remove the cascade delete event handler for any entities in the current collection.
  180. foreach (dat_trab item in _dat_trab)
  181. {
  182. ChangeTracker.ObjectStateChanging -= item.HandleCascadeDelete;
  183. }
  184. }
  185. _dat_trab = value;
  186. if (_dat_trab != null)
  187. {
  188. _dat_trab.CollectionChanged += Fixupdat_trab;
  189. // This is the principal end in an association that performs cascade deletes.
  190. // Add the cascade delete event handler for any entities that are already in the new collection.
  191. foreach (dat_trab item in _dat_trab)
  192. {
  193. ChangeTracker.ObjectStateChanging += item.HandleCascadeDelete;
  194. }
  195. }
  196. OnNavigationPropertyChanged("dat_trab");
  197. }
  198. }
  199. }
  200. private TrackableCollection<dat_trab> _dat_trab;
  201. #endregion
  202. #region ChangeTracking
  203. protected virtual void OnPropertyChanged(String propertyName)
  204. {
  205. if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
  206. {
  207. ChangeTracker.State = ObjectState.Modified;
  208. }
  209. if (_propertyChanged != null)
  210. {
  211. _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
  212. }
  213. }
  214. protected virtual void OnNavigationPropertyChanged(String propertyName)
  215. {
  216. if (_propertyChanged != null)
  217. {
  218. _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
  219. }
  220. }
  221. event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
  222. private event PropertyChangedEventHandler _propertyChanged;
  223. private ObjectChangeTracker _changeTracker;
  224. [DataMember]
  225. public ObjectChangeTracker ChangeTracker
  226. {
  227. get
  228. {
  229. if (_changeTracker == null)
  230. {
  231. _changeTracker = new ObjectChangeTracker();
  232. _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
  233. }
  234. return _changeTracker;
  235. }
  236. set
  237. {
  238. if(_changeTracker != null)
  239. {
  240. _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
  241. }
  242. _changeTracker = value;
  243. if(_changeTracker != null)
  244. {
  245. _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
  246. }
  247. }
  248. }
  249. private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
  250. {
  251. if (e.NewState == ObjectState.Deleted)
  252. {
  253. ClearNavigationProperties();
  254. }
  255. }
  256. protected bool IsDeserializing { get; private set; }
  257. [OnDeserializing]
  258. public void OnDeserializingMethod(StreamingContext context)
  259. {
  260. IsDeserializing = true;
  261. }
  262. [OnDeserialized]
  263. public void OnDeserializedMethod(StreamingContext context)
  264. {
  265. IsDeserializing = false;
  266. ChangeTracker.ChangeTrackingEnabled = true;
  267. }
  268. protected virtual void ClearNavigationProperties()
  269. {
  270. dat_trab.Clear();
  271. }
  272. #endregion
  273. #region Association Fixup
  274. private void Fixupdat_trab(object sender, NotifyCollectionChangedEventArgs e)
  275. {
  276. if (IsDeserializing)
  277. {
  278. return;
  279. }
  280. if (e.NewItems != null)
  281. {
  282. foreach (dat_trab item in e.NewItems)
  283. {
  284. item.t_turnos = this;
  285. if (ChangeTracker.ChangeTrackingEnabled)
  286. {
  287. if (!item.ChangeTracker.ChangeTrackingEnabled)
  288. {
  289. item.StartTracking();
  290. }
  291. ChangeTracker.RecordAdditionToCollectionProperties("dat_trab", item);
  292. }
  293. // This is the principal end in an association that performs cascade deletes.
  294. // Update the event listener to refer to the new dependent.
  295. ChangeTracker.ObjectStateChanging += item.HandleCascadeDelete;
  296. }
  297. }
  298. if (e.OldItems != null)
  299. {
  300. foreach (dat_trab item in e.OldItems)
  301. {
  302. if (ReferenceEquals(item.t_turnos, this))
  303. {
  304. item.t_turnos = null;
  305. }
  306. if (ChangeTracker.ChangeTrackingEnabled)
  307. {
  308. ChangeTracker.RecordRemovalFromCollectionProperties("dat_trab", item);
  309. }
  310. // This is the principal end in an association that performs cascade deletes.
  311. // Remove the previous dependent from the event listener.
  312. ChangeTracker.ObjectStateChanging -= item.HandleCascadeDelete;
  313. }
  314. }
  315. }
  316. #endregion
  317. }
  318. }