838 lines
29 KiB
C#
838 lines
29 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
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 AyABL.AUT.Autenticacion;
|
|||
|
|
using AyABL.Usuario;
|
|||
|
|
using AyABL.APL;
|
|||
|
|
using AyADAL;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using AyABL.RCS;
|
|||
|
|
using AyABL.Tran;
|
|||
|
|
using AyABL.Usuario;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public partial class Forms_TRA_frwFoliosyPlanos : 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);
|
|||
|
|
|
|||
|
|
//construirGridView();
|
|||
|
|
|
|||
|
|
grvListarPlanos.Visible = true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
Javascript.CheckAllGridViewItems(Page);
|
|||
|
|
|
|||
|
|
//cuwBusquedaList.Buscar += new _controlesusuario_Estandar_cuwBusquedaList.SearchEvent(Buscar);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R0M1", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Variables (R1)
|
|||
|
|
|
|||
|
|
GridView grvListarPlanosTemp;
|
|||
|
|
provinciaBL objprovinciaBL;
|
|||
|
|
requisitoBL objRequisitoBL;
|
|||
|
|
solicitudBL objSolicitudBL;
|
|||
|
|
usuarioBL objUsuarioBL;
|
|||
|
|
PlanoBL objPlanoBL;
|
|||
|
|
string strNumSolicitudTMP = "0";
|
|||
|
|
|
|||
|
|
#region variables del estandar
|
|||
|
|
string strPagina = string.Empty;
|
|||
|
|
string strScript = string.Empty;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Formulario (R2)
|
|||
|
|
|
|||
|
|
protected void Page_Load(object sender, EventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnGuarda);
|
|||
|
|
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnReutilizar);
|
|||
|
|
|
|||
|
|
if (Session["SOLICITUD"] != null )
|
|||
|
|
{
|
|||
|
|
strNumSolicitudTMP = Session["SOLICITUD"].ToString();
|
|||
|
|
lblNumSolicitud.Text = strNumSolicitudTMP;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if ((!IsPostBack) && (Session.Count > 0))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Session["Pagina"] = "";
|
|||
|
|
llenarGridView(true);
|
|||
|
|
txtAno.Text = DateTime.Now.Year.ToString();
|
|||
|
|
llenarDDLProvincia();
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
//ComandosxMenu();
|
|||
|
|
}
|
|||
|
|
if (!Page.IsPostBack)
|
|||
|
|
{
|
|||
|
|
#region Ajax methods
|
|||
|
|
if (Request.QueryString["MethodName"] != null)
|
|||
|
|
{
|
|||
|
|
if (Request["MethodName"].ToString() == "insertarRegistro")
|
|||
|
|
// same Method Name that we are specifying on client side(DeleteR)
|
|||
|
|
{
|
|||
|
|
insertarRegistro();// Method defined on the page to delete the record
|
|||
|
|
//mostrarFilaTabla(1);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeError();</script>");}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R2M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Controles Web (R3)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para extraer información del registro de la base de datos y ser mostrado en el acordeon de Controles
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
|
|||
|
|
protected void grvListarPlanos_RowCommand(object sender, GridViewCommandEventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (e.CommandName == "eliminar")
|
|||
|
|
{
|
|||
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|||
|
|
GridViewRow selectedRow = grvListarPlanos.Rows[i];
|
|||
|
|
int intPkPlanocatastrado = int.Parse(selectedRow.Cells[0].Text);
|
|||
|
|
if (removersolicitud(intPkPlanocatastrado))
|
|||
|
|
llenarGridView(true);
|
|||
|
|
|
|||
|
|
////int intPkPlanocatastrado = Convert.ToInt32(selectedRow.Cells[2].Text);
|
|||
|
|
//ViewState["PkPlanocatastrado"] = intPkPlanocatastrado;
|
|||
|
|
//ViewState["MODO"] = "Modifica";
|
|||
|
|
|
|||
|
|
//mostrarFilaTabla(2);
|
|||
|
|
|
|||
|
|
//mostrarDatos(intPkPlanocatastrado);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para la paginación del Grid en caso de que el usuario desee ver mas registros
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
protected void grvListarPlanos_PageIndexChanging(object sender, GridViewPageEventArgs e) //M3
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvListarPlanos.PageIndex = e.NewPageIndex;
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M3", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
///<summary>
|
|||
|
|
///Activar el botón de Refrescar
|
|||
|
|
///</summary>
|
|||
|
|
///<param name="sender"></param>
|
|||
|
|
///<param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void btnRefrescar_Click(object sender, System.Web.UI.ImageClickEventArgs e) //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M4" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Activa el evento del botón Buscar (binoculares)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
protected void btnBuscar_Click(object sender, System.Web.UI.ImageClickEventArgs e) //M7
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M7" + MensajesAplicacion.UsuarioInexistente.ToString(), 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) //M14
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (txtConsultaFolio.Text == string.Empty)
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeInformativo('Se debe ingresar el folio.');</script>");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (txtNumeroPlano.Text == string.Empty)
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeAlerta();</script>");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ViewState["MODO"] = "Nuevo";
|
|||
|
|
int PkPlanocatastrado = GuardarDatos();
|
|||
|
|
if (PkPlanocatastrado != 0)
|
|||
|
|
limpiarCampos();
|
|||
|
|
llenarGridView(true);
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
grvListarPlanos.Visible = true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
|||
|
|
//ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeAlerta();</script>");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M14", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
protected void btnReutilizar_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
insertarRegistro();
|
|||
|
|
llenarGridView(true);
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
grvListarPlanos.Visible = true;
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
{
|
|||
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeInformativo('Se presento un error al insertar el registro.');</script>"); }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//protected void ddlAnno_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Personalizados (R4)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Oculta las filas que lo requieran
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intFila"></param>
|
|||
|
|
private void mostrarFilaTabla(int p_intFila) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
divDatosSuperiores.Visible = false;
|
|||
|
|
|
|||
|
|
//divDatosInferiores.Visible = false;
|
|||
|
|
|
|||
|
|
switch (p_intFila)
|
|||
|
|
{
|
|||
|
|
case 1:
|
|||
|
|
llenarGridView(true);
|
|||
|
|
divDatosSuperiores.Visible = true;
|
|||
|
|
break;
|
|||
|
|
case 2:
|
|||
|
|
llenarGridView(true);
|
|||
|
|
//divDatosInferiores.Visible = true;
|
|||
|
|
break;
|
|||
|
|
case 3:
|
|||
|
|
llenarGridView(true);
|
|||
|
|
//divDatosInferiores.Visible = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para contruir el Grid al inicio de la pantalla
|
|||
|
|
/// </summary>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
private void construirGridView() //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvListarPlanosTemp = (GridView)tdLista.FindControl("grvListarPlanos");
|
|||
|
|
|
|||
|
|
GridViewBoundField bdfPkPlanocatastrado = new GridViewBoundField("PKPLANOCATASTRADO", "ID", true, false, true);
|
|||
|
|
GridViewBoundField bdfPLANOCATASTROPLANOCATASTRADO = new GridViewBoundField("PLANOCATASTROPLANOCATASTRADO", "Plano", true, false, true);
|
|||
|
|
GridViewBoundField bdfUSUARIOPLANOCATASTRADO = new GridViewBoundField("USUARIOPLANOCATASTRADO", "Usuario", true, false, true);
|
|||
|
|
GridViewBoundField bdfNUMFOLIOREALPLANOCATASTRADO = new GridViewBoundField("NUMFOLIOREALPLANOCATASTRADO", "Folio", true, false, true);
|
|||
|
|
GridViewBoundField bdfFecha = new GridViewBoundField("FECHAPLANOCATASTRADO", "Fecha", true, true, true);
|
|||
|
|
GridViewBoundField bdfNUMSOLICITUD = new GridViewBoundField("NUMSOLICITUDPLANOCATASTRADO", "Solicitud", true, false, true);
|
|||
|
|
|
|||
|
|
grvListarPlanosTemp.Columns.Add(bdfPkPlanocatastrado);
|
|||
|
|
grvListarPlanosTemp.Columns.Add(bdfPLANOCATASTROPLANOCATASTRADO);
|
|||
|
|
grvListarPlanosTemp.Columns.Add(bdfUSUARIOPLANOCATASTRADO);
|
|||
|
|
grvListarPlanosTemp.Columns.Add(bdfNUMFOLIOREALPLANOCATASTRADO);
|
|||
|
|
grvListarPlanosTemp.Columns.Add(bdfFecha);
|
|||
|
|
grvListarPlanosTemp.Columns.Add(bdfNUMSOLICITUD);
|
|||
|
|
|
|||
|
|
grvListarPlanosTemp.Columns[0].ItemStyle.Width = 25;
|
|||
|
|
grvListarPlanosTemp.Columns[1].ItemStyle.Width = 25;
|
|||
|
|
grvListarPlanosTemp.Columns[2].ItemStyle.Width = 600;
|
|||
|
|
grvListarPlanosTemp.Columns[3].ItemStyle.Width = 425;
|
|||
|
|
grvListarPlanosTemp.Columns[4].ItemStyle.Width = 100;
|
|||
|
|
grvListarPlanosTemp.Columns[5].ItemStyle.Width = 100;
|
|||
|
|
|
|||
|
|
|
|||
|
|
//cuwBusquedaList.LlenarCHKLBusqueda(grvListarPlanosTemp);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se encarga de agregar el filtro de busqueda seleccionado por el usuario
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
|
|||
|
|
//private void condicionesBusqueda() //M2
|
|||
|
|
//{
|
|||
|
|
// objRequisitoBL = new requisitoBL();
|
|||
|
|
// CondicionDAL condicion;
|
|||
|
|
// DateTime dteFechaInicio = new DateTime();
|
|||
|
|
// DateTime dteFechaFin = new DateTime();
|
|||
|
|
// ListItem li = new ListItem();
|
|||
|
|
// string p_parametros;
|
|||
|
|
// p_parametros = this.cuwBusquedaList.getValorBusqueda();
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// if (p_parametros != "")
|
|||
|
|
// {
|
|||
|
|
// //aqui se construye el listItem con los datos que vienen del control en formato {valor : texto , valor : texto}
|
|||
|
|
// char[] separadorTuplas = { ',' };
|
|||
|
|
// char[] separadorValores = { ':' };
|
|||
|
|
// string[] arrayTupla = p_parametros.Split(separadorTuplas);
|
|||
|
|
|
|||
|
|
// for (int i = 0; i <= (arrayTupla.Length - 1); i++)
|
|||
|
|
// {
|
|||
|
|
// if (arrayTupla[i].ToString() != "")
|
|||
|
|
// {
|
|||
|
|
// string[] arrayValores = arrayTupla[i].ToString().Split(separadorValores);
|
|||
|
|
// li = new ListItem(arrayValores[1], arrayValores[0]);
|
|||
|
|
|
|||
|
|
// if (li.Value.Contains("FECHA") && li.Text != string.Empty)
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// if (li.Value.Contains("INICIO"))
|
|||
|
|
// {
|
|||
|
|
// dteFechaInicio = Convert.ToDateTime(li.Text.ToString());
|
|||
|
|
// }
|
|||
|
|
// if (li.Value.Contains("FIN"))
|
|||
|
|
// {
|
|||
|
|
// dteFechaFin = Convert.ToDateTime(li.Text.ToString());
|
|||
|
|
|
|||
|
|
// if (dteFechaFin != null || dteFechaInicio != null)
|
|||
|
|
// if (dteFechaInicio < dteFechaFin || dteFechaFin == dteFechaInicio)
|
|||
|
|
// {
|
|||
|
|
// objPlanoBL = new PlanoBL();
|
|||
|
|
// arlCondicionesFiltroBusqueda = objPlanoBL.buscarPorFechas(Tablas.planocatastrado, dteFechaInicio, dteFechaFin, operadorLogico.AND);
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + "Verifique que la Fecha de Inicio sea menor que la Fecha Final" + "M2");
|
|||
|
|
// else
|
|||
|
|
// MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + "Verifique que los campos de las fechas no estén vacíos" + "M2");
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// if (li.Value.Contains("booleano") && li.Text != "2")
|
|||
|
|
// {
|
|||
|
|
// condicion = new CondicionDAL();
|
|||
|
|
// char[] separadorColumna = { '|' };
|
|||
|
|
// string[] strColumna = li.Value.Split(separadorColumna);
|
|||
|
|
// condicion.valorIzquierdo = strColumna[1].ToString();
|
|||
|
|
// condicion.operadorGeneral = operadorGeneral.EQUAL;
|
|||
|
|
// condicion.operadorLogico = operadorLogico.AND;
|
|||
|
|
// condicion.valorDerecho = li.Text;
|
|||
|
|
// arlCondicionesFiltroBusqueda.Add(condicion);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// if (li.Text != string.Empty && !li.Value.Contains("booleano"))
|
|||
|
|
// {
|
|||
|
|
// condicion = new CondicionDAL();
|
|||
|
|
// condicion.valorIzquierdo = li.Value;
|
|||
|
|
// condicion.operadorGeneral = operadorGeneral.LIKEALL;
|
|||
|
|
// condicion.operadorLogico = operadorLogico.AND;
|
|||
|
|
// condicion.valorDerecho = "%" + li.Text + "%";
|
|||
|
|
// arlCondicionesFiltroBusqueda.Add(condicion);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// catch (Exception ex)
|
|||
|
|
// {
|
|||
|
|
// throw ex;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza con el buscador de la parte superior de la pantalla, y hace que se despliegue la información de acuerdo
|
|||
|
|
/// a lo solicitado
|
|||
|
|
/// </summary>|
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
private void Buscar() //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para el despliegue de los botones
|
|||
|
|
/// </summary>
|
|||
|
|
private void ComandosxMenu() //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DataSet dsComandos = getComandos();
|
|||
|
|
|
|||
|
|
if (dsComandos != null)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
|
|||
|
|
{
|
|||
|
|
case "NUEVO":
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "MODIFICA":
|
|||
|
|
//Inicio de variable tipo VIEWSTATE
|
|||
|
|
ViewState["PUEDEMODIFICAR"] = true;
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para remover el role asignado al usuario
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intPkPlanocatastrado"></param>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
private bool removersolicitud(int p_intPkPlanocatastrado)
|
|||
|
|
{
|
|||
|
|
bool blnValorRetornado = false;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
objPlanoBL = new PlanoBL();
|
|||
|
|
objPlanoBL.objplanoEL.PK = p_intPkPlanocatastrado;
|
|||
|
|
|
|||
|
|
objPlanoBL.eliminarSolicitud();
|
|||
|
|
blnValorRetornado = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return blnValorRetornado;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Controles a Datos (R5)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// guarda y modifica registros en la tabla.
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private int GuardarDatos() //M0
|
|||
|
|
{
|
|||
|
|
int nValorRetornado = 0;
|
|||
|
|
|
|||
|
|
string strSolicitudes = null;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string strModo = ViewState["MODO"].ToString();
|
|||
|
|
|
|||
|
|
objPlanoBL = new PlanoBL();
|
|||
|
|
objPlanoBL.objplanoEL.PLANOCATASTRO = ddlProvincia.SelectedValue.ToString() + "-" + txtNumeroPlano.Text + "-" + txtAno.Text;
|
|||
|
|
objPlanoBL.objplanoEL.NUMFOLIOREAL = txtConsultaFolio.Text;
|
|||
|
|
objPlanoBL.objplanoEL.Fecha = DateTime.Now;
|
|||
|
|
objPlanoBL.objplanoEL.USUARIO = Session["LOGIN"].ToString();
|
|||
|
|
objPlanoBL.objplanoEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|||
|
|
|
|||
|
|
if (strModo == "Nuevo")
|
|||
|
|
{
|
|||
|
|
objPlanoBL.objplanoEL.PK = 0;
|
|||
|
|
DataSet ds = objPlanoBL.listarPlanos(null, true, null);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count == 0)//si no existe
|
|||
|
|
{
|
|||
|
|
nValorRetornado = objPlanoBL.insertarPlanos();
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ha ingresado un nuevo número de plano " + txtNumeroPlano.Text.Trim(),
|
|||
|
|
"frwFoliosyPlanosSolicitud.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
strSolicitudes = strSolicitudes + row["NUMSOLICITUDPLANOCATASTRADO"].ToString() + ",";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ds = objPlanoBL.dsListarPlanos(null);
|
|||
|
|
if (ds.Tables[0].Rows.Count == 0)//si no existe asociado a la solicitud
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeInformativo('El folio y plano ya fueron ingresados para otra solicitudes " + strSolicitudes + ".Desea agregarla?.<br /><br /> <button type=button onclick=ejecutarClick(); class=btn clear>Si</button> <button type=button class=btn clear>No</button> ');</script>"); }
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else//si existe asociado a la solicitud
|
|||
|
|
{
|
|||
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeInformativo('El folio y plano ya fueron ingresados para esta solicitud.');</script>"); }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (strModo == "Modifica" && bool.Parse(ViewState["PUEDEMODIFICAR"].ToString()) == true)
|
|||
|
|
{
|
|||
|
|
objPlanoBL.objplanoEL.PK = Convert.ToInt32(ViewState["PkPlanocatastrado"]);
|
|||
|
|
nValorRetornado = objPlanoBL.modificarPlanos();
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ha modificado el número de Folio y Plano " + txtNumeroPlano.Text.Trim(),
|
|||
|
|
"frwFoliosyPlanosSolicitud.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return nValorRetornado;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void insertarRegistro()
|
|||
|
|
{
|
|||
|
|
int nValorRetornado = 0;
|
|||
|
|
objPlanoBL = new PlanoBL();
|
|||
|
|
objPlanoBL.objplanoEL.PLANOCATASTRO = ddlProvincia.SelectedValue.ToString() + "-" + txtNumeroPlano.Text + "-" + txtAno.Text;
|
|||
|
|
objPlanoBL.objplanoEL.NUMFOLIOREAL = txtConsultaFolio.Text;
|
|||
|
|
objPlanoBL.objplanoEL.Fecha = DateTime.Now;
|
|||
|
|
objPlanoBL.objplanoEL.USUARIO = Session["LOGIN"].ToString();
|
|||
|
|
objPlanoBL.objplanoEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP); ;
|
|||
|
|
nValorRetornado = objPlanoBL.insertarPlanos();
|
|||
|
|
|
|||
|
|
llenarGridView(true);
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
grvListarPlanos.Visible = true;
|
|||
|
|
limpiarCampos();
|
|||
|
|
|
|||
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
|||
|
|
//ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeAlerta();</script>");
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ha ingresado el número de Folio y Plano " + txtNumeroPlano.Text.Trim(),
|
|||
|
|
"frwFoliosyPlanos.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Datos a Controles (R6)
|
|||
|
|
/// <summary>
|
|||
|
|
/// Carga el grid principal
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_Llenar"></param>
|
|||
|
|
public void llenarGridView(bool p_Llenar) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack || p_Llenar)
|
|||
|
|
{
|
|||
|
|
//condicionesBusqueda();
|
|||
|
|
|
|||
|
|
objPlanoBL = new PlanoBL();
|
|||
|
|
if (txtConsultaFolio.Text != string.Empty)
|
|||
|
|
objPlanoBL.objplanoEL.NUMFOLIOREAL = txtConsultaFolio.Text;
|
|||
|
|
if (txtNumeroPlano.Text != string.Empty)
|
|||
|
|
objPlanoBL.objplanoEL.PLANOCATASTRO = ddlProvincia.SelectedValue.ToString() + "-" + txtNumeroPlano.Text + "-" + txtAno.Text;
|
|||
|
|
objPlanoBL.objplanoEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP); ;
|
|||
|
|
DataSet dsPlanos = objPlanoBL.dsListarPlanos(arlCondicionesFiltroBusqueda);
|
|||
|
|
General.detalleGridView(dsPlanos, grvListarPlanos, lblTotalDatos);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Muestra los datos del registro
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intPkConsultar"></param>
|
|||
|
|
private void mostrarDatos(int p_intPkConsultar) //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
limpiarCampos();
|
|||
|
|
objRequisitoBL = new requisitoBL();
|
|||
|
|
objPlanoBL = new PlanoBL();
|
|||
|
|
objPlanoBL.objplanoEL.PK = p_intPkConsultar;
|
|||
|
|
DataSet dsPlanos = objPlanoBL.dsListarPlanos(null);
|
|||
|
|
|
|||
|
|
if (dsPlanos.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
//Información de la cantonal
|
|||
|
|
txtNumeroPlano.Text = dsPlanos.Tables[0].Rows[0]["PLANOCATASTROPLANOCATASTRADO"].ToString();
|
|||
|
|
txtConsultaFolio.Text = dsPlanos.Tables[0].Rows[0]["NUMFOLIOREALPLANOCATASTRADO"].ToString();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void limpiarCampos()
|
|||
|
|
{
|
|||
|
|
txtConsultaFolio.Text = "";
|
|||
|
|
txtNumeroPlano.Text = "";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de grado academico según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
//private void llenarDDLAño() //M2
|
|||
|
|
//{
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// //Limpia el control
|
|||
|
|
// ddlAnno.Items.Clear();
|
|||
|
|
// //Instancia el bjeto
|
|||
|
|
// objSolicitudBL = new solicitudBL();
|
|||
|
|
// //Asigna datos al atributo
|
|||
|
|
|
|||
|
|
|
|||
|
|
// //Carga la información en un dataset
|
|||
|
|
// DataSet dsGradoAcademico = objSolicitudBL.dsListaAnnos(null);
|
|||
|
|
// if (dsGradoAcademico.Tables[0].Rows.Count != 0)
|
|||
|
|
// {
|
|||
|
|
// ddlAnno.DataSource = dsGradoAcademico;
|
|||
|
|
// ddlAnno.DataTextField = dsGradoAcademico.Tables[0].Columns["FECHAINSERTASOLICITUD"].ColumnName;
|
|||
|
|
// ddlAnno.DataValueField = dsGradoAcademico.Tables[0].Columns["FECHAINSERTASOLICITUD"].ColumnName;
|
|||
|
|
// ddlAnno.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
// //ddlAnno.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// ddlAnno.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
|||
|
|
// }
|
|||
|
|
// catch (Exception ex)
|
|||
|
|
// {
|
|||
|
|
// throw ex;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de grado academico según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarDDLProvincia() //M6
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlProvincia.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
|
|||
|
|
objprovinciaBL = new provinciaBL();
|
|||
|
|
//Asigna datos al atributo
|
|||
|
|
|
|||
|
|
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
|
|||
|
|
|
|||
|
|
DataSet ds = objprovinciaBL.dsListaProvincias(null);
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlProvincia.DataSource = ds;
|
|||
|
|
ddlProvincia.DataTextField = ds.Tables[0].Columns["PKPROVINCIA"].ColumnName;
|
|||
|
|
ddlProvincia.DataValueField = ds.Tables[0].Columns["PKPROVINCIA"].ColumnName;
|
|||
|
|
ddlProvincia.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
// ddlProvincia.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
ddlProvincia.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
protected void ddlProvincia_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|