720 lines
No EOL
27 KiB
C#
720 lines
No EOL
27 KiB
C#
/*===========================================================================================================================
|
||
* Instituto Costarricense de Acueductos y Alcantarillados. - 2019
|
||
* Formularios para Proyectos de Inversión
|
||
* Nombre de la Pantalla: wfrCicloVida.aspx
|
||
*
|
||
* Explicación de los contenidos del archivo
|
||
*===========================================================================================================================
|
||
* HISTORIAL
|
||
*
|
||
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
||
* Esteban Gutierrez Rapso 13 – 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.Generic;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
|
||
using AyADAL;
|
||
using AyABL.ADM;
|
||
using AyABL.RCS;
|
||
|
||
using AyABL.AGP;
|
||
using AyABL.CVP;
|
||
using System.Web.UI.HtmlControls;
|
||
using System.Data;
|
||
|
||
public partial class webforms_FOR_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);
|
||
|
||
construirgrvEtapas();
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R0M1", ex);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Variables (R1)
|
||
|
||
GridView grvListaEtapasTemp;
|
||
|
||
ProyectoBL objProyectoBL;
|
||
CicloVidaBL objCicloVidaBL;
|
||
EtapaBL objEtapaBL;
|
||
CatalogoBL objCatalogoBL;
|
||
|
||
#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();
|
||
|
||
if (!string.IsNullOrWhiteSpace(txtNumeroBPIP.Text))
|
||
txtProyecto.ReadOnly = true;
|
||
}
|
||
|
||
llenarDDLEtapa();
|
||
llenarDDLSituacionActual();
|
||
llenarDDLEtapaActual();
|
||
|
||
objCicloVidaBL = new CicloVidaBL();
|
||
objCicloVidaBL.objCicloVidaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
DataSet dsCicloVida = objCicloVidaBL.getCicloVida();
|
||
if (dsCicloVida.Tables[0].Rows.Count == 0)
|
||
{
|
||
ViewState["Modo"] = "Nuevo";
|
||
}
|
||
else
|
||
{
|
||
ViewState["Modo"] = "Modifica";
|
||
mostrarDatos();
|
||
}
|
||
|
||
llenarGridEtapas();
|
||
}
|
||
|
||
ScriptManager.RegisterStartupScript(Page, typeof(Page), "Check", "validarEstado()", true);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R2M0", ex);
|
||
}
|
||
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Eventos Controles Web (R3)
|
||
|
||
protected void grvListaEtapas_RowCommand(object sender, GridViewCommandEventArgs e) //M0
|
||
{
|
||
try
|
||
{
|
||
if (e.CommandName == "editar")
|
||
{
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaEtapas.Rows[i];
|
||
int intPkEtapa = Convert.ToInt32(selectedRow.Cells[2].Text);
|
||
ViewState["PkEtapa"] = intPkEtapa;
|
||
ViewState["Modo_Etapa"] = "Modifica";
|
||
|
||
mostrarFilasEtapas(2);
|
||
mostrarEtapa();
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M0", ex);
|
||
}
|
||
}
|
||
|
||
protected void grvListaEtapas_PageIndexChanging(object sender, GridViewPageEventArgs e) //M1
|
||
{
|
||
try
|
||
{
|
||
grvListaEtapas.PageIndex = e.NewPageIndex;
|
||
llenarGridEtapas();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error R3M1", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnNuevoET_Click(object sender, EventArgs e) //M2
|
||
{
|
||
try
|
||
{
|
||
ViewState["Modo_Etapa"] = "Nuevo";
|
||
mostrarFilasEtapas(2);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M2", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnEliminarET_Click(object sender, EventArgs e) //M3
|
||
{
|
||
try
|
||
{
|
||
// recorro el grid
|
||
foreach (GridViewRow row in grvListaEtapasTemp.Rows)
|
||
{
|
||
|
||
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
||
if (chkTemp != null)
|
||
{
|
||
// si el registro esta marcado
|
||
if (chkTemp.Checked)
|
||
{
|
||
//Iguala la variable al valor en la celda seleccionada
|
||
int intPkEliminar = Convert.ToInt32(row.Cells[2].Text);
|
||
EliminaEtapa(intPkEliminar);
|
||
}
|
||
}
|
||
}
|
||
llenarGridEtapas();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M3", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnGuardarET_Click(object sender, EventArgs e) //M4
|
||
{
|
||
try
|
||
{
|
||
if (GuardaEtapa())
|
||
{
|
||
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 btnAnteriorET_Click(object sender, EventArgs e) //M5
|
||
{
|
||
try
|
||
{
|
||
mostrarFilasEtapas(1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M5", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnGuardar_Click(object sender, EventArgs e) //M6
|
||
{
|
||
try
|
||
{
|
||
if (GuardarDatos())
|
||
{
|
||
MensajeInformativo("El registro fue almacenado exitosamente");
|
||
}
|
||
else
|
||
{
|
||
MensajeError("El registro no fue almacenado, verifique", null);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M6", ex);
|
||
}
|
||
}
|
||
|
||
protected void btnAnterior_Click(object sender, EventArgs e) //M7
|
||
{
|
||
try
|
||
{
|
||
Response.Redirect("wfrProyectos.aspx");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M7", ex);
|
||
}
|
||
}
|
||
|
||
protected void grvListaEtapas_RowDataBound(object sender, GridViewRowEventArgs e) //M8
|
||
{
|
||
try
|
||
{
|
||
GridViewRow selectedRow = e.Row;
|
||
|
||
|
||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||
{
|
||
HtmlInputCheckBox cb = (HtmlInputCheckBox)selectedRow.FindControl("chkItem");
|
||
|
||
if (e.Row.Cells[9].Text.Trim() == "1")
|
||
cb.Checked = true;
|
||
e.Row.Cells[9].Visible = false;
|
||
|
||
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M8", ex);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region Metodos Personalizados (R4)
|
||
|
||
private void construirgrvEtapas() //M0
|
||
{
|
||
try
|
||
{
|
||
grvListaEtapasTemp = (GridView)divListaEtapas.FindControl("grvListaEtapas");
|
||
|
||
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);
|
||
GridViewBoundField bdfEtapaActual = new GridViewBoundField("ETAPAACTUAL", "", false, false, true);
|
||
GridViewBoundField bdfPorcentajeCicloVida = new GridViewBoundField("PORCENTAJECICLOVIDA", "PORCENTAJE", false, false, true);
|
||
GridViewBoundField bdfMontoCicloVida = new GridViewBoundField("MONTOCICLOVIDA", "MONTO", false, false, true);
|
||
|
||
grvListaEtapasTemp.Columns.Add(bdfPkEtapa);
|
||
grvListaEtapasTemp.Columns.Add(bdfEtapa);
|
||
grvListaEtapasTemp.Columns.Add(bdfInicio);
|
||
grvListaEtapasTemp.Columns.Add(bdfConclusion);
|
||
grvListaEtapasTemp.Columns.Add(bdfSituacion);
|
||
//grvListaEtapasTemp.Columns.Add(bdfEtapaActual);
|
||
grvListaEtapasTemp.Columns.Add(bdfPorcentajeCicloVida);
|
||
grvListaEtapasTemp.Columns.Add(bdfMontoCicloVida);
|
||
|
||
|
||
|
||
grvListaEtapasTemp.Columns.Add(bdfEtapaActual);
|
||
|
||
grvListaEtapasTemp.Columns[0].ItemStyle.Width = 25;
|
||
grvListaEtapasTemp.Columns[1].ItemStyle.Width = 25;
|
||
//grvListaEtapasTemp.Columns[3].ItemStyle.Width = 25;
|
||
//grvListaEtapasTemp.Columns[4].ItemStyle.Width = 125;
|
||
//grvListaEtapasTemp.Columns[5].ItemStyle.Width = 125;
|
||
//grvListaEtapasTemp.Columns[6].ItemStyle.Width = 125;
|
||
//grvListaEtapasTemp.Columns[7].ItemStyle.Width = 0;
|
||
|
||
grvListaEtapasTemp.Columns[3].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
grvListaEtapasTemp.Columns[4].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
|
||
grvListaEtapasTemp.Columns[5].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
grvListaEtapasTemp.Columns[6].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
//grvListaEtapasTemp.Columns[7].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
|
||
// grvListaEtapasTemp.Columns[3].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
//.Columns[4].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
// grvListaEtapasTemp.Columns[5].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
// grvListaEtapasTemp.Columns[7].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R4M0", ex);
|
||
}
|
||
}
|
||
|
||
private void mostrarFilasEtapas(int p_intFila) //M1
|
||
{
|
||
try
|
||
{
|
||
divListaEtapas.Visible = false;
|
||
divFormularioEtapas.Visible = false;
|
||
|
||
switch (p_intFila)
|
||
{
|
||
case 1:
|
||
llenarGridEtapas();
|
||
divListaEtapas.Visible = true;
|
||
break;
|
||
case 2:
|
||
limpiarCamposET();
|
||
divFormularioEtapas.Visible = true;
|
||
break;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R4M1", ex);
|
||
}
|
||
}
|
||
|
||
private void limpiarCamposET() //M4
|
||
{
|
||
txtInicio.Text = string.Empty;
|
||
txtConcluye.Text = string.Empty;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Metodos Controles a Datos (R5)
|
||
|
||
private bool GuardarDatos() //M0
|
||
{
|
||
bool blnEjecutado = false;
|
||
|
||
try
|
||
{
|
||
string strModo = ViewState["Modo"].ToString();
|
||
|
||
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.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
|
||
ViewState["PkCicloVida"] = objCicloVidaBL.insertarCicloVida();
|
||
|
||
if (Int32.Parse(ViewState["PkCicloVida"].ToString()) != 0)
|
||
{
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Etapa Actual: " + ddlEtapaActual.SelectedItem.Text + ", Porcentaje: " + txtAvanceEtapa.Text + ", Monto: " + txtMontoEtapa.Text +
|
||
", Proyecto: " + txtProyecto.Text,
|
||
"wfrCicloVida.aspx");
|
||
|
||
blnEjecutado = true;
|
||
|
||
ViewState["Modo"] = "Modifica";
|
||
}
|
||
}
|
||
else if (strModo == "Modifica")
|
||
{
|
||
objCicloVidaBL.objCicloVidaEL.PK = Int32.Parse(ViewState["PkCicloVida"].ToString());
|
||
|
||
if (objCicloVidaBL.actualizarCicloVida())
|
||
{
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.UPDATE.ToString(),
|
||
MensajesBitacora.ModificarRegistro + ": Etapa Actual: " + ddlEtapaActual.SelectedItem.Text + ", Porcentaje: " + txtAvanceEtapa.Text + ", Monto: " + txtMontoEtapa.Text +
|
||
", Proyecto: " + txtProyecto.Text,
|
||
"wfrCicloVida.aspx");
|
||
}
|
||
|
||
blnEjecutado = true;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
blnEjecutado = false;
|
||
throw ex;
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
return blnEjecutado;
|
||
}
|
||
|
||
private void EliminarDatos() //M1
|
||
{
|
||
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.EliminarRegistro + ": Se ha borrado el registro " + ", Etapa Actual: " + ddlEtapaActual.SelectedItem.Text + ", Porcentaje: " + txtAvanceEtapa.Text + ", Monto: " +
|
||
txtMontoEtapa.Text + ", Fecha Etapa Anterior: " + ", Proyecto: " + txtProyecto.Text,
|
||
"wfrCicloVida.aspx");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M2", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
}
|
||
|
||
private bool GuardaEtapa() //M2
|
||
{
|
||
bool blnEjecutado = false;
|
||
string strModo = ViewState["Modo_Etapa"].ToString();
|
||
|
||
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());
|
||
if (DateTime.Parse(txtInicio.Text) < DateTime.Parse(txtConcluye.Text))
|
||
{
|
||
if (strModo == "Nuevo")
|
||
{
|
||
if (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: " + txtProyecto.Text, "wfrCicloVida.aspx");
|
||
}
|
||
else if (strModo == "Modifica")
|
||
{
|
||
objEtapaBL.objEtapaEL.PK = Int32.Parse(ViewState["PkEtapa"].ToString());
|
||
|
||
if (objEtapaBL.actualizarEtapa())
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.UPDATE.ToString(),
|
||
MensajesBitacora.ModificarRegistro + ": Fecha Inicio: " + txtInicio.Text + ", Fecha Concluye: " + txtConcluye.Text + ", Etapa: " + ddlEtapa.SelectedItem.Text + ", Situación Actual: " +
|
||
ddlSituacionActual.Text + ", Proyecto: " + txtProyecto.Text, "wfrCicloVida.aspx");
|
||
}
|
||
}
|
||
else
|
||
MensajeAdvertencia("La fecha de conclusión debe ser mayor a la fecha de inicio");
|
||
}
|
||
else
|
||
{
|
||
MensajeAdvertencia("Debe suminitrar toda la información");
|
||
}
|
||
|
||
blnEjecutado = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M2", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
return blnEjecutado;
|
||
}
|
||
|
||
private void EliminaEtapa(int p_intPKEtapa) //M3
|
||
{
|
||
try
|
||
{
|
||
objEtapaBL = new EtapaBL();
|
||
|
||
objEtapaBL.objEtapaEL.PK = p_intPKEtapa;
|
||
objEtapaBL.objEtapaEL.ASTATE = false;
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.DELETE.ToString(),
|
||
MensajesBitacora.EliminarRegistro + ": Se ha borrado el registro con la PK: " + p_intPKEtapa + " Fecha Inicio: " + txtInicio.Text + ", Fecha Concluye: " +
|
||
txtConcluye.Text + ", Etapa: " + ddlEtapa.SelectedItem.Text + ", Situación Actual: " + ddlSituacionActual.Text + ", Proyecto: " + txtProyecto.Text,
|
||
"frwCicloVida.aspx");
|
||
objEtapaBL.actualizaEstadoEtapa();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R5M3", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Metodos Datos a Controles (R6)
|
||
|
||
private int mostrarDatos() //M0
|
||
{
|
||
int intValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
objCicloVidaBL = new CicloVidaBL();
|
||
objCicloVidaBL.objCicloVidaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
DataSet dsCicloVida = objCicloVidaBL.getCicloVida();
|
||
if (dsCicloVida.Tables[0].Rows.Count > 0)
|
||
{
|
||
ViewState["PkCicloVida"] = dsCicloVida.Tables[0].Rows[0]["PKCICLOVIDA"].ToString();
|
||
ddlEtapaActual.SelectedValue = dsCicloVida.Tables[0].Rows[0]["FKETAPAACTUAL"].ToString();
|
||
txtAvanceEtapa.Text = Decimal.Parse(dsCicloVida.Tables[0].Rows[0]["PORCENTAJECICLOVIDA"].ToString()).ToString("###.#0"); ;
|
||
txtMontoEtapa.Text = Decimal.Parse(dsCicloVida.Tables[0].Rows[0]["MONTOCICLOVIDA"].ToString()).ToString("###,###,###.#0");
|
||
}
|
||
llenarGridEtapas();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M0", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
return intValorRetornado;
|
||
}
|
||
|
||
private void llenarGridEtapas() //M1
|
||
{
|
||
try
|
||
{
|
||
objEtapaBL = new EtapaBL();
|
||
objEtapaBL.objEtapaEL.Etapa = 0;
|
||
objEtapaBL.objEtapaEL.PK = 0;
|
||
objEtapaBL.objEtapaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
||
|
||
DataSet dsEtapas = objEtapaBL.getEtapa();
|
||
detalleGRVDatos(dsEtapas, grvListaEtapas);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M1", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
}
|
||
|
||
private void llenarDDLEtapa() //M2
|
||
{
|
||
try
|
||
{
|
||
objCatalogoBL = new CatalogoBL();
|
||
objCatalogoBL.objCatalogoEL.PK = 0;
|
||
objCatalogoBL.objCatalogoEL.Padre = 16;
|
||
objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
//Carga la información en un dataset
|
||
DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
ddlEtapa.DataSource = dsCatalogo;
|
||
ddlEtapa.DataTextField = dsCatalogo.Tables[0].Columns[2].ColumnName;
|
||
ddlEtapa.DataValueField = dsCatalogo.Tables[0].Columns[0].ColumnName;
|
||
ddlEtapa.DataBind();
|
||
|
||
ddlEtapa.Items.Insert(0, new ListItem("Seleccione una etapa", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M2", ex);
|
||
}
|
||
}
|
||
|
||
private void llenarDDLSituacionActual() //M3
|
||
{
|
||
objCatalogoBL = new CatalogoBL();
|
||
try
|
||
{
|
||
objCatalogoBL.objCatalogoEL.PK = 0;
|
||
objCatalogoBL.objCatalogoEL.Padre = 24;
|
||
objCatalogoBL.objCatalogoEL.ASTATE = true;
|
||
|
||
//Carga la información en un dataset
|
||
DataSet dsCatalogo = objCatalogoBL.getCatalogo();
|
||
|
||
ddlSituacionActual.DataSource = dsCatalogo;
|
||
ddlSituacionActual.DataTextField = dsCatalogo.Tables[0].Columns[2].ColumnName;
|
||
ddlSituacionActual.DataValueField = dsCatalogo.Tables[0].Columns[0].ColumnName;
|
||
ddlSituacionActual.DataBind();
|
||
|
||
ddlSituacionActual.Items.Insert(0, new ListItem("Seleccione situación", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M3", ex);
|
||
}
|
||
}
|
||
|
||
private void llenarDDLEtapaActual() //M4
|
||
{
|
||
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();
|
||
|
||
ddlEtapaActual.DataSource = dsCatalogo;
|
||
ddlEtapaActual.DataTextField = dsCatalogo.Tables[0].Columns[2].ColumnName;
|
||
ddlEtapaActual.DataValueField = dsCatalogo.Tables[0].Columns[0].ColumnName;
|
||
ddlEtapaActual.DataBind();
|
||
|
||
ddlEtapaActual.Items.Insert(0, new ListItem("Seleccione etapa actual", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M4", ex);
|
||
}
|
||
}
|
||
|
||
private int mostrarEtapa() //M5
|
||
{
|
||
int intValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
objEtapaBL = new EtapaBL();
|
||
objEtapaBL.objEtapaEL.PK = Int32.Parse(ViewState["PkEtapa"].ToString());
|
||
objEtapaBL.objEtapaEL.Etapa = 0;
|
||
DataSet dsEtapa = objEtapaBL.getEtapa2();
|
||
if (dsEtapa.Tables[0].Rows.Count > 0)
|
||
{
|
||
ddlEtapa.SelectedValue = dsEtapa.Tables[0].Rows[0]["FKETAPA"].ToString();
|
||
txtInicio.Text = DateTime.Parse(dsEtapa.Tables[0].Rows[0]["FECHAINICIOETAPA"].ToString()).ToString("dd/MM/yyyy");
|
||
txtConcluye.Text = DateTime.Parse(dsEtapa.Tables[0].Rows[0]["FECHAFINETAPA"].ToString()).ToString("dd/MM/yyyy");
|
||
ddlSituacionActual.SelectedValue = dsEtapa.Tables[0].Rows[0]["FKSITUACIONACTUAL"].ToString();
|
||
}
|
||
llenarGridEtapas();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R6M5", ex);
|
||
General.ReportarError(ex, Session["LOGIN"].ToString());
|
||
}
|
||
|
||
return intValorRetornado;
|
||
}
|
||
|
||
#endregion
|
||
|
||
} |