/Docs/07-Implementacion/Source/trunk/EDUAR_Regular/EDUAR/EDUAR_UI/Private/Account/ChangeEmail.aspx.cs

http://blpm.googlecode.com/ · C# · 180 lines · 126 code · 12 blank · 42 comment · 8 complexity · e1e316075a6650cb29bd302d9d96cb0d MD5 · raw file

  1. using System;
  2. using EDUAR_BusinessLogic.Security;
  3. using EDUAR_Entities.Security;
  4. using EDUAR_UI.Shared;
  5. using EDUAR_Utility.Enumeraciones;
  6. using EDUAR_Utility.Constantes;
  7. using EDUAR_BusinessLogic.Common;
  8. using EDUAR_Entities;
  9. namespace EDUAR_UI
  10. {
  11. public partial class ChangeEmail : EDUARBasePage
  12. {
  13. #region --[Atributos]--
  14. private BLSeguridad atrBLSeguridad;
  15. #endregion
  16. #region --[Propiedades]--
  17. /// <summary>
  18. /// Propiedad que contiene el objeto seguridad que devuelve la consulta a la Capa de Negocio.
  19. /// </summary>
  20. public DTSeguridad propSeguridad
  21. {
  22. get
  23. {
  24. if (ViewState["propSeguridad"] == null)
  25. return null;
  26. return (DTSeguridad)ViewState["propSeguridad"];
  27. }
  28. set { ViewState["propSeguridad"] = value; }
  29. }
  30. /// <summary>
  31. /// Propiedad que contiene el objeto usuario que se edita.
  32. /// </summary>
  33. /// <value>
  34. /// The obj usuario.
  35. /// </value>
  36. public DTUsuario propUsuario
  37. {
  38. get
  39. {
  40. if (ViewState["propUsuario"] == null)
  41. propUsuario = new DTUsuario();
  42. return (DTUsuario)ViewState["propUsuario"];
  43. }
  44. set { ViewState["propUsuario"] = value; }
  45. }
  46. #endregion
  47. #region --[Eventos]--
  48. /// <summary>
  49. /// Método que se ejecuta al dibujar los controles de la página.
  50. /// Se utiliza para gestionar las excepciones del método Page_Load().
  51. /// </summary>
  52. /// <param name="e"></param>
  53. protected override void OnPreRender(EventArgs e)
  54. {
  55. base.OnPreRender(e);
  56. if (AvisoMostrar)
  57. {
  58. AvisoMostrar = false;
  59. try
  60. {
  61. Master.ManageExceptions(AvisoExcepcion);
  62. }
  63. catch (Exception ex) { Master.ManageExceptions(ex); }
  64. }
  65. }
  66. /// <summary>
  67. /// Handles the Load event of the Page control.
  68. /// </summary>
  69. /// <param name="sender">The source of the event.</param>
  70. /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
  71. protected void Page_Load(object sender, EventArgs e)
  72. {
  73. try
  74. {
  75. Master.BotonAvisoAceptar += (VentanaAceptar);
  76. if (!Page.IsPostBack)
  77. {
  78. lblEmailActual.Text = ObjSessionDataUI.ObjDTUsuario.Email;
  79. //CargarPresentacion();
  80. //CargarCamposFiltros();
  81. //BuscarUsuarios(propSeguridad.Usuario);
  82. }
  83. }
  84. catch (Exception ex)
  85. {
  86. AvisoMostrar = true;
  87. AvisoExcepcion = ex;
  88. }
  89. }
  90. /// <summary>
  91. /// Ventanas the aceptar.
  92. /// </summary>
  93. /// <param name="sender">The sender.</param>
  94. /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
  95. void VentanaAceptar(object sender, EventArgs e)
  96. {
  97. try
  98. {
  99. switch (AccionPagina)
  100. {
  101. case enumAcciones.Guardar:
  102. GuardarUsuario();
  103. AccionPagina = enumAcciones.Redirect;
  104. Master.MostrarMensaje(enumTipoVentanaInformacion.Satisfactorio.ToString(), UIConstantesGenerales.MensajeGuardadoOk, enumTipoVentanaInformacion.Satisfactorio);
  105. //LimpiarCampos();
  106. //udpRoles.Visible = false;
  107. break;
  108. case enumAcciones.Redirect:
  109. Response.Redirect("~/Private/Account/Welcome.aspx", false);
  110. break;
  111. case enumAcciones.Salir:
  112. Response.Redirect("~/Default.aspx", false);
  113. break;
  114. default:
  115. break;
  116. }
  117. //udpRoles.Update();
  118. //udpGrilla.Update();
  119. }
  120. catch (Exception ex)
  121. {
  122. Master.ManageExceptions(ex);
  123. }
  124. }
  125. /// <summary>
  126. /// Handles the Click event of the btnAsignarRol control.
  127. /// </summary>
  128. /// <param name="sender">The source of the event.</param>
  129. /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
  130. protected void btnGuardar_Click(object sender, EventArgs e)
  131. {
  132. try
  133. {
  134. //if (ValidarPagina())
  135. //{
  136. if (Page.IsValid)
  137. {
  138. AccionPagina = enumAcciones.Guardar;
  139. Master.MostrarMensaje(enumTipoVentanaInformacion.Confirmación.ToString(), UIConstantesGenerales.MensajeConfirmarCambios, enumTipoVentanaInformacion.Confirmación);
  140. }
  141. else
  142. {
  143. AccionPagina = enumAcciones.Limpiar;
  144. Master.MostrarMensaje(enumTipoVentanaInformacion.Advertencia.ToString(), UIConstantesGenerales.MensajeDatosRequeridos, enumTipoVentanaInformacion.Advertencia);
  145. }
  146. //}
  147. }
  148. catch (Exception ex)
  149. {
  150. Master.ManageExceptions(ex);
  151. }
  152. }
  153. #endregion
  154. #region --[Métodos Privados]
  155. /// <summary>
  156. /// Guardars the usuario.
  157. /// </summary>
  158. private void GuardarUsuario()
  159. {
  160. DTSeguridad objSeguridad = new DTSeguridad();
  161. objSeguridad.Usuario = ObjSessionDataUI.ObjDTUsuario;
  162. objSeguridad.Usuario.Email = txtEmail.Text;
  163. atrBLSeguridad = new BLSeguridad(objSeguridad);
  164. atrBLSeguridad.ActualizarEmail();
  165. }
  166. #endregion
  167. }
  168. }