2019-05-27 14:46:35 +00:00
/ * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Instituto Costarricense de Acueductos y Alcantarillados . - 2019
* Formularios para Proyectos de Inversión
* Nombre de la Pantalla : wfrCierre . aspx
*
* Explicación de los contenidos del archivo
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* HISTORIAL
*
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
* Esteban Gutierrez Rapso 20 – 02 - 2019 Se inicia con el diseño de la pagina
* … … … … … … … … … … … … … … … … … … … … … …
* … … … … … … … … … … … … … … … … … … … … … …
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Derechos Reservados ( C ) 2019 AyA .
* ESTE CÓDIGO ES PROVEÍDO “ TAL CUAL ES ” SIN GARANTÍA ALGUNA
* DE NINGÚN TIPO , SEA IMPLICITA O EXPLICITA .
* NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL , NI SU COMERCIALIZACIÓN
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* /
using System ;
using System.Collections ;
using System.Collections.Generic ;
using System.Configuration ;
using System.Data ;
using System.Linq ;
using System.Web ;
using System.Web.UI ;
using System.Web.UI.WebControls ;
using System.Web.UI.HtmlControls ;
using AyABL ;
using AyADAL ;
using AyABL.RCS ;
using AyABL.IGP ;
using AyABL.AGP ;
using AyABL.PLE ;
using AyABL.ADM ;
using AyABL.CIP ;
using AyABL.FNP ;
public partial class webforms_FOR_wfrCierre : General
{
#region Inicializar Formulario ( R0 )
override protected void OnInit ( EventArgs e ) //M0
{
try
{
base . OnInit ( e ) ;
InicializarFormulario ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R0M0" , ex ) ;
}
}
private void InicializarFormulario ( ) //M1
{
try
{
Response . Cache . SetCacheability ( HttpCacheability . NoCache ) ;
Javascript . CheckAllGridViewItems ( Page ) ;
construirGrvLeccion ( ) ;
construirGrvComentario ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R0M1" , ex ) ;
}
}
#endregion
#region Variables ( R1 )
GridView grvComentariosTemp , grvLeccionesTemp ;
ProyectoBL objProyectoBL ;
InformacionGeneralBL objInformacionGeneralBL ;
LeccionBL objLeccionBL ;
ComentarioBL objComentarioBL ;
CierreBL objCierreBL ;
ObjetivoEspecificoBL objObjetivoEspecificoBL ;
FinanciamientoBL objFinanciamientoBL ;
#endregion
#region Eventos Formulario ( R2 )
protected void Page_Load ( object sender , EventArgs e ) //M0
{
try
{
if ( ( ! IsPostBack ) & & ( Session . Count > 0 ) )
{
objProyectoBL = new ProyectoBL ( ) ;
objProyectoBL . objProyectoEL . PK = Int32 . Parse ( Session [ "PKPROYECTO" ] . ToString ( ) ) ;
DataSet dsProyecto = objProyectoBL . getProyectos ( ) ;
if ( dsProyecto . Tables [ 0 ] . Rows . Count ! = 0 )
{
txtProyecto . Text = dsProyecto . Tables [ 0 ] . Rows [ 0 ] [ "NOMBREPROYECTO" ] . ToString ( ) ;
txtNumeroBPIP . Text = dsProyecto . Tables [ 0 ] . Rows [ 0 ] [ "NUMEROBPIPPROYECTO" ] . ToString ( ) ;
txtEstadoProyecto . Text = string . IsNullOrEmpty ( dsProyecto . Tables [ 0 ] . Rows [ 0 ] [ "NOMBREESTADO" ] . ToString ( ) ) ? "Sin Asignar" : dsProyecto . Tables [ 0 ] . Rows [ 0 ] [ "NOMBREESTADO" ] . ToString ( ) ;
2019-06-24 04:03:12 +00:00
if ( ! string . IsNullOrWhiteSpace ( txtNumeroBPIP . Text ) )
txtProyecto . ReadOnly = true ;
2019-05-27 14:46:35 +00:00
}
mostrarDatosCierre ( ) ;
llenarGrvObjetivos ( ) ;
llenarGrvLecciones ( ) ;
llenarGrvComentarios ( ) ;
}
2019-06-02 05:36:32 +00:00
ScriptManager . RegisterStartupScript ( Page , typeof ( Page ) , "Check" , "validarEstado()" , true ) ;
2019-05-27 14:46:35 +00:00
}
catch ( Exception ex )
{
MensajeError ( "Error en R2M0" , ex ) ;
}
}
#endregion
#region Eventos Controles Web ( R3 )
protected void btnAnterior_Click ( object sender , EventArgs e ) //M0
{
try
{
Response . Redirect ( "wfrProyectos.aspx" ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M0" , ex ) ;
}
}
protected void btnGuardarCR_Click ( object sender , EventArgs e ) //M1
{
try
{
if ( guardarDatosCierre ( ) )
{
MensajeInformativo ( "El registro fue almacenado exitosamente" ) ;
}
else
{
MensajeError ( "El registro no fue almacenado, verifique" , null ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M1" , ex ) ;
}
}
protected void grvLecciones_RowCommand ( object sender , GridViewCommandEventArgs e ) //M2
{
try
{
if ( e . CommandName = = "editar" )
{
int i = Convert . ToInt32 ( e . CommandArgument ) ;
GridViewRow selectedRow = grvLecciones . Rows [ i ] ;
ViewState [ "PkLeccion" ] = Convert . ToInt32 ( selectedRow . Cells [ 2 ] . Text ) ;
ViewState [ "Modo_Leccion" ] = "Modifica" ;
mostrarFilasLecciones ( 2 ) ;
mostrarDatosLecciones ( ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M5" , ex ) ;
}
}
protected void grvLecciones_PageIndexChanging ( object sender , GridViewPageEventArgs e ) //M3
{
try
{
grvLecciones . PageIndex = e . NewPageIndex ;
llenarGrvLecciones ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error R3M3" , ex ) ;
}
}
protected void btnGuardarLA_Click ( object sender , EventArgs e ) //M4
{
try
{
if ( guardarDatosLeccion ( ) )
{
MensajeInformativo ( "El registro fue almacenado exitosamente" ) ;
}
else
{
MensajeError ( "El registro no fue almacenado, verifique" , null ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M4" , ex ) ;
}
}
protected void btnEliminarLA_Click ( object sender , EventArgs e ) //M5
{
try
{
// recorro el grid
foreach ( GridViewRow row in grvLecciones . Rows )
{
HtmlInputCheckBox chkTemp = ( HtmlInputCheckBox ) row . Controls [ 0 ] . Controls [ 1 ] ;
if ( chkTemp ! = null )
{
// si el registro esta marcado
if ( chkTemp . Checked )
{
int intPkIndice = Convert . ToInt32 ( row . Cells [ 2 ] . Text ) ;
eliminarLeccion ( intPkIndice ) ;
}
}
}
llenarGrvLecciones ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M5" , ex ) ;
}
}
protected void btnNuevoLA_Click ( object sender , EventArgs e ) //M6
{
try
{
ViewState [ "Modo_Leccion" ] = "Nuevo" ;
mostrarFilasLecciones ( 2 ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M6" , ex ) ;
}
}
protected void btnAnteriorLA_Click ( object sender , EventArgs e ) //M7
{
try
{
mostrarFilasLecciones ( 1 ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M7" , ex ) ;
}
}
protected void grvComentarios_RowCommand ( object sender , GridViewCommandEventArgs e ) //M8
{
try
{
if ( e . CommandName = = "editar" )
{
int i = Convert . ToInt32 ( e . CommandArgument ) ;
GridViewRow selectedRow = grvComentarios . Rows [ i ] ;
ViewState [ "PkComentario" ] = Convert . ToInt32 ( selectedRow . Cells [ 2 ] . Text ) ;
ViewState [ "Modo_Comentario" ] = "Modifica" ;
mostrarFilasComentarios ( 2 ) ;
mostrarDatosComentarios ( ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M5" , ex ) ;
}
}
protected void grvComentarios_PageIndexChanging ( object sender , GridViewPageEventArgs e ) //M9
{
try
{
grvComentarios . PageIndex = e . NewPageIndex ;
llenarGrvComentarios ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error R3M3" , ex ) ;
}
}
protected void btnGuardarCT_Click ( object sender , EventArgs e ) //M10
{
try
{
if ( guardarDatosComentario ( ) )
{
MensajeInformativo ( "El registro fue almacenado exitosamente" ) ;
}
else
{
MensajeError ( "El registro no fue almacenado, verifique" , null ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M4" , ex ) ;
}
}
protected void btnEliminarCT_Click ( object sender , EventArgs e ) //M11
{
try
{
// recorro el grid
foreach ( GridViewRow row in grvComentarios . Rows )
{
HtmlInputCheckBox chkTemp = ( HtmlInputCheckBox ) row . Controls [ 0 ] . Controls [ 1 ] ;
if ( chkTemp ! = null )
{
// si el registro esta marcado
if ( chkTemp . Checked )
{
int intPkIndice = Convert . ToInt32 ( row . Cells [ 2 ] . Text ) ;
eliminarComentario ( intPkIndice ) ;
}
}
}
llenarGrvComentarios ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M5" , ex ) ;
}
}
protected void btnNuevoCT_Click ( object sender , EventArgs e ) //M12
{
try
{
ViewState [ "Modo_Comentario" ] = "Nuevo" ;
mostrarFilasComentarios ( 2 ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M12" , ex ) ;
}
}
protected void btnAnteriorCT_Click ( object sender , EventArgs e ) //M13
{
try
{
mostrarFilasComentarios ( 1 ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M13" , ex ) ;
}
}
#endregion
#region Metodos Personalizados ( R4 )
private void limpiarCamposCierre ( ) //M0
{
try
{
txtFechaCapitalizacion . Value = string . Empty ;
txtFechaEntrega . Value = string . Empty ;
txtFechaFinalizacion . Value = string . Empty ;
txtFechaInicio . Value = string . Empty ;
txtFinanciamiento . Text = string . Empty ;
txtInversion . Text = string . Empty ;
txtMontoCapitalizacion . Value = string . Empty ;
txtPreInversion . Text = string . Empty ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M0" , ex ) ;
}
}
private void mostrarFilasLecciones ( int p_intFila ) //M1
{
try
{
divListadoLecciones . Visible = false ;
divFormularioLecciones . Visible = false ;
switch ( p_intFila )
{
case 1 :
llenarGrvLecciones ( ) ;
divListadoLecciones . Visible = true ;
break ;
case 2 :
limpiarCamposLecciones ( ) ;
divFormularioLecciones . Visible = true ;
break ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M1" , ex ) ;
}
}
private void limpiarCamposLecciones ( ) //M2
{
try
{
txtDescripcion . Text = string . Empty ;
txtEvento . Text = string . Empty ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M2" , ex ) ;
}
}
private void construirGrvLeccion ( ) //M3
{
try
{
grvLeccionesTemp = ( GridView ) divListadoLecciones . FindControl ( "grvLecciones" ) ;
GridViewBoundField bdfPkLeccion = new GridViewBoundField ( "PKLECCION" , "PK" , false , false , false ) ;
GridViewBoundField bdfEvento = new GridViewBoundField ( "EVENTOLECCION" , "EVENTO" , true , false , true ) ;
GridViewBoundField bdfDescripcion = new GridViewBoundField ( "DESCRIPCIONLECCION" , "DESCRIPCION" , true , false , true ) ;
grvLeccionesTemp . Columns . Add ( bdfPkLeccion ) ;
grvLeccionesTemp . Columns . Add ( bdfEvento ) ;
grvLeccionesTemp . Columns . Add ( bdfDescripcion ) ;
grvLeccionesTemp . Columns [ 0 ] . ItemStyle . Width = 25 ;
grvLeccionesTemp . Columns [ 1 ] . ItemStyle . Width = 25 ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M3" , ex ) ;
}
}
private void construirGrvComentario ( ) //M4
{
try
{
grvComentariosTemp = ( GridView ) divListadoComentarios . FindControl ( "grvComentarios" ) ;
GridViewBoundField bdfPkComentario = new GridViewBoundField ( "PKCOMENTARIO" , "PK" , false , false , false ) ;
GridViewBoundField bdfFecha = new GridViewBoundField ( "FECHAINGRESOCOMENTARIO" , "FECHA" , true , true , true ) ;
GridViewBoundField bdfComentario = new GridViewBoundField ( "COMENTARIO" , "COMENTARIO" , true , false , true ) ;
grvComentariosTemp . Columns . Add ( bdfPkComentario ) ;
grvComentariosTemp . Columns . Add ( bdfFecha ) ;
grvComentariosTemp . Columns . Add ( bdfComentario ) ;
grvComentariosTemp . Columns [ 0 ] . ItemStyle . Width = 25 ;
grvComentariosTemp . Columns [ 2 ] . ItemStyle . Width = 50 ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M4" , ex ) ;
}
}
private void mostrarFilasComentarios ( int p_intFila ) //M5
{
try
{
divListadoComentarios . Visible = false ;
divFormularioComentarios . Visible = false ;
switch ( p_intFila )
{
case 1 :
llenarGrvComentarios ( ) ;
divListadoComentarios . Visible = true ;
break ;
case 2 :
limpiarCamposComentarios ( ) ;
divFormularioComentarios . Visible = true ;
break ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M5" , ex ) ;
}
}
private void limpiarCamposComentarios ( ) //M6
{
try
{
txtFecha . Value = string . Empty ;
txtComentario . Text = string . Empty ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R4M2" , ex ) ;
}
}
#endregion
#region Metodos Controles a Datos ( R5 )
private bool guardarDatosCierre ( ) //M0
{
bool blnEjecutado = false ;
try
{
string strModo = ViewState [ "Modo_Cierre" ] . ToString ( ) ;
objCierreBL = new CierreBL ( ) ;
objCierreBL . objCierreEL . DocumentoFinanciamiento = txtFinanciamiento . Text ;
objCierreBL . objCierreEL . DocumentoInversion = txtInversion . Text ;
objCierreBL . objCierreEL . DocumentoPreInversion = txtPreInversion . Text ;
objCierreBL . objCierreEL . MontoCapitalizacion = txtMontoCapitalizacion . Value ! = "" ? Decimal . Parse ( txtMontoCapitalizacion . Value ) : 0 ;
objCierreBL . objCierreEL . FechaCapitalizacion = txtFechaCapitalizacion . Value ! = "" ? Convert . ToDateTime ( txtFechaCapitalizacion . Value ) : DateTime . Now ;
objCierreBL . objCierreEL . Proyecto = Int32 . Parse ( Session [ "PKPROYECTO" ] . ToString ( ) ) ;
if ( strModo = = "Nuevo" )
{
ViewState [ "PkCierre" ] = objCierreBL . insertarCierre ( ) ;
blnEjecutado = true ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha ingresado el registro: " + " : DocumentoFinanciamiento" + txtFinanciamiento . Text + " : DocumentoInversion" + txtInversion . Text + " : DocumentoPreInversion" + txtPreInversion . Text +
" MontoCapitalizacion: " + txtMontoCapitalizacion . Value + " FechaCapitalizacion: " + txtFechaCapitalizacion . Value + " FechaEntrega: " +
txtFechaEntrega . Value + " FechaFinalizacion: " + txtFechaFinalizacion . Value + " FechaInicio: " + txtFechaInicio . Value ,
"wfrCierre.aspx" ) ;
ViewState [ "Modo_Cierre" ] = "Modifica" ;
}
else if ( strModo = = "Modifica" )
{
objCierreBL . objCierreEL . PK = Int32 . Parse ( ViewState [ "PkCierre" ] . ToString ( ) ) ;
if ( objCierreBL . actualizarCierre ( ) )
{
blnEjecutado = true ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . UPDATE . ToString ( ) ,
MensajesBitacora . ModificarRegistro + ": Se ha modificado el registro: " + " : DocumentoFinanciamiento" + txtFinanciamiento . Text + " : DocumentoInversion" + txtInversion . Text + " : DocumentoPreInversion" + txtPreInversion . Text +
" MontoCapitalizacion: " + txtMontoCapitalizacion . Value + " FechaCapitalizacion: " + txtFechaCapitalizacion . Value + " FechaEntrega: " +
txtFechaEntrega . Value + " FechaFinalizacion: " + txtFechaFinalizacion . Value + " FechaInicio: " + txtFechaInicio . Value ,
"wfrCierre.aspx" ) ;
}
}
}
catch ( Exception ex )
{
blnEjecutado = false ;
throw ex ;
}
return blnEjecutado ;
}
private bool guardarDatosLeccion ( ) //M1
{
bool blnEjecutado = false ;
try
{
string strModo = ViewState [ "Modo_Leccion" ] . ToString ( ) ;
if ( ViewState [ "PkCierre" ] ! = null )
{
objLeccionBL = new LeccionBL ( ) ;
objLeccionBL . objLeccionEL . Evento = txtEvento . Text ;
objLeccionBL . objLeccionEL . Descripcion = txtDescripcion . Text ;
objLeccionBL . objLeccionEL . Cierre = Int32 . Parse ( ViewState [ "PkCierre" ] . ToString ( ) ) ;
if ( strModo = = "Nuevo" )
{
int leccion = objLeccionBL . insertarLeccion ( ) ;
{
blnEjecutado = true ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha ingresado el registro en Leccion: " + " : Evento" + txtEvento . Text + " : Descripcion" + txtDescripcion . Text ,
"wfrCierre.aspx" ) ;
}
}
else if ( strModo = = "Modifica" )
{
objLeccionBL . objLeccionEL . PK = Int32 . Parse ( ViewState [ "PkLeccion" ] . ToString ( ) ) ;
if ( objLeccionBL . actualizarLeccion ( ) )
{
blnEjecutado = true ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . UPDATE . ToString ( ) ,
MensajesBitacora . ModificarRegistro +
MensajesBitacora . IngresarRegistro + ": Se ha modificado el registro en Leccion: " + " : Evento" + txtEvento . Text + " : Descripcion" + txtDescripcion . Text ,
"wfrCierre.aspx" ) ;
}
}
}
else
MensajeAdvertencia ( "Es necesario que inicialmente se incluya la información del Cierre" ) ;
}
catch ( Exception ex )
{
blnEjecutado = false ;
throw ex ;
}
return blnEjecutado ;
}
private void eliminarLeccion ( int p_intPKIndice ) //M2
{
try
{
objLeccionBL = new LeccionBL ( ) ;
objLeccionBL . objLeccionEL . PK = p_intPKIndice ;
objLeccionBL . actualizaEstadoLeccion ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . DELETE . ToString ( ) ,
MensajesBitacora . EliminarRegistro + ": Se ha eliminado el registro: " + p_intPKIndice + " de Leccion." ,
"wfrCierre.aspx" ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R5M2" , ex ) ;
}
}
private bool guardarDatosComentario ( ) //M3
{
bool blnEjecutado = false ;
try
{
string strModo = ViewState [ "Modo_Comentario" ] . ToString ( ) ;
if ( ViewState [ "PkCierre" ] ! = null )
{
objComentarioBL = new ComentarioBL ( ) ;
objComentarioBL . objComentarioEL . Comentario = txtComentario . Text ;
objComentarioBL . objComentarioEL . Fecha = txtFecha . Value ! = "" ? Convert . ToDateTime ( txtFecha . Value ) : DateTime . Now ;
objComentarioBL . objComentarioEL . Cierre = Int32 . Parse ( ViewState [ "PkCierre" ] . ToString ( ) ) ;
if ( strModo = = "Nuevo" )
{
int observ = objComentarioBL . insertarComentario ( ) ;
{
blnEjecutado = true ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha ingresado el registro en Observación: " + " : Comentario: " + txtComentario . Text + " , Fecha: " + objComentarioBL . objComentarioEL . Fecha ,
"wfrCierre.aspx" ) ;
}
}
else if ( strModo = = "Modifica" )
{
objComentarioBL . objComentarioEL . PK = Int32 . Parse ( ViewState [ "PkComentario" ] . ToString ( ) ) ;
if ( objComentarioBL . actualizarComentario ( ) )
{
blnEjecutado = true ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . UPDATE . ToString ( ) ,
MensajesBitacora . ModificarRegistro + ": Se ha modificado el registro en Observación: " + " : Comentario: " + txtComentario . Text + " , Fecha: " + objComentarioBL . objComentarioEL . Fecha ,
"wfrCierre.aspx" ) ;
}
}
}
}
catch ( Exception ex )
{
blnEjecutado = false ;
throw ex ;
}
return blnEjecutado ;
}
private void eliminarComentario ( int p_intPKIndice ) //M4
{
try
{
objComentarioBL = new ComentarioBL ( ) ;
objComentarioBL . objComentarioEL . PK = p_intPKIndice ;
objComentarioBL . actualizaEstadoComentario ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . DELETE . ToString ( ) ,
MensajesBitacora . EliminarRegistro + ": Se ha eliminado el registro: " + p_intPKIndice + " de Comentario." ,
"wfrCierre.aspx" ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R5M4" , ex ) ;
}
}
#endregion
#region Metodos Datos a Controles ( R6 )
private void mostrarDatosCierre ( ) //M0
{
try
{
limpiarCamposCierre ( ) ;
objCierreBL = new CierreBL ( ) ;
objCierreBL . objCierreEL . Proyecto = Convert . ToInt32 ( Session [ "PKPROYECTO" ] . ToString ( ) ) ;
DataSet dsCierre = objCierreBL . getCierre ( ) ;
if ( dsCierre . Tables [ 0 ] . Rows . Count ! = 0 )
{
ViewState [ "PkCierre" ] = Convert . ToInt32 ( dsCierre . Tables [ 0 ] . Rows [ 0 ] [ "PKCIERRE" ] . ToString ( ) ) ;
txtPreInversion . Text = dsCierre . Tables [ 0 ] . Rows [ 0 ] [ "DOCUMENTOPREINVERSIONCIERRE" ] . ToString ( ) ;
txtFinanciamiento . Text = dsCierre . Tables [ 0 ] . Rows [ 0 ] [ "DOCUMENTOFINANCIAMIENTOCIERRE" ] . ToString ( ) ;
txtInversion . Text = dsCierre . Tables [ 0 ] . Rows [ 0 ] [ "DOCUMENTOINVERSIONCIERRE" ] . ToString ( ) ;
txtFechaCapitalizacion . Value = Convert . ToDateTime ( dsCierre . Tables [ 0 ] . Rows [ 0 ] [ "FECHACAPITALIZACIONCIERRE" ] . ToString ( ) ) . Date . ToString ( "dd/MM/yyyy" ) ;
txtMontoCapitalizacion . Value = Decimal . Parse ( dsCierre . Tables [ 0 ] . Rows [ 0 ] [ "MONTOCAPITALIZACIONCIERRE" ] . ToString ( ) ) . ToString ( "###,###,###,###.#0" ) ;
ViewState [ "Modo_Cierre" ] = "Modifica" ;
}
else if ( dsCierre . Tables [ 0 ] . Rows . Count = = 0 )
{
ViewState [ "Modo_Cierre" ] = "Nuevo" ;
}
DataSet dsCierreOtros = objCierreBL . getOtrosDatos ( ) ;
if ( dsCierreOtros . Tables [ 0 ] . Rows . Count ! = 0 )
{
txtFechaInicio . Value = dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "FECHAINICIO" ] = = null ? string . Empty : Convert . ToDateTime ( dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "FECHAINICIO" ] . ToString ( ) ) . Date . ToString ( "dd/MM/yyyy" ) ;
txtCostoTotal . Value = dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "MONTOFINANCIAMIENTO" ] = = null ? string . Empty : Decimal . Parse ( dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "MONTOFINANCIAMIENTO" ] . ToString ( ) ) . ToString ( "###,###,###,###.#0" ) ;
txtFechaFinalizacion . Value = dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "FECHAFIN" ] = = null ? string . Empty : Convert . ToDateTime ( dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "FECHAFIN" ] . ToString ( ) ) . Date . ToString ( "dd/MM/yyyy" ) ;
txtFechaEntrega . Value = dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "FECHAFIN" ] = = null ? string . Empty : Convert . ToDateTime ( dsCierreOtros . Tables [ 0 ] . Rows [ 0 ] [ "FECHAFIN" ] . ToString ( ) ) . Date . ToString ( "dd/MM/yyyy" ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M0" , ex ) ;
}
}
private DataSet llenarGrvObjetivosProyecto ( bool cumplido ) //M1
{
DataSet dsObjetivos = new DataSet ( ) ;
try
{
objObjetivoEspecificoBL = new ObjetivoEspecificoBL ( ) ;
objObjetivoEspecificoBL . objObjetivoEspecificoEL . Proyecto = Int32 . Parse ( Session [ "PKPROYECTO" ] . ToString ( ) ) ;
dsObjetivos = objObjetivoEspecificoBL . getObjetivoEspecifico ( ) ;
if ( dsObjetivos . Tables [ 0 ] . Rows . Count ! = 0 )
{
for ( int r = 0 ; r < dsObjetivos . Tables [ 0 ] . Rows . Count ; r + + )
{
if ( Convert . ToBoolean ( dsObjetivos . Tables [ 0 ] . Rows [ r ] [ "CUMPLIDOOBJETIVOESPECIFICO" ] . ToString ( ) ) ! = cumplido )
dsObjetivos . Tables [ 0 ] . Rows [ r ] . Delete ( ) ;
}
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M1" , ex ) ;
}
return dsObjetivos ;
}
private void llenarGrvObjetivos ( ) //M2
{
try
{
detalleGRVDatos ( llenarGrvObjetivosProyecto ( false ) , grvObjNoCumplidos ) ;
if ( grvObjNoCumplidos . HeaderRow ! = null )
{
//Invisibiliza la fila de t[itulo
grvObjNoCumplidos . HeaderRow . Cells [ 0 ] . Visible = false ;
grvObjNoCumplidos . HeaderRow . Cells [ 1 ] . Text = " # " ;
grvObjNoCumplidos . HeaderRow . Cells [ 1 ] . Width = 30 ;
grvObjNoCumplidos . HeaderRow . Cells [ 2 ] . Text = "OBJETIVO" ;
grvObjNoCumplidos . HeaderRow . Cells [ 3 ] . Visible = false ;
grvObjNoCumplidos . HeaderRow . Cells [ 4 ] . Visible = false ;
grvObjNoCumplidos . HeaderRow . Cells [ 5 ] . Visible = false ;
//Invisibiliza las columnas que no se ocupan
for ( int i = 0 ; i < = grvObjNoCumplidos . Rows . Count - 1 ; + + i )
{
grvObjNoCumplidos . Rows [ i ] . Cells [ 0 ] . Visible = false ;
grvObjNoCumplidos . Rows [ i ] . Cells [ 3 ] . Visible = false ;
grvObjNoCumplidos . Rows [ i ] . Cells [ 4 ] . Visible = false ;
grvObjNoCumplidos . Rows [ i ] . Cells [ 5 ] . Visible = false ;
}
}
detalleGRVDatos ( llenarGrvObjetivosProyecto ( true ) , grvObjCumplidos ) ;
if ( grvObjCumplidos . HeaderRow ! = null )
{
//Invisibiliza la fila de t[itulo
grvObjCumplidos . HeaderRow . Cells [ 0 ] . Visible = false ;
grvObjCumplidos . HeaderRow . Cells [ 1 ] . Text = " # " ;
grvObjCumplidos . HeaderRow . Cells [ 1 ] . Width = 30 ;
grvObjCumplidos . HeaderRow . Cells [ 2 ] . Text = "OBJETIVO" ;
grvObjCumplidos . HeaderRow . Cells [ 3 ] . Visible = false ;
grvObjCumplidos . HeaderRow . Cells [ 4 ] . Visible = false ;
grvObjCumplidos . HeaderRow . Cells [ 5 ] . Visible = false ;
//Invisibiliza las columnas que no se ocupan
for ( int i = 0 ; i < = grvObjCumplidos . Rows . Count - 1 ; + + i )
{
grvObjCumplidos . Rows [ i ] . Cells [ 0 ] . Visible = false ;
grvObjCumplidos . Rows [ i ] . Cells [ 3 ] . Visible = false ;
grvObjCumplidos . Rows [ i ] . Cells [ 4 ] . Visible = false ;
grvObjCumplidos . Rows [ i ] . Cells [ 5 ] . Visible = false ;
}
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M2" , ex ) ;
}
}
private void llenarGrvLecciones ( ) //M3
{
int intPkCierre = 0 ;
try
{
intPkCierre = ViewState [ "PkCierre" ] = = null ? 0 : Int32 . Parse ( ViewState [ "PkCierre" ] . ToString ( ) ) ;
objLeccionBL = new LeccionBL ( ) ;
objLeccionBL . objLeccionEL . Cierre = intPkCierre ;
DataSet dsLeccion = objLeccionBL . getLeccion ( ) ;
detalleGRVDatos ( dsLeccion , grvLecciones ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M3" , ex ) ;
}
}
private void mostrarDatosLecciones ( ) //M4
{
try
{
limpiarCamposLecciones ( ) ;
objLeccionBL = new LeccionBL ( ) ;
objLeccionBL . objLeccionEL . PK = Convert . ToInt32 ( ViewState [ "PkLeccion" ] . ToString ( ) ) ;
objLeccionBL . objLeccionEL . Cierre = 0 ;
DataSet dsLeccion = objLeccionBL . getLeccion2 ( ) ;
if ( dsLeccion . Tables [ 0 ] . Rows . Count ! = 0 )
{
txtEvento . Text = dsLeccion . Tables [ 0 ] . Rows [ 0 ] [ "EVENTOLECCION" ] . ToString ( ) ;
txtDescripcion . Text = dsLeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONLECCION" ] . ToString ( ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M4" , ex ) ;
}
}
private void llenarGrvComentarios ( ) //M5
{
try
{
objComentarioBL = new ComentarioBL ( ) ;
objComentarioBL . objComentarioEL . Cierre = ViewState [ "PkCierre" ] = = null ? 0 : Int32 . Parse ( ViewState [ "PkCierre" ] . ToString ( ) ) ;
DataSet dsComentario = objComentarioBL . getComentario ( ) ;
detalleGRVDatos ( dsComentario , grvComentarios ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M5" , ex ) ;
}
}
private void mostrarDatosComentarios ( ) //M6
{
try
{
limpiarCamposLecciones ( ) ;
objComentarioBL = new ComentarioBL ( ) ;
objComentarioBL . objComentarioEL . PK = Convert . ToInt32 ( ViewState [ "PkComentario" ] . ToString ( ) ) ;
objComentarioBL . objComentarioEL . Cierre = 0 ;
DataSet dsComentario = objComentarioBL . getComentario ( ) ;
if ( dsComentario . Tables [ 0 ] . Rows . Count ! = 0 )
{
txtFecha . Value = Convert . ToDateTime ( dsComentario . Tables [ 0 ] . Rows [ 0 ] [ "FECHAINGRESOCOMENTARIO" ] . ToString ( ) ) . Date . ToString ( "dd/MM/yyyy" ) ;
txtComentario . Text = dsComentario . Tables [ 0 ] . Rows [ 0 ] [ "COMENTARIO" ] . ToString ( ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R6M4" , ex ) ;
}
}
#endregion
}