3043 lines
No EOL
126 KiB
C#
3043 lines
No EOL
126 KiB
C#
/*===========================================================================================================================
|
||
* Instituto Costarricense de Acueductos y Alcantarillados. - 2015
|
||
* Administración de la Seguridad
|
||
* Nombre de la Pantalla: frwBusquedaSolicitud.aspx
|
||
*
|
||
* Explicación de los contenidos del archivo
|
||
*===========================================================================================================================
|
||
* HISTORIAL
|
||
*
|
||
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
||
* Esteban Gutierrez Rapso 20 – 04 - 2015 Se inicia con el diseño de la pagina
|
||
* …………………………………………………………
|
||
* …………………………………………………………
|
||
*===========================================================================================================================
|
||
* Derechos Reservados (C) 2015 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.Data;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Web.UI.HtmlControls;
|
||
using System.IO;
|
||
using AyABL;
|
||
|
||
using AyABL.AUT.Autenticacion;
|
||
using AyABL.APL;
|
||
using AyADAL;
|
||
using System.Configuration;
|
||
using AyABL.RCS;
|
||
using AyABL.Tran;
|
||
using AyABL.Usuario;
|
||
using AyABL.TRA;
|
||
using AyABL.AUT.Encripta;
|
||
using System.Drawing;
|
||
|
||
|
||
|
||
|
||
public partial class Forms_Trans_frwNuevaSolicitud : 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);
|
||
//txtCedulaPropietario.Attributes.Add("OnBlur", "return validarCedula()");
|
||
//txtCedulaSolicitante.Attributes.Add("OnBlur", "return validarCedula()");
|
||
|
||
|
||
|
||
Javascript.CheckAllGridViewItems(Page);
|
||
//btnAgregarClientes.Click += new EventHandler(this.btnAgregarClientes_Click);
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R0M1", ex);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Variables (R1)
|
||
solicitudBL objSolicitudBL;
|
||
clienteSolicitudBL objClienteSolicitudBL;
|
||
proyectoSolicitudBL objproyectoSolicitudBL;
|
||
provinciaBL objprovinciaBL;
|
||
cantonBL objcantonBL;
|
||
distritoBL objdistritoBL;
|
||
temporalBL objtemporalBL;
|
||
consecutivoBL objconsecutivoBL;
|
||
public string strPKSolicitudTMP = "0";
|
||
public string strNumSolicitudTMP = "0";
|
||
public string strPKReutiliza = "0";
|
||
int nTipoDisponibilidad = 0;
|
||
int nTipoPropietario = 0;
|
||
#region variables del estandar
|
||
string strPagina = string.Empty;
|
||
string strScript = string.Empty;
|
||
#endregion
|
||
|
||
|
||
#endregion
|
||
|
||
#region Eventos Formulario (R2)
|
||
|
||
protected void Page_Load(object sender, EventArgs e) //M0
|
||
{
|
||
try
|
||
{
|
||
|
||
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(ddlProvincia);
|
||
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(ddlCanton);
|
||
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(ddlDistrito);
|
||
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(ddlTipoProyecto);
|
||
|
||
|
||
ValidationSettings.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;
|
||
|
||
//Session["Solicitud"] = "2016-02";
|
||
|
||
|
||
if (Session["SOLICITUD"] != null)
|
||
{
|
||
hfPkSolicitud.Value = Session["PKSOLICITUD"].ToString();
|
||
strPKSolicitudTMP = Session["PKSOLICITUD"].ToString();
|
||
strNumSolicitudTMP = Session["SOLICITUD"].ToString();
|
||
strPKReutiliza = Session["FKREUTILIZA"].ToString();
|
||
if (strPKReutiliza == " ")
|
||
strPKReutiliza = "0";
|
||
|
||
Session["SOLICITUD"] = strNumSolicitudTMP;
|
||
Session["FKREUTILIZA"] = strPKReutiliza;
|
||
|
||
|
||
|
||
}
|
||
BloquearIntros();
|
||
|
||
if ((!IsPostBack) && (Session.Count > 0))
|
||
{
|
||
if (Session["PKPROGRAMACION"].ToString() != " " && Session["PKPROGRAMACION"] != null) //se verifica que ya se haya asignado la actividad 1
|
||
GuardarDatosActividad("pendiente");
|
||
|
||
if (Request.UrlReferrer.ToString().Contains("frwGestionarTrabajo") || Request["d"] != null)
|
||
HabilitarCampos();
|
||
else
|
||
DeshabilitarCampos();
|
||
|
||
if (Request["d"] != null)
|
||
{
|
||
if (Request["d"].ToString() == "deshabilitar")
|
||
DeshabilitarCampos();
|
||
}
|
||
if (Request["d"] != null)
|
||
{
|
||
if (Request["d"].ToString() == "resolucion" && Session["ESTADO"].ToString() != "Finalizada")
|
||
{
|
||
HabilitarCampos();
|
||
btnGuardar.Enabled = true;
|
||
//EjecutarScript("$('#accordion').context.activeElement.id = 'TipoDisponibilidad';");
|
||
}
|
||
}
|
||
if (Request["d"] != null)
|
||
{
|
||
if (Request["d"].ToString() == "ingresodatos" && Session["ESTADO"].ToString() != "Finalizada" && Session["ESTADO"].ToString() != "Cancelada")
|
||
btnGuardar.Enabled = true;
|
||
}
|
||
|
||
if (Request["c"] != null)
|
||
{
|
||
if (Request["c"].ToString() == "confeccion" )
|
||
EjecutarScript("$('#accordion').accordion({active:2});$('#accordion').context.activeElement.id = 'constancia';limpiarFrame(3);inicializaAcordeon('TipoDisponibilidad');");
|
||
if (Request["c"].ToString() == "prorroga" && Session["ESTADO"].ToString() != "Finalizada" && Session["ESTADO"].ToString() != "Cancelada")
|
||
{
|
||
HabilitarCampos();
|
||
//deshabilitarProrroga();
|
||
EjecutarScript("$('#accordion').accordion({active:1});$('#accordion').context.activeElement.id = 'requisitos';limpiarFrame(3);inicializaAcordeon('TipoDisponibilidad');");
|
||
btnGuardar.Enabled = true;
|
||
}
|
||
}
|
||
else
|
||
EjecutarScript("inicializaAcordeon('TipoDisponibilidad');");
|
||
identificaClientePropietarioSolicitud();
|
||
if (nTipoDisponibilidad == 2 && Session["ESTADO"].ToString() != "Finalizada" && Session["ESTADO"].ToString() != "Cancelada")//prorroga
|
||
{
|
||
deshabilitarProrroga();
|
||
btnGuardar.Enabled = true;
|
||
}
|
||
if (nTipoDisponibilidad == 3 && Session["ESTADO"].ToString() != "Finalizada" && Session["ESTADO"].ToString() != "Cancelada")//revision
|
||
{
|
||
deshabilitarRevision();
|
||
btnGuardar.Enabled = true;
|
||
}
|
||
|
||
Session["Pagina"] = "";
|
||
|
||
mostrarFilaTabla(1);
|
||
ComandosxMenu();
|
||
llenarTipoProyecto();
|
||
llenarGridProyectoSolicitud(strPKSolicitudTMP);
|
||
llenarGridClientePropietarioSolicitud(strPKSolicitudTMP);
|
||
llenarDDLTipoInspeccion();
|
||
llenarDDLTipoDisponibilidad();
|
||
//llenarDDLProvincia();
|
||
//llenarDDLCanton();
|
||
//llenarDDLDistrito();
|
||
llenarGridSolicitudFolio();
|
||
llenarDDLTipoVisado();
|
||
llenarTitularInmueble();
|
||
//llenarDDLUsoEdificacion();
|
||
limpiarCampos();
|
||
cargarSolicitud();
|
||
txtCaudalSolicitado.Text = "0.00";
|
||
txtValor.Text = "0";
|
||
//txtCantidadEdificaciones.Text = "0";
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
if (Session["Pagina"] == null)
|
||
{
|
||
Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R2M0", ex);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
#region Eventos Controles Web (R3)
|
||
|
||
|
||
|
||
///<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) //M1
|
||
{
|
||
try
|
||
{
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M2" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
}
|
||
}
|
||
|
||
//protected void imgBtnPlanos_Click(object sender, ImageClickEventArgs e) //M2
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwFoliosyPlanosSolicitud.aspx";
|
||
// //Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwFoliosyPlanosSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// // ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
|
||
//protected void imgBtnRequisitos_Click(object sender, ImageClickEventArgs e) //M2
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwRequisitosSolicitud.aspx";
|
||
// //Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwRequisitosSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// // ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
//protected void imgBtnInspector_Click(object sender, ImageClickEventArgs e)
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwVisitaSolicitud.aspx";
|
||
// //Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwVisitaSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// //ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
//protected void imgBtnDeBaja_Click(object sender, ImageClickEventArgs e)
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwDeBajaSolicitud.aspx";
|
||
// //Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwDeBajaSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// //ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir2", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
//protected void imgBtnPausarTramite_Click(object sender, ImageClickEventArgs e)
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwPausarTramiteSolicitud.aspx";
|
||
// // Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwPausarTramiteSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// //ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
|
||
//protected void imgBtnSubirArchivos_Click(object sender, ImageClickEventArgs e)
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwAgregarDocumentosSolicitud.aspx";
|
||
// // Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwAgregarDocumentosSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// //ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
|
||
// protected void imgBtnObservaciones_Click(object sender, ImageClickEventArgs e)
|
||
//{
|
||
// try
|
||
// {
|
||
// strPagina = "frwObservacionesSolicitud.aspx";
|
||
// // Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwObservacionesSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// //ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M3" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
//}
|
||
|
||
// protected void imgBtnCarta_Click(object sender, ImageClickEventArgs e)//M7
|
||
// {
|
||
// try
|
||
// {
|
||
// strPagina = "frwCartaSolicitud.aspx";
|
||
// // Session["Solicitud"] = "2016-02";
|
||
// Session["Pagina"] = "frwCartaSolicitud.aspx";
|
||
|
||
// btnSalir.Visible = true;
|
||
// strScript = "<script type=text/javascript>VentanaAbrir();</script>";
|
||
// //ScriptManager.RegisterStartupScript(this, GetType(), "VentanaAbrir", strScript, false);
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "VentanaAbrir", "<script>javascript: VentanaAbrir();</script>");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// MensajeError("Error en R3M7" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
// }
|
||
// }
|
||
|
||
protected void btnSalir_Click(object sender, EventArgs e) //M3
|
||
{
|
||
try
|
||
{
|
||
|
||
|
||
strScript = "<script type=text/javascript>VentanaCerrar();</script>";
|
||
ScriptManager.RegisterStartupScript(this, GetType(), "VentanaCerrar", strScript, false);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M4" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
||
}
|
||
}
|
||
|
||
protected void btnCancelar_Click(object sender, EventArgs e) //M4
|
||
{
|
||
try
|
||
{
|
||
CancelarDatos();
|
||
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.CancelacionExitosa.ToString());
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M4" + MensajesAplicacion.CancelacionFallida.ToString(), ex);
|
||
}
|
||
}
|
||
protected void btnGuardar_Click(object sender, EventArgs e) //M5
|
||
{
|
||
try
|
||
{
|
||
if (Session["SOLICITUD"]!= null)
|
||
{
|
||
//modificar el registro de la tabla solicitud poner en true valor temporal
|
||
|
||
if (txtTelefono1.Text == String.Empty || txtCorreo.Text == String.Empty)
|
||
{
|
||
if (txtTelefono1.Text == String.Empty)
|
||
{
|
||
reqTel.Text = "* Campo Obligatorio";
|
||
reqTel.Visible = true;
|
||
reqTel.ForeColor = Color.Red;
|
||
}
|
||
else
|
||
{
|
||
reqTel.Visible = false;
|
||
}
|
||
|
||
if (txtCorreo.Text == String.Empty )
|
||
{
|
||
reqCorreo.Text = "* Campo Obligatorio";
|
||
reqCorreo.Visible = true;
|
||
reqCorreo.ForeColor = Color.Red;
|
||
}
|
||
else
|
||
{
|
||
reqCorreo.Visible = false;
|
||
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
reqCorreo.Visible = txtCorreo.Text != String.Empty ? false : true;
|
||
reqTel.Visible = txtTelefono1.Text != String.Empty ? false : true;
|
||
|
||
ViewState["MODO"] = "Nuevo";
|
||
int pkRegistro = GuardarDatosSolicitud();
|
||
if (pkRegistro != -1)
|
||
{
|
||
VerificarCampos();
|
||
//GuardarDatosActividad("aprueba");
|
||
|
||
llenarGridProyectoSolicitud(strPKSolicitudTMP);
|
||
txtValor.Text = "0";
|
||
mostrarFilaTabla(1);
|
||
llenarTipoProyecto();
|
||
|
||
EjecutarScript("$('#accordion').accordion({active:1});$('#accordion').context.activeElement.id = 'requisitos';limpiarFrame(3);inicializaAcordeon('TipoDisponibilidad','exitoGuardado');");
|
||
//MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
||
}
|
||
}
|
||
|
||
//else
|
||
//{
|
||
// EjecutarScript("inicializaAcordeon('TipoDisponibilidad','errorGuardado');");
|
||
//}
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
EjecutarScript("inicializaAcordeon('TipoDisponibilidad','errorGuardado');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
//MensajeError("Error en R3M5" + MensajesAplicacion.GuardadoFallido.ToString(), ex);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// Metodo que se utiliza para borrar el rol del tipo de proyecto
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
|
||
protected void grvListaTipoProyecto_RowCommand(object sender, GridViewCommandEventArgs e) //M5
|
||
{
|
||
try
|
||
{
|
||
if (e.CommandName == "borrar")
|
||
{
|
||
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaTipoProyecto.Rows[i];
|
||
|
||
|
||
//Instancia el objeto
|
||
objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
//Asigna un valor al atributo de referencia del objeto
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
//Carga en un dataset la información
|
||
DataSet ds = objproyectoSolicitudBL.dsListaProyectoSolicitud();
|
||
if (ds.Tables[0].Rows.Count > 1)
|
||
{
|
||
|
||
int nPk = int.Parse(selectedRow.Cells[1].Text);
|
||
if (removerTipoProyecto(nPk))
|
||
llenarGridProyectoSolicitud(strPKSolicitudTMP);
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.EliminarRegistro + ": Se ha eliminado el proyecto " + selectedRow.Cells[3].Text + " de la solicitud " + Session["SOLICITUD"].ToString(),
|
||
"frwNuevaSolicitud.aspx",
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("Debe existir al menos un tipo de proyecto asociado a la solicitud, agregue primero un proyecto a la solicitud y luego proceda a eliminar el tipo de proyecto deseado.");
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M5", ex);
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
|
||
protected void btnAgregarProyecto_Click(object sender, EventArgs e) //M6
|
||
{
|
||
try
|
||
{
|
||
|
||
if (Session["SOLICITUD"]== null)
|
||
{
|
||
strPKSolicitudTMP = obtenerNumSolicitudTemporal();
|
||
Session["SOLICITUD"]= strPKSolicitudTMP;
|
||
}
|
||
//if (txtValor.Text != "" && txtValor.Text != "0")
|
||
{
|
||
ViewState["MODO"] = "Nuevo";
|
||
int pkRegistro = GuardarDatosTipoProyecto();
|
||
llenarGridProyectoSolicitud(strPKSolicitudTMP);
|
||
txtValor.Text = "0";
|
||
txtCaudalSolicitado.Text = "0.00";
|
||
chkVisado.Checked = false;
|
||
txtCantidadLotes.Text = "0";
|
||
ddlSubClasificacion.SelectedValue = "-1";
|
||
|
||
mostrarFilaTabla(1);
|
||
//llenarTipoProyecto();
|
||
// MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
||
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M6", ex);
|
||
}
|
||
finally
|
||
{
|
||
//EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
|
||
}
|
||
|
||
protected void btnAgregarClientes_Click(object sender, EventArgs e) //M7
|
||
{
|
||
try
|
||
{
|
||
if (txtNombrePropietario.Text != string.Empty && txtCedulaPropietario.Text != string.Empty && strPKSolicitudTMP != "0")
|
||
{
|
||
|
||
ViewState["MODO"] = "Nuevo";
|
||
int pkRegistro = GuardarDatosClientePropietario();
|
||
llenarGridClientePropietarioSolicitud(strPKSolicitudTMP);
|
||
txtNombrePropietario.Text = "";
|
||
txtCedulaPropietario.Text = "";
|
||
mostrarFilaTabla(1);
|
||
|
||
//MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
||
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M7", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Metodo que se utiliza para borrar clientes
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
|
||
protected void grvListaClienteSolicitud_RowCommand(object sender, GridViewCommandEventArgs e) //M8
|
||
{
|
||
try
|
||
{
|
||
if (e.CommandName == "borrar")
|
||
{
|
||
//Instancia el objeto
|
||
objClienteSolicitudBL = new clienteSolicitudBL();
|
||
//Asigna un valor al atributo de referencia del objeto
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
|
||
//Carga en un dataset la información
|
||
DataSet ds = objClienteSolicitudBL.dsListaClienteSolicitud();
|
||
if (ds.Tables[0].Rows.Count > 1)
|
||
{
|
||
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaClienteSolicitud.Rows[i];
|
||
int nPk = int.Parse(selectedRow.Cells[1].Text);
|
||
string strNombreCliente = selectedRow.Cells[4].Text;
|
||
if (removerCliente(nPk, strNombreCliente))
|
||
llenarGridClientePropietarioSolicitud(strPKSolicitudTMP);
|
||
EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
//GuardarEventoBitacora(
|
||
// Session["LOGIN"].ToString(),
|
||
// AccionBitacora.INSERT.ToString(),
|
||
// MensajesBitacora.EliminarRegistro + ": Se ha eliminado el cliente de la solicitud " + selectedRow.Cells[2].Text,
|
||
// "frwNuevaSolicitud.aspx",
|
||
// Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
// );
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("Debe existir al menos un cliente asociado a la solicitud, agregue primero un cliente nuevo a la solicitud y luego proceda a eliminar el cliente deseado.");
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M5", ex);
|
||
}
|
||
}
|
||
|
||
protected void ddlProvincia_SelectedIndexChanged(object sender, EventArgs e) //M9
|
||
{
|
||
try
|
||
{
|
||
llenarDDLCanton();
|
||
llenarDDLDistrito();
|
||
llenarDDLdependencia(0);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M9", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
protected void ddlDistrito_SelectedIndexChanged(object sender, EventArgs e) //M10
|
||
{
|
||
try
|
||
{
|
||
llenarDDLdependencia(0);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M11", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
protected void ddlCanton_SelectedIndexChanged(object sender, EventArgs e) //M11
|
||
{
|
||
try
|
||
{
|
||
llenarDDLDistrito();
|
||
llenarDDLdependencia(0);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M11", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
|
||
protected void ddlTipoProyecto_SelectedIndexChanged(object sender, EventArgs e)//M12
|
||
{
|
||
try
|
||
{
|
||
buscarUnidadMedidaTipoProyecto();
|
||
txtValor.Focus();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M12", ex);
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
|
||
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) //M13
|
||
{
|
||
|
||
try
|
||
{
|
||
//string strModo = ViewState["MODO"].ToString();
|
||
DataSet dsOpen = new DataSet();
|
||
|
||
if (ViewState["FKOPEN"].ToString() != string.Empty)
|
||
{
|
||
openBL objOpenBL = new openBL();
|
||
objOpenBL.objOpenEL.PK = int.Parse(ViewState["FKOPEN"].ToString());
|
||
dsOpen = objOpenBL.dsConsultaOpenSolicitud();
|
||
if (dsOpen.Tables[0].Rows[0][0].ToString() != "0")
|
||
{
|
||
grvOpen.DataSource = dsOpen;
|
||
grvOpen.DataBind();
|
||
grvOpen.Columns[0].ItemStyle.Width = 145;
|
||
grvOpen.Columns[7].ItemStyle.Width = 345;
|
||
EjecutarScript("abrirOpen();");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
wsOpenConstruccion.ServiceSoapClient ws = new wsOpenConstruccion.ServiceSoapClient();
|
||
dsOpen = ws.wmDeudaFirmaDigital(int.Parse(txtNIS.Text));
|
||
|
||
if (dsOpen.Tables[0].Rows.Count > 0 && dsOpen.Tables[0].Rows[0][0].ToString() != "X") //SI NO DEVUELVE NADA ES PORQUE NO TIENE DEUDAS PENDIENTES
|
||
{
|
||
Int32 nImporteDeuda = int.Parse(dsOpen.Tables[0].Rows[0]["MON_DEUDA"].ToString());
|
||
grvOpen.DataSource = dsOpen;
|
||
grvOpen.DataBind();
|
||
grvOpen.Columns[0].ItemStyle.Width = 145;
|
||
grvOpen.Columns[7].ItemStyle.Width = 345;
|
||
EjecutarScript("abrirOpen();");
|
||
|
||
|
||
}
|
||
if (dsOpen.Tables[0].Rows.Count > 0 && dsOpen.Tables[0].Rows[0][0].ToString() == "X") //NO EXISTE EL NIS
|
||
{
|
||
MensajeInformativo("El NIS no existe o no presenta datos.");
|
||
}
|
||
|
||
//if (dsOpen.Tables[0].Rows[0][0].ToString() != "0")
|
||
//{
|
||
// grvOpen.DataSource = dsOpen;
|
||
// grvOpen.DataBind();
|
||
// grvOpen.Columns[0].ItemStyle.Width = 145;
|
||
// grvOpen.Columns[7].ItemStyle.Width = 345;
|
||
// EjecutarScript("abrirOpen();");
|
||
//}
|
||
ws.Close();
|
||
}
|
||
//if (dsOpen.Tables[0].Rows[0][0].ToString() == "0")
|
||
//{
|
||
|
||
//}
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M12", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
protected void grvListaTerrenoSolicitud_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
grvListaTerrenoSolicitud.PageIndex = e.NewPageIndex;
|
||
llenarGridSolicitudFolio();
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M1", ex);
|
||
}
|
||
}
|
||
#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 = 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_nPk"></param>
|
||
private bool removerTipoProyecto(int p_nPk) //M5
|
||
{
|
||
bool blnValorRetornado = false;
|
||
try
|
||
{
|
||
objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.PK = p_nPk;
|
||
|
||
objproyectoSolicitudBL.eliminarProyectoSolicitud();
|
||
blnValorRetornado = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return blnValorRetornado;
|
||
}
|
||
|
||
private string obtenerNumSolicitudTemporal() //M6
|
||
{
|
||
string strResultado = "";
|
||
try
|
||
{
|
||
objtemporalBL = new temporalBL();
|
||
objtemporalBL.objTemporalEL.USER = Session["LOGIN"].ToString();
|
||
int resultado = objtemporalBL.insertarTemporal();
|
||
strResultado = DateTime.Now.Year.ToString() + "-" + resultado.ToString() + "-TMP";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return strResultado;
|
||
}
|
||
|
||
private string obtenerNumSolicitudPermanente() //M6
|
||
{
|
||
string strResultado = "";
|
||
try
|
||
{
|
||
objconsecutivoBL = new consecutivoBL();
|
||
objconsecutivoBL.objConsecutivoEL.USUARIO = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
||
objconsecutivoBL.objConsecutivoEL.ANNO = DateTime.Now.Year;
|
||
objconsecutivoBL.objConsecutivoEL.FKCANTONAL = int.Parse(Session["DEPENDENCIA"].ToString());
|
||
objconsecutivoBL.objConsecutivoEL.FKREGION = int.Parse(Session["REGION"].ToString());
|
||
|
||
|
||
int resultado = objconsecutivoBL.obtenerConsecutivo(objconsecutivoBL.objConsecutivoEL);
|
||
strResultado = DateTime.Now.Year.ToString() + "-" + resultado.ToString();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return strResultado;
|
||
}
|
||
/// <summary>
|
||
/// Metodo que se utiliza para remover el role asignado al usuario
|
||
/// </summary>
|
||
/// <param name="p_nPk"></param>
|
||
private bool removerCliente(int p_nPk, string p_nombreCliente) //M5
|
||
{
|
||
bool blnValorRetornado = false;
|
||
try
|
||
{
|
||
objClienteSolicitudBL = new clienteSolicitudBL();
|
||
objClienteSolicitudBL.objclientesolicitudEL.PK = p_nPk;
|
||
|
||
objClienteSolicitudBL.eliminarClienteSolicitud();
|
||
blnValorRetornado = true;
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.DELETE.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha eliminado el cliente " + p_nombreCliente.ToString() + " de la solicitud " + Session["SOLICITUD"].ToString(),
|
||
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return blnValorRetornado;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Limpia los campos
|
||
/// </summary>
|
||
private void limpiarCampos()
|
||
{
|
||
txtNombreSolicitante.Text = string.Empty;
|
||
txtApellido1Solicitante.Text = string.Empty;
|
||
txtApellido2Solicitante.Text = string.Empty;
|
||
txtCedulaSolicitante.Text = string.Empty;
|
||
txtNombrePropietario.Text = string.Empty;
|
||
txtCedulaPropietario.Text = string.Empty;
|
||
txtNIS.Text = string.Empty;
|
||
//txtCantidadEdificaciones.Text = string.Empty;
|
||
//txtDescripcionUsoEdificaciones.Text = string.Empty;
|
||
txtDireccionExactaPropiedad.Text = string.Empty;
|
||
txtCaudalSolicitado.Text = string.Empty;
|
||
chkVisado.Checked = false;
|
||
txtCantidadLotes.Text = string.Empty;
|
||
ddlSubClasificacion.SelectedValue = "-1";
|
||
|
||
txtCorreo.Text = string.Empty;
|
||
txtCorreo2.Text = string.Empty;
|
||
txtFax.Text = string.Empty;
|
||
txtOtroEnteSolicita.Text = string.Empty;
|
||
txtTelefono1.Text = string.Empty;
|
||
txtTelefono2.Text = string.Empty;
|
||
txtValor.Text = string.Empty;
|
||
ddlTipoProyecto.SelectedValue = "-1";
|
||
ddlTitularInmueble.SelectedValue = "-1";
|
||
|
||
}
|
||
|
||
[System.Web.Services.WebMethod]
|
||
public static string VerificarPropietarios(string strPKSolicitudTMP)
|
||
{
|
||
string strResultado = string.Empty;
|
||
strResultado = "OK";
|
||
//llenar datos cliente propietario
|
||
clienteSolicitudBL objClienteSolicitudBL = new clienteSolicitudBL();
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
DataSet dsClientes = objClienteSolicitudBL.dsListaClienteSolicitud();
|
||
if (dsClientes.Tables[0].Rows.Count == 0)
|
||
{
|
||
|
||
strResultado = "faltapropietarios";
|
||
return strResultado;
|
||
|
||
}
|
||
proyectoSolicitudBL objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
DataSet dsProyecto = objproyectoSolicitudBL.dsListaProyectoSolicitud();
|
||
if (dsProyecto.Tables[0].Rows.Count == 0)
|
||
{
|
||
strResultado = "faltaproyectos";
|
||
return strResultado;
|
||
}
|
||
|
||
return strResultado;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Metodos Controles a Datos (R5)
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private int GuardarDatosTipoProyecto() //M0
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
string strModo = ViewState["MODO"].ToString();
|
||
|
||
if (ddlTipoProyecto.SelectedValue != "-1")
|
||
{
|
||
if (txtValor.Text != "" && int.Parse(txtValor.Text) >= 1)
|
||
{
|
||
|
||
if (txtCaudalSolicitado.Text != "")
|
||
{
|
||
if (txtNivelesConstruccion.Text != "" && txtAreaConstruccion.Text != "" )
|
||
{
|
||
objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKPROYECTO = int.Parse(ddlTipoProyecto.SelectedValue);
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.CANTIDAD = int.Parse(txtValor.Text);
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.CAUDALSOLICITADO = decimal.Parse(txtCaudalSolicitado.Text);
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.CAUDALASIGNADO = 0;
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.OBSERVACIONES = txtObservacionesProposito.Text;
|
||
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.NIVELESCONSTRUCCION = int.Parse(txtNivelesConstruccion.Text);
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.AREACONSTRUCCION = decimal.Parse(txtAreaConstruccion.Text);
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.VISADO = chkVisado.Checked;
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKMOTIVOPROYECTO = int.Parse(rblMotivoProyecto.SelectedValue);
|
||
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
nValorRetornado = objproyectoSolicitudBL.insertarProyectoSolicitud();
|
||
if (nValorRetornado != 0)
|
||
{
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha ingresado el tipo de proyecto " + ddlTipoProyecto.SelectedItem.Text.Trim() + " para la solicitud " + strNumSolicitudTMP,
|
||
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
|
||
GuardarDatosSolicitud();
|
||
if (ddlSubClasificacion.SelectedValue == "-1")
|
||
{
|
||
ddlSubClasificacion.SelectedValue = "4";
|
||
txtCantidadLotes.Text = "0";
|
||
}
|
||
visadoproyectoBL objVisadoProyectoBL = new visadoproyectoBL();
|
||
objVisadoProyectoBL.objvisadoproyectoEL.CANTIDADLOTES = int.Parse(txtCantidadLotes.Text);
|
||
objVisadoProyectoBL.objvisadoproyectoEL.FKPROYECTOSOLICITUD = nValorRetornado;
|
||
objVisadoProyectoBL.objvisadoproyectoEL.FKTIPOVISADO = int.Parse(ddlSubClasificacion.SelectedValue);
|
||
int nValorTipoVisado = objVisadoProyectoBL.insertarVisadoProyecto();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
if (txtNivelesConstruccion.Text == "")
|
||
{
|
||
MensajeAlerta("Debe digitar los niveles de construccion");
|
||
txtNivelesConstruccion.Focus(); txtCaudalSolicitado.Focus();
|
||
|
||
}
|
||
|
||
if (txtAreaConstruccion.Text == "")
|
||
{
|
||
MensajeAlerta("Debe digitar el area de construccion");
|
||
txtAreaConstruccion.Focus();
|
||
}
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("Debe digitar el caudal solicitado");
|
||
txtCaudalSolicitado.Focus();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("Debe digitar la cantidad");
|
||
txtValor.Focus();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("Debe seleccionar el tipo de proyecto antes de continuar");
|
||
ddlTipoProyecto.Focus();
|
||
}
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
|
||
private int GuardarDatosSolicitud() //M1
|
||
{
|
||
int nValorRetornado = 0;
|
||
int nConsecutivoTmp = 0;
|
||
string[] strArrayTmp;
|
||
|
||
|
||
|
||
try
|
||
{
|
||
string strModo = ViewState["MODO"].ToString();
|
||
|
||
{
|
||
string strNumSolicitud = "";
|
||
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(strPKSolicitudTMP);
|
||
objSolicitudBL.objSolicitudEL.FKTIPOINSPECCION = int.Parse(ddlTipoInspeccion.SelectedValue);
|
||
objSolicitudBL.objSolicitudEL.FKTIPODISPONIBILIDAD = int.Parse(ddlTipoDisponibilidad.SelectedValue);
|
||
objSolicitudBL.objSolicitudEL.FECHAMODIFICA = DateTime.Now;
|
||
//objSolicitudBL.objSolicitudEL.NUMEROSOLICITUD = strNumSolicitudTMP;
|
||
objSolicitudBL.objSolicitudEL.TIENESERVICIOSOLICITUD = Convert.ToBoolean(int.Parse(rdlTieneServicios.SelectedValue));
|
||
objSolicitudBL.objSolicitudEL.NUMERONIS = txtNIS.Text;
|
||
|
||
if(txtNIS.Text != string.Empty && txtNIS.Text != "N/A")
|
||
objSolicitudBL.objSolicitudEL.FKOPEN = GuardarRegistroOpen();
|
||
//else
|
||
// objSolicitudBL.objSolicitudEL.FKOPEN = ;
|
||
|
||
//if (txtCantidadEdificaciones.Text == "")
|
||
objSolicitudBL.objSolicitudEL.CANTIDADEDIFICACIONES = 0;
|
||
|
||
//else
|
||
//{
|
||
// objSolicitudBL.objSolicitudEL.CANTIDADEDIFICACIONES = int.Parse(txtCantidadEdificaciones.Text);
|
||
|
||
|
||
//}
|
||
objSolicitudBL.objSolicitudEL.CEDULASOLICITANTE = txtCedulaSolicitante.Text;
|
||
objSolicitudBL.objSolicitudEL.NOMBRESOLICITANTE = txtNombreSolicitante.Text;
|
||
objSolicitudBL.objSolicitudEL.APELLIDO1SOLICITANTE = txtApellido1Solicitante.Text;
|
||
objSolicitudBL.objSolicitudEL.APELLIDO2SOLICITANTE = txtApellido2Solicitante.Text;
|
||
objSolicitudBL.objSolicitudEL.FKTITULARINMUEBLE = int.Parse(ddlTitularInmueble.SelectedValue);
|
||
objSolicitudBL.objSolicitudEL.DIRECCIONEXACTAPROPIEDAD = txtDireccionExactaPropiedad.Text;
|
||
objSolicitudBL.objSolicitudEL.NUMEROTELEFONO1 = txtTelefono1.Text;
|
||
objSolicitudBL.objSolicitudEL.NUMEROTELEFONO2 = txtTelefono2.Text;
|
||
objSolicitudBL.objSolicitudEL.FAX = txtFax.Text;
|
||
objSolicitudBL.objSolicitudEL.CORREOELECTRONICO = txtCorreo.Text;
|
||
objSolicitudBL.objSolicitudEL.CORREOELECTRONICO2 = txtCorreo2.Text;
|
||
|
||
|
||
|
||
objSolicitudBL.objSolicitudEL.FKPROVINCIA = int.Parse(ddlProvincia.SelectedValue);
|
||
objSolicitudBL.objSolicitudEL.FKCANTON = int.Parse(ddlCanton.SelectedValue);
|
||
objSolicitudBL.objSolicitudEL.FKDISTRITO = int.Parse(ddlDistrito.SelectedValue);
|
||
if (Session["FKSOLICITUDOTROSPROYECTO"] != null)
|
||
objSolicitudBL.objSolicitudEL.FKSOLICITUDOTROSPROYECTO = int.Parse(Session["FKSOLICITUDOTROSPROYECTO"].ToString());//al insertar en la tabla nos traemos el ultimo id insertado
|
||
if (Session["FKSOLICITUDOTROSENTE"] != null)
|
||
objSolicitudBL.objSolicitudEL.FKSOLICITUDOTROSENTE = int.Parse(Session["FKSOLICITUDOTROSENTE"].ToString());
|
||
//objSolicitudBL.objSolicitudEL.FKUSOEDIFICACION = int.Parse(ddlUsoEdificacion.SelectedValue);
|
||
//objSolicitudBL.objSolicitudEL.DESCRIPCIONUSOEDIFICACION = txtDescripcionUsoEdificaciones.Text;
|
||
objSolicitudBL.objSolicitudEL.DESCRIPCIONUSOEDIFICACION = string.Empty;
|
||
objSolicitudBL.objSolicitudEL.FKDEPENDENCIA = int.Parse(ddlDependencia.SelectedValue);
|
||
|
||
objSolicitudBL.objSolicitudEL.SOLICITAMUNICIPALIDAD = chkMunicipalidad.Checked;
|
||
objSolicitudBL.objSolicitudEL.SOLICITAMINISTERIOSALUD = chkMinisterio.Checked;
|
||
objSolicitudBL.objSolicitudEL.SOLICITACFIA = chkCFIA.Checked;
|
||
objSolicitudBL.objSolicitudEL.SOLICITAOTROENTE = txtOtroEnteSolicita.Text;
|
||
objSolicitudBL.objSolicitudEL.ASTATE = true;
|
||
|
||
DataSet ds = objSolicitudBL.dsExisteSolicitud(null);
|
||
|
||
|
||
if (strModo == "Nuevo" && ds.Tables[0].Rows.Count == 0 && nConsecutivoTmp != 0)
|
||
{
|
||
objSolicitudBL.objSolicitudEL.NUMEROSOLICITUD = obtenerNumSolicitudPermanente();
|
||
nValorRetornado = objSolicitudBL.insertarSolicitud();
|
||
if (chkCFIA.Checked == true)
|
||
ModificarDescripcionCFIA(nValorRetornado);
|
||
VerificarCampos();
|
||
//if (VerificarCampos())
|
||
// GuardarDatosActividad("aprueba");
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha ingresado la solicitud " + objSolicitudBL.objSolicitudEL.NUMEROSOLICITUD,
|
||
"frwNuevaSolicitud.aspx",
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
|
||
if (strModo == "Nuevo" && ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
//si se modifica el tipo de inspeccion se debe eliminar la asignacion de tarea que sobra
|
||
|
||
if (int.Parse(ddlTipoInspeccion.SelectedValue) == 1 && int.Parse(ddlTipoInspeccion.SelectedValue) != 3 && Session["PKPROGRAMACION"].ToString() != " ")//agua potable
|
||
//eliminar criterio tecnico de as
|
||
{
|
||
solicitudBL objSolicitudActividadBL = new solicitudBL();
|
||
objSolicitudActividadBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudActividadBL.objSolicitudEL.ORDEN = 2;//se valida la tarea 2 si ya esta finalizada no se pueden quitar los responsables de actividades
|
||
objSolicitudActividadBL.objSolicitudEL.FKESTADO = 5;
|
||
objSolicitudActividadBL.objSolicitudEL.FKESTADO2 = 8;
|
||
DataSet dsEncargadosActividades = objSolicitudActividadBL.dsListaActividadesEncargado(null);
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count == 0)
|
||
{
|
||
objSolicitudActividadBL = new solicitudBL();
|
||
|
||
objSolicitudActividadBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudActividadBL.objSolicitudEL.ORDEN = 4;//Confección del Criterio técnico de alcantarillado sanitario
|
||
|
||
dsEncargadosActividades = objSolicitudActividadBL.dsListaActividadesEncargado(null);
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
||
objObservacionesBL.objobservacionesEL.PKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
objObservacionesBL.objobservacionesEL.PKPROGRAMACIONSOLICITUD = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
//objObservacionesBL.objobservacionesEL.PKACTIVIDAD = int.Parse(Session["NACTIVIDAD"].ToString());
|
||
|
||
objObservacionesBL.objobservacionesEL.PKRESPONSABLEACTIVIDAD = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
|
||
DataSet dsObservaciones = objObservacionesBL.dsListarObservacionesActividades(null);
|
||
|
||
if (dsObservaciones.Tables[0].Rows.Count == 0)
|
||
{
|
||
solicitudBL objresponsableActividadBL = new solicitudBL();
|
||
objresponsableActividadBL.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
nValorRetornado = objresponsableActividadBL.eliminarAsignacionActividadEncargado();
|
||
|
||
}
|
||
else
|
||
{
|
||
//MensajeAlerta("El registro no puede ser eliminado ya que esta asociado a otro flujo de la solicitud");
|
||
EjecutarScript("VentanaAbrir();toastr.warning('El registro no puede ser eliminado ya que esta asociado a otro flujo de la solicitud', 'Información',toastr.options ={closeButton: true})");
|
||
return -1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
EjecutarScript("VentanaAbrir();toastr.warning('El registro no puede ser eliminado la tarea de asignación de actividades se encuentra finalizada', 'Información',toastr.options ={closeButton: true})");
|
||
//return -1;
|
||
}
|
||
}
|
||
if (int.Parse(ddlTipoInspeccion.SelectedValue) == 2 && int.Parse(ddlTipoInspeccion.SelectedValue) != 3 && Session["PKPROGRAMACION"].ToString() != " ")//alcantarillado sanitario
|
||
//eliminar criterio tecnico de ap
|
||
{
|
||
solicitudBL objSolicitudActividadBL = new solicitudBL();
|
||
objSolicitudActividadBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudActividadBL.objSolicitudEL.ORDEN = 2;//se valida la tarea 2 si ya esta finalizada no se pueden quitar los responsables de actividades
|
||
objSolicitudActividadBL.objSolicitudEL.FKESTADO = 5;
|
||
objSolicitudActividadBL.objSolicitudEL.FKESTADO2 = 8;
|
||
DataSet dsEncargadosActividades = objSolicitudActividadBL.dsListaActividadesEncargado(null);
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count == 0)
|
||
{
|
||
objSolicitudActividadBL = new solicitudBL();
|
||
|
||
objSolicitudActividadBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudActividadBL.objSolicitudEL.ORDEN = 3;//Confección del Criterio técnico de agua potable
|
||
|
||
dsEncargadosActividades = objSolicitudActividadBL.dsListaActividadesEncargado(null);
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
||
objObservacionesBL.objobservacionesEL.PKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
objObservacionesBL.objobservacionesEL.PKPROGRAMACIONSOLICITUD = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
//objObservacionesBL.objobservacionesEL.PKACTIVIDAD = int.Parse(Session["NACTIVIDAD"].ToString());
|
||
|
||
objObservacionesBL.objobservacionesEL.PKRESPONSABLEACTIVIDAD = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
|
||
DataSet dsObservaciones = objObservacionesBL.dsListarObservacionesActividades(null);
|
||
|
||
if (dsObservaciones.Tables[0].Rows.Count == 0)
|
||
{
|
||
solicitudBL objresponsableActividadBL = new solicitudBL();
|
||
objresponsableActividadBL.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
nValorRetornado = objresponsableActividadBL.eliminarAsignacionActividadEncargado();
|
||
|
||
}
|
||
else
|
||
{
|
||
//MensajeAlerta("El registro no puede ser eliminado ya que esta asociado a otro flujo de la solicitud");
|
||
EjecutarScript("VentanaAbrir();toastr.warning('El registro no puede ser eliminado ya que esta asociado a otro flujo de la solicitud', 'Información',toastr.options ={closeButton: true})");
|
||
return -1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
EjecutarScript("VentanaAbrir();toastr.warning('El registro no puede ser eliminado la tarea de asignación de actividades se encuentra finalizada', 'Información',toastr.options ={closeButton: true})");
|
||
//return -1;
|
||
}
|
||
}
|
||
|
||
nValorRetornado = objSolicitudBL.modificarSolicitud();
|
||
if (chkCFIA.Checked == true && ds.Tables[0].Rows[0]["PKDESCRIPCIONCFIA"].ToString() != string.Empty)
|
||
ModificarDescripcionCFIA(int.Parse(ds.Tables[0].Rows[0]["PKDESCRIPCIONCFIA"].ToString()));
|
||
|
||
|
||
|
||
string xmlTexto = ToXmls(ds);
|
||
AyAEL.TRA.historialxmlEL objHistorialEL = new AyAEL.TRA.historialxmlEL();
|
||
objHistorialEL.REGISTRO = xmlTexto;
|
||
objHistorialEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
objHistorialEL.FECHAINSERTA = DateTime.Now;
|
||
|
||
nValorRetornado = objSolicitudBL.insertarHistorialXmlSolicitud(objHistorialEL);
|
||
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha modificado la solicitud " + strNumSolicitudTMP,
|
||
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
|
||
}
|
||
llenarTipoProyecto();
|
||
llenarGridProyectoSolicitud(strPKSolicitudTMP);
|
||
llenarGridClientePropietarioSolicitud(strPKSolicitudTMP);
|
||
llenarGridSolicitudFolio();
|
||
cargarSolicitud();
|
||
}
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
finally
|
||
{
|
||
//EjecutarScript("inicializaAcordeon('TipoDisponibilidad');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
|
||
public bool VerificarCampos()
|
||
{
|
||
try
|
||
{
|
||
bool bValorRetornado = true;
|
||
string strMensaje = string.Empty;
|
||
string strPestanna = string.Empty;
|
||
|
||
|
||
if (ddlTipoInspeccion.SelectedValue == "4" && bValorRetornado == true)//sin asignar
|
||
{
|
||
strMensaje = "Debe seleccionar el tipo de inspección";
|
||
bValorRetornado = false;
|
||
strPestanna = "TipoDisponibilidad";
|
||
}
|
||
|
||
if (ddlTipoDisponibilidad.SelectedValue == "-1" && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe seleccionar el tipo de disponibilidad";
|
||
bValorRetornado = false;
|
||
strPestanna = "TipoDisponibilidad";
|
||
|
||
}
|
||
|
||
if ((txtNombreSolicitante.Text == string.Empty || txtNombreSolicitante.Text == "N/A") && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe digitar el nombre del solicitante";
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
|
||
if ((txtApellido1Solicitante.Text == string.Empty || txtApellido1Solicitante.Text == "N/A") && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe digitar el apellido del solicitante";
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
|
||
if ((txtCedulaSolicitante.Text == string.Empty || txtCedulaSolicitante.Text == "N/A") && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe digitar la cédula del solicitante";
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
|
||
if (ddlTitularInmueble.SelectedValue == "-1" && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe seleccionar la titularidad del Solicitante.";
|
||
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
|
||
if (bValorRetornado == true)
|
||
{
|
||
//llenar datos cliente propietario
|
||
objClienteSolicitudBL = new clienteSolicitudBL();
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
DataSet dsClientes = objClienteSolicitudBL.dsListaClienteSolicitud();
|
||
if (dsClientes.Tables[0].Rows.Count == 0 && bValorRetornado == true)
|
||
{
|
||
|
||
strMensaje = "No se han agregado los propietarios.";
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
}
|
||
|
||
if (rdlTieneServicios.SelectedValue == "1")//otro
|
||
{
|
||
if ((txtNIS.Text == string.Empty || txtNIS.Text == "N/A") && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe digitar el número de NIS";
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
}
|
||
|
||
|
||
//if (txtDescripcionUsoEdificaciones.Text == string.Empty && bValorRetornado == true)
|
||
//{
|
||
// strMensaje = "Debe digitar una especificación del uso de edificaciones o si no aplica digite N/A";
|
||
// bValorRetornado = false;
|
||
// strPestanna = "datosCliente";
|
||
//}
|
||
|
||
|
||
|
||
if ((txtDireccionExactaPropiedad.Text == string.Empty || txtDireccionExactaPropiedad.Text == "N/A") && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe digitar la dirección de la propiedad";
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
|
||
|
||
|
||
if (ddlDependencia.SelectedValue == "-1" && bValorRetornado == true)
|
||
{
|
||
strMensaje = "Debe seleccionar la dependencia.";
|
||
|
||
bValorRetornado = false;
|
||
strPestanna = "datosCliente";
|
||
}
|
||
|
||
if (bValorRetornado == true)
|
||
{
|
||
objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
DataSet dsProyecto = objproyectoSolicitudBL.dsListaProyectoSolicitud();
|
||
if (dsProyecto.Tables[0].Rows.Count == 0 && bValorRetornado == true)
|
||
{
|
||
bValorRetornado = false;
|
||
strMensaje = "No se han agregado los proyectos a la solicitud.";
|
||
strPestanna = "proposito";
|
||
}
|
||
}
|
||
|
||
if(bValorRetornado == false)
|
||
EjecutarScript("toastr.warning('" + strMensaje + "', 'Información',toastr.options ={closeButton: true});inicializaAcordeon('" + strPestanna + "');");
|
||
|
||
return bValorRetornado;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
///
|
||
|
||
|
||
private int GuardarDatosActividad(string p_accion)
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
|
||
// string strModo = ViewState["MODO"].ToString();
|
||
int nPkSolicitud = 0;
|
||
int nResultadoActualizar = 0;
|
||
string strMensajeContenido = "";
|
||
string strAsuntoCorreo = "";
|
||
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”";
|
||
|
||
solicitudBL objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
//objSolicitudBL.objSolicitudEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 1;
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
//if (int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["PKUSUARIOXDEPENDENCIA"].ToString()) == int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString()) && int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString())!= 5
|
||
// && int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString())!= 8)
|
||
if (int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString()) != 5 && int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString()) != 8)
|
||
{
|
||
string strEncargadoActividad = dsEncargadosActividades.Tables[0].Rows[0]["PKRESPONSABLEACTIVIDAD"].ToString();
|
||
|
||
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
||
|
||
objObservacionesBL.objobservacionesEL.DESCRIPCION = "\n" + DateTime.Now.ToString()+ " - " + Session["NOMBREEMPLEADO"].ToString() + " - Se actualiza el formulario " + Session["SOLICITUD"].ToString() + " por parte del usuario " + Session["NOMBREEMPLEADO"].ToString();
|
||
objObservacionesBL.objobservacionesEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
||
objObservacionesBL.objobservacionesEL.PKRESPONSABLEACTIVIDAD = int.Parse(strEncargadoActividad);
|
||
objObservacionesBL.objobservacionesEL.Fecha = DateTime.Now;
|
||
objObservacionesBL.objobservacionesEL.TIPO = 1;
|
||
|
||
nValorRetornado = objObservacionesBL.insertarObservacionActividad();
|
||
|
||
|
||
if (nValorRetornado != 0)
|
||
{
|
||
solicitudBL objSolicitud = new solicitudBL();
|
||
objSolicitud.objresponsableActividadEL.FECHADEVOLUCION = DateTime.Now;
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
|
||
objSolicitud.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
if (p_accion == "aprueba")
|
||
{
|
||
|
||
decimal nTiempoActividad = 0;
|
||
if (row["CLASIFICACIONSOLICITUD"].ToString() == "Crecimiento vegetativo")
|
||
nTiempoActividad = decimal.Parse(row["TIEMPOCVACTIVIDAD"].ToString());
|
||
if (row["CLASIFICACIONSOLICITUD"].ToString() == "Desarrollo urbanistico")
|
||
nTiempoActividad = decimal.Parse(row["TIEMPODUACTIVIDAD"].ToString());
|
||
|
||
char[] separadorColumna = { '.' };
|
||
string[] strArrayTiempo = nTiempoActividad.ToString().Replace(",", ".").Split(separadorColumna);
|
||
|
||
DateTime dtFechaRecibido = DateTime.Parse(row["FECHAASIGNACIONRESPONSABLEACTIVIDAD"].ToString()).AddDays(double.Parse(strArrayTiempo[0].ToString()));
|
||
if (double.Parse(strArrayTiempo[1].ToString()) > 0)
|
||
dtFechaRecibido = dtFechaRecibido.AddHours(4);
|
||
|
||
|
||
|
||
|
||
if (dtFechaRecibido > DateTime.Now)
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 5;//finalizada a tiempo t_sgm_estadoactividad
|
||
else
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 8;//finalizada fuera de tiempo t_sgm_estadoactividad
|
||
|
||
strMensajeContenido = "La actividad ingreso y asignación de expedientes de la solicitud N° " + Session["SOLICITUD"].ToString() + " ha sido concluida para ver los detalles, ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin.> SIGDD</a>" + strPiePagina;
|
||
strAsuntoCorreo = "Conclusión de actividad - SIGDD";
|
||
|
||
|
||
|
||
nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
|
||
if (nResultadoActualizar > 0)
|
||
{
|
||
#region Envio de correo
|
||
|
||
AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
|
||
|
||
nPkSolicitud = Convert.ToInt32(row[1].ToString());//AQUI INSERTAMOS LA PK DE LA SOLICITUD
|
||
|
||
objcorreoBL.objcorreoEL.FKNUMSOLICITUD = nPkSolicitud;
|
||
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
|
||
objcorreoBL.objcorreoEL.ASUNTO = strAsuntoCorreo;
|
||
objcorreoBL.objcorreoEL.CONTENIDO = strMensajeContenido;
|
||
objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(row["FKUSUARIOXDEPENDENCIA"].ToString());
|
||
objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
||
|
||
nValorRetornado = objcorreoBL.insertarCorreo();
|
||
|
||
//poner la siguiente actividad en pendiente
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 2;
|
||
|
||
DataSet dsEncargadosActividadesSiguiente = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
foreach (DataRow row6 in dsEncargadosActividadesSiguiente.Tables[0].Rows)
|
||
{
|
||
|
||
objSolicitud.objresponsableActividadEL.PK = int.Parse(row6["PKRESPONSABLEACTIVIDAD"].ToString()); ;
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 3;//pendiente t_sgm_estadoactividad
|
||
objSolicitud.objresponsableActividadEL.FECHARECIBIDO = DateTime.Now;
|
||
nResultadoActualizar = objSolicitud.actualizarActividadSolicitudSiguiente();
|
||
|
||
objcorreoBL.objcorreoEL.ASUNTO = strAsuntoCorreo;
|
||
objcorreoBL.objcorreoEL.CONTENIDO = strMensajeContenido;
|
||
objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(row6["FKUSUARIOXDEPENDENCIA"].ToString());
|
||
objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
||
|
||
nValorRetornado = objcorreoBL.insertarCorreo();
|
||
}
|
||
//cancelar notificacion
|
||
notificacionBL objNotificacionBL = new notificacionBL();
|
||
|
||
objNotificacionBL.objnotificacionEL.ID_DOCUMENTO = Session["SOLICITUD"].ToString() + " - Ingreso y asignación de expedientes";
|
||
objNotificacionBL.objnotificacionEL.status = "00";
|
||
objNotificacionBL.objnotificacionEL.message = "OK";
|
||
nValorRetornado = objNotificacionBL.cancelarNotificacion(objNotificacionBL.objnotificacionEL);
|
||
#endregion
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": La actividad ingreso y asignación de expedientes de la solicitud N° " + Session["SOLICITUD"].ToString() + " ha sido finalizada por parte del encargado de la actividad: " + Session["NOMBREEMPLEADO"].ToString().Trim(),
|
||
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if (p_accion == "pendiente")
|
||
{
|
||
//Poner la actividad 2 programacion en pendiente(3)
|
||
objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 1;
|
||
|
||
dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
|
||
objSolicitud.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString()); ;
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 3;//pendiente t_sgm_estadoactividad
|
||
nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
|
||
return nValorRetornado;
|
||
}
|
||
|
||
private int CambiarEstadoActividad1()
|
||
{
|
||
int nResultadoActualizar = 0;
|
||
try
|
||
{
|
||
ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
|
||
|
||
solicitudBL objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 1; //la activida de Ingreso y asignacion de expediente
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
|
||
objSolicitudBL.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString()); ;
|
||
objSolicitudBL.objresponsableActividadEL.FKESTADO = 1;//devolucion
|
||
objSolicitudBL.objresponsableActividadEL.FECHADEVOLUCION = DateTime.Now;
|
||
nResultadoActualizar = objSolicitudBL.actualizarActividadSolicitud();
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
|
||
return nResultadoActualizar;
|
||
}
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private bool CancelarDatos() //M2
|
||
{
|
||
bool blnValorRetornado = false;
|
||
|
||
try
|
||
{
|
||
|
||
if (Session["SOLICITUD"]!= null)
|
||
{
|
||
objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
|
||
objproyectoSolicitudBL.eliminarProyectoSolicitud();
|
||
blnValorRetornado = true;
|
||
Session["SOLICITUD"]= null;
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha cancelado el ingreso de la solicitud temporal " + Session["SOLICITUD"].ToString(),
|
||
"frwNuevaSolicitud.aspx",
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
return blnValorRetornado;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private int GuardarDatosClientePropietario() //M3
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
string strModo = ViewState["MODO"].ToString();
|
||
|
||
//llenar datos cliente propietario
|
||
objClienteSolicitudBL = new clienteSolicitudBL();
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
objClienteSolicitudBL.objclientesolicitudEL.CEDULA = txtCedulaPropietario.Text;
|
||
objClienteSolicitudBL.objclientesolicitudEL.NOMBRE = txtNombrePropietario.Text;
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKTIPOPROPIETARIO = int.Parse(rblTipoPropietario.SelectedValue.ToString());
|
||
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
nValorRetornado = objClienteSolicitudBL.insertarClienteSolicitud();
|
||
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha ingresado el cliente " + txtNombrePropietario.Text.Trim() + "a la solicitud " + strNumSolicitudTMP,
|
||
"frwNuevaSolicitud.aspx",
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private int GuardarDescripcionCFIA(int p_pksolicitud) //M3
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
string strModo = ViewState["MODO"].ToString();
|
||
|
||
//llenar datos cliente propietario
|
||
descripcioncfiaBL objdescripcionCFIABL = new descripcioncfiaBL();
|
||
objdescripcionCFIABL.objdescripcioncfiaEL.FKSOLICITUD = p_pksolicitud;
|
||
objdescripcionCFIABL.objdescripcioncfiaEL.DESCRIPCION = txtDescripcionCFIA.Text;
|
||
objdescripcionCFIABL.objdescripcioncfiaEL.ASTATE = true;
|
||
|
||
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
nValorRetornado = objdescripcionCFIABL.insertarDescripcionCFIA();
|
||
|
||
|
||
//GuardarEventoBitacora(
|
||
//Session["LOGIN"].ToString(),
|
||
//AccionBitacora.INSERT.ToString(),
|
||
//MensajesBitacora.IngresarRegistro + ": Se ha ingresado el cliente " + txtNombrePropietario.Text.Trim(),
|
||
//"frwNuevaSolicitud.aspx",
|
||
//Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
//);
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private int ModificarDescripcionCFIA(int p_pkdescripcioncfia) //M3
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
string strModo = ViewState["MODO"].ToString();
|
||
|
||
//llenar datos cliente propietario
|
||
descripcioncfiaBL objdescripcionCFIABL = new descripcioncfiaBL();
|
||
objdescripcionCFIABL.objdescripcioncfiaEL.PKDESCRIPCIONCFIA = p_pkdescripcioncfia;
|
||
objdescripcionCFIABL.objdescripcioncfiaEL.DESCRIPCION = txtDescripcionCFIA.Text;
|
||
objdescripcionCFIABL.objdescripcioncfiaEL.ASTATE = true;
|
||
|
||
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
nValorRetornado = objdescripcionCFIABL.modificarDescripcionCFIA();
|
||
|
||
|
||
//GuardarEventoBitacora(
|
||
//Session["LOGIN"].ToString(),
|
||
//AccionBitacora.INSERT.ToString(),
|
||
//MensajesBitacora.IngresarRegistro + ": Se ha ingresado el cliente " + txtNombrePropietario.Text.Trim(),
|
||
//"frwNuevaSolicitud.aspx",
|
||
//Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
//);
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
private string ToXmls(DataSet ds)
|
||
{
|
||
MemoryStream memoryStream = new MemoryStream();
|
||
|
||
|
||
using (TextWriter streamWriter = new StreamWriter(memoryStream))
|
||
{
|
||
var xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(DataSet));
|
||
xmlSerializer.Serialize(streamWriter, ds);
|
||
|
||
}
|
||
return System.Text.Encoding.UTF8.GetString(memoryStream.ToArray());
|
||
}
|
||
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private int GuardarRegistroOpen() //M3
|
||
{
|
||
int nValorRetornado = 0;
|
||
openBL objOpenBL = new openBL();
|
||
wsOpenConstruccion.ServiceSoapClient ws = new wsOpenConstruccion.ServiceSoapClient();
|
||
string strModo = ViewState["MODO"].ToString();
|
||
try
|
||
{
|
||
|
||
DataSet dsOpen = ws.wmConstruccion(int.Parse(txtNIS.Text));
|
||
|
||
if (dsOpen.Tables[0].Rows[0][0].ToString() != "0")
|
||
{
|
||
//llenar datos cliente propietario
|
||
|
||
objOpenBL.objOpenEL.NIS_RAD = dsOpen.Tables[0].Rows[0]["NIS_RAD"].ToString();
|
||
objOpenBL.objOpenEL.MEDIDOR = dsOpen.Tables[0].Rows[0]["MEDIDOR"].ToString();
|
||
objOpenBL.objOpenEL.ACC_FINCA = dsOpen.Tables[0].Rows[0]["ACC_FINCA"].ToString();
|
||
objOpenBL.objOpenEL.NOMBRE_CLIENTE = dsOpen.Tables[0].Rows[0]["NOM_CLIENTE"].ToString();
|
||
objOpenBL.objOpenEL.TARIFA = dsOpen.Tables[0].Rows[0]["TARIFA"].ToString();
|
||
objOpenBL.objOpenEL.AYA_DIAMETRO_AGUA = decimal.Parse(dsOpen.Tables[0].Rows[0]["AYA_DIAMETRI_AGUA"].ToString());
|
||
objOpenBL.objOpenEL.AYA_DIAMETRO_ALCA = decimal.Parse( dsOpen.Tables[0].Rows[0]["AYA_DIAMETRO_ALCA"].ToString());
|
||
objOpenBL.objOpenEL.LOCALIZACION = dsOpen.Tables[0].Rows[0]["LOCALIZACION(SC.NIS_RAD)"].ToString();
|
||
objOpenBL.objOpenEL.MON_DEUDA = decimal.Parse(dsOpen.Tables[0].Rows[0]["MON_DEUDA"].ToString());
|
||
objOpenBL.objOpenEL.MON_DEUDA_REC_VENC = decimal.Parse(dsOpen.Tables[0].Rows[0]["MON_DEUDA_REC_VENC"].ToString());
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
nValorRetornado = objOpenBL.insertarRegistroOpen();
|
||
|
||
}
|
||
if (strModo == "Modificar")
|
||
{
|
||
objOpenBL.objOpenEL.PK = int.Parse(ViewState["FKOPEN"].ToString());
|
||
nValorRetornado = objOpenBL.modificarClienteSolicitud();
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
finally
|
||
{
|
||
ws.Close();
|
||
// EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Metodos Datos a Controles (R6)
|
||
|
||
|
||
/// <summary>
|
||
/// Llena el dropdownlist de grado academico según la aplicación
|
||
/// </summary>
|
||
private void llenarTipoProyecto() //M1
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlTipoProyecto.Items.Clear();
|
||
//Instancia el bjeto
|
||
proyectoBL objProyectoBL;
|
||
objProyectoBL = new proyectoBL();
|
||
//Asigna datos al atributo
|
||
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet dsProyectos = objProyectoBL.dsListaProyectos(null);
|
||
|
||
if (dsProyectos.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlTipoProyecto.DataSource = dsProyectos;
|
||
ddlTipoProyecto.DataTextField = dsProyectos.Tables[0].Columns["DESCRIPCIONPROYECTO"].ColumnName;
|
||
ddlTipoProyecto.DataValueField = dsProyectos.Tables[0].Columns["PKPROYECTO"].ColumnName;
|
||
ddlTipoProyecto.DataBind();
|
||
|
||
|
||
ddlTipoProyecto.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlTipoProyecto.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Llena el dropdownlist del Tipo visado
|
||
/// </summary>
|
||
///
|
||
|
||
private void llenarDDLTipoVisado() //M6
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlSubClasificacion.Items.Clear();
|
||
//Instancia el bjeto
|
||
|
||
solicitudBL objsolicitudBL = new solicitudBL();
|
||
//Asigna datos al atributo
|
||
|
||
|
||
//Carga la información en un dataset
|
||
|
||
DataSet ds = objsolicitudBL.dsListaTipoVisado(null);
|
||
|
||
if (ds.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlSubClasificacion.DataSource = ds;
|
||
ddlSubClasificacion.DataTextField = ds.Tables[0].Columns["DESCRIPCIONTIPOVISADO"].ColumnName;
|
||
ddlSubClasificacion.DataValueField = ds.Tables[0].Columns["PKTIPOVISADO"].ColumnName;
|
||
ddlSubClasificacion.DataBind();
|
||
|
||
|
||
ddlSubClasificacion.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlSubClasificacion.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Llena el dropdownlist de tipo de consulta
|
||
/// </summary>
|
||
private void llenarDDLMes() //M2
|
||
{
|
||
try
|
||
{
|
||
//ddlMes.Items.Clear();
|
||
//ddlMes.Items.Insert(0, new ListItem("Diciembre", "12"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Noviembre", "11"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Octubre", "10"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Setiembre", "9"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Agosto", "8"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Julio", "7"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Junio", "6"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Mayo", "5"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Abril", "4"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Marzo", "3"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Febrero", "2"));
|
||
//ddlMes.Items.Insert(0, new ListItem("Enero", "1"));
|
||
//ddlMes.Items.Insert(0, new ListItem("----- Seleccione el mes -----", "-1"));
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// LLena el listado de roles de usuario
|
||
/// </summary>
|
||
private void llenarGridProyectoSolicitud(string strNumSolicitud) //M3
|
||
{
|
||
try
|
||
{
|
||
//Instancia el objeto
|
||
objproyectoSolicitudBL = new proyectoSolicitudBL();
|
||
//Asigna un valor al atributo de referencia del objeto
|
||
objproyectoSolicitudBL.objproyectosolicitudEL.FKSOLICITUD = int.Parse(strNumSolicitud);
|
||
//Carga en un dataset la información
|
||
DataSet ds = objproyectoSolicitudBL.dsListaProyectoSolicitud();
|
||
if (ds.Tables.Count > 0)
|
||
{
|
||
grvListaTipoProyecto.DataSource = ds;
|
||
grvListaTipoProyecto.DataBind();
|
||
General.detalleGridView(ds, grvListaTipoProyecto, null);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// LLena el listado de clientes
|
||
/// </summary>
|
||
private void llenarGridClientePropietarioSolicitud(string strNumSolicitud) //M4
|
||
{
|
||
try
|
||
{
|
||
//Instancia el objeto
|
||
objClienteSolicitudBL = new clienteSolicitudBL();
|
||
//Asigna un valor al atributo de referencia del objeto
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(strNumSolicitud);
|
||
|
||
//Carga en un dataset la información
|
||
DataSet ds = objClienteSolicitudBL.dsListaClienteSolicitud();
|
||
if (ds.Tables.Count > 0)
|
||
{
|
||
grvListaClienteSolicitud.DataSource = ds;
|
||
grvListaClienteSolicitud.DataBind();
|
||
General.detalleGridView(ds, grvListaClienteSolicitud, null);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// LLena el listado de clientes
|
||
/// </summary>
|
||
private void llenarCargarDatosSolicitud(string strNumSolicitud) //M5
|
||
{
|
||
try
|
||
{
|
||
//Instancia el objeto
|
||
objSolicitudBL = new solicitudBL();
|
||
//Asigna un valor al atributo de referencia del objeto
|
||
objSolicitudBL.objSolicitudEL.NUMEROSOLICITUD = strNumSolicitud;
|
||
|
||
//Carga en un dataset la información
|
||
DataSet ds = objSolicitudBL.dsListaSolicitud(null);
|
||
if (ds.Tables.Count > 0)
|
||
{
|
||
//grvListaClienteSolicitud.DataSource = ds;
|
||
//grvListaClienteSolicitud.DataBind();
|
||
//General.detalleGridView(ds, grvListaClienteSolicitud, null);
|
||
}
|
||
}
|
||
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["DESCRIPCIONPROVINCIA"].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;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Llena el dropdownlist de grado academico según la aplicación
|
||
/// </summary>
|
||
private void llenarDDLCanton() //M7
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlCanton.Items.Clear();
|
||
//Instancia el bjeto
|
||
|
||
objcantonBL = new cantonBL();
|
||
//Asigna datos al atributo
|
||
objcantonBL.objcantonEL.FKPROVINCIA = int.Parse(ddlProvincia.SelectedValue);
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet ds = objcantonBL.dsListaCantones(null);
|
||
|
||
if (ds.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlCanton.DataSource = ds;
|
||
ddlCanton.DataTextField = ds.Tables[0].Columns["DESCRIPCIONCANTON"].ColumnName;
|
||
ddlCanton.DataValueField = ds.Tables[0].Columns["PKCANTON"].ColumnName;
|
||
ddlCanton.DataBind();
|
||
|
||
|
||
// ddlCanton.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlCanton.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 llenarDDLDistrito() //M8
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlDistrito.Items.Clear();
|
||
//Instancia el bjeto
|
||
|
||
objdistritoBL = new distritoBL();
|
||
//Asigna datos al atributo
|
||
objdistritoBL.objdistritoEL.FKCANTON = int.Parse(ddlCanton.SelectedValue);
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet ds = objdistritoBL.dsListaDistrito(null);
|
||
|
||
if (ds.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlDistrito.DataSource = ds;
|
||
ddlDistrito.DataTextField = ds.Tables[0].Columns["DESCRIPCIONDISTRITO"].ColumnName;
|
||
ddlDistrito.DataValueField = ds.Tables[0].Columns["PKDISTRITO"].ColumnName;
|
||
ddlDistrito.DataBind();
|
||
|
||
|
||
// ddlCanton.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlDistrito.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Llena el dropdownlist de dependencias
|
||
/// </summary>
|
||
private void llenarDDLdependencia(int p_nPKRDistrito) //M3
|
||
{
|
||
try
|
||
{
|
||
int nPKRegion = 0;
|
||
distritoBL objDistritoBL = new distritoBL();
|
||
objDistritoBL.objdistritoEL.PK = int.Parse(ddlDistrito.SelectedValue.ToString());
|
||
DataSet dsDistrito = objDistritoBL.dsListaDistrito(null);
|
||
if (dsDistrito.Tables[0].Rows.Count != 0)
|
||
{
|
||
nPKRegion = int.Parse(dsDistrito.Tables[0].Rows[0]["FKREGION"].ToString());
|
||
|
||
regionBL objRegionBL = new regionBL();
|
||
objRegionBL.objregionEL.PK = nPKRegion;
|
||
DataSet dsRegion = objRegionBL.dsListaRegiones(null);
|
||
lblNuevaRegion.Text = dsRegion.Tables[0].Rows[0]["DESCRIPCIONREGION"].ToString();
|
||
//Limpia el control
|
||
ddlDependencia.Items.Clear();
|
||
//Instancia el bjeto
|
||
oficinaayaBL objDependenciaBL = new oficinaayaBL();
|
||
|
||
//Carga la información en un dataset
|
||
objDependenciaBL.objoficinaayaEL.PK = 0;
|
||
objDependenciaBL.objoficinaayaEL.FKREGION = nPKRegion;
|
||
DataSet dsDependencia = objDependenciaBL.dsListaoficinas(null);
|
||
if (dsDependencia.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlDependencia.DataSource = dsDependencia;
|
||
ddlDependencia.DataTextField = dsDependencia.Tables[0].Columns["DESCRIPCIONDEPENDENCIASIGDD"].ColumnName;
|
||
ddlDependencia.DataValueField = dsDependencia.Tables[0].Columns["PKDEPENDENCIASIGDD"].ColumnName;
|
||
ddlDependencia.DataBind();
|
||
|
||
ddlDependencia.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlDependencia.Items.Insert(0, new ListItem("----- No existen dependencias -----", "-1"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Llena el dropdownlist de uso de edificacion
|
||
/// </summary>
|
||
//private void llenarDDLUsoEdificacion() //M8
|
||
//{
|
||
// try
|
||
// {
|
||
// //Limpia el control
|
||
// ddlUsoEdificacion.Items.Clear();
|
||
// //Instancia el bjeto
|
||
|
||
// objSolicitudBL = new solicitudBL();
|
||
|
||
|
||
// //Carga la información en un dataset
|
||
|
||
|
||
// DataSet ds = objSolicitudBL.dsListaUsoEdificacion(null);
|
||
|
||
// if (ds.Tables[0].Rows.Count != 0)
|
||
// {
|
||
// ddlUsoEdificacion.DataSource = ds;
|
||
// ddlUsoEdificacion.DataTextField = ds.Tables[0].Columns["DESCRIPCIONUSOEDIFICACION"].ColumnName;
|
||
// ddlUsoEdificacion.DataValueField = ds.Tables[0].Columns["PKUSOEDIFICACION"].ColumnName;
|
||
// ddlUsoEdificacion.DataBind();
|
||
|
||
|
||
// // ddlCanton.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
// }
|
||
// else
|
||
// ddlDistrito.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// throw ex;
|
||
// }
|
||
//}
|
||
|
||
/// <summary>
|
||
/// Llena el dropdownlist de tipo de inspeccion
|
||
/// </summary>
|
||
private void llenarDDLTipoInspeccion() //M8
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlTipoInspeccion.Items.Clear();
|
||
//Instancia el bjeto
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet ds = objSolicitudBL.dsListaTipoInspeccion(null);
|
||
|
||
if (ds.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlTipoInspeccion.DataSource = ds;
|
||
ddlTipoInspeccion.DataTextField = ds.Tables[0].Columns["DESCRIPCIONTIPOINSPECCION"].ColumnName;
|
||
ddlTipoInspeccion.DataValueField = ds.Tables[0].Columns["PKTIPOINSPECCION"].ColumnName;
|
||
ddlTipoInspeccion.DataBind();
|
||
|
||
|
||
// ddlCanton.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlDistrito.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Llena el dropdownlist de tipo de disponibilidad
|
||
/// </summary>
|
||
private void llenarDDLTipoDisponibilidad() //M8
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlTipoDisponibilidad.Items.Clear();
|
||
//Instancia el bjeto
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet ds = objSolicitudBL.dsListaTipoDisponibilidad(null);
|
||
|
||
if (ds.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlTipoDisponibilidad.DataSource = ds;
|
||
ddlTipoDisponibilidad.DataTextField = ds.Tables[0].Columns["DESCRIPCIONTIPODISPONIBILIDAD"].ColumnName;
|
||
ddlTipoDisponibilidad.DataValueField = ds.Tables[0].Columns["PKTIPODISPONIBILIDAD"].ColumnName;
|
||
ddlTipoDisponibilidad.DataBind();
|
||
|
||
|
||
// ddlCanton.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlTipoDisponibilidad.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Llena el dropdownlist de tipo de disponibilidad
|
||
/// </summary>
|
||
private void llenarTitularInmueble() //M8
|
||
{
|
||
try
|
||
{
|
||
//Limpia el control
|
||
ddlTitularInmueble.Items.Clear();
|
||
//Instancia el bjeto
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet ds = objSolicitudBL.dsTitularInmueble(null);
|
||
|
||
if (ds.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlTitularInmueble.DataSource = ds;
|
||
ddlTitularInmueble.DataTextField = ds.Tables[0].Columns["DESCRIPCIONTITULARINMUEBLE"].ColumnName;
|
||
ddlTitularInmueble.DataValueField = ds.Tables[0].Columns["PKTITULARINMUEBLE"].ColumnName;
|
||
ddlTitularInmueble.DataBind();
|
||
}
|
||
else
|
||
ddlTitularInmueble.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 buscarUnidadMedidaTipoProyecto() //M9
|
||
{
|
||
try
|
||
{
|
||
|
||
//Instancia el bjeto
|
||
proyectoBL objProyectoBL;
|
||
objProyectoBL = new proyectoBL();
|
||
//Asigna datos al atributo
|
||
if (ddlTipoProyecto.SelectedValue != "")
|
||
objProyectoBL.objproyectoEL.PK = int.Parse(ddlTipoProyecto.SelectedValue);
|
||
|
||
//Carga la información en un dataset
|
||
|
||
|
||
DataSet dsProyectos = objProyectoBL.dsListaProyectos(null);
|
||
|
||
if (dsProyectos.Tables[0].Rows.Count != 0)
|
||
{
|
||
lblUnidadMedida.Text = dsProyectos.Tables[0].Rows[0]["UNIDADMEDIDAPROYECTO"].ToString();
|
||
}
|
||
else
|
||
lblUnidadMedida.Text = "Sin registrar";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
public void llenarGridSolicitudFolio()
|
||
{
|
||
try
|
||
{
|
||
|
||
solicitudfolioBL objsolicitudfolioBL = new solicitudfolioBL();
|
||
|
||
objsolicitudfolioBL.objsolicitudfolioEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
||
|
||
DataSet ds = objsolicitudfolioBL.dsListaSolicitudFolio(null);
|
||
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
|
||
grvListaTerrenoSolicitud.DataSource = ds;
|
||
grvListaTerrenoSolicitud.DataBind();
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
private void cargarSolicitud()
|
||
{
|
||
try
|
||
{
|
||
ViewState.Remove("FKOPEN");
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(strPKSolicitudTMP);
|
||
|
||
DataSet dsSolicitud = objSolicitudBL.dsExisteSolicitud(null);
|
||
|
||
if (dsSolicitud.Tables[0].Rows.Count > 0)
|
||
{
|
||
ViewState["FKOPEN"] = dsSolicitud.Tables[0].Rows[0]["FKOPEN"].ToString();
|
||
//nConsecutivoTmp = objSolicitudBL.objSolicitudEL.NUMSOLICITUD;
|
||
ddlTipoInspeccion.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKTIPOINSPECCION"].ToString();
|
||
ddlTipoDisponibilidad.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKTIPODISPONIBILIDAD"].ToString();
|
||
|
||
txtNombreSolicitante.Text = dsSolicitud.Tables[0].Rows[0]["NOMBRESOLICITANTESOLICITUD"].ToString();
|
||
txtApellido1Solicitante.Text = dsSolicitud.Tables[0].Rows[0]["APELLIDO1SOLICITANTESOLICITUD"].ToString();
|
||
txtApellido2Solicitante.Text = dsSolicitud.Tables[0].Rows[0]["APELLIDO2SOLICITANTESOLICITUD"].ToString();
|
||
txtCedulaSolicitante.Text = dsSolicitud.Tables[0].Rows[0]["CEDULASOLICITANTESOLICITUD"].ToString();
|
||
|
||
ddlTitularInmueble.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKTITULARINMUEBLE"].ToString();
|
||
|
||
txtNIS.Text = dsSolicitud.Tables[0].Rows[0]["NUMERONISSOLICITUD"].ToString();
|
||
|
||
if (dsSolicitud.Tables[0].Rows[0]["TIENESERVICIOSOLICITUD"].ToString().ToLower() == "true")
|
||
{
|
||
rdlTieneServicios.SelectedValue = "1";
|
||
txtNIS.Enabled = true;
|
||
imgBOpen.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
rdlTieneServicios.SelectedValue = "0";
|
||
txtNIS.Enabled = false;
|
||
imgBOpen.Enabled = false;
|
||
}
|
||
|
||
|
||
//txtCantidadEdificaciones.Text = dsSolicitud.Tables[0].Rows[0]["CANTIDADEDIFICACIONESSOLICITUD"].ToString();
|
||
//ddlUsoEdificacion.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKUSOEDIFICACION"].ToString();
|
||
//txtDescripcionUsoEdificaciones.Text = dsSolicitud.Tables[0].Rows[0]["DESCRIPCIONUSOEDIFICACIONSOLICITUD"].ToString();
|
||
llenarDDLProvincia();
|
||
ddlProvincia.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKPROVINCIA"].ToString();
|
||
llenarDDLCanton();
|
||
ddlCanton.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKCANTON"].ToString();
|
||
llenarDDLDistrito();
|
||
ddlDistrito.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKDISTRITO"].ToString();
|
||
llenarDDLdependencia(0);
|
||
ddlDependencia.SelectedValue = dsSolicitud.Tables[0].Rows[0]["FKDEPENDENCIASIGDD"].ToString();
|
||
|
||
txtDireccionExactaPropiedad.Text = dsSolicitud.Tables[0].Rows[0]["DIRECCIONEXACTAPROPIEDADSOLICITUD"].ToString();
|
||
txtTelefono1.Text = dsSolicitud.Tables[0].Rows[0]["NUMEROTELEFONO1SOLICITUD"].ToString();
|
||
txtTelefono2.Text = dsSolicitud.Tables[0].Rows[0]["NUMEROTELEFONO2SOLICITUD"].ToString();
|
||
txtFax.Text = dsSolicitud.Tables[0].Rows[0]["FAXSOLICITUD"].ToString();
|
||
txtCorreo.Text = dsSolicitud.Tables[0].Rows[0]["CORREOELECTRONICOSOLICITUD"].ToString();
|
||
txtCorreo2.Text = dsSolicitud.Tables[0].Rows[0]["CORREOELECTRONICO2SOLICITUD"].ToString();
|
||
|
||
chkMunicipalidad.Checked = Convert.ToBoolean(dsSolicitud.Tables[0].Rows[0]["SOLICITAMUNICIPALIDADSOLICITUD"].ToString());
|
||
chkMinisterio.Checked = Convert.ToBoolean(dsSolicitud.Tables[0].Rows[0]["SOLICITAMINISTERIOSALUDSOLICITUD"].ToString());
|
||
chkCFIA.Checked = Convert.ToBoolean(dsSolicitud.Tables[0].Rows[0]["SOLICITACFIASOLICITUD"].ToString());
|
||
if (chkCFIA.Checked == true)
|
||
{
|
||
lblDescripcionCFIA.Visible = true;
|
||
txtDescripcionCFIA.Visible = true;
|
||
txtDescripcionCFIA.Text = dsSolicitud.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString();
|
||
|
||
}
|
||
else
|
||
{
|
||
lblDescripcionCFIA.Visible = false;
|
||
txtDescripcionCFIA.Visible = false;
|
||
txtDescripcionCFIA.Text = string.Empty;
|
||
|
||
}
|
||
|
||
txtOtroEnteSolicita.Text = dsSolicitud.Tables[0].Rows[0]["SOLICITAOTROENTESOLICITUD"].ToString();
|
||
|
||
ViewState["FKOPEN"] = dsSolicitud.Tables[0].Rows[0]["FKOPEN"].ToString();
|
||
|
||
//txtUsoEspecifique.Text = dsSolicitud.Tables[0].Rows[0]["USOESPECIFIQUESOLICITUD"].ToString();
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
private void DeshabilitarCampos()
|
||
{
|
||
ddlTipoInspeccion.Enabled = false;
|
||
//ddlTipoDisponibilidad.Enabled = false;
|
||
txtNombreSolicitante.Enabled = false;
|
||
txtApellido1Solicitante.Enabled = false;
|
||
txtApellido2Solicitante.Enabled = false;
|
||
txtCedulaSolicitante.Enabled = false;
|
||
ddlTitularInmueble.Enabled = false;
|
||
chkSolicitantePropietario.Enabled = false;
|
||
rdlTieneServicios.Enabled = false;
|
||
txtNIS.Enabled = false;
|
||
//txtCantidadEdificaciones.Enabled = false;
|
||
//ddlUsoEdificacion.Enabled = false;
|
||
//txtDescripcionUsoEdificaciones.Enabled = false;
|
||
ddlProvincia.Enabled = false;
|
||
ddlCanton.Enabled = false;
|
||
ddlDistrito.Enabled = false;
|
||
ddlDependencia.Enabled = false;
|
||
txtDireccionExactaPropiedad.Enabled = false;
|
||
txtTelefono1.Enabled = false;
|
||
txtTelefono2.Enabled = false;
|
||
txtFax.Enabled = false;
|
||
txtCorreo.Enabled = false;
|
||
txtCorreo2.Enabled = false;
|
||
chkMunicipalidad.Enabled = false;
|
||
chkMinisterio.Enabled = false;
|
||
chkCFIA.Enabled = false;
|
||
txtOtroEnteSolicita.Enabled = false;
|
||
txtNombrePropietario.Enabled = false;
|
||
rblTipoPropietario.Enabled = false;
|
||
txtCedulaPropietario.Enabled = false;
|
||
lblDescripcionCFIA.Visible = false;
|
||
txtDescripcionCFIA.Enabled = false;
|
||
btnAgregarClientes.Enabled = false;
|
||
ddlTipoProyecto.Enabled = false;
|
||
txtValor.Enabled = false;
|
||
txtCaudalSolicitado.Enabled = false;
|
||
btnAgregarProyecto.Enabled = false;
|
||
grvListaTerrenoSolicitud.Enabled = false;
|
||
grvListaTipoProyecto.Enabled = false;
|
||
grvListaClienteSolicitud.Enabled = false;
|
||
btnModificarFolioPlano.Enabled = false;
|
||
}
|
||
|
||
private void deshabilitarProrroga()
|
||
{
|
||
|
||
DeshabilitarCampos();
|
||
txtNombrePropietario.Enabled = true;
|
||
rblTipoPropietario.Enabled = true;
|
||
txtCedulaPropietario.Enabled = true;
|
||
btnAgregarClientes.Enabled = true;
|
||
txtNombreSolicitante.Enabled = true;
|
||
txtApellido1Solicitante.Enabled = true;
|
||
txtApellido2Solicitante.Enabled = true;
|
||
txtCedulaSolicitante.Enabled = true;
|
||
ddlTitularInmueble.Enabled = true;
|
||
txtNIS.Enabled = true;
|
||
ddlProvincia.Enabled = true;
|
||
ddlCanton.Enabled = true;
|
||
ddlDistrito.Enabled = true;
|
||
ddlDependencia.Enabled = true;
|
||
txtDireccionExactaPropiedad.Enabled = true;
|
||
txtTelefono1.Enabled = true;
|
||
txtTelefono2.Enabled = true;
|
||
txtFax.Enabled = true;
|
||
txtCorreo.Enabled = true;
|
||
txtCorreo2.Enabled = true;
|
||
chkMunicipalidad.Enabled = true;
|
||
chkMinisterio.Enabled = true;
|
||
//chkCFIA.Enabled = true;
|
||
txtOtroEnteSolicita.Enabled = true;
|
||
txtDescripcionCFIA.Enabled = true;
|
||
}
|
||
|
||
private void deshabilitarRevision()
|
||
{
|
||
DeshabilitarCampos();
|
||
grvListaTerrenoSolicitud.Enabled = true;
|
||
btnModificarFolioPlano.Enabled = true;
|
||
rdlTieneServicios.Enabled = true;
|
||
//txtCantidadEdificaciones.Enabled = true;
|
||
//ddlProvincia.Enabled = true;
|
||
//ddlCanton.Enabled = true;
|
||
//ddlDistrito.Enabled = true;
|
||
txtDireccionExactaPropiedad.Enabled = true;
|
||
}
|
||
|
||
private void HabilitarCampos()
|
||
{
|
||
ddlTipoInspeccion.Enabled = true;
|
||
//ddlTipoDisponibilidad.Enabled = true;
|
||
txtNombreSolicitante.Enabled = true;
|
||
txtApellido1Solicitante.Enabled = true;
|
||
txtApellido2Solicitante.Enabled = true;
|
||
txtCedulaSolicitante.Enabled = true;
|
||
ddlTitularInmueble.Enabled = true;
|
||
chkSolicitantePropietario.Enabled = true;
|
||
rdlTieneServicios.Enabled = true;
|
||
txtNIS.Enabled = true;
|
||
//txtCantidadEdificaciones.Enabled = true;
|
||
//ddlUsoEdificacion.Enabled = true;
|
||
//txtDescripcionUsoEdificaciones.Enabled = true;
|
||
ddlProvincia.Enabled = true;
|
||
ddlCanton.Enabled = true;
|
||
ddlDistrito.Enabled = true;
|
||
ddlDependencia.Enabled = true;
|
||
txtDireccionExactaPropiedad.Enabled = true;
|
||
txtTelefono1.Enabled = true;
|
||
txtTelefono2.Enabled = true;
|
||
txtFax.Enabled = true;
|
||
txtCorreo.Enabled = true;
|
||
txtCorreo2.Enabled = true;
|
||
chkMunicipalidad.Enabled = true;
|
||
chkMinisterio.Enabled = true;
|
||
//chkCFIA.Enabled = true;
|
||
txtOtroEnteSolicita.Enabled = true;
|
||
txtNombrePropietario.Enabled = true;
|
||
rblTipoPropietario.Enabled = true;
|
||
txtCedulaPropietario.Enabled = true;
|
||
|
||
txtDescripcionCFIA.Enabled = true;
|
||
btnAgregarClientes.Enabled = true;
|
||
ddlTipoProyecto.Enabled = true;
|
||
txtValor.Enabled = true;
|
||
txtCaudalSolicitado.Enabled = true;
|
||
btnAgregarProyecto.Enabled = true;
|
||
grvListaTerrenoSolicitud.Enabled = true;
|
||
btnModificarFolioPlano.Enabled = true;
|
||
grvListaTipoProyecto.Enabled = true;
|
||
grvListaClienteSolicitud.Enabled = true;
|
||
|
||
|
||
}
|
||
/// <summary>
|
||
/// LLena el listado de clientes
|
||
/// </summary>
|
||
private void identificaClientePropietarioSolicitud() //M4
|
||
{
|
||
try
|
||
{
|
||
//Instancia el objeto
|
||
clienteSolicitudBL objClienteSolicitudBL = new clienteSolicitudBL();
|
||
//Asigna un valor al atributo de referencia del objeto
|
||
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
//objClienteSolicitudBL.objclientesolicitudEL.FKTIPOPROPIETARIO = 2;//pregunta si es de tipo cedula juridica primero para verificar que no hay ninguno entre los mismos
|
||
|
||
//Carga en un dataset la información
|
||
DataSet ds = objClienteSolicitudBL.dsListaClienteSolicitud();
|
||
nTipoPropietario = 1;
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (int.Parse(row["FKTIPOPROPIETARIO"].ToString()) == 2)
|
||
{
|
||
nTipoPropietario = 2;
|
||
|
||
}
|
||
nTipoDisponibilidad = int.Parse(ds.Tables[0].Rows[0]["FKTIPODISPONIBILIDAD"].ToString());
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
private void BloquearIntros()
|
||
{
|
||
foreach (Control c in divDatosSuperiores.Controls)
|
||
{
|
||
if (c is TextBox)
|
||
{
|
||
((TextBox)c).Attributes.Add("onkeypress", "javascript:if(event.keyCode==13){return false;}");
|
||
|
||
}
|
||
if (c is RadioButtonList)
|
||
{
|
||
((RadioButtonList)c).Attributes.Add("onkeypress", "javascript:if(event.keyCode==13){return false;}");
|
||
|
||
}
|
||
|
||
foreach (Control childc in c.Controls)
|
||
{
|
||
if (childc is TextBox || c is RadioButtonList)
|
||
{
|
||
((TextBox)childc).Attributes.Add("onkeypress", "javascript:if(event.keyCode==13){return false;}");
|
||
|
||
}
|
||
if (childc is RadioButtonList)
|
||
{
|
||
((RadioButtonList)childc).Attributes.Add("onkeypress", "javascript:if(event.keyCode==13){return false;}");
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
protected void chkSolicitantePropietario_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (txtNombreSolicitante.Text != string.Empty && txtCedulaSolicitante.Text != string.Empty && strPKSolicitudTMP != "0" && chkSolicitantePropietario.Checked == true)
|
||
{
|
||
txtNombrePropietario.Text = txtNombreSolicitante.Text + " " + txtApellido1Solicitante.Text + " " + txtApellido2Solicitante.Text;
|
||
txtCedulaPropietario.Text = txtCedulaSolicitante.Text;
|
||
|
||
//ViewState["MODO"] = "Nuevo";
|
||
//int pkRegistro = GuardarDatosClientePropietario();
|
||
//llenarGridClientePropietarioSolicitud(strPKSolicitudTMP);
|
||
//txtNombrePropietario.Text = "";
|
||
//txtCedulaPropietario.Text = "";
|
||
//mostrarFilaTabla(1);
|
||
|
||
//MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
txtNombrePropietario.Text = string.Empty;
|
||
txtCedulaPropietario.Text = string.Empty;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M7", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
protected void chkCFIA_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (chkCFIA.Checked == true)
|
||
{
|
||
lblDescripcionCFIA.Visible = true;
|
||
txtDescripcionCFIA.Visible = true;
|
||
}
|
||
else
|
||
{
|
||
lblDescripcionCFIA.Visible = false;
|
||
txtDescripcionCFIA.Visible = false;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M7", ex);
|
||
}
|
||
finally
|
||
{
|
||
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
protected void btnAnterior2_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
|
||
EncriptaBL objEncripta = new EncriptaBL();
|
||
|
||
Response.Redirect("~/forms/tra/" + Session["PaginaBack"].ToString() + "?l=" + objEncripta.Encryptar(Session["LOGIN"].ToString()) + "&u=" + objEncripta.Encryptar(Session["PKUSUARIO"].ToString()));
|
||
|
||
|
||
//EjecutarScript("window.history.back();");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Se produjo un error.", ex);
|
||
}
|
||
}
|
||
protected void grvListaTipoProyecto_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
grvListaTipoProyecto.PageIndex = e.NewPageIndex;
|
||
llenarGridProyectoSolicitud(strPKSolicitudTMP);
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M1", ex);
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaTab('grid');");
|
||
}
|
||
}
|
||
protected void rdlTieneServicios_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (rdlTieneServicios.SelectedValue == "1")//otro
|
||
{
|
||
|
||
txtNIS.Enabled = true;
|
||
imgBOpen.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
txtNIS.Text = "N/A";
|
||
txtNIS.Enabled = false;
|
||
imgBOpen.Enabled = false;
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Se produjo un error al seleccionar la opcion.", ex);
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaTab('grid');");
|
||
}
|
||
}
|
||
protected void btnModificarFolioPlano_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
//llenarGridView(true);
|
||
Response.Redirect("~/forms/tra/Validarplanosyfolios.aspx");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//MensajeError("Error en R3M4" + MensajesAplicacion.BusquedaFallido.ToString(), ex);
|
||
}
|
||
}
|
||
protected void chkVisado_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (chkVisado.Checked == true)
|
||
divnum1.Visible = true;
|
||
else
|
||
divnum1.Visible = false;
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Se produjo un error al mostrar las opciones para visado", ex);
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaAcordeon('proposito');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
|
||
}
|
||
|
||
protected void ddlDependencia_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
protected void ddlTipoInspeccion_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Se produjo un error al mostrar las opciones para visado", ex);
|
||
}
|
||
finally
|
||
{
|
||
EjecutarScript("inicializaAcordeon('TipoDisponibilidad');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
||
}
|
||
}
|
||
} |