612 lines
26 KiB
C#
612 lines
26 KiB
C#
using AyABL.ADM;
|
|
using AyABL.AGP;
|
|
using AyABL.FNP;
|
|
using AyABL.PPP;
|
|
using AyABL.RCS;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class webforms_FOR_wfrEndeudamiento : 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);
|
|
construirGrvEndeudamiento();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R0M1", ex);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Variables (R1)
|
|
|
|
GridView grvListaEndeudamientoTemp;
|
|
FuenteFinanciamientoBL objFuenteFinanciamientoBL;
|
|
RecursoBL objRecursoBL;
|
|
FinanciamientoBL objFinanciamientoBL;
|
|
EndeudamientoBL objEndeudamientoBL;
|
|
ProyectoBL objProyectoBL;
|
|
DistribucionPartidaBL objDistribucionPartidaBL;
|
|
|
|
#endregion
|
|
|
|
#region Eventos Formularios
|
|
|
|
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;
|
|
}
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
llenarDDLTipoFuente();
|
|
llenarDDLFuenteFinanciamiento();
|
|
llenarDDLDesembolsoI();
|
|
llenarDDLDesembolsoF();
|
|
|
|
}
|
|
|
|
ScriptManager.RegisterStartupScript(Page, typeof(Page), "Check", "validarEstado()", true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R2M0", ex);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Metodos Personalizados
|
|
private void construirGrvEndeudamiento() //M9
|
|
{
|
|
try
|
|
{
|
|
grvListaEndeudamientoTemp = (GridView)divListadoEndeudamiento.FindControl("grvListaEndeudamiento");
|
|
|
|
GridViewBoundField bdfPkEndeudamiento = new GridViewBoundField("PKENDEUDAMIENTO", "PK", false, false, false);
|
|
GridViewBoundField bdfFuenteFinanciamiento = new GridViewBoundField("NOMBREFUENTEFINANCIAMIENTO", "FUENTE", true, false, true);
|
|
GridViewBoundField bdfMonto = new GridViewBoundField("MONTOENDEUDAMIENTO", "MONTO", true, false, true);
|
|
GridViewBoundField bdfPeriodoGracia = new GridViewBoundField("PERIODOGRACIAENDEUDAMIENTO", "PERIODO GRACIA", true, false, true);
|
|
GridViewBoundField bdfPlazo = new GridViewBoundField("PLAZOENDEUDAMIENTO", "PLAZO", true, false, true);
|
|
GridViewBoundField bdfDesembolsoInicio = new GridViewBoundField("DESEMBOLSOINICIOENDEUDAMIENTO", "DESEMBOLSO INICIAL", true, false, true);
|
|
GridViewBoundField bdfDesembolsoFin = new GridViewBoundField("DESEMBOLSOFINENDEUDAMIENTO", "DESEMBOLSO FINAL", true, false, true);
|
|
GridViewBoundField bdfTipoCambio = new GridViewBoundField("TIPOCAMBIOCONTRATOENDEUDAMIENTO", "TIPO CAMBIO", true, false, true);
|
|
GridViewBoundField bdfFechaContrato = new GridViewBoundField("FECHACONTRATOENDEUDAMIENTO", "FECHA DE CONTRATO", true, true, true);
|
|
GridViewBoundField bdfSituacionActual = new GridViewBoundField("SITUACIONACTUALENDEUDAMIENTO", "SITUACION ACTUAL", true, false, true);
|
|
GridViewBoundField bdfTasa = new GridViewBoundField("TASAENDEUDAMIENTO", "TASA INTERES", true, false, true);
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfPkEndeudamiento);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfFuenteFinanciamiento);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfMonto);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfPeriodoGracia);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfPlazo);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfDesembolsoInicio);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfDesembolsoFin);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfTipoCambio);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfFechaContrato);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfSituacionActual);
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfTasa);
|
|
|
|
bdfMonto.DataFormatString = "{0:N2}";
|
|
bdfTipoCambio.DataFormatString = "{0:N2}";
|
|
|
|
grvListaEndeudamientoTemp.Columns[0].ItemStyle.Width = 15;
|
|
grvListaEndeudamientoTemp.Columns[1].ItemStyle.Width = 25;
|
|
grvListaEndeudamientoTemp.Columns[3].ItemStyle.Width = 300;
|
|
grvListaEndeudamientoTemp.Columns[4].ItemStyle.Width = 110;
|
|
grvListaEndeudamientoTemp.Columns[5].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[6].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[7].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[8].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[9].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[10].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[11].ItemStyle.Width = 50;
|
|
grvListaEndeudamientoTemp.Columns[12].ItemStyle.Width = 50;
|
|
|
|
grvListaEndeudamientoTemp.Columns[4].ItemStyle.HorizontalAlign = HorizontalAlign.Right;
|
|
grvListaEndeudamientoTemp.Columns[5].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[6].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[7].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[8].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[9].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[10].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[11].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
grvListaEndeudamientoTemp.Columns[12].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R4M9", ex);
|
|
}
|
|
}
|
|
|
|
private void mostrarFilasEndeudamiento(int p_intFila) //M10
|
|
{
|
|
try
|
|
{
|
|
divListadoEndeudamiento.Visible = false;
|
|
divDatosEndeudamiento.Visible = false;
|
|
|
|
switch (p_intFila)
|
|
{
|
|
case 1:
|
|
llenarGrvListaEndeudamiento();
|
|
divListadoEndeudamiento.Visible = true;
|
|
break;
|
|
case 2:
|
|
limpiarCamposED();
|
|
divDatosEndeudamiento.Visible = true;
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R4M10", ex);
|
|
}
|
|
}
|
|
|
|
private void limpiarCamposED() //M11
|
|
{
|
|
llenarDDLTipoFuente();
|
|
llenarDDLFuenteFinanciamiento();
|
|
txtMontoDeuda.Text = string.Empty;
|
|
txtTasa.Text = string.Empty;
|
|
txtPeriodoGracia.Text = string.Empty;
|
|
txtPlazo.Text = string.Empty;
|
|
llenarDDLDesembolsoI();
|
|
llenarDDLDesembolsoF();
|
|
txtTipoCambio.Text = string.Empty;
|
|
txtFechaContrato.Text = string.Empty;
|
|
txtSituacionContrato.Text = string.Empty;
|
|
}
|
|
#endregion
|
|
|
|
#region Metodos Datos a Controles
|
|
private void llenarGrvListaEndeudamiento() //M9
|
|
{
|
|
try
|
|
{
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = 0;
|
|
objEndeudamientoBL.objEndeudamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
DataSet dsEndeudamiento = objEndeudamientoBL.getEndeudamiento();
|
|
detalleGRVDatos(dsEndeudamiento, grvListaEndeudamientoTemp);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R6M9", ex);
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
}
|
|
}
|
|
|
|
private void mostrarDatosEndeudamiento() //M10
|
|
{
|
|
try
|
|
{
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = Int32.Parse(ViewState["PkEndeudamiento"].ToString());
|
|
objEndeudamientoBL.objEndeudamientoEL.Proyecto = 0;
|
|
DataSet dsEndeudamiento = objEndeudamientoBL.getEndeudamiento();
|
|
|
|
if (dsEndeudamiento.Tables[0].Rows.Count != 0)
|
|
{
|
|
ddlTipoFuente.SelectedValue = dsEndeudamiento.Tables[0].Rows[0]["PADREFUENTEFINANCIAMIENTO"].ToString();
|
|
llenarDDLFuenteFinanciamiento();
|
|
ddlFuenteFinanciamiento.SelectedValue = dsEndeudamiento.Tables[0].Rows[0]["FKFUENTEFINANCIAMIENTO"].ToString();
|
|
txtMontoDeuda.Text = Decimal.Parse(dsEndeudamiento.Tables[0].Rows[0]["MONTOENDEUDAMIENTO"].ToString()).ToString("###,###,###,###.#0");
|
|
txtTasa.Text = dsEndeudamiento.Tables[0].Rows[0]["TASAENDEUDAMIENTO"].ToString();
|
|
txtPeriodoGracia.Text = dsEndeudamiento.Tables[0].Rows[0]["PERIODOGRACIAENDEUDAMIENTO"].ToString();
|
|
txtPlazo.Text = dsEndeudamiento.Tables[0].Rows[0]["PLAZOENDEUDAMIENTO"].ToString();
|
|
ddlDesembolInicio.SelectedItem.Text = dsEndeudamiento.Tables[0].Rows[0]["DESEMBOLSOINICIOENDEUDAMIENTO"].ToString();
|
|
ddlDesembolFinal.SelectedItem.Text = dsEndeudamiento.Tables[0].Rows[0]["DESEMBOLSOFINENDEUDAMIENTO"].ToString();
|
|
txtTipoCambio.Text = dsEndeudamiento.Tables[0].Rows[0]["TIPOCAMBIOCONTRATOENDEUDAMIENTO"].ToString();
|
|
txtFechaContrato.Text = DateTime.Parse(dsEndeudamiento.Tables[0].Rows[0]["FECHACONTRATOENDEUDAMIENTO"].ToString()).ToString("dd/MM/yyyy");
|
|
txtSituacionContrato.Text = dsEndeudamiento.Tables[0].Rows[0]["SITUACIONACTUALENDEUDAMIENTO"].ToString();
|
|
}
|
|
else
|
|
{
|
|
MensajeInformativo("No se encontró el registro solicitado");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R6M10" +
|
|
"", ex);
|
|
}
|
|
}
|
|
private void llenarDDLFuenteFinanciamiento() //M11
|
|
{
|
|
try
|
|
{
|
|
objFuenteFinanciamientoBL = new FuenteFinanciamientoBL();
|
|
|
|
string strFuente = "Fuente Financiamiento";
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.Padre = Int32.Parse(ddlTipoFuente.SelectedValue);
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.PK = 0;
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.ASTATE = true;
|
|
|
|
//Carga la información en un dataset
|
|
DataSet dsFuente = objFuenteFinanciamientoBL.getFuenteFinanciamiento();
|
|
|
|
ddlListaDatos(dsFuente, ddlFuenteFinanciamiento, strFuente);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R6M11", ex);
|
|
}
|
|
}
|
|
private void llenarDDLTipoFuente() //M12
|
|
{
|
|
try
|
|
{
|
|
objFuenteFinanciamientoBL = new FuenteFinanciamientoBL();
|
|
|
|
string strFuente = "Tipo Fuente";
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.Padre = -1;
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.PK = 0;
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.ASTATE = true;
|
|
|
|
//Carga la información en un dataset
|
|
DataSet dsFuente = objFuenteFinanciamientoBL.getFuenteFinanciamiento();
|
|
|
|
ddlListaDatos(dsFuente, ddlTipoFuente, strFuente);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R6M12", ex);
|
|
}
|
|
}
|
|
|
|
private void llenarDDLDesembolsoI() //M13
|
|
{
|
|
try
|
|
{
|
|
|
|
ddlDesembolInicio.Items.Clear();
|
|
|
|
ListItem lstAnios = new ListItem("Desembolso Inicial");
|
|
ddlDesembolInicio.Items.Add(lstAnios);
|
|
|
|
|
|
for (int i = DateTime.Now.Year - 7; i <= DateTime.Now.Year + 7; i++)
|
|
{
|
|
lstAnios = new ListItem(i.ToString());
|
|
ddlDesembolInicio.Items.Add(lstAnios);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R6M13", ex);
|
|
}
|
|
}
|
|
|
|
private void llenarDDLDesembolsoF() //M14
|
|
{
|
|
try
|
|
{
|
|
|
|
ddlDesembolFinal.Items.Clear();
|
|
|
|
ListItem lstAnios = new ListItem("Desembolso Final");
|
|
ddlDesembolFinal.Items.Add(lstAnios);
|
|
|
|
|
|
for (int i = DateTime.Now.Year - 7; i <= DateTime.Now.Year + 7; i++)
|
|
{
|
|
lstAnios = new ListItem(i.ToString());
|
|
ddlDesembolFinal.Items.Add(lstAnios);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R6M14", ex);
|
|
}
|
|
}
|
|
|
|
public static void ddlListaDatos(DataSet p_dsDatos, DropDownList p_ddlListado,
|
|
string p_strSeleccion) //M8
|
|
{
|
|
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(p_strSeleccion, "-1"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Metodos Controles a Datos
|
|
private bool GuardarDatosED() //M2
|
|
{
|
|
bool blnEjecutado = false;
|
|
|
|
try
|
|
{
|
|
string strModo = ViewState["Modo_Endeudamiento"].ToString();
|
|
|
|
if (txtMontoDeuda.Text != string.Empty && txtPeriodoGracia.Text != string.Empty && txtPlazo.Text != string.Empty && ddlDesembolInicio.SelectedItem.Text != "Desembolso Inicial" &&
|
|
ddlDesembolFinal.SelectedItem.Text != "Desembolso Final" && txtTipoCambio.Text != string.Empty && txtFechaContrato.Text != string.Empty && txtSituacionContrato.Text != string.Empty &&
|
|
txtTasa.Text != string.Empty && ddlFuenteFinanciamiento.SelectedItem.Text != "Fuente de Financiamiento" && ddlTipoFuente.SelectedItem.Text != "Tipo de Fuente")
|
|
{
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
objEndeudamientoBL.objEndeudamientoEL.Monto = Decimal.Parse(txtMontoDeuda.Text);
|
|
objEndeudamientoBL.objEndeudamientoEL.PeriodoGracia = txtPeriodoGracia.Text;
|
|
objEndeudamientoBL.objEndeudamientoEL.Plazo = txtPlazo.Text;
|
|
objEndeudamientoBL.objEndeudamientoEL.DesembolsoInicio = Int32.Parse(ddlDesembolInicio.SelectedItem.Text);
|
|
objEndeudamientoBL.objEndeudamientoEL.DesembolsoFin = Int32.Parse(ddlDesembolFinal.SelectedItem.Text);
|
|
objEndeudamientoBL.objEndeudamientoEL.TipoCambio = Decimal.Parse(txtTipoCambio.Text);
|
|
objEndeudamientoBL.objEndeudamientoEL.FechaContrato = DateTime.Parse(txtFechaContrato.Text);
|
|
objEndeudamientoBL.objEndeudamientoEL.SituacinActual = txtSituacionContrato.Text;
|
|
objEndeudamientoBL.objEndeudamientoEL.Tasa = txtTasa.Text;
|
|
objEndeudamientoBL.objEndeudamientoEL.FuenteFinanciamiento = Int32.Parse(ddlFuenteFinanciamiento.SelectedValue);
|
|
objEndeudamientoBL.objEndeudamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
if (strModo == "Nuevo")
|
|
{
|
|
|
|
if (objEndeudamientoBL.insertarEndeudamiento())
|
|
{
|
|
blnEjecutado = true;
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Monto: " + Decimal.Parse(txtMontoDeuda.Text).ToString("###,###,###.#0") + ", " +
|
|
"Periodo Gracia: " + txtPeriodoGracia.Text + ", Plazo: " + txtPlazo.Text + ", Desembolzo Inicial: " +
|
|
ddlDesembolInicio.SelectedItem.Text + ", Desembolso Final: " + ddlDesembolFinal.SelectedItem.Text +
|
|
", Tipo Cambio: " + Decimal.Parse(txtTipoCambio.Text).ToString("###,###,###.#0") + ", Fecha Contrato: " +
|
|
txtFechaContrato.Text + ", Situación Actual: " + txtSituacionContrato.Text + ", Tasa: " +
|
|
txtTasa.Text + ", Fuente de Financiamiento: " + ddlFuenteFinanciamiento.SelectedItem.Text +
|
|
", Proyecto: " + txtProyecto.Text, "wfrFinancimiento.aspx");
|
|
}
|
|
}
|
|
else if (strModo == "Modifica")
|
|
{
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = Int32.Parse(ViewState["PkEndeudamiento"].ToString());
|
|
|
|
if (objEndeudamientoBL.actualizarEndeudamiento())
|
|
{
|
|
blnEjecutado = true;
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
AccionBitacora.UPDATE.ToString(),
|
|
MensajesBitacora.ModificarRegistro + ": " + "Monto: " + Decimal.Parse(txtMontoDeuda.Text).ToString("###,###,###.#0") + ", Periodo Gracia: " +
|
|
txtPeriodoGracia.Text + ", Plazo: " + txtPlazo.Text + ", Desembolzo Inicial: " +
|
|
ddlDesembolInicio.SelectedItem.Text + ", Desembolso Final: " + ddlDesembolFinal.SelectedItem.Text +
|
|
", Tipo Cambio: " + Decimal.Parse(txtTipoCambio.Text).ToString("###,###,###.#0") + ", Fecha Contrato: " +
|
|
txtFechaContrato.Text + ", Situación Actual: " + txtSituacionContrato.Text + ", Tasa: " +
|
|
txtTasa.Text + ", Fuente de Financiamiento: " + ddlFuenteFinanciamiento.SelectedItem.Text +
|
|
", Proyecto: " + txtProyecto.Text, "wfrFinancimiento.aspx");
|
|
}
|
|
}
|
|
llenarGrvListaEndeudamiento();
|
|
}
|
|
else
|
|
{
|
|
MensajeAdvertencia("Debe suminitrar toda la información");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R5M2", ex);
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
}
|
|
|
|
return blnEjecutado;
|
|
}
|
|
private void eliminarDatosED(int p_intPKEndeudamiento) //M3
|
|
{
|
|
try
|
|
{
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = p_intPKEndeudamiento;
|
|
objEndeudamientoBL.objEndeudamientoEL.ASTATE = false;
|
|
objEndeudamientoBL.actualizaEstadoEndeudamiento();
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
AccionBitacora.DELETE.ToString(),
|
|
MensajesBitacora.EliminarRegistro + " PK: " + ": " + p_intPKEndeudamiento +
|
|
" del Proyecto: " + txtProyecto.Text, "wfrFinancimiento.aspx");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R5M3", ex);
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Eventos Controles Web
|
|
|
|
protected void btnAnterior_Click(object sender, EventArgs e) //M0
|
|
{
|
|
try
|
|
{
|
|
Response.Redirect("wfrProyectos.aspx");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M0", ex);
|
|
}
|
|
}
|
|
|
|
protected void btnNuevoED_Click(object sender, EventArgs e) //M10
|
|
{
|
|
try
|
|
{
|
|
ViewState["Modo_Endeudamiento"] = "Nuevo";
|
|
mostrarFilasEndeudamiento(2);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M10", ex);
|
|
}
|
|
}
|
|
|
|
protected void btnEliminarED_Click(object sender, EventArgs e) //M11
|
|
{
|
|
try
|
|
{
|
|
// recorro el grid
|
|
foreach (GridViewRow row in grvListaEndeudamientoTemp.Rows)
|
|
{
|
|
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
if (chkTemp != null)
|
|
{
|
|
// si el registro esta marcado
|
|
if (chkTemp.Checked)
|
|
{
|
|
int intPkEliminar = Convert.ToInt32(row.Cells[2].Text);
|
|
eliminarDatosED(intPkEliminar);
|
|
}
|
|
}
|
|
}
|
|
MensajeInformativo("El registro fue eliminado");
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M11", ex);
|
|
}
|
|
}
|
|
|
|
protected void btnGuardarED_Click(object sender, EventArgs e) //M12
|
|
{
|
|
try
|
|
{
|
|
if (GuardarDatosED())
|
|
{
|
|
MensajeInformativo("El registro fue almacenado");
|
|
}
|
|
else
|
|
{
|
|
MensajeError("El registro no fue almacenado, verifique", null);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M12", ex);
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
}
|
|
}
|
|
|
|
protected void btnAnteriorED_Click(object sender, EventArgs e) //M13
|
|
{
|
|
try
|
|
{
|
|
mostrarFilasEndeudamiento(1);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M13", ex);
|
|
}
|
|
}
|
|
|
|
protected void grvListaEndeudamiento_RowCommand(object sender, GridViewCommandEventArgs e) //M14
|
|
{
|
|
try
|
|
{
|
|
if (e.CommandName == "editar")
|
|
{
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|
GridViewRow selectedRow = grvListaEndeudamiento.Rows[i];
|
|
ViewState["PkEndeudamiento"] = Convert.ToInt32(selectedRow.Cells[2].Text);
|
|
ViewState["Modo_Endeudamiento"] = "Modifica";
|
|
|
|
mostrarFilasEndeudamiento(2);
|
|
|
|
mostrarDatosEndeudamiento();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M14", ex);
|
|
}
|
|
}
|
|
|
|
protected void grvListaEndeudamiento_PageIndexChanging(object sender, GridViewPageEventArgs e)//M15
|
|
{
|
|
try
|
|
{
|
|
grvListaEndeudamiento.PageIndex = e.NewPageIndex;
|
|
llenarGrvListaEndeudamiento();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error R3M15", ex);
|
|
}
|
|
}
|
|
|
|
protected void ddlTipoFuente_SelectedIndexChanged(object sender, EventArgs e) //M16
|
|
{
|
|
try
|
|
{
|
|
llenarDDLFuenteFinanciamiento();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M16", ex);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
|