/Docs/07-Implementacion/Source/trunk/EDUAR_Regular/EDUAR/EDUAR_BusinessLogic/Common/BLReunion.cs
http://blpm.googlecode.com/ · C# · 183 lines · 151 code · 14 blank · 18 comment · 12 complexity · ba24ab3cfabf7c0bb5b9efd1176856fb MD5 · raw file
- using System;
- using System.Collections.Generic;
- using EDUAR_BusinessLogic.Shared;
- using EDUAR_DataAccess.Common;
- using EDUAR_DataAccess.Shared;
- using EDUAR_Entities;
- using EDUAR_Entities.Shared;
- using EDUAR_Utility.Enumeraciones;
- using EDUAR_Utility.Excepciones;
-
- namespace EDUAR_BusinessLogic.Common
- {
- public class BLReunion : BusinessLogicBase<Reunion, DAReunion>
- {
- #region --[Constante]--
- private const string ClassName = "BLReunion";
- #endregion
-
- #region --[Constructores]--
- /// <summary>
- /// Constructor con DTO como parámetro.
- /// </summary>
- public BLReunion(DTBase objReunion)
- {
- Data = (Reunion)objReunion;
- }
- /// <summary>
- /// Constructor vacio
- /// </summary>
- public BLReunion()
- {
- Data = new Reunion();
- }
- #endregion
-
- #region --[Propiedades Override]--
- protected override sealed DAReunion DataAcces
- {
- get { return dataAcces; }
- set { dataAcces = value; }
- }
-
- public override sealed Reunion Data
- {
- get { return data; }
- set { data = value; }
- }
-
- public override string FieldId
- {
- get { return DataAcces.FieldID; }
- }
-
- public override string FieldDescription
- {
- get { return DataAcces.FieldDescription; }
- }
-
- /// <summary>
- /// Gets the by id.
- /// </summary>
- public override void GetById()
- {
- try
- {
- Data = DataAcces.GetById(Data);
- }
- catch (CustomizedException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new CustomizedException(string.Format("Fallo en {0} - GetById", ClassName), ex,
- enuExceptionType.BusinessLogicException);
- }
- }
-
- /// <summary>
- /// Método que guarda el registro actualmente cargado en memoria. No importa si se trata de una alta o modificación.
- /// </summary>
- public override void Save()
- {
- try
- {
- //Abre la transaccion que se va a utilizar
- DataAcces.Transaction.OpenTransaction();
- int idReunion = 0;
-
- if (Data.idReunion == 0)
- DataAcces.Create(Data, out idReunion);
- else
- DataAcces.Update(Data);
-
- //Se da el OK para la transaccion.
- DataAcces.Transaction.CommitTransaction();
- }
- catch (CustomizedException ex)
- {
- if (DataAcces != null && DataAcces.Transaction != null)
- DataAcces.Transaction.RollbackTransaction();
- throw ex;
- }
- catch (Exception ex)
- {
- if (DataAcces != null && DataAcces.Transaction != null)
- DataAcces.Transaction.RollbackTransaction();
- throw new CustomizedException(string.Format("Fallo en {0} - Save()", ClassName), ex,
- enuExceptionType.BusinessLogicException);
- }
- }
-
- /// <summary>
- /// Método que guarda el registro actualmente cargado en memoria. No importa si se trata de una alta o modificación.
- /// </summary>
- public override void Save(DATransaction objDATransaction)
- {
- try
- {
- //Si no viene el Id es porque se esta creando la entidad
- DataAcces = new DAReunion(objDATransaction);
- if (Data.idReunion == 0)
- DataAcces.Create(Data);
- else
- {
- DataAcces.Update(Data);
- }
- }
- catch (CustomizedException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new CustomizedException(string.Format("Fallo en {0} - Save()", ClassName), ex,
- enuExceptionType.BusinessLogicException);
- }
- }
-
- public override void Delete()
- {
- throw new NotImplementedException();
- }
-
- public override void Delete(DATransaction objDATransaction)
- {
- try
- {
- DataAcces = new DAReunion(objDATransaction);
- DataAcces.Delete(Data);
- }
- catch (CustomizedException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new CustomizedException(string.Format("Fallo en {0} - Delete()", ClassName), ex,
- enuExceptionType.BusinessLogicException);
- }
- }
- #endregion
-
- #region --[Métodos publicos]--
- public List<Reunion> GetReuniones(Reunion entidad)
- {
- try
- {
- return DataAcces.GetReuniones(entidad);
- }
- catch (CustomizedException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new CustomizedException(string.Format("Fallo en {0} - GetReunions", ClassName), ex,
- enuExceptionType.BusinessLogicException);
- }
- }
- #endregion
- }
- }