827 lines
No EOL
31 KiB
C#
827 lines
No EOL
31 KiB
C#
/*===========================================================================================================================
|
||
* Instituto Costarricense de Acueductos y Alcantarillados. - 2015
|
||
* Formularios para Proyectos de Inversión
|
||
* Nombre de la Pantalla: frwCicloVida.aspx
|
||
*
|
||
* Explicación de los contenidos del archivo
|
||
*===========================================================================================================================
|
||
* HISTORIAL
|
||
*
|
||
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
||
* Esteban Gutierrez Rapso 21 – 11 - 2016 Se inicia con el diseño de la pagina
|
||
* …………………………………………………………
|
||
* …………………………………………………………
|
||
*===========================================================================================================================
|
||
* Derechos Reservados (C) 2016 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.ADM;
|
||
using AyABL.AGP;
|
||
using AyABL.CVP;
|
||
|
||
public partial class webforms_CVP_wfrCicloVida : 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);
|
||
|
||
construirgrvEtapas();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R0M1", ex);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Variables (R1)
|
||
|
||
GridView grvEtapasTemp;
|
||
|
||
CatalogoBL objCatalogoBL;
|
||
CicloVidaBL objCicloVidaBL;
|
||
EtapaBL objEtapaBL;
|
||
ProyectoBL objProyectoBL;
|
||
|
||
#endregion
|
||
|
||
#region Eventos Formulario (R2)
|
||
|
||
protected void Page_Load(object sender, EventArgs e) //M0
|
||
{
|
||
try
|
||
{
|
||
if ((!IsPostBack) && (Session.Count > 0))
|
||
{
|
||
llenarDDLProyecto();
|
||
ComandosxMenu();
|
||
|
||
if (Session["PKPROYECTO"] != null)
|
||
{
|
||
ddlProyecto.SelectedValue = Session["PKPROYECTO"].ToString();
|
||
|
||
ddlProyecto_SelectedIndexChanged(null, null);
|
||
}
|
||
|
||
mostrarDatos();
|
||
|
||
llenarDDLEtapa();
|
||
llenarDDLSituacionActual();
|
||
//llenarDDLEtapaAnterior();
|
||
//llenarDDLFaseEjecucion();
|
||
//llenarDDLEstudioFactibilidad();
|
||
//llenarDDLEjecuta();
|
||
//llenarDDLEtapaActual();
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R2M0", ex);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Eventos Controles Web (R3)
|
||
|
||
/// <summary>
|
||
/// Activa el evento del boton Nuevo
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
|
||
protected void btnNuevo_Click(object sender, EventArgs e) //M0
|
||
{
|
||
try
|
||
{
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M0", ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Activa el evento del boton guardar.1
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
|
||
protected void btnGuardar_Click(object sender, EventArgs e) //M1
|
||
{
|
||
try
|
||
{
|
||
if(GuardarCicloVida())
|
||
{
|
||
MensajeInformativo("El registro fue almacenado exitosamente");
|
||
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M1", ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Cambia el ViewState["MODO"] a Modificar
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ddlProyecto_SelectedIndexChanged(object sender, EventArgs e) //M2
|
||
{
|
||
try
|
||
{
|
||
Session["PKPROYECTO"] = ddlProyecto.SelectedValue;
|
||
|
||
mostrarDatos();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M2", ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Cambia el ASTATE a traves del PK del proyecto designado en el ddlProyecto
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnEliminar_Click(object sender, EventArgs e) //M3
|
||
{
|
||
try
|
||
{
|
||
EliminarCicloVida();
|
||
MensajeInformativo("El registro de Ciclo de Vida ha sido eliminado");
|
||
limpiarCampos();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M3", ex);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
protected void btnGuardarEtapa_Click(object sender, EventArgs e) //M4
|
||
{
|
||
try
|
||
{
|
||
guardarEtapa();
|
||
|
||
llenarGRVEtapa();
|
||
|
||
txtInicio.Text = string.Empty;
|
||
txtConcluye.Text = string.Empty;
|
||
ddlEtapa.Focus();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M3", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnModificar_Click(object sender, EventArgs e) //M5
|
||
{
|
||
try
|
||
{
|
||
if (ModificarDatos())
|
||
{
|
||
MensajeInformativo("El registro fue modificado exitosamente");
|
||
}
|
||
else
|
||
{
|
||
MensajeError("El registro no fue modificado, verifique", null);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M5", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnEliminarEtapa_Click(object sender, EventArgs e) //M6
|
||
{
|
||
try
|
||
{
|
||
// recorro el grid
|
||
foreach (GridViewRow row in grvEtapas.Rows)
|
||
{
|
||
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
||
if (chkTemp != null)
|
||
{
|
||
// si el registro esta marcado
|
||
if (chkTemp.Checked)
|
||
{
|
||
int intPkEtapa = Convert.ToInt32(row.Cells[1].Text);
|
||
eliminarEtapa(intPkEtapa);
|
||
}
|
||
}
|
||
}
|
||
|
||
llenarGRVEtapa();
|
||
|
||
txtInicio.Text = string.Empty;
|
||
txtConcluye.Text = string.Empty;
|
||
ddlEtapa.Focus();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M6", ex);
|
||
}
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region Metodos Personalizados (R4)
|
||
|
||
private void ComandosxMenu() //M0
|
||
{
|
||
try
|
||
{
|
||
DataSet dsComandos = getComandos();
|
||
|
||
if (dsComandos != null)
|
||
{
|
||
foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
|
||
{
|
||
switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
|
||
{
|
||
case "NUEVO":
|
||
break;
|
||
case "ELIMINAR":
|
||
btnEliminar.Visible = true;
|
||
btnEliminarEtapa.Visible = true;
|
||
break;
|
||
case "MODIFICA":
|
||
//Inicio de variable tipo VIEWSTATE
|
||
ViewState["PUEDEMODIFICAR"] = true;
|
||
btnGuardar.Visible = true;
|
||
btnGuardarEtapa.Visible = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R4M0", ex);
|
||
}
|
||
}
|
||
|
||
public static void ddlListaDatos(DataSet p_dsDatos, DropDownList p_ddlListado, string p_strSeleccion) //M1
|
||
{
|
||
try
|
||
{
|
||
p_ddlListado.DataSource = p_dsDatos;
|
||
p_ddlListado.DataTextField = p_dsDatos.Tables[0].Columns[2].ColumnName;
|
||
p_ddlListado.DataValueField = p_dsDatos.Tables[0].Columns[0].ColumnName;
|
||
p_ddlListado.DataBind();
|
||
|
||
p_ddlListado.Items.Insert(0, new ListItem("Seleccione " + p_strSeleccion, "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
private void construirgrvEtapas() //M2
|
||
{
|
||
try
|
||
{
|
||
grvEtapasTemp = (GridView)divDatosInferiores.FindControl("grvEtapas");
|
||
|
||
GridViewBoundField bdfPkEtapa = new GridViewBoundField("PKETAPA", "PK", false, false, false);
|
||
GridViewBoundField bdfEtapa = new GridViewBoundField("ETAPA", "ETAPA", false, false, true);
|
||
GridViewBoundField bdfInicio = new GridViewBoundField("FECHAINICIOETAPA", "INICIA", false, true, true);
|
||
GridViewBoundField bdfConclusion = new GridViewBoundField("FECHAFINETAPA", "CONCLUYE", false, true, true);
|
||
GridViewBoundField bdfSituacion = new GridViewBoundField("SITUACION", "SITUACION ACTUAL", false, false, true);
|
||
|
||
grvEtapasTemp.Columns.Add(bdfPkEtapa);
|
||
grvEtapasTemp.Columns.Add(bdfEtapa);
|
||
grvEtapasTemp.Columns.Add(bdfInicio);
|
||
grvEtapasTemp.Columns.Add(bdfConclusion);
|
||
grvEtapasTemp.Columns.Add(bdfSituacion);
|
||
|
||
grvEtapasTemp.Columns[0].ItemStyle.Width = 25;
|
||
grvEtapasTemp.Columns[1].ItemStyle.Width = 25;
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R4M1", ex);
|
||
}
|
||
}
|
||
|
||
private void limpiarCampos() //M3
|
||
{
|
||
llenarDDLEtapaActual();
|
||
txtAvanceEtapa.Text = string.Empty;
|
||
txtMontoEtapa.Text = string.Empty;
|
||
//llenarDDLEtapaAnterior();
|
||
//txtFechaAprobacionAnterior.Text = string.Empty;
|
||
//llenarDDLFaseEjecucion();
|
||
//llenarDDLEstudioFactibilidad();
|
||
//txtFechaEstudioFactibilidad.Text = string.Empty;
|
||
//llenarDDLEjecuta();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Metodos Controles a Datos (R5)
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private bool GuardarCicloVida() //M0
|
||
{
|
||
|
||
bool blnEjecutado = false;
|
||
string strModo = string.Empty;
|
||
|
||
try
|
||
{
|
||
if (ddlEtapaActual.SelectedItem.Text != "Seleccione una Etapa" && txtAvanceEtapa.Text != string.Empty && txtMontoEtapa.Text != string.Empty) //&&
|
||
//ddlEtapaAnterior.SelectedItem.Text != "Seleccione una opción" &&
|
||
//txtFechaAprobacionAnterior.Text != string.Empty && txtFechaAprobacionAnterior.Text != string.Empty &&
|
||
//ddlFaseEjecucion.SelectedItem.Text != "Seleccione una opción" && //ddlEstudioFactibilidad.SelectedItem.Text != "Seleccione una opción" &&
|
||
//txtFechaEstudioFactibilidad.Text != string.Empty &&
|
||
//ddlEjecuta.SelectedItem.Text != "Seleccione una opción")
|
||
{
|
||
objCicloVidaBL = new CicloVidaBL();
|
||
objCicloVidaBL.objCicloVidaEL.EtapaActual = Int32.Parse(ddlEtapaActual.SelectedValue);
|
||
objCicloVidaBL.objCicloVidaEL.Porcentaje = Decimal.Parse(txtAvanceEtapa.Text);
|
||
objCicloVidaBL.objCicloVidaEL.Monto = Decimal.Parse(txtMontoEtapa.Text);
|
||
//objCicloVidaBL.objCicloVidaEL.EtapaAnterior = Int32.Parse(ddlEtapaAnterior.SelectedValue);
|
||
//objCicloVidaBL.objCicloVidaEL.FechaEtapaAnterior = DateTime.Parse(txtFechaAprobacionAnterior.Text);
|
||
//objCicloVidaBL.objCicloVidaEL.EjecutaProyecto = Int32.Parse(ddlFaseEjecucion.SelectedValue);
|
||
//objCicloVidaBL.objCicloVidaEL.EstudioFactibilidad = Int32.Parse(ddlEstudioFactibilidad.SelectedValue);
|
||
//objCicloVidaBL.objCicloVidaEL.FechaAprobacion = DateTime.Parse(txtFechaEstudioFactibilidad.Text);
|
||
//objCicloVidaBL.objCicloVidaEL.FaseEjecucion = Int32.Parse(ddlEjecuta.SelectedValue);
|
||
objCicloVidaBL.objCicloVidaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
|
||
if (objCicloVidaBL.insertarCicloVida() != 0)
|
||
{
|
||
|
||
blnEjecutado = true;
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Etapa Actual: " + ddlEtapaActual.SelectedItem.Text + ", Porcentaje: " + txtAvanceEtapa.Text + ", Monto: " + txtMontoEtapa.Text + //", Fecha Etapa Anterior: " +
|
||
//txtFechaAprobacionAnterior.Text + ", Ejecución Proyecto: " + ddlFaseEjecucion.SelectedItem.Text + ", Estudio Factibilidad: " + ddlEstudioFactibilidad.SelectedItem.Text + ", Fecha Aprobación: " +
|
||
//txtFechaEstudioFactibilidad.Text + ", Fase Ejecución: " + ddlEjecuta.SelectedItem.Text +
|
||
", Proyecto: " + ddlProyecto.SelectedItem.Text,
|
||
"frwCicloVida.aspx");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MensajeAdvertencia("Debe suminitrar toda la información");
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
blnEjecutado = false;
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
return blnEjecutado;
|
||
}
|
||
|
||
private bool ModificarDatos() //M1
|
||
{
|
||
bool blnEjecutado = false;
|
||
try
|
||
{
|
||
objCicloVidaBL = new CicloVidaBL();
|
||
objCicloVidaBL.objCicloVidaEL.EtapaActual = Int32.Parse(ddlEtapaActual.SelectedValue);
|
||
objCicloVidaBL.objCicloVidaEL.Porcentaje = Decimal.Parse(txtAvanceEtapa.Text);
|
||
objCicloVidaBL.objCicloVidaEL.Monto = Decimal.Parse(txtMontoEtapa.Text);
|
||
//objCicloVidaBL.objCicloVidaEL.EtapaAnterior = Int32.Parse(ddlEtapaAnterior.SelectedValue);
|
||
//objCicloVidaBL.objCicloVidaEL.FechaEtapaAnterior = DateTime.Parse(txtFechaAprobacionAnterior.Text);
|
||
//objCicloVidaBL.objCicloVidaEL.EjecutaProyecto = Int32.Parse(ddlFaseEjecucion.SelectedValue);
|
||
//objCicloVidaBL.objCicloVidaEL.EstudioFactibilidad = Int32.Parse(ddlEstudioFactibilidad.SelectedValue);
|
||
//objCicloVidaBL.objCicloVidaEL.FechaAprobacion = DateTime.Parse(txtFechaEstudioFactibilidad.Text);
|
||
//objCicloVidaBL.objCicloVidaEL.FaseEjecucion = Int32.Parse(ddlEjecuta.SelectedValue);
|
||
objCicloVidaBL.objCicloVidaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
|
||
if (objCicloVidaBL.actualizarCicloVida())
|
||
{
|
||
blnEjecutado = true;
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.UPDATE.ToString(),
|
||
MensajesBitacora.ModificarRegistro + ": Etapa Actual: " + ddlEtapaActual.SelectedItem.Text + ", Porcentaje: " + txtAvanceEtapa.Text + ", Monto: " + txtMontoEtapa.Text + //", Fecha Etapa Anterior: " +
|
||
//txtFechaAprobacionAnterior.Text + ", Ejecución Proyecto: " + ddlFaseEjecucion.SelectedItem.Text + ", Estudio Factibilidad: " + ddlEstudioFactibilidad.SelectedItem.Text + ", Fecha Aprobación: " +
|
||
//txtFechaEstudioFactibilidad.Text + ", Fase Ejecución: " + ddlEjecuta.SelectedItem.Text +
|
||
", Proyecto: " + ddlProyecto.SelectedItem.Text,
|
||
"frwCicloVida.aspx");
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M1", ex);
|
||
blnEjecutado = false;
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
return blnEjecutado;
|
||
|
||
}
|
||
|
||
private void EliminarCicloVida() //M2
|
||
{
|
||
try
|
||
{
|
||
objCicloVidaBL = new CicloVidaBL();
|
||
objCicloVidaBL.objCicloVidaEL.PK = 0;
|
||
objCicloVidaBL.objCicloVidaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
|
||
objCicloVidaBL.actualizaEstadoCicloVida();
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.DELETE.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha borrado el registro " + ", Etapa Actual: " + ddlEtapaActual.SelectedItem.Text + ", Porcentaje: " + txtAvanceEtapa.Text + ", Monto: " + txtMontoEtapa.Text + ", Fecha Etapa Anterior: " +
|
||
//txtFechaAprobacionAnterior.Text + ", Ejecución Proyecto: " + ddlFaseEjecucion.SelectedItem.Text + ", Estudio Factibilidad: " + ddlEstudioFactibilidad.SelectedItem.Text + ", Fecha Aprobación: " +
|
||
//txtFechaEstudioFactibilidad.Text + ", Fase Ejecución: " + ddlEjecuta.SelectedItem.Text +
|
||
", Proyecto: " + ddlProyecto.SelectedItem.Text,
|
||
"frwCicloVida.aspx");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M2", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
}
|
||
|
||
private void guardarEtapa() //M3
|
||
{
|
||
try
|
||
{
|
||
if (txtInicio.Text != string.Empty && txtConcluye.Text != string.Empty && ddlEtapa.SelectedItem.Text != "Seleccione una Etapa" &&
|
||
ddlSituacionActual.SelectedItem.Text != "Seleccione la Situación Actual ")
|
||
{
|
||
objEtapaBL = new EtapaBL();
|
||
objEtapaBL.objEtapaEL.FechaInicio = DateTime.Parse(txtInicio.Text);
|
||
objEtapaBL.objEtapaEL.FechaFin = DateTime.Parse(txtConcluye.Text);
|
||
objEtapaBL.objEtapaEL.Etapa = Int32.Parse(ddlEtapa.SelectedValue);
|
||
objEtapaBL.objEtapaEL.SituacionActual = Int32.Parse(ddlSituacionActual.SelectedValue);
|
||
objEtapaBL.objEtapaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
|
||
objEtapaBL.insertarEtapa();
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Fecha Inicio: " + txtInicio.Text + ", Fecha Concluye: " + txtConcluye.Text + ", Etapa: " + ddlEtapa.SelectedItem.Text + ", Situación Actual: " +
|
||
ddlSituacionActual.Text + ", Proyecto: " + ddlProyecto.SelectedItem.Text,
|
||
"frwCicloVida.aspx");
|
||
}
|
||
else
|
||
{
|
||
MensajeAdvertencia("Debe suminitrar toda la información");
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M3", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
}
|
||
|
||
private void eliminarEtapa(int p_intPKEtapa) //M4
|
||
{
|
||
try
|
||
{
|
||
objEtapaBL = new EtapaBL();
|
||
|
||
objEtapaBL.objEtapaEL.PK = p_intPKEtapa;
|
||
objEtapaBL.objEtapaEL.ASTATE = false;
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.DELETE.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha borrado el registro con la PK: " + p_intPKEtapa + " del Proyecto: " + ddlProyecto.SelectedItem.Text,
|
||
"frwCicloVida.aspx");
|
||
objEtapaBL.actualizaEstadoEtapa();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M4", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Metodos Datos a Controles (R6)
|
||
|
||
/// <summary>
|
||
/// Muestra los datos del registro
|
||
/// </summary>
|
||
private int mostrarDatos() //M0
|
||
{
|
||
int intValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
limpiarCampos();
|
||
|
||
objCicloVidaBL = new CicloVidaBL();
|
||
objCicloVidaBL.objCicloVidaEL.Proyecto = Int32.Parse(ddlProyecto.SelectedValue);
|
||
DataSet dsCicloVida = objCicloVidaBL.getCicloVida();
|
||
if (dsCicloVida.Tables[0].Rows.Count > 0)
|
||
{
|
||
ddlEtapaActual.SelectedValue = dsCicloVida.Tables[0].Rows[0]["FKETAPAACTUAL"].ToString();
|
||
txtAvanceEtapa.Text = Int32.Parse(dsCicloVida.Tables[0].Rows[0]["PORCENTAJECICLOVIDA"].ToString()).ToString("###.#0"); ;
|
||
txtMontoEtapa.Text = Decimal.Parse(dsCicloVida.Tables[0].Rows[0]["MONTOCICLOVIDA"].ToString()).ToString("###,###,###,###.#0");
|
||
//ddlEtapaAnterior.SelectedValue = dsCicloVida.Tables[0].Rows[0]["FKETAPAANTERIOR"].ToString();
|
||
//txtFechaAprobacionAnterior.Text = DateTime.Parse(dsCicloVida.Tables[0].Rows[0]["FECHAAPROBACIONCICLOVIDA"].ToString()).ToString("dd/MM/yyyy");
|
||
//ddlFaseEjecucion.SelectedValue = dsCicloVida.Tables[0].Rows[0]["FKFASEEJECUCION"].ToString();
|
||
//ddlEstudioFactibilidad.SelectedValue = dsCicloVida.Tables[0].Rows[0]["FKESTUDIOFACTIBILIDAD"].ToString();
|
||
//txtFechaEstudioFactibilidad.Text = DateTime.Parse(dsCicloVida.Tables[0].Rows[0]["FECHAETAPAANTERIORCICLOVIDA"].ToString()).ToString("dd/MM/yyyy");
|
||
//ddlEjecuta.SelectedValue = dsCicloVida.Tables[0].Rows[0]["FKEJECUTAPROYECTO"].ToString();
|
||
|
||
intValorRetornado = dsCicloVida.Tables[0].Rows.Count;
|
||
|
||
if (ddlProyecto.SelectedValue != "-1" && bool.Parse(ViewState["PUEDEMODIFICAR"].ToString()) == true)
|
||
{
|
||
btnGuardar.Visible = false;
|
||
btnModificar.Visible = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (ddlProyecto.SelectedValue != "-1")
|
||
{
|
||
btnGuardar.Visible = true;
|
||
btnModificar.Visible = false;
|
||
}
|
||
}
|
||
|
||
llenarGRVEtapa();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M0", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
return intValorRetornado;
|
||
}
|
||
|
||
private void llenarDDLProyecto() //M1
|
||
{
|
||
try
|
||
{
|
||
//Instancia el objeto
|
||
objProyectoBL = new ProyectoBL();
|
||
|
||
objProyectoBL.objProyectoEL.PK = 0;
|
||
objProyectoBL.objProyectoEL.CodigoAcceso = Session["CODIGOACCESO"].ToString();
|
||
objProyectoBL.objProyectoEL.ASTATE = true;
|
||
DataSet dsProyecto = objProyectoBL.getProyectos();
|
||
|
||
ddlListaProyectos(dsProyecto, ddlProyecto);
|
||
ddlProyecto.Attributes["style"] = "width: 90%; max-width: 90%";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M1", ex);
|
||
}
|
||
}
|
||
|
||
private void llenarDDLSituacionActual() //M2
|
||
{
|
||
objCatalogoBL = new CatalogoBL();
|
||
|
||
string strCatalogo = "la Situación Actual";
|
||
|
||
try
|
||
{
|
||
objCatalogoBL.objCatalogoEL.PK = 0;
|
||
objCatalogoBL.objCatalogoEL.Padre = 24;
|
||
objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
//Carga la información en un dataset
|
||
DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
ddlListaDatos(dsCatalogo, ddlSituacionActual, strCatalogo);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M2", ex);
|
||
}
|
||
}
|
||
|
||
//private void llenarDDLEtapaAnterior() //M3
|
||
//{
|
||
// try
|
||
// {
|
||
// objCatalogoBL = new CatalogoBL();
|
||
|
||
// string strCatalogo = "una opción";
|
||
|
||
// objCatalogoBL.objCatalogoEL.PK = 0;
|
||
// objCatalogoBL.objCatalogoEL.Padre = 28;
|
||
// objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
// //Carga la información en un dataset
|
||
// DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
// ddlListaDatos(dsCatalogo, ddlEtapaAnterior, strCatalogo);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R6M3", ex);
|
||
// }
|
||
//}
|
||
|
||
//private void llenarDDLFaseEjecucion() //M4
|
||
//{
|
||
// try
|
||
// {
|
||
// objCatalogoBL = new CatalogoBL();
|
||
|
||
// string strCatalogo = "una opción";
|
||
|
||
// objCatalogoBL.objCatalogoEL.PK = 0;
|
||
// objCatalogoBL.objCatalogoEL.Padre = 28;
|
||
// objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
// //Carga la información en un dataset
|
||
// DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
// ddlListaDatos(dsCatalogo, ddlFaseEjecucion, strCatalogo);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R6M4", ex);
|
||
// }
|
||
//}
|
||
|
||
//private void llenarDDLEstudioFactibilidad() //M5
|
||
//{
|
||
// try
|
||
// {
|
||
// objCatalogoBL = new CatalogoBL();
|
||
|
||
// string strCatalogo = "una opción";
|
||
|
||
// objCatalogoBL.objCatalogoEL.PK = 0;
|
||
// objCatalogoBL.objCatalogoEL.Padre = 28;
|
||
// objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
// //Carga la información en un dataset
|
||
// DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
// ddlListaDatos(dsCatalogo, ddlEstudioFactibilidad, strCatalogo);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R6M5", ex);
|
||
// }
|
||
//}
|
||
|
||
//private void llenarDDLEjecuta() //M6
|
||
//{
|
||
// try
|
||
// {
|
||
// objCatalogoBL = new CatalogoBL();
|
||
|
||
// string strCatalogo = "una opción";
|
||
|
||
// objCatalogoBL.objCatalogoEL.PK = 0;
|
||
// objCatalogoBL.objCatalogoEL.Padre = 28;
|
||
// objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
// //Carga la información en un dataset
|
||
// DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
// ddlListaDatos(dsCatalogo, ddlEjecuta, strCatalogo);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R6M6", ex);
|
||
// }
|
||
//}
|
||
|
||
private void llenarDDLEtapaActual() //M7
|
||
{
|
||
try
|
||
{
|
||
objCatalogoBL = new CatalogoBL();
|
||
|
||
string strCatalogo = " una Etapa";
|
||
|
||
objCatalogoBL.objCatalogoEL.PK = 0;
|
||
objCatalogoBL.objCatalogoEL.Padre = 16;
|
||
objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
//Carga la información en un dataset
|
||
DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
ddlListaDatos(dsCatalogo, ddlEtapaActual, strCatalogo);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M7", ex);
|
||
}
|
||
}
|
||
|
||
private void llenarDDLEtapa() //M8
|
||
{
|
||
try
|
||
{
|
||
objCatalogoBL = new CatalogoBL();
|
||
|
||
string strCatalogo = " una Etapa";
|
||
|
||
objCatalogoBL.objCatalogoEL.PK = 0;
|
||
objCatalogoBL.objCatalogoEL.Padre = 16;
|
||
objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
//Carga la información en un dataset
|
||
DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
ddlListaDatos(dsCatalogo, ddlEtapa, strCatalogo);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M8", ex);
|
||
}
|
||
}
|
||
|
||
private void llenarGRVEtapa() //M9
|
||
{
|
||
try
|
||
{
|
||
objEtapaBL = new EtapaBL();
|
||
objEtapaBL.objEtapaEL.Etapa = 0;
|
||
objEtapaBL.objEtapaEL.Proyecto = Int32.Parse(ddlProyecto.SelectedValue);
|
||
|
||
DataSet dsEtapas = objEtapaBL.getEtapa();
|
||
detalleGRVDatos(dsEtapas, grvEtapas);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M9", ex);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
} |