PageRenderTime 41ms CodeModel.GetById 16ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 1ms

/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
  1using System;
  2using System.Collections.Generic;
  3using EDUAR_BusinessLogic.Shared;
  4using EDUAR_DataAccess.Common;
  5using EDUAR_DataAccess.Shared;
  6using EDUAR_Entities;
  7using EDUAR_Entities.Shared;
  8using EDUAR_Utility.Enumeraciones;
  9using EDUAR_Utility.Excepciones;
 10
 11namespace EDUAR_BusinessLogic.Common
 12{
 13    public class BLReunion : BusinessLogicBase<Reunion, DAReunion>
 14    {
 15        #region --[Constante]--
 16        private const string ClassName = "BLReunion";
 17        #endregion
 18
 19        #region --[Constructores]--
 20        /// <summary>
 21        /// Constructor con DTO como parámetro.
 22        /// </summary>
 23        public BLReunion(DTBase objReunion)
 24        {
 25            Data = (Reunion)objReunion;
 26        }
 27        /// <summary>
 28        /// Constructor vacio
 29        /// </summary>
 30        public BLReunion()
 31        {
 32            Data = new Reunion();
 33        }
 34        #endregion
 35
 36        #region --[Propiedades Override]--
 37        protected override sealed DAReunion DataAcces
 38        {
 39            get { return dataAcces; }
 40            set { dataAcces = value; }
 41        }
 42
 43        public override sealed Reunion Data
 44        {
 45            get { return data; }
 46            set { data = value; }
 47        }
 48
 49        public override string FieldId
 50        {
 51            get { return DataAcces.FieldID; }
 52        }
 53
 54        public override string FieldDescription
 55        {
 56            get { return DataAcces.FieldDescription; }
 57        }
 58
 59        /// <summary>
 60        /// Gets the by id.
 61        /// </summary>
 62        public override void GetById()
 63        {
 64            try
 65            {
 66                Data = DataAcces.GetById(Data);
 67            }
 68            catch (CustomizedException ex)
 69            {
 70                throw ex;
 71            }
 72            catch (Exception ex)
 73            {
 74                throw new CustomizedException(string.Format("Fallo en {0} - GetById", ClassName), ex,
 75                                              enuExceptionType.BusinessLogicException);
 76            }
 77        }
 78
 79        /// <summary>
 80        /// Método que guarda el registro actualmente cargado en memoria. No importa si se trata de una alta o modificación.
 81        /// </summary>
 82        public override void Save()
 83        {
 84            try
 85            {
 86                //Abre la transaccion que se va a utilizar
 87                DataAcces.Transaction.OpenTransaction();
 88                int idReunion = 0;
 89
 90                if (Data.idReunion == 0)
 91                    DataAcces.Create(Data, out idReunion);
 92                else
 93                    DataAcces.Update(Data);
 94
 95                //Se da el OK para la transaccion.
 96                DataAcces.Transaction.CommitTransaction();
 97            }
 98            catch (CustomizedException ex)
 99            {
100                if (DataAcces != null && DataAcces.Transaction != null)
101                    DataAcces.Transaction.RollbackTransaction();
102                throw ex;
103            }
104            catch (Exception ex)
105            {
106                if (DataAcces != null && DataAcces.Transaction != null)
107                    DataAcces.Transaction.RollbackTransaction();
108                throw new CustomizedException(string.Format("Fallo en {0} - Save()", ClassName), ex,
109                                              enuExceptionType.BusinessLogicException);
110            }
111        }
112
113        /// <summary>
114        /// Método que guarda el registro actualmente cargado en memoria. No importa si se trata de una alta o modificación.
115        /// </summary>
116        public override void Save(DATransaction objDATransaction)
117        {
118            try
119            {
120                //Si no viene el Id es porque se esta creando la entidad
121                DataAcces = new DAReunion(objDATransaction);
122                if (Data.idReunion == 0)
123                    DataAcces.Create(Data);
124                else
125                {
126                    DataAcces.Update(Data);
127                }
128            }
129            catch (CustomizedException ex)
130            {
131                throw ex;
132            }
133            catch (Exception ex)
134            {
135                throw new CustomizedException(string.Format("Fallo en {0} - Save()", ClassName), ex,
136                                              enuExceptionType.BusinessLogicException);
137            }
138        }
139
140        public override void Delete()
141        {
142            throw new NotImplementedException();
143        }
144
145        public override void Delete(DATransaction objDATransaction)
146        {
147            try
148            {
149                DataAcces = new DAReunion(objDATransaction);
150                DataAcces.Delete(Data);
151            }
152            catch (CustomizedException ex)
153            {
154                throw ex;
155            }
156            catch (Exception ex)
157            {
158                throw new CustomizedException(string.Format("Fallo en {0} - Delete()", ClassName), ex,
159                                              enuExceptionType.BusinessLogicException);
160            }
161        }
162        #endregion
163
164        #region --[Métodos publicos]--
165        public List<Reunion> GetReuniones(Reunion entidad)
166        {
167            try
168            {
169                return DataAcces.GetReuniones(entidad);
170            }
171            catch (CustomizedException ex)
172            {
173                throw ex;
174            }
175            catch (Exception ex)
176            {
177                throw new CustomizedException(string.Format("Fallo en {0} - GetReunions", ClassName), ex,
178                                              enuExceptionType.BusinessLogicException);
179            }
180        }
181        #endregion
182    }
183}