/Docs/07-Implementacion/Source/trunk/EDUAR_actual/EDUAR/EDUAR_DataAccess/Common/DAPeriodo.cs

http://blpm.googlecode.com/ · C# · 110 lines · 93 code · 17 blank · 0 comment · 5 complexity · e013542e954eaa17e3378eea3fb13ef7 MD5 · raw file

  1. using System;
  2. using EDUAR_DataAccess.Shared;
  3. using EDUAR_Entities;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Data.SqlClient;
  7. using EDUAR_Utility.Excepciones;
  8. using EDUAR_Utility.Enumeraciones;
  9. namespace EDUAR_DataAccess.Common
  10. {
  11. public class DAPeriodo : DataAccesBase<Periodo>
  12. {
  13. #region --[Atributos]--
  14. private const string ClassName = "DAPeriodo";
  15. #endregion
  16. #region --[Constructor]--
  17. public DAPeriodo()
  18. {
  19. }
  20. public DAPeriodo(DATransaction objDATransaction)
  21. : base(objDATransaction)
  22. {
  23. }
  24. #endregion
  25. #region --[Implementación métodos heredados]--
  26. public override string FieldID
  27. {
  28. get { throw new NotImplementedException(); }
  29. }
  30. public override string FieldDescription
  31. {
  32. get { throw new NotImplementedException(); }
  33. }
  34. public override Periodo GetById(Periodo entidad)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. public override void Create(Periodo entidad)
  39. {
  40. throw new NotImplementedException();
  41. }
  42. public override void Create(Periodo entidad, out int identificador)
  43. {
  44. throw new NotImplementedException();
  45. }
  46. public override void Update(Periodo entidad)
  47. {
  48. throw new NotImplementedException();
  49. }
  50. public override void Delete(Periodo entidad)
  51. {
  52. throw new NotImplementedException();
  53. }
  54. #endregion
  55. #region --[Métodos Públicos]--
  56. public List<Periodo> GetPeriodos(Periodo entidad)
  57. {
  58. try
  59. {
  60. Transaction.DBcomand = Transaction.DataBase.GetStoredProcCommand("Periodo_Select");
  61. if (entidad != null)
  62. {
  63. if (entidad.idPeriodo > 0)
  64. Transaction.DataBase.AddInParameter(Transaction.DBcomand, "@idPeriodo", DbType.Int32, entidad.idPeriodo);
  65. if (entidad.cicloLectivo.idCicloLectivo > 0)
  66. Transaction.DataBase.AddInParameter(Transaction.DBcomand, "@idCicloLectivo", DbType.Int32, entidad.cicloLectivo.idCicloLectivo);
  67. }
  68. IDataReader reader = Transaction.DataBase.ExecuteReader(Transaction.DBcomand);
  69. List<Periodo> listaPeriodos = new List<Periodo>();
  70. Periodo objPeriodo;
  71. while (reader.Read())
  72. {
  73. objPeriodo = new Periodo();
  74. objPeriodo.idPeriodo = Convert.ToInt32(reader["idPeriodo"]);
  75. objPeriodo.nombre = reader["nombre"].ToString();
  76. listaPeriodos.Add(objPeriodo);
  77. }
  78. return listaPeriodos;
  79. }
  80. catch (SqlException ex)
  81. {
  82. throw new CustomizedException(string.Format("Fallo en {0} - GetAsignaturas()", ClassName),
  83. ex, enuExceptionType.SqlException);
  84. }
  85. catch (Exception ex)
  86. {
  87. throw new CustomizedException(string.Format("Fallo en {0} - GetAsignaturas()", ClassName),
  88. ex, enuExceptionType.DataAccesException);
  89. }
  90. }
  91. #endregion
  92. }
  93. }