3982 lines
138 KiB
C#
3982 lines
138 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SIG.Web.AppCode.Configuration;
|
|
using SIG.Web.AppCode.Infrastructure.WebForms;
|
|
using SIG.Web.AppCode.Models.Bitacora;
|
|
using SIG.Web.AppCode.Models.Common;
|
|
using SIG.Web.AppCode.Models.Convenios;
|
|
using SIG.Web.AppCode.Models.Documentos;
|
|
using SIG.Web.AppCode.Models.Fraccionamientos;
|
|
using SIG.Web.AppCode.Models.Tramites;
|
|
using SIG.Web.AppCode.Models.Ventas;
|
|
using SIG.Web.AppCode.Security;
|
|
using SIG.Web.AppCode.Session;
|
|
using SIG.Web.AppCode.SigControls;
|
|
using SIG.Web.AppCode.Utilities;
|
|
|
|
namespace SIG.Web.Pages.Fraccionamientos
|
|
{
|
|
public partial class FraccionamientoDetalle : ClsPaginaBase
|
|
{
|
|
private const string ValorVisualizacionVacio = "—";
|
|
|
|
#region "Propiedades"
|
|
private int CveFraccionamientoActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaCondicionesActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaCondicionesActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaCondicionesActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaCondicionesActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaLotesActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaLotesActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaLotesActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaLotesActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoLoteActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoLoteActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoLoteActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoLoteActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaLoteEdicionActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaLoteEdicionActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaLoteEdicionActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaLoteEdicionActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaFiltroLotesActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaFiltroLotesActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaFiltroLotesActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaFiltroLotesActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaAvanceActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaAvanceActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaAvanceActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaAvanceActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveFraccionamientoEtapaGisActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveFraccionamientoEtapaGisActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveFraccionamientoEtapaGisActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveFraccionamientoEtapaGisActual"] = value;
|
|
}
|
|
}
|
|
|
|
protected bool EsAdministradorEstatus
|
|
{
|
|
get { return !CurrentUser.EsDesarrollador; }
|
|
}
|
|
|
|
private FiltroActivo FiltroTramiteEstatus
|
|
{
|
|
get
|
|
{
|
|
return UcTramiteFiltros.GetFiltroActivo(
|
|
"Estatus");
|
|
}
|
|
}
|
|
|
|
private FiltroActivo FiltroTramiteTipo
|
|
{
|
|
get
|
|
{
|
|
return UcTramiteFiltros.GetFiltroActivo(
|
|
"TipoTramite");
|
|
}
|
|
}
|
|
|
|
private FiltroActivo FiltroTramiteEtapa
|
|
{
|
|
get
|
|
{
|
|
return UcTramiteFiltros.GetFiltroActivo(
|
|
"Etapa");
|
|
}
|
|
}
|
|
|
|
private int CveSolicitudDocumentoActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveSolicitudDocumentoActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveSolicitudDocumentoActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveSolicitudDocumentoActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveTipoDocumentoActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveTipoDocumentoActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveTipoDocumentoActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveTipoDocumentoActual"] = value;
|
|
}
|
|
}
|
|
|
|
private int CveDocumentoSolicitudRevisionActual
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveDocumentoSolicitudRevisionActual"] == null
|
|
? 0
|
|
: (int)ViewState["CveDocumentoSolicitudRevisionActual"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CveDocumentoSolicitudRevisionActual"] = value;
|
|
}
|
|
}
|
|
|
|
private FiltroActivo FiltroDocumentoTipoTramite
|
|
{
|
|
get
|
|
{
|
|
return UcDocumentoFiltros.GetFiltroActivo(
|
|
"TipoTramite");
|
|
}
|
|
}
|
|
|
|
private FiltroActivo FiltroDocumentoEtapa
|
|
{
|
|
get
|
|
{
|
|
return UcDocumentoFiltros.GetFiltroActivo(
|
|
"Etapa");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
ConfigurarCuadriculaOrdenEtapas();
|
|
var administradorAcciones = ScriptManager.GetCurrent(Page);
|
|
if (administradorAcciones != null)
|
|
{
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnSolicitarDocumentoConjunto);
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnCargarDocumentosConjunto);
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnDescargarDocumentosConjunto);
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnAgregarTipoViviendaConjunto);
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnAgregarLotesConjunto);
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnCargarGisConjunto);
|
|
administradorAcciones.RegisterAsyncPostBackControl(BtnLimpiarLotesConjunto);
|
|
}
|
|
|
|
|
|
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
|
|
|
if (scriptManager != null)
|
|
{
|
|
scriptManager.RegisterAsyncPostBackControl(
|
|
BtnEditarEtapaAvance);
|
|
scriptManager.RegisterAsyncPostBackControl(
|
|
BtnAgregarTramite);
|
|
}
|
|
|
|
if (IsPostBack)
|
|
{
|
|
return;
|
|
}
|
|
|
|
int cveFraccionamiento;
|
|
|
|
if (!int.TryParse(
|
|
Request.QueryString["id"],
|
|
out cveFraccionamiento) ||
|
|
cveFraccionamiento <= 0)
|
|
{
|
|
Alert("Seleccione un fraccionamiento válido.", TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
CveFraccionamientoActual = cveFraccionamiento;
|
|
|
|
CargarClientes();
|
|
CargarEstatus();
|
|
CargarFraccionamiento();
|
|
CargarRelacionados();
|
|
CargarBitacoraDetalle();
|
|
CargarAvisos();
|
|
int etapaGis;
|
|
if (int.TryParse(Request.QueryString["gisEtapa"], out etapaGis) && etapaGis > 0)
|
|
{
|
|
var etapa = AppServices.ServicioFraccionamiento.ObtenerEtapa(
|
|
etapaGis, CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
if (etapa.Success && etapa.Data != null &&
|
|
etapa.Data.CveFraccionamiento == CveFraccionamientoActual)
|
|
{
|
|
CveFraccionamientoEtapaFiltroLotesActual = etapaGis;
|
|
AbrirModalGisEtapa();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void BtnGuardar_Click(object sender, EventArgs e)
|
|
{
|
|
decimal? hectareas;
|
|
|
|
if (!IntentarConvertirDecimalAnulable(
|
|
TxtHectareas.Text,
|
|
out hectareas))
|
|
{
|
|
MostrarEditarError(
|
|
"Capture las hectáreas con un valor numérico válido.");
|
|
return;
|
|
}
|
|
|
|
int cveCliente;
|
|
|
|
if (!int.TryParse(
|
|
DdlCliente.SelectedValue,
|
|
out cveCliente))
|
|
{
|
|
MostrarEditarError("Seleccione un cliente válido.");
|
|
return;
|
|
}
|
|
|
|
int idEstatus;
|
|
|
|
if (!int.TryParse(
|
|
DdlEstatus.SelectedValue,
|
|
out idEstatus))
|
|
{
|
|
MostrarEditarError("Seleccione un estatus válido.");
|
|
return;
|
|
}
|
|
|
|
var fraccionamiento = new ModeloFraccionamiento
|
|
{
|
|
CveFraccionamiento = CveFraccionamientoActual,
|
|
CveCliente = cveCliente,
|
|
Fraccionamiento = TxtFraccionamiento.Text,
|
|
Hectareas = hectareas,
|
|
Ubicacion = TxtUbicacion.Text,
|
|
CveEstatus = idEstatus,
|
|
EsActivo = ChkActivo.Checked
|
|
};
|
|
|
|
DbResult<int> resultado =
|
|
AppServices.ServicioFraccionamiento.Guardar(
|
|
fraccionamiento,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarEditarModal();
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
OcultarEditarMensaje();
|
|
CargarFraccionamiento();
|
|
CargarRelacionados();
|
|
UpResumen.Update();
|
|
UpEtapasDetalle.Update();
|
|
UpCantidadEtapas.Update();
|
|
UpCantidadLotes.Update();
|
|
UpCantidadTramites.Update();
|
|
UpPagosDetalle.Update();
|
|
UpCantidadPagos.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
OcultarEditarModal();
|
|
ActualizarBitacoraDetalle();
|
|
Alert("Fraccionamiento guardado correctamente.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnEliminar_Click(object sender, EventArgs e)
|
|
{
|
|
DbResult<bool> resultado =
|
|
AppServices.ServicioFraccionamiento.Eliminar(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
AlertNextRequest(
|
|
"Fraccionamiento eliminado correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
|
|
Response.Redirect(
|
|
"~/Pages/Fraccionamientos/Fraccionamientos.aspx",
|
|
false);
|
|
Context.ApplicationInstance.CompleteRequest();
|
|
}
|
|
|
|
protected void BtnNuevaEtapa_Click(object sender, EventArgs e)
|
|
{
|
|
LimpiarEtapa();
|
|
LitEtapaTitulo.Text = "Nueva etapa";
|
|
UpEtapaModal.Update();
|
|
MostrarModalEtapa();
|
|
}
|
|
|
|
protected void BtnAgregarTramite_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabTramites));
|
|
CargarOpcionesEtapaParaAgregarTramite();
|
|
CargarOpcionesTipoTramiteParaAgregar();
|
|
OcultarAgregarTramiteMensaje();
|
|
UpAgregarTramiteModal.Update();
|
|
MostrarModalAgregarTramite();
|
|
}
|
|
|
|
protected void DdlAgregarTramiteEtapa_SeleccionadoIndiceCambiado(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
CargarOpcionesTipoTramiteParaAgregar();
|
|
OcultarAgregarTramiteMensaje();
|
|
UpAgregarTramiteModal.Update();
|
|
MostrarModalAgregarTramite();
|
|
}
|
|
|
|
protected void BtnGuardarAgregarTramite_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
int cveTipoTramite;
|
|
|
|
if (!int.TryParse(
|
|
DdlAgregarTramiteEtapa.SelectedValue,
|
|
out cveFraccionamientoEtapa) ||
|
|
cveFraccionamientoEtapa <= 0)
|
|
{
|
|
MostrarValidacionAgregarTramite(
|
|
"Seleccione una etapa válida.");
|
|
return;
|
|
}
|
|
|
|
if (!int.TryParse(
|
|
DdlAgregarTipoTramite.SelectedValue,
|
|
out cveTipoTramite) ||
|
|
cveTipoTramite <= 0)
|
|
{
|
|
MostrarValidacionAgregarTramite(
|
|
"Seleccione un tipo de trámite válido.");
|
|
return;
|
|
}
|
|
|
|
DbResult<TramiteSolicitudCreateResultModel> resultado =
|
|
AppServices.TramiteSolicitudService.AddStageRequest(
|
|
CveFraccionamientoActual,
|
|
cveFraccionamientoEtapa,
|
|
cveTipoTramite,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success || resultado.Data == null)
|
|
{
|
|
MostrarValidacionAgregarTramite(resultado.UserMessage);
|
|
return;
|
|
}
|
|
|
|
CargarTramites();
|
|
CargarDocumentos();
|
|
ActualizarBitacoraDetalle();
|
|
UpCantidadTramites.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
OcultarModalAgregarTramite();
|
|
|
|
Alert(
|
|
resultado.Data.EsNuevo
|
|
? "Trámite agregado correctamente."
|
|
: "El trámite ya se encontraba registrado para la etapa.",
|
|
resultado.Data.EsNuevo
|
|
? TipoMensaje.ToastExito
|
|
: TipoMensaje.MsgAdvertencia);
|
|
}
|
|
|
|
protected void UcTramiteFiltros_MostrarFiltros(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabTramites));
|
|
|
|
/*
|
|
* Los DropDownList del modal son únicamente el editor.
|
|
* Los FiltroActivo del control son la fuente de verdad.
|
|
*/
|
|
RestaurarValorSeleccionado(
|
|
DdlEstatusTramite,
|
|
FiltroTramiteEstatus == null
|
|
? string.Empty
|
|
: FiltroTramiteEstatus.Valor);
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlTipoTramite,
|
|
FiltroTramiteTipo == null
|
|
? string.Empty
|
|
: FiltroTramiteTipo.Valor);
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlTramiteEtapa,
|
|
FiltroTramiteEtapa == null
|
|
? string.Empty
|
|
: FiltroTramiteEtapa.Valor);
|
|
|
|
UpTramiteFiltrosModal.Update();
|
|
MostrarModalFiltrosTramites();
|
|
}
|
|
|
|
protected void BtnAplicarTramiteFiltros_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
EstablecerFiltroTramite(
|
|
"Estatus",
|
|
"Estatus",
|
|
1,
|
|
DdlEstatusTramite.SelectedValue,
|
|
ObtenerTextoSeleccionado(DdlEstatusTramite));
|
|
|
|
EstablecerFiltroTramite(
|
|
"TipoTramite",
|
|
"Tipo de trámite",
|
|
2,
|
|
DdlTipoTramite.SelectedValue,
|
|
ObtenerTextoSeleccionado(DdlTipoTramite));
|
|
|
|
EstablecerFiltroTramite(
|
|
"Etapa",
|
|
"Etapa",
|
|
3,
|
|
DdlTramiteEtapa.SelectedValue,
|
|
ObtenerTextoSeleccionado(DdlTramiteEtapa));
|
|
|
|
/*
|
|
* BindFiltros dispara FiltrosChanged.
|
|
* El grid se vuelve a consultar usando los chips activos.
|
|
*/
|
|
UcTramiteFiltros.BindFiltros();
|
|
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabTramites));
|
|
UpCantidadTramites.Update();
|
|
OcultarModalFiltrosTramites();
|
|
}
|
|
|
|
protected void UcTramiteFiltros_FiltrosCambiados(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabTramites));
|
|
CargarTramites();
|
|
UpCantidadTramites.Update();
|
|
}
|
|
|
|
protected void UcTramiteFiltros_Consultar(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabTramites));
|
|
CargarTramites();
|
|
UpCantidadTramites.Update();
|
|
}
|
|
|
|
private int CveSolicitudConfiguracionDocumentos
|
|
{
|
|
get { return ViewState["CveSolicitudConfiguracionDocumentos"] as int? ?? 0; }
|
|
set { ViewState["CveSolicitudConfiguracionDocumentos"] = value; }
|
|
}
|
|
|
|
private List<SolicitudDocumentoConfiguracionModel> ConfiguracionDocumentosSolicitud
|
|
{
|
|
get
|
|
{
|
|
return ViewState["ConfiguracionDocumentosSolicitud"] as
|
|
List<SolicitudDocumentoConfiguracionModel> ??
|
|
new List<SolicitudDocumentoConfiguracionModel>();
|
|
}
|
|
set { ViewState["ConfiguracionDocumentosSolicitud"] = value; }
|
|
}
|
|
|
|
private void CargarConfiguracionDocumentosSolicitud()
|
|
{
|
|
var resultado = AppServices.TramiteDocumentoService.ListarConfiguracionSolicitud(
|
|
CveFraccionamientoActual, CveSolicitudConfiguracionDocumentos,
|
|
CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
ConfiguracionDocumentosSolicitud = resultado.Data;
|
|
var contexto = resultado.Data.FirstOrDefault();
|
|
LitContextoConfiguracionDocumentos.Text = contexto == null
|
|
? "Seleccione un documento disponible en el catálogo."
|
|
: contexto.Folio + " · " + contexto.TipoTramite + " · " + contexto.Etapa;
|
|
GvConfiguracionDocumentosSolicitud.DataSource =
|
|
resultado.Data.Where(documento => documento.EsConfigurado).ToList();
|
|
GvConfiguracionDocumentosSolicitud.DataBind();
|
|
DdlConfiguracionTipoDocumento.DataSource = resultado.Data;
|
|
DdlConfiguracionTipoDocumento.DataValueField = "CveTipoDocumento";
|
|
DdlConfiguracionTipoDocumento.DataTextField = "TipoDocumento";
|
|
DdlConfiguracionTipoDocumento.DataBind();
|
|
DdlConfiguracionTipoDocumento.Items.Insert(0, new ListItem("Seleccione un documento", ""));
|
|
ChkConfiguracionDocumentoRequerido.Checked = false;
|
|
ChkConfiguracionDocumentoVigencia.Checked = false;
|
|
ChkConfiguracionDocumentoActivo.Checked = true;
|
|
DdlConfiguracionResponsable.SelectedValue = "1";
|
|
TxtConfiguracionDocumentoOrden.Text = "0";
|
|
UpConfiguracionDocumentosSolicitud.Update();
|
|
RegistraScript(
|
|
"$('#ModalConfiguracionDocumentosSolicitud').modal('show');",
|
|
"MostrarConfiguracionDocumentosSolicitud");
|
|
}
|
|
|
|
protected void DdlConfiguracionTipoDocumento_Cambiado(object sender, EventArgs e)
|
|
{
|
|
int cveTipoDocumento;
|
|
if (!int.TryParse(DdlConfiguracionTipoDocumento.SelectedValue, out cveTipoDocumento))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var documento = ConfiguracionDocumentosSolicitud.FirstOrDefault(
|
|
configuracion => configuracion.CveTipoDocumento == cveTipoDocumento);
|
|
if (documento == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
ChkConfiguracionDocumentoRequerido.Checked = documento.EsRequerido;
|
|
ChkConfiguracionDocumentoVigencia.Checked = documento.TieneVigencia;
|
|
ChkConfiguracionDocumentoActivo.Checked = documento.EsActivo;
|
|
DdlConfiguracionResponsable.SelectedValue = documento.EsCliente ? "1" : "0";
|
|
TxtConfiguracionDocumentoOrden.Text = documento.Orden.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
protected void GvConfiguracionDocumentosSolicitud_Comando(
|
|
object sender, GridViewCommandEventArgs e)
|
|
{
|
|
int cveTipoDocumento;
|
|
if (!int.TryParse(Convert.ToString(e.CommandArgument), out cveTipoDocumento))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "EditarConfiguracion")
|
|
{
|
|
DdlConfiguracionTipoDocumento.SelectedValue =
|
|
cveTipoDocumento.ToString(CultureInfo.InvariantCulture);
|
|
DdlConfiguracionTipoDocumento_Cambiado(sender, EventArgs.Empty);
|
|
}
|
|
else if (e.CommandName == "RetirarConfiguracion")
|
|
{
|
|
var resultado = AppServices.TramiteDocumentoService.EliminarConfiguracionSolicitud(
|
|
CveFraccionamientoActual, CveSolicitudConfiguracionDocumentos,
|
|
cveTipoDocumento, CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
ActualizarTrasConfiguracionDocumentos();
|
|
Alert("Configuración particular retirada. Los archivos se conservaron.", TipoMensaje.ToastExito);
|
|
}
|
|
}
|
|
|
|
protected void BtnGuardarConfiguracionDocumento_Click(object sender, EventArgs e)
|
|
{
|
|
int cveTipoDocumento;
|
|
int orden;
|
|
if (!int.TryParse(DdlConfiguracionTipoDocumento.SelectedValue, out cveTipoDocumento) ||
|
|
cveTipoDocumento <= 0 ||
|
|
!int.TryParse(TxtConfiguracionDocumentoOrden.Text, out orden) ||
|
|
(DdlConfiguracionResponsable.SelectedValue != "1" &&
|
|
DdlConfiguracionResponsable.SelectedValue != "0"))
|
|
{
|
|
Alert("Seleccione un documento, su responsable y un orden válido.", TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
var configuracion = new SolicitudDocumentoConfiguracionModel
|
|
{
|
|
CveFraccionamiento = CveFraccionamientoActual,
|
|
CveSolicitud = CveSolicitudConfiguracionDocumentos,
|
|
CveTipoDocumento = cveTipoDocumento,
|
|
EsRequerido = ChkConfiguracionDocumentoRequerido.Checked,
|
|
EsCliente = DdlConfiguracionResponsable.SelectedValue == "1",
|
|
TieneVigencia = ChkConfiguracionDocumentoVigencia.Checked,
|
|
Orden = orden,
|
|
EsActivo = ChkConfiguracionDocumentoActivo.Checked
|
|
};
|
|
var resultado = AppServices.TramiteDocumentoService.GuardarConfiguracionSolicitud(
|
|
configuracion, CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
ActualizarTrasConfiguracionDocumentos();
|
|
Alert("Documento configurado únicamente para esta solicitud.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
private void ActualizarTrasConfiguracionDocumentos()
|
|
{
|
|
CargarConfiguracionDocumentosSolicitud();
|
|
CargarDocumentos();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
ActualizarBitacoraDetalle();
|
|
}
|
|
|
|
protected void GvTramites_FilaEnlazada(object origen, GridViewRowEventArgs argumentos)
|
|
{
|
|
if (argumentos.Row.RowType != DataControlRowType.DataRow)
|
|
{
|
|
return;
|
|
}
|
|
var boton = (LinkButton)argumentos.Row.FindControl("BtnCambiarEstatusTramite");
|
|
boton.Attributes["data-sig-panel-abrir"] = "#" + PanelSeguimiento.ClientID;
|
|
// Ejecuta el postback de WebForms; el evento del panel cancela el href para no duplicarlo.
|
|
boton.OnClientClick = Page.ClientScript.GetPostBackEventReference(boton, string.Empty) + ";";
|
|
ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(boton);
|
|
}
|
|
|
|
protected void GvTramites_FilaComando(
|
|
object sender,
|
|
GridViewCommandEventArgs e)
|
|
{
|
|
if (e.CommandName != "ChangeStatus" && e.CommandName != "ConfigurarDocumentos")
|
|
{
|
|
return;
|
|
}
|
|
|
|
int cveSolicitud;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(e.CommandArgument),
|
|
out cveSolicitud) ||
|
|
cveSolicitud <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "ConfigurarDocumentos")
|
|
{
|
|
CveSolicitudConfiguracionDocumentos = cveSolicitud;
|
|
CargarConfiguracionDocumentosSolicitud();
|
|
return;
|
|
}
|
|
|
|
AbrirModalEstatusTramite(cveSolicitud);
|
|
}
|
|
|
|
protected void UcDocumentoFiltros_MostrarFiltros(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlDocumentoTipoTramite,
|
|
FiltroDocumentoTipoTramite == null
|
|
? string.Empty
|
|
: FiltroDocumentoTipoTramite.Valor);
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlDocumentoEtapa,
|
|
FiltroDocumentoEtapa == null
|
|
? string.Empty
|
|
: FiltroDocumentoEtapa.Valor);
|
|
|
|
UpDocumentoFiltrosModal.Update();
|
|
MostrarModalFiltrosDocumentos();
|
|
}
|
|
|
|
protected void BtnAplicarDocumentoFiltros_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
EstablecerFiltroDocumento(
|
|
"TipoTramite",
|
|
"Tipo de trámite",
|
|
1,
|
|
DdlDocumentoTipoTramite.SelectedValue,
|
|
ObtenerTextoSeleccionado(DdlDocumentoTipoTramite));
|
|
|
|
EstablecerFiltroDocumento(
|
|
"Etapa",
|
|
"Etapa",
|
|
2,
|
|
DdlDocumentoEtapa.SelectedValue,
|
|
ObtenerTextoSeleccionado(DdlDocumentoEtapa));
|
|
|
|
UcDocumentoFiltros.BindFiltros();
|
|
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
OcultarModalFiltrosDocumentos();
|
|
}
|
|
|
|
protected void UcDocumentoFiltros_FiltrosCambiados(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
CargarDocumentos();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
}
|
|
|
|
protected void UcDocumentoFiltros_Consultar(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
CargarDocumentos();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
}
|
|
|
|
protected void GvDocumentos_FilaComando(
|
|
object sender,
|
|
GridViewCommandEventArgs e)
|
|
{
|
|
string nombreComando = e.CommandName ?? string.Empty;
|
|
|
|
if (nombreComando == "Upload")
|
|
{
|
|
string[] valores = Convert.ToString(e.CommandArgument)
|
|
.Split('|');
|
|
int cveSolicitud;
|
|
int cveTipoDocumento;
|
|
|
|
if (valores.Length != 2 ||
|
|
!int.TryParse(valores[0], out cveSolicitud) ||
|
|
!int.TryParse(valores[1], out cveTipoDocumento) ||
|
|
cveSolicitud <= 0 || cveTipoDocumento <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
AbrirModalCargaDocumento(
|
|
cveSolicitud,
|
|
cveTipoDocumento);
|
|
return;
|
|
}
|
|
|
|
if (nombreComando == "ManageGis")
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(e.CommandArgument),
|
|
out cveFraccionamientoEtapa) ||
|
|
cveFraccionamientoEtapa <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
CveFraccionamientoEtapaFiltroLotesActual = cveFraccionamientoEtapa;
|
|
AbrirModalGisEtapa();
|
|
return;
|
|
}
|
|
|
|
if (nombreComando == "Approve")
|
|
{
|
|
int cveSolicitudDocumento;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(e.CommandArgument),
|
|
out cveSolicitudDocumento) ||
|
|
cveSolicitudDocumento <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
RevisarDocumento(
|
|
cveSolicitudDocumento,
|
|
true,
|
|
null);
|
|
return;
|
|
}
|
|
|
|
if (nombreComando == "Reject")
|
|
{
|
|
int cveSolicitudDocumento;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(e.CommandArgument),
|
|
out cveSolicitudDocumento) ||
|
|
cveSolicitudDocumento <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (CurrentUser.EsDesarrollador)
|
|
{
|
|
Alert(
|
|
"La revisión de documentos corresponde a Agua de Hermosillo.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
CveDocumentoSolicitudRevisionActual = cveSolicitudDocumento;
|
|
TxtNotaRechazoDocumento.Text = string.Empty;
|
|
OcultarMensajeRechazoDocumento();
|
|
UpModalRechazoDocumento.Update();
|
|
MostrarModalRechazoDocumento();
|
|
}
|
|
}
|
|
|
|
protected void BtnGuardarCargaDocumento_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveSolicitud = CveSolicitudDocumentoActual;
|
|
int cveTipoDocumento = CveTipoDocumentoActual;
|
|
|
|
if (cveSolicitud <= 0 || cveTipoDocumento <= 0)
|
|
{
|
|
MostrarValidacionCargaDocumento(
|
|
"Seleccione un documento válido.");
|
|
return;
|
|
}
|
|
|
|
var archivoDocumento = CargaArchivoWebHelper.ObtenerArchivo(Page, ArchivoDocumento);
|
|
if (archivoDocumento == null)
|
|
{
|
|
MostrarValidacionCargaDocumento(
|
|
"Seleccione el archivo que desea guardar.");
|
|
return;
|
|
}
|
|
|
|
DateTime? fechaDocumento;
|
|
DateTime? fechaVencimiento;
|
|
if (!IntentarLeerFechaDocumento(TxtFechaDocumento.Text, out fechaDocumento) ||
|
|
!IntentarLeerFechaDocumento(TxtVencimientoDocumento.Text, out fechaVencimiento))
|
|
{
|
|
MostrarValidacionCargaDocumento("Capture fechas válidas.");
|
|
return;
|
|
}
|
|
|
|
DbResult<TramiteDocumentoSaveResultModel> resultado =
|
|
AppServices.TramiteDocumentoService.Upload(
|
|
CveFraccionamientoActual,
|
|
cveSolicitud,
|
|
cveTipoDocumento,
|
|
archivoDocumento.FileName,
|
|
archivoDocumento.ContentType,
|
|
archivoDocumento.InputStream,
|
|
archivoDocumento.ContentLength,
|
|
TxtComentarioClienteDocumento.Text,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio,
|
|
fechaDocumento,
|
|
fechaVencimiento);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarValidacionCargaDocumento(resultado.UserMessage);
|
|
return;
|
|
}
|
|
|
|
CargaArchivoWebHelper.ConfirmarArchivo(Page, archivoDocumento);
|
|
CveSolicitudDocumentoActual = 0;
|
|
CveTipoDocumentoActual = 0;
|
|
TxtComentarioClienteDocumento.Text = string.Empty;
|
|
OcultarMensajeCargaDocumento();
|
|
CargarDocumentos();
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
ActualizarBitacoraDetalle();
|
|
OcultarModalCargaDocumento();
|
|
|
|
Alert(
|
|
resultado.Data != null && resultado.Data.EsNuevo
|
|
? "Documento agregado correctamente."
|
|
: "Documento actualizado correctamente. La revisión quedó pendiente nuevamente.",
|
|
TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnConfirmarRechazoDocumento_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveSolicitudDocumento =
|
|
CveDocumentoSolicitudRevisionActual;
|
|
|
|
if (cveSolicitudDocumento <= 0)
|
|
{
|
|
MostrarValidacionRechazoDocumento(
|
|
"Seleccione un documento válido.");
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(
|
|
TxtNotaRechazoDocumento.Text))
|
|
{
|
|
MostrarValidacionRechazoDocumento(
|
|
"Capture la nota o motivo del rechazo.");
|
|
return;
|
|
}
|
|
|
|
DbResult<TramiteDocumentoReviewResultModel> resultado =
|
|
AppServices.TramiteDocumentoService.Review(
|
|
CveFraccionamientoActual,
|
|
cveSolicitudDocumento,
|
|
false,
|
|
TxtNotaRechazoDocumento.Text,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarValidacionRechazoDocumento(resultado.UserMessage);
|
|
return;
|
|
}
|
|
|
|
CveDocumentoSolicitudRevisionActual = 0;
|
|
TxtNotaRechazoDocumento.Text = string.Empty;
|
|
OcultarMensajeRechazoDocumento();
|
|
CargarDocumentos();
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
ActualizarBitacoraDetalle();
|
|
OcultarModalRechazoDocumento();
|
|
|
|
Alert(
|
|
"Documento rechazado correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnEditarEtapaAvance_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabTramites));
|
|
OcultarMensajeAvanceEtapa();
|
|
|
|
if (!CargarOpcionesAvanceEtapa())
|
|
{
|
|
return;
|
|
}
|
|
|
|
UpEtapaAvanceModal.Update();
|
|
MostrarModalAvanceEtapa();
|
|
}
|
|
|
|
protected void DdlEtapaAvance_SeleccionadoIndiceCambiado(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
|
|
if (!int.TryParse(DdlEtapaAvance.SelectedValue, out cveFraccionamientoEtapa))
|
|
{
|
|
CveFraccionamientoEtapaAvanceActual = 0;
|
|
TxtEtapaAvance.Text = string.Empty;
|
|
PnlEtapaAvanceCaptura.Visible = false;
|
|
UpEtapaAvanceModal.Update();
|
|
MostrarModalAvanceEtapa();
|
|
return;
|
|
}
|
|
|
|
CargarCapturaAvanceEtapa(cveFraccionamientoEtapa);
|
|
UpEtapaAvanceModal.Update();
|
|
MostrarModalAvanceEtapa();
|
|
}
|
|
|
|
protected void BtnGuardarEtapaAvance_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
decimal? avance;
|
|
|
|
if (!int.TryParse(DdlEtapaAvance.SelectedValue, out cveFraccionamientoEtapa) ||
|
|
cveFraccionamientoEtapa <= 0)
|
|
{
|
|
MostrarValidacionAvanceEtapa("Seleccione una etapa válida.");
|
|
return;
|
|
}
|
|
|
|
if (!IntentarConvertirDecimalAnulable(TxtEtapaAvance.Text, out avance) ||
|
|
!avance.HasValue ||
|
|
avance.Value < 0m ||
|
|
avance.Value > 100m)
|
|
{
|
|
MostrarValidacionAvanceEtapa(
|
|
"Capture un avance entre 0.00 y 100.00.");
|
|
return;
|
|
}
|
|
|
|
DbResult<ModeloEtapaFraccionamiento> resultadoEtapa =
|
|
AppServices.ServicioFraccionamiento.ObtenerEtapa(
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!EtapaPerteneceAlFraccionamientoActual(resultadoEtapa))
|
|
{
|
|
MostrarModalAvanceEtapa();
|
|
Alert(
|
|
ObtenerMensajeValidacionEtapa(resultadoEtapa),
|
|
ObtenerTipoMensajeValidacionEtapa(resultadoEtapa));
|
|
return;
|
|
}
|
|
|
|
DbResult<ResultadoAvanceEtapaFraccionamiento> resultado =
|
|
AppServices.ServicioFraccionamiento.ActualizarAvanceEtapa(
|
|
cveFraccionamientoEtapa,
|
|
avance.Value,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarModalAvanceEtapa();
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
OcultarMensajeAvanceEtapa();
|
|
CargarFraccionamiento();
|
|
CargarRelacionados();
|
|
UpResumen.Update();
|
|
UpEtapasDetalle.Update();
|
|
UpCantidadEtapas.Update();
|
|
UpCantidadLotes.Update();
|
|
UpCantidadTramites.Update();
|
|
UpPagosDetalle.Update();
|
|
UpCantidadPagos.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
OcultarModalAvanceEtapa();
|
|
ActualizarBitacoraDetalle();
|
|
Alert("Avance actualizado correctamente.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnGuardarEtapa_Click(object sender, EventArgs e)
|
|
{
|
|
decimal? hectareas;
|
|
|
|
if (!IntentarConvertirDecimalAnulable(
|
|
TxtEtapaHectareas.Text,
|
|
out hectareas))
|
|
{
|
|
MostrarEtapaError(
|
|
"Capture las hectáreas de la etapa con un valor numérico válido.");
|
|
return;
|
|
}
|
|
|
|
var etapa = new ModeloEtapaFraccionamiento
|
|
{
|
|
CveFraccionamientoEtapa =
|
|
CveFraccionamientoEtapaActual,
|
|
CveFraccionamiento = CveFraccionamientoActual,
|
|
Etapa = TxtEtapa.Text,
|
|
Hectareas = hectareas,
|
|
EsActivo = ChkEtapaActivo.Checked
|
|
};
|
|
|
|
DbResult<int> resultado =
|
|
AppServices.ServicioFraccionamiento.GuardarEtapa(
|
|
etapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarModalEtapa();
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
CargarFraccionamiento();
|
|
CargarRelacionados();
|
|
UpResumen.Update();
|
|
UpEtapasDetalle.Update();
|
|
UpCantidadEtapas.Update();
|
|
UpCantidadLotes.Update();
|
|
UpCantidadTramites.Update();
|
|
UpPagosDetalle.Update();
|
|
UpCantidadPagos.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
OcultarModalEtapa();
|
|
ActualizarBitacoraDetalle();
|
|
Alert("Etapa guardada correctamente.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnGuardarCondicionesEtapa_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
if (CveFraccionamientoEtapaCondicionesActual <= 0)
|
|
{
|
|
Alert(
|
|
"Seleccione una etapa válida.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
var condiciones = new ModeloCondicionesEtapaFraccionamiento
|
|
{
|
|
CveFraccionamientoEtapa =
|
|
CveFraccionamientoEtapaCondicionesActual,
|
|
Aprobado_Prefactibilidad = ObtenerBitAnulable(
|
|
DdlEtapaAprobadoPrefactibilidad),
|
|
RequiereObrasExternas = ObtenerBitAnulable(
|
|
DdlEtapaRequiereObrasExternas),
|
|
TipoDeObra = ObtenerBitAnulable(DdlEtapaTipoDeObra),
|
|
LiberacionMacromedidor = ObtenerBitAnulable(
|
|
DdlEtapaLiberacionMacromedidor),
|
|
Relotificacion = ObtenerBitAnulable(
|
|
DdlEtapaRelotificacion),
|
|
LiberacionDeLotes = ObtenerBitAnulable(
|
|
DdlEtapaLiberacionDeLotes),
|
|
LiberacionDePagosDeDerechos = ObtenerBitAnulable(
|
|
DdlEtapaLiberacionDePagosDeDerechos)
|
|
};
|
|
|
|
DbResult<ModeloCondicionesEtapaFraccionamiento> resultado =
|
|
AppServices.ServicioFraccionamiento.GuardarCondicionesEtapa(
|
|
condiciones,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
MostrarCondicionesEtapa();
|
|
return;
|
|
}
|
|
|
|
MostrarCondicionesEtapa();
|
|
ActualizarBitacoraDetalle();
|
|
Alert(
|
|
"Condiciones de la etapa guardadas correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void DdlLotesEtapa_SeleccionadoIndiceCambiado(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
|
|
CveFraccionamientoEtapaFiltroLotesActual = int.TryParse(
|
|
DdlLotesEtapa.SelectedValue,
|
|
out cveFraccionamientoEtapa)
|
|
? cveFraccionamientoEtapa
|
|
: 0;
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabLotes));
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
}
|
|
|
|
protected void BtnAgregarEtapaGis_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
AbrirModalGisEtapa();
|
|
}
|
|
|
|
protected void BtnAdministrarEtapaGis_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
AbrirModalGisEtapa();
|
|
}
|
|
|
|
protected void BtnActualizarEtapaGis_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
OcultarEtapaGisMensaje();
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
CargarDocumentos();
|
|
ActualizarBitacoraDetalle();
|
|
UpCantidadLotes.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
UpEtapaGisModal.Update();
|
|
OcultarModalGisEtapa();
|
|
Alert(
|
|
"GIS actualizado correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnLimpiarEtapaLotes_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int? cveFraccionamientoEtapa = ObtenerCveEtapaLotesSeleccionada();
|
|
|
|
if (!cveFraccionamientoEtapa.HasValue)
|
|
{
|
|
Alert(
|
|
"Seleccione una etapa específica para vaciar sus lotes.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
DbResult<int> resultado =
|
|
AppServices.ServicioFraccionamiento.LimpiarLotesEtapa(
|
|
CveFraccionamientoActual,
|
|
cveFraccionamientoEtapa.Value,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
CargarFraccionamiento();
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
UpResumen.Update();
|
|
UpCantidadLotes.Update();
|
|
ActualizarBitacoraDetalle();
|
|
Alert(
|
|
resultado.Data == 1
|
|
? "Lote eliminado correctamente."
|
|
: resultado.Data.ToString(CultureInfo.CurrentCulture) +
|
|
" lotes eliminados correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnGuardarLotes_Click(object sender, EventArgs e)
|
|
{
|
|
List<ModeloLoteFraccionamiento> lotes;
|
|
string mensajeValidacion;
|
|
|
|
if (!IntentarCrearLotesRapidos(out lotes, out mensajeValidacion))
|
|
{
|
|
MostrarValidacionLote(mensajeValidacion);
|
|
return;
|
|
}
|
|
|
|
GuardarLotes(lotes);
|
|
}
|
|
|
|
protected void BtnGuardarLote_Click(object sender, EventArgs e)
|
|
{
|
|
decimal? squareMeters;
|
|
|
|
if (!IntentarConvertirDecimalAnulable(
|
|
TxtEditarLoteMetrosCuadrados.Text,
|
|
out squareMeters))
|
|
{
|
|
MostrarValidacionEdicionLote(
|
|
"Capture los metros cuadrados con un valor numérico válido.");
|
|
return;
|
|
}
|
|
|
|
if (CveFraccionamientoLoteActual <= 0 ||
|
|
CveFraccionamientoEtapaLoteEdicionActual <= 0)
|
|
{
|
|
MostrarValidacionEdicionLote(
|
|
"Seleccione nuevamente el lote que desea editar.");
|
|
return;
|
|
}
|
|
|
|
var lote = new ModeloLoteFraccionamiento
|
|
{
|
|
CveFraccionamientoLote = CveFraccionamientoLoteActual,
|
|
CveFraccionamientoEtapa =
|
|
CveFraccionamientoEtapaLoteEdicionActual,
|
|
Nombre = TxtEditarLoteNombre.Text,
|
|
Tipo = TxtEditarLoteTipo.Text,
|
|
Calle = TxtEditarLoteCalle.Text,
|
|
Catastro = TxtEditarLoteCatastro.Text,
|
|
MetrosCuadrados = squareMeters,
|
|
Duplicador = TxtEditarLoteDuplicador.Text,
|
|
EsActivo = ChkEditarLoteActivo.Checked
|
|
};
|
|
|
|
DbResult<int> resultado =
|
|
AppServices.ServicioFraccionamiento.GuardarLote(
|
|
CveFraccionamientoActual,
|
|
lote,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarEditarLoteModal();
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
OcultarEditarLoteMensaje();
|
|
CargarFraccionamiento();
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
UpResumen.Update();
|
|
UpCantidadLotes.Update();
|
|
OcultarEditarLoteModal();
|
|
ActualizarBitacoraDetalle();
|
|
Alert("Lote guardado correctamente.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
protected void BtnImportarLotes_Click(object sender, EventArgs e)
|
|
{
|
|
if (CveFraccionamientoEtapaLotesActual <= 0)
|
|
{
|
|
MostrarValidacionLote(
|
|
"Seleccione una etapa para cargar los lotes.");
|
|
return;
|
|
}
|
|
|
|
var archivoLotes = CargaArchivoWebHelper.ObtenerArchivo(Page, ArchivoLotes);
|
|
if (archivoLotes == null)
|
|
{
|
|
MostrarValidacionLote(
|
|
"Seleccione la plantilla de Excel que desea cargar.");
|
|
return;
|
|
}
|
|
|
|
ResultadoExcelLotesFraccionamiento resultadoExcel =
|
|
ExcelLotesFraccionamiento.Leer(
|
|
archivoLotes.InputStream,
|
|
archivoLotes.FileName,
|
|
archivoLotes.ContentLength,
|
|
archivoLotes.ContentType);
|
|
|
|
if (!resultadoExcel.Exitoso)
|
|
{
|
|
MostrarValidacionLote(resultadoExcel.Mensaje);
|
|
return;
|
|
}
|
|
|
|
if (GuardarLotes(resultadoExcel.Lotes))
|
|
{
|
|
CargaArchivoWebHelper.ConfirmarArchivo(Page, archivoLotes);
|
|
}
|
|
}
|
|
|
|
protected void GvEtapas_FilaComando(
|
|
object sender,
|
|
GridViewCommandEventArgs e)
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(e.CommandArgument),
|
|
out cveFraccionamientoEtapa))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "AddLots")
|
|
{
|
|
AbrirLotesModal(cveFraccionamientoEtapa);
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "EliminarEtapa")
|
|
{
|
|
EliminarEtapa(cveFraccionamientoEtapa);
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "EditarEtapa")
|
|
{
|
|
EditarEtapa(cveFraccionamientoEtapa);
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "EditarCondicionesEtapa")
|
|
{
|
|
EditarCondicionesEtapa(cveFraccionamientoEtapa);
|
|
}
|
|
}
|
|
|
|
protected void BtnEtapaOrdenMover_Click(
|
|
object sender,
|
|
EventArgs e)
|
|
{
|
|
int cveFraccionamientoEtapa;
|
|
int cveFraccionamientoEtapaReferencia;
|
|
bool colocarDespues;
|
|
|
|
if (!IntentarInterpretarMovimientoOrdenEtapa(
|
|
CampoOcultoMovimientoOrdenEtapa.Value,
|
|
out cveFraccionamientoEtapa,
|
|
out cveFraccionamientoEtapaReferencia,
|
|
out colocarDespues))
|
|
{
|
|
Alert(
|
|
"No fue posible determinar la nueva posición de la etapa.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
CargarEtapas();
|
|
UpEtapasDetalle.Update();
|
|
UpCantidadEtapas.Update();
|
|
UpCantidadLotes.Update();
|
|
return;
|
|
}
|
|
|
|
DbResult<bool> resultado =
|
|
AppServices.ServicioFraccionamiento.MoverOrdenEtapa(
|
|
cveFraccionamientoEtapa,
|
|
cveFraccionamientoEtapaReferencia,
|
|
colocarDespues,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
CampoOcultoMovimientoOrdenEtapa.Value = string.Empty;
|
|
CargarEtapas();
|
|
UpEtapasDetalle.Update();
|
|
UpCantidadEtapas.Update();
|
|
UpCantidadLotes.Update();
|
|
|
|
if (resultado.Success)
|
|
{
|
|
ActualizarBitacoraDetalle();
|
|
}
|
|
|
|
Alert(
|
|
resultado.Success
|
|
? "Orden de etapas actualizado correctamente."
|
|
: resultado.UserMessage,
|
|
resultado.Success
|
|
? TipoMensaje.ToastExito
|
|
: TipoMensaje.MsgAdvertencia);
|
|
}
|
|
|
|
protected void GvLotes_FilaComando(
|
|
object sender,
|
|
GridViewCommandEventArgs e)
|
|
{
|
|
int cveFraccionamientoLote;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(e.CommandArgument),
|
|
out cveFraccionamientoLote))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "EditarLote")
|
|
{
|
|
EditarLote(cveFraccionamientoLote);
|
|
return;
|
|
}
|
|
|
|
if (e.CommandName == "EliminarLote")
|
|
{
|
|
EliminarLote(cveFraccionamientoLote);
|
|
}
|
|
}
|
|
|
|
protected string ObtenerCssEstatusEtapa(object activoValor)
|
|
{
|
|
return ConvertirABooleano(activoValor)
|
|
? "fraction-row-status is-active"
|
|
: "fraction-row-status is-inactive";
|
|
}
|
|
|
|
protected string ObtenerTextoEstatusEtapa(object activoValor)
|
|
{
|
|
return ConvertirABooleano(activoValor)
|
|
? "Activa"
|
|
: "Inactiva";
|
|
}
|
|
|
|
protected string ObtenerCssEstatusLote(object activoValor)
|
|
{
|
|
return ObtenerCssEstatusEtapa(activoValor);
|
|
}
|
|
|
|
protected string ObtenerTextoEstatusLote(object activoValor)
|
|
{
|
|
return ObtenerTextoEstatusEtapa(activoValor);
|
|
}
|
|
|
|
protected string ObtenerTextoEstatusTramite(object valorEstatus)
|
|
{
|
|
return ObtenerValorVisualizacion(
|
|
Convert.ToString(valorEstatus));
|
|
}
|
|
|
|
protected string ObtenerUrlDescargaDocumento(
|
|
object valorCveSolicitudDocumento)
|
|
{
|
|
int cveSolicitudDocumento;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(valorCveSolicitudDocumento),
|
|
out cveSolicitudDocumento) ||
|
|
cveSolicitudDocumento <= 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
return ResolveUrl(
|
|
"~/Pages/Fraccionamientos/TramiteDocumento.ashx" +
|
|
"?fraccionamiento=" +
|
|
CveFraccionamientoActual.ToString(
|
|
CultureInfo.InvariantCulture) +
|
|
"&documento=" +
|
|
cveSolicitudDocumento.ToString(
|
|
CultureInfo.InvariantCulture));
|
|
}
|
|
|
|
protected string ObtenerTextoBotonCargaDocumento(
|
|
object tieneArchivoValor)
|
|
{
|
|
return ConvertirABooleano(tieneArchivoValor)
|
|
? "Actualizar archivo"
|
|
: "Agregar archivo";
|
|
}
|
|
|
|
protected string ObtenerTextoNotaDocumento(object valorNota)
|
|
{
|
|
return ObtenerValorVisualizacion(Convert.ToString(valorNota));
|
|
}
|
|
|
|
protected string ObtenerCssEstatusDocumento(
|
|
object valorEstatus)
|
|
{
|
|
string estatus = Convert.ToString(valorEstatus);
|
|
|
|
if (string.Equals(
|
|
estatus,
|
|
"Aprobado",
|
|
StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return "label label-success";
|
|
}
|
|
|
|
if (string.Equals(
|
|
estatus,
|
|
"Rechazado",
|
|
StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return "label label-danger";
|
|
}
|
|
|
|
if (string.Equals(
|
|
estatus,
|
|
"Sin cargar",
|
|
StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return "label label-default";
|
|
}
|
|
|
|
return "label label-warning";
|
|
}
|
|
|
|
protected string ObtenerTextoAvance(object avanceValor)
|
|
{
|
|
return NormalizarAvance(avanceValor).ToString(
|
|
"0.00",
|
|
CultureInfo.CurrentCulture) + "%";
|
|
}
|
|
|
|
protected string ObtenerValorAriaDeAvance(object avanceValor)
|
|
{
|
|
return NormalizarAvance(avanceValor).ToString(
|
|
"0.##",
|
|
CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
protected string ObtenerEstiloAnchoAvance(object avanceValor)
|
|
{
|
|
return "width: " +
|
|
ObtenerValorAriaDeAvance(avanceValor) +
|
|
"%;";
|
|
}
|
|
|
|
private void EliminarEtapa(int cveFraccionamientoEtapa)
|
|
{
|
|
DbResult<bool> resultado =
|
|
AppServices.ServicioFraccionamiento.EliminarEtapa(
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
if (CveFraccionamientoEtapaFiltroLotesActual ==
|
|
cveFraccionamientoEtapa)
|
|
{
|
|
CveFraccionamientoEtapaFiltroLotesActual = 0;
|
|
}
|
|
|
|
CargarFraccionamiento();
|
|
CargarRelacionados();
|
|
UpResumen.Update();
|
|
UpEtapasDetalle.Update();
|
|
UpCantidadEtapas.Update();
|
|
UpCantidadLotes.Update();
|
|
UpCantidadTramites.Update();
|
|
UpPagosDetalle.Update();
|
|
UpCantidadPagos.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
ActualizarBitacoraDetalle();
|
|
Alert("Etapa eliminada correctamente.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
private void EditarEtapa(int cveFraccionamientoEtapa)
|
|
{
|
|
DbResult<List<ModeloEtapaFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ListarEtapas(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
ModeloEtapaFraccionamiento etapa = resultado.Success
|
|
? resultado.Data.FirstOrDefault(
|
|
elemento =>
|
|
elemento.CveFraccionamientoEtapa ==
|
|
cveFraccionamientoEtapa)
|
|
: null;
|
|
|
|
if (etapa == null)
|
|
{
|
|
string mensaje = resultado.Success
|
|
? "No se encontró la etapa."
|
|
: resultado.UserMessage;
|
|
|
|
Alert(
|
|
mensaje,
|
|
resultado.Success
|
|
? TipoMensaje.MsgAdvertencia
|
|
: TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
OcultarEtapaMensaje();
|
|
CveFraccionamientoEtapaActual =
|
|
etapa.CveFraccionamientoEtapa;
|
|
TxtEtapa.Text = etapa.Etapa;
|
|
TxtEtapaHectareas.Text =
|
|
FormatearDecimal(etapa.Hectareas);
|
|
ChkEtapaActivo.Checked = etapa.EsActivo;
|
|
LitEtapaTitulo.Text = "Editar etapa";
|
|
|
|
UpEtapaModal.Update();
|
|
MostrarModalEtapa();
|
|
}
|
|
|
|
private void EditarCondicionesEtapa(int cveFraccionamientoEtapa)
|
|
{
|
|
DbResult<ModeloCondicionesEtapaFraccionamiento> resultado =
|
|
AppServices.ServicioFraccionamiento.ObtenerCondicionesEtapa(
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success ||
|
|
resultado.Data == null ||
|
|
resultado.Data.CveFraccionamiento != CveFraccionamientoActual)
|
|
{
|
|
Alert(
|
|
resultado.Success
|
|
? "No se encontraron las condiciones de la etapa."
|
|
: resultado.UserMessage,
|
|
resultado.Success
|
|
? TipoMensaje.MsgAdvertencia
|
|
: TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
PnlCondicionesEtapa.Visible = true;
|
|
DdlEtapaCondiciones.SelectedValue =
|
|
cveFraccionamientoEtapa.ToString(CultureInfo.InvariantCulture);
|
|
ModeloCondicionesEtapaFraccionamiento condiciones = resultado.Data;
|
|
CveFraccionamientoEtapaCondicionesActual =
|
|
condiciones.CveFraccionamientoEtapa;
|
|
LitNombreCondicionesEtapa.Text = Server.HtmlEncode(
|
|
" — " + condiciones.Etapa);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaAprobadoPrefactibilidad,
|
|
condiciones.Aprobado_Prefactibilidad);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaRequiereObrasExternas,
|
|
condiciones.RequiereObrasExternas);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaTipoDeObra,
|
|
condiciones.TipoDeObra);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaLiberacionMacromedidor,
|
|
condiciones.LiberacionMacromedidor);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaRelotificacion,
|
|
condiciones.Relotificacion);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaLiberacionDeLotes,
|
|
condiciones.LiberacionDeLotes);
|
|
SeleccionarBitAnulable(
|
|
DdlEtapaLiberacionDePagosDeDerechos,
|
|
condiciones.LiberacionDePagosDeDerechos);
|
|
|
|
UpCondicionesEtapa.Update();
|
|
MostrarCondicionesEtapa();
|
|
}
|
|
|
|
private bool CargarOpcionesAvanceEtapa()
|
|
{
|
|
DbResult<List<ModeloEtapaFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ListarEtapas(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
List<ModeloEtapaFraccionamiento> etapas = resultado.Success
|
|
? resultado.Data ?? new List<ModeloEtapaFraccionamiento>()
|
|
: new List<ModeloEtapaFraccionamiento>();
|
|
|
|
DdlEtapaAvance.DataSource = etapas;
|
|
DdlEtapaAvance.DataTextField = "Etapa";
|
|
DdlEtapaAvance.DataValueField = "CveFraccionamientoEtapa";
|
|
DdlEtapaAvance.DataBind();
|
|
DdlEtapaAvance.Items.Insert(
|
|
0,
|
|
new ListItem("Seleccione una etapa", string.Empty));
|
|
|
|
CveFraccionamientoEtapaAvanceActual = 0;
|
|
TxtEtapaAvance.Text = string.Empty;
|
|
PnlEtapaAvanceCaptura.Visible = false;
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return false;
|
|
}
|
|
|
|
if (etapas.Count == 0)
|
|
{
|
|
Alert(
|
|
"El fraccionamiento todavía no tiene etapas para editar su avance.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return false;
|
|
}
|
|
|
|
int cveFraccionamientoEtapaPreferida = CveFraccionamientoEtapaFiltroLotesActual;
|
|
string valorPreferido = cveFraccionamientoEtapaPreferida > 0
|
|
? cveFraccionamientoEtapaPreferida.ToString(CultureInfo.InvariantCulture)
|
|
: string.Empty;
|
|
|
|
if (!string.IsNullOrWhiteSpace(valorPreferido) &&
|
|
DdlEtapaAvance.Items.FindByValue(valorPreferido) != null)
|
|
{
|
|
DdlEtapaAvance.SelectedValue = valorPreferido;
|
|
CargarCapturaAvanceEtapa(cveFraccionamientoEtapaPreferida);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private bool CargarCapturaAvanceEtapa(int cveFraccionamientoEtapa)
|
|
{
|
|
DbResult<ModeloEtapaFraccionamiento> resultado =
|
|
AppServices.ServicioFraccionamiento.ObtenerEtapa(
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!EtapaPerteneceAlFraccionamientoActual(resultado))
|
|
{
|
|
CveFraccionamientoEtapaAvanceActual = 0;
|
|
TxtEtapaAvance.Text = string.Empty;
|
|
PnlEtapaAvanceCaptura.Visible = false;
|
|
Alert(
|
|
ObtenerMensajeValidacionEtapa(resultado),
|
|
ObtenerTipoMensajeValidacionEtapa(resultado));
|
|
return false;
|
|
}
|
|
|
|
ModeloEtapaFraccionamiento etapa = resultado.Data;
|
|
|
|
CveFraccionamientoEtapaAvanceActual =
|
|
etapa.CveFraccionamientoEtapa;
|
|
TxtEtapaAvance.Text = etapa.Avance.ToString(
|
|
"0.##",
|
|
CultureInfo.CurrentCulture);
|
|
PnlEtapaAvanceCaptura.Visible = true;
|
|
OcultarMensajeAvanceEtapa();
|
|
return true;
|
|
}
|
|
|
|
private void AbrirModalGisEtapa()
|
|
{
|
|
int cveFraccionamientoEtapa = CveFraccionamientoEtapaFiltroLotesActual;
|
|
|
|
if (cveFraccionamientoEtapa <= 0)
|
|
{
|
|
Alert(
|
|
"Seleccione una etapa para administrar su GIS.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
DbResult<VistaGisFraccionamiento> resultadoGis =
|
|
AppServices.ServicioGisFraccionamiento.Obtener(
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultadoGis.Success ||
|
|
resultadoGis.Data == null ||
|
|
resultadoGis.Data.Contexto == null)
|
|
{
|
|
Alert(
|
|
resultadoGis.Success
|
|
? "No fue posible obtener el contexto GIS de la etapa."
|
|
: resultadoGis.UserMessage,
|
|
resultadoGis.Success
|
|
? TipoMensaje.MsgAdvertencia
|
|
: TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
VistaGisFraccionamiento gis = resultadoGis.Data;
|
|
|
|
if (gis.Contexto.CveFraccionamiento != CveFraccionamientoActual)
|
|
{
|
|
Alert(
|
|
"La etapa no pertenece al fraccionamiento actual.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
OcultarEtapaGisMensaje();
|
|
CveFraccionamientoEtapaGisActual = cveFraccionamientoEtapa;
|
|
CampoOcultoCveEtapaGis.Value = cveFraccionamientoEtapa.ToString(
|
|
CultureInfo.InvariantCulture);
|
|
LitEtapaGisModalTitulo.Text = gis.TieneArchivo
|
|
? "Administrar GIS"
|
|
: "Agregar GIS";
|
|
LitEtapaGisEtapaNombre.Text = CodificarValorVisualizacion(
|
|
gis.Contexto.Etapa);
|
|
UpEtapaGisModal.Update();
|
|
MostrarModalGisEtapa();
|
|
}
|
|
|
|
private void AbrirModalCargaDocumento(
|
|
int cveSolicitud,
|
|
int cveTipoDocumento)
|
|
{
|
|
DbResult<TramiteDocumentoUploadContextModel> resultado =
|
|
AppServices.TramiteDocumentoService.GetUploadContext(
|
|
CveFraccionamientoActual,
|
|
cveSolicitud,
|
|
cveTipoDocumento,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success || resultado.Data == null)
|
|
{
|
|
Alert(
|
|
resultado.Success
|
|
? "No fue posible obtener el documento seleccionado."
|
|
: resultado.UserMessage,
|
|
resultado.Success
|
|
? TipoMensaje.MsgAdvertencia
|
|
: TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
TramiteDocumentoUploadContextModel contexto = resultado.Data;
|
|
|
|
CveSolicitudDocumentoActual = contexto.CveSolicitud;
|
|
CveTipoDocumentoActual = contexto.CveTipoDocumento;
|
|
LitTituloCargaDocumento.Text = contexto.CveDocumentoSolicitud > 0
|
|
? "Actualizar archivo"
|
|
: "Agregar archivo";
|
|
LitTipoCargaDocumento.Text = CodificarValorVisualizacion(
|
|
contexto.TipoDocumento);
|
|
LitContextoCargaDocumento.Text = Server.HtmlEncode(
|
|
contexto.TipoTramite + " | " + contexto.Etapa +
|
|
" | " + contexto.Folio);
|
|
|
|
string reglas = string.IsNullOrWhiteSpace(
|
|
contexto.ExtensionesPermitidas)
|
|
? "Extensiones configuradas por el tipo de documento."
|
|
: "Extensiones permitidas: " +
|
|
contexto.ExtensionesPermitidas;
|
|
|
|
if (contexto.TamanoMaximoMb.HasValue &&
|
|
contexto.TamanoMaximoMb.Value > 0)
|
|
{
|
|
reglas += ". Tamaño máximo: " +
|
|
contexto.TamanoMaximoMb.Value.ToString(
|
|
CultureInfo.CurrentCulture) +
|
|
" MB";
|
|
}
|
|
|
|
LitReglasCargaDocumento.Text = Server.HtmlEncode(reglas);
|
|
CargaArchivoWebHelper.Configurar(
|
|
ArchivoDocumento,
|
|
contexto.ExtensionesPermitidas,
|
|
contexto.TamanoMaximoMb,
|
|
1);
|
|
TxtComentarioClienteDocumento.Text =
|
|
contexto.ComentarioClienteAnterior ?? string.Empty;
|
|
TxtFechaDocumento.Text = FormatearFechaDocumento(DateTime.Today);
|
|
TxtFechaDocumento.Attributes["max"] = FormatearFechaDocumento(DateTime.Today);
|
|
TxtVencimientoDocumento.Text = FormatearFechaDocumento(contexto.FechaVencimientoAnterior);
|
|
OcultarMensajeCargaDocumento();
|
|
UpModalCargaDocumento.Update();
|
|
MostrarModalCargaDocumento();
|
|
}
|
|
|
|
private void RevisarDocumento(
|
|
int cveSolicitudDocumento,
|
|
bool aprobado,
|
|
string nota)
|
|
{
|
|
if (CurrentUser.EsDesarrollador)
|
|
{
|
|
Alert(
|
|
"La revisión de documentos corresponde a Agua de Hermosillo.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
DbResult<TramiteDocumentoReviewResultModel> resultado =
|
|
AppServices.TramiteDocumentoService.Review(
|
|
CveFraccionamientoActual,
|
|
cveSolicitudDocumento,
|
|
aprobado,
|
|
nota,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
CargarDocumentos();
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
ActualizarBitacoraDetalle();
|
|
|
|
Alert(
|
|
aprobado
|
|
? "Documento aprobado correctamente."
|
|
: "Documento rechazado correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
}
|
|
|
|
private static string FormatearFechaDocumento(DateTime? fecha)
|
|
{
|
|
return fecha.HasValue
|
|
? fecha.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)
|
|
: string.Empty;
|
|
}
|
|
|
|
private static bool IntentarLeerFechaDocumento(string texto, out DateTime? fecha)
|
|
{
|
|
fecha = null;
|
|
if (string.IsNullOrWhiteSpace(texto))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
DateTime valor;
|
|
if (!DateTime.TryParseExact(texto, "yyyy-MM-dd", CultureInfo.InvariantCulture,
|
|
DateTimeStyles.None, out valor))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
fecha = valor;
|
|
return true;
|
|
}
|
|
|
|
private void AbrirModalEstatusTramite(int cveSolicitud)
|
|
{
|
|
AbrirSeguimiento(cveSolicitud, CveFraccionamientoActual);
|
|
}
|
|
|
|
protected void SeguimientoTramite_Cambiado(object origen, EventArgs argumentos)
|
|
{
|
|
CargarOpcionesEstatusTramite();
|
|
CargarTramites();
|
|
CargarDocumentos();
|
|
UpCantidadTramites.Update();
|
|
UpDocumentosDetalle.Update();
|
|
UpCantidadDocumentos.Update();
|
|
ActualizarBitacoraDetalle();
|
|
}
|
|
|
|
private void CargarBitacoraDetalle()
|
|
{
|
|
UcBitacoraDetalle.ConfigurarConsulta(
|
|
new List<BitacoraCampoFiltroModel>
|
|
{
|
|
new BitacoraCampoFiltroModel
|
|
{
|
|
NombreTablaSQL = "Fraccionamientos",
|
|
NombreCampoSQL = "CveFraccionamiento",
|
|
Valor = CveFraccionamientoActual.ToString(
|
|
CultureInfo.InvariantCulture)
|
|
}
|
|
},
|
|
new List<BitacoraRelacionMostrarModel>
|
|
{
|
|
new BitacoraRelacionMostrarModel
|
|
{
|
|
Orden = 1,
|
|
NombreTablaSQL = "Fraccionamientos",
|
|
NombreCampoMostrarSQL = "Fraccionamiento"
|
|
},
|
|
new BitacoraRelacionMostrarModel
|
|
{
|
|
Orden = 2,
|
|
NombreTablaSQL = "FraccionamientosEtapas",
|
|
NombreCampoMostrarSQL = "Etapa"
|
|
} });
|
|
|
|
UcBitacoraDetalle.Consultar(true);
|
|
}
|
|
|
|
private void ActualizarBitacoraDetalle()
|
|
{
|
|
UcBitacoraDetalle.Refrescar();
|
|
}
|
|
|
|
private static decimal NormalizarAvance(object avanceValor)
|
|
{
|
|
decimal avance;
|
|
|
|
if (avanceValor == null ||
|
|
avanceValor == DBNull.Value ||
|
|
(!decimal.TryParse(
|
|
Convert.ToString(avanceValor),
|
|
NumberStyles.Number,
|
|
CultureInfo.CurrentCulture,
|
|
out avance) &&
|
|
!decimal.TryParse(
|
|
Convert.ToString(avanceValor),
|
|
NumberStyles.Number,
|
|
CultureInfo.InvariantCulture,
|
|
out avance)))
|
|
{
|
|
return 0m;
|
|
}
|
|
|
|
if (avance < 0m)
|
|
{
|
|
return 0m;
|
|
}
|
|
|
|
return avance > 100m
|
|
? 100m
|
|
: avance;
|
|
}
|
|
|
|
private void EstablecerVisualizacionAvance(
|
|
Literal avanceLiteral,
|
|
Panel avanceBarra,
|
|
decimal avance)
|
|
{
|
|
decimal avanceNormalizado = NormalizarAvance(avance);
|
|
string valorAria = avanceNormalizado.ToString(
|
|
"0.##",
|
|
CultureInfo.InvariantCulture);
|
|
string valorVisual = avanceNormalizado.ToString(
|
|
"0.00",
|
|
CultureInfo.CurrentCulture) + "%";
|
|
|
|
avanceLiteral.Text = Server.HtmlEncode(valorVisual);
|
|
avanceBarra.Style["width"] = valorAria + "%";
|
|
avanceBarra.Attributes["aria-valuenow"] = valorAria;
|
|
avanceBarra.Attributes["title"] = valorVisual;
|
|
}
|
|
|
|
private bool EtapaPerteneceAlFraccionamientoActual(
|
|
DbResult<ModeloEtapaFraccionamiento> resultadoEtapa)
|
|
{
|
|
return resultadoEtapa != null &&
|
|
resultadoEtapa.Success &&
|
|
resultadoEtapa.Data != null &&
|
|
resultadoEtapa.Data.CveFraccionamiento ==
|
|
CveFraccionamientoActual;
|
|
}
|
|
|
|
private string ObtenerMensajeValidacionEtapa(
|
|
DbResult<ModeloEtapaFraccionamiento> resultadoEtapa)
|
|
{
|
|
if (resultadoEtapa != null &&
|
|
!string.IsNullOrWhiteSpace(resultadoEtapa.UserMessage))
|
|
{
|
|
return resultadoEtapa.UserMessage;
|
|
}
|
|
|
|
return "La etapa no existe o no pertenece al fraccionamiento actual.";
|
|
}
|
|
|
|
private static TipoMensaje ObtenerTipoMensajeValidacionEtapa(
|
|
DbResult<ModeloEtapaFraccionamiento> resultadoEtapa)
|
|
{
|
|
return resultadoEtapa != null && !resultadoEtapa.Success
|
|
? TipoMensaje.MsgError
|
|
: TipoMensaje.MsgAdvertencia;
|
|
}
|
|
|
|
private void CargarClientes()
|
|
{
|
|
DbResult<List<OpcionClienteFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ListarClientes(
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
DdlCliente.DataSource = resultado.Data;
|
|
DdlCliente.DataTextField = "Cliente";
|
|
DdlCliente.DataValueField = "CveCliente";
|
|
DdlCliente.DataBind();
|
|
}
|
|
|
|
private void CargarEstatus()
|
|
{
|
|
DbResult<List<OpcionEstatusFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ListarEstatus(
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
DdlEstatus.DataSource = resultado.Data;
|
|
DdlEstatus.DataTextField = "Estatus";
|
|
DdlEstatus.DataValueField = "CveEstatus";
|
|
DdlEstatus.DataBind();
|
|
DdlEstatus.Items.Insert(
|
|
0,
|
|
new ListItem(
|
|
"Seleccione un estatus",
|
|
string.Empty));
|
|
}
|
|
|
|
private void CargarFraccionamiento()
|
|
{
|
|
DbResult<ModeloFraccionamiento> resultado =
|
|
AppServices.ServicioFraccionamiento.Obtener(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success || resultado.Data == null)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
ModeloFraccionamiento fraccionamiento = resultado.Data;
|
|
CveClienteDetalle = fraccionamiento.CveCliente;
|
|
string cveCliente = fraccionamiento.CveCliente
|
|
.ToString(CultureInfo.InvariantCulture);
|
|
string idEstatus = fraccionamiento.CveEstatus
|
|
.ToString(CultureInfo.InvariantCulture);
|
|
|
|
if (DdlCliente.Items.FindByValue(cveCliente) != null)
|
|
{
|
|
DdlCliente.SelectedValue = cveCliente;
|
|
}
|
|
|
|
if (DdlEstatus.Items.FindByValue(idEstatus) != null)
|
|
{
|
|
DdlEstatus.SelectedValue = idEstatus;
|
|
}
|
|
|
|
TxtFraccionamiento.Text =
|
|
fraccionamiento.Fraccionamiento;
|
|
TxtHectareas.Text =
|
|
FormatearDecimal(fraccionamiento.Hectareas);
|
|
TxtUbicacion.Text = fraccionamiento.Ubicacion;
|
|
ChkActivo.Checked = fraccionamiento.EsActivo;
|
|
|
|
CargarResumen(fraccionamiento);
|
|
EstablecerNavegacion(fraccionamiento.Fraccionamiento);
|
|
}
|
|
|
|
private void CargarAvisos()
|
|
{
|
|
DbResult<List<ModeloAvisoDetalleFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ObtenerAvisosDetalle(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
List<ModeloAvisoDetalleFraccionamiento> avisos =
|
|
resultado.Data ??
|
|
new List<ModeloAvisoDetalleFraccionamiento>();
|
|
|
|
if (avisos.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
string mensajeAvisos = string.Join(
|
|
Environment.NewLine,
|
|
avisos.Select(aviso => aviso.Aviso ?? string.Empty));
|
|
|
|
Alert(mensajeAvisos, TipoMensaje.MsgAdvertencia);
|
|
}
|
|
|
|
private void CargarResumen(
|
|
ModeloFraccionamiento fraccionamiento)
|
|
{
|
|
LitFraccionamientoNombre.Text = CodificarValorVisualizacion(
|
|
fraccionamiento.Fraccionamiento);
|
|
LitResumenCliente.Text = CodificarValorVisualizacion(
|
|
fraccionamiento.Cliente);
|
|
LitResumenHectareas.Text = CodificarValorVisualizacion(
|
|
FormatearDecimal(fraccionamiento.Hectareas));
|
|
LitResumenUbicacion.Text = CodificarValorVisualizacion(
|
|
fraccionamiento.Ubicacion);
|
|
LitResumenFechaApertura.Text = CodificarValorVisualizacion(
|
|
FormatearFecha(fraccionamiento.FechaAlta));
|
|
LitLoteCantidad.Text = fraccionamiento.NumeroLotes.ToString(
|
|
CultureInfo.CurrentCulture);
|
|
EstablecerVisualizacionAvance(
|
|
LitResumenGlobalAvance,
|
|
PnlResumenGlobalAvanceBarra,
|
|
fraccionamiento.AvanceGlobal);
|
|
|
|
string textoEstatus = ObtenerValorVisualizacion(
|
|
fraccionamiento.Estatus);
|
|
|
|
LblEstatusResumen.Text = Server.HtmlEncode(textoEstatus);
|
|
LblEstatusResumen.CssClass = fraccionamiento.EsActivo
|
|
? "fraction-status-value is-active"
|
|
: "fraction-status-value is-inactive";
|
|
|
|
LblFraccionamientoActivo.Text = fraccionamiento.EsActivo
|
|
? "Activo"
|
|
: "Inactivo";
|
|
LblFraccionamientoActivo.CssClass = fraccionamiento.EsActivo
|
|
? "fraction-status-badge is-active"
|
|
: "fraction-status-badge is-inactive";
|
|
}
|
|
|
|
private void EstablecerNavegacion(string fraccionamientoNombre)
|
|
{
|
|
var rutasNavegacion = new[]
|
|
{
|
|
new BreadcrumbItemModel
|
|
{
|
|
Texto = "Fraccionamientos",
|
|
Url = "~/Pages/Fraccionamientos/Fraccionamientos.aspx"
|
|
},
|
|
new BreadcrumbItemModel
|
|
{
|
|
Texto = ObtenerValorVisualizacion(fraccionamientoNombre)
|
|
}
|
|
};
|
|
|
|
((Site)Master).SetPageNavigation(
|
|
ObtenerValorVisualizacion(fraccionamientoNombre),
|
|
rutasNavegacion);
|
|
}
|
|
|
|
private void SeleccionarPestanaDetalle(int indicePestana)
|
|
{
|
|
PestanasDetalleFraccionamiento.ActiveTabIndex = indicePestana;
|
|
|
|
// El contenedor de pestañas permanece fuera de los paneles parciales.
|
|
RegistraScript(
|
|
"var pestanas = $find('" + PestanasDetalleFraccionamiento.ClientID +
|
|
"'); if (pestanas) { pestanas.set_activeTabIndex(" +
|
|
indicePestana.ToString(CultureInfo.InvariantCulture) + "); }",
|
|
"SeleccionarPestanaDetalle");
|
|
}
|
|
|
|
private void CargarRelacionados()
|
|
{
|
|
CargarEtapas();
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
CargarOpcionesTipoTramite();
|
|
CargarOpcionesEstatusTramite();
|
|
CargarOpcionesTipoTramiteDocumento();
|
|
CargarTramites();
|
|
CargarPagos();
|
|
CargarDocumentos();
|
|
UcConveniosFraccionamiento.Cargar(new FiltroConvenios
|
|
{
|
|
CveCliente = CveClienteDetalle,
|
|
CveFraccionamiento = CveFraccionamientoActual
|
|
});
|
|
}
|
|
|
|
protected void ConveniosFraccionamientoCambiados(object origen, EventArgs argumentos)
|
|
{
|
|
CargarTramites();
|
|
UpCantidadTramites.Update();
|
|
}
|
|
|
|
protected void EtapaCondicionesCambiada(object origen, EventArgs argumentos)
|
|
{
|
|
PnlCondicionesEtapa.Visible = false;
|
|
CveFraccionamientoEtapaCondicionesActual = 0;
|
|
int cveEtapa;
|
|
if (int.TryParse(DdlEtapaCondiciones.SelectedValue, out cveEtapa) && cveEtapa > 0)
|
|
{
|
|
EditarCondicionesEtapa(cveEtapa);
|
|
}
|
|
}
|
|
|
|
private void CargarEtapas()
|
|
{
|
|
DbResult<List<ModeloEtapaFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ListarEtapas(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
List<ModeloEtapaFraccionamiento> etapas =
|
|
resultado.Data ??
|
|
new List<ModeloEtapaFraccionamiento>();
|
|
|
|
GvEtapas.DataSource = etapas;
|
|
GvEtapas.DataBind();
|
|
LitEtapaCantidad.Text = etapas.Count.ToString(
|
|
CultureInfo.CurrentCulture);
|
|
|
|
string seleccionCondiciones = DdlEtapaCondiciones.SelectedValue;
|
|
DdlEtapaCondiciones.DataSource = etapas;
|
|
DdlEtapaCondiciones.DataValueField = "CveFraccionamientoEtapa";
|
|
DdlEtapaCondiciones.DataTextField = "Etapa";
|
|
DdlEtapaCondiciones.DataBind();
|
|
DdlEtapaCondiciones.Items.Insert(0, new ListItem("Seleccione una etapa", ""));
|
|
if (DdlEtapaCondiciones.Items.FindByValue(seleccionCondiciones) != null)
|
|
{
|
|
DdlEtapaCondiciones.SelectedValue = seleccionCondiciones;
|
|
}
|
|
else
|
|
{
|
|
PnlCondicionesEtapa.Visible = false;
|
|
CveFraccionamientoEtapaCondicionesActual = 0;
|
|
}
|
|
UpCondicionesEtapa.Update();
|
|
|
|
CargarOpcionesEtapaLote(etapas);
|
|
CargarOpcionesEtapaTramite(etapas);
|
|
CargarOpcionesEtapaDocumento(etapas);
|
|
}
|
|
|
|
private void CargarTramites()
|
|
{
|
|
UcTramitesConjunto.Cargar(CveClienteDetalle, CveFraccionamientoActual);
|
|
LitTramiteCantidad.Text = UcTramitesConjunto.Cantidad.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
private void CargarDocumentos()
|
|
{
|
|
UcDocumentosEtapa.Cargar(
|
|
CveFraccionamientoActual,
|
|
ObtenerCveFiltro(FiltroDocumentoEtapa),
|
|
ObtenerCveFiltro(FiltroDocumentoTipoTramite));
|
|
LitDocumentoCantidad.Text = UcDocumentosEtapa.Cantidad.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
protected void DocumentosEtapa_AdministrarGis(object origen, EventArgs argumentos)
|
|
{
|
|
CveFraccionamientoEtapaFiltroLotesActual = UcDocumentosEtapa.CveEtapaGis;
|
|
AbrirModalGisEtapa();
|
|
}
|
|
|
|
protected void DocumentosEtapa_Cambiados(object origen, EventArgs argumentos)
|
|
{
|
|
LitDocumentoCantidad.Text = UcDocumentosEtapa.Cantidad.ToString(CultureInfo.InvariantCulture);
|
|
UpCantidadDocumentos.Update();
|
|
CargarTramites();
|
|
}
|
|
|
|
private void CargarPagos()
|
|
{
|
|
DbResult<List<ModeloObligacionPago>> resultadoPendientes =
|
|
AppServices.ServicioPagosConvenios.ListarObligaciones(
|
|
new ModeloFiltroObligacionesPago
|
|
{
|
|
CveFraccionamiento = CveFraccionamientoActual,
|
|
SoloPendientes = true,
|
|
EstadoAdministrativo = "ACTIVO"
|
|
},
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
DbResult<List<ModeloAbono>> resultadoRealizados =
|
|
AppServices.ServicioPagosConvenios.ListarAbonos(
|
|
new ModeloFiltroAbonos { CveFraccionamiento = CveFraccionamientoActual },
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultadoPendientes.Success || !resultadoRealizados.Success)
|
|
{
|
|
Alert(
|
|
!resultadoPendientes.Success
|
|
? resultadoPendientes.UserMessage
|
|
: resultadoRealizados.UserMessage,
|
|
TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
List<ModeloObligacionPago> pagosPendientes =
|
|
resultadoPendientes.Data ??
|
|
new List<ModeloObligacionPago>();
|
|
List<ModeloAbono> pagosRealizados =
|
|
resultadoRealizados.Data ??
|
|
new List<ModeloAbono>();
|
|
|
|
GvPagosPendientes.DataSource = pagosPendientes;
|
|
GvPagosPendientes.DataBind();
|
|
GvPagosRealizados.DataSource = pagosRealizados;
|
|
GvPagosRealizados.DataBind();
|
|
|
|
LitCantidadPagos.Text =
|
|
(pagosPendientes.Count + pagosRealizados.Count).ToString(
|
|
CultureInfo.CurrentCulture);
|
|
}
|
|
|
|
private void EstablecerFiltroDocumento(
|
|
string nombre,
|
|
string titulo,
|
|
int orden,
|
|
string valor,
|
|
string descripcion)
|
|
{
|
|
FiltroActivo filtro = null;
|
|
|
|
if (!string.IsNullOrWhiteSpace(valor))
|
|
{
|
|
filtro = new FiltroActivo
|
|
{
|
|
Nombre = nombre,
|
|
Titulo = titulo,
|
|
Descripcion = string.IsNullOrWhiteSpace(descripcion)
|
|
? valor
|
|
: descripcion,
|
|
Valor = valor,
|
|
Orden = orden,
|
|
Visible = true
|
|
};
|
|
}
|
|
|
|
UcDocumentoFiltros.SetFiltroActivo(
|
|
filtro,
|
|
nombre);
|
|
}
|
|
|
|
private void CargarOpcionesEtapaDocumento(
|
|
IList<ModeloEtapaFraccionamiento> etapas)
|
|
{
|
|
string seleccionadoValor =
|
|
DdlDocumentoEtapa.SelectedValue;
|
|
|
|
DdlDocumentoEtapa.DataSource =
|
|
etapas ?? new List<ModeloEtapaFraccionamiento>();
|
|
DdlDocumentoEtapa.DataTextField = "Etapa";
|
|
DdlDocumentoEtapa.DataValueField =
|
|
"CveFraccionamientoEtapa";
|
|
DdlDocumentoEtapa.DataBind();
|
|
DdlDocumentoEtapa.Items.Insert(
|
|
0,
|
|
new ListItem("Todos", string.Empty));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlDocumentoEtapa,
|
|
seleccionadoValor);
|
|
}
|
|
|
|
private void CargarOpcionesTipoTramiteDocumento()
|
|
{
|
|
string seleccionadoValor =
|
|
DdlDocumentoTipoTramite.SelectedValue;
|
|
|
|
DbResult<List<TipoTramiteModel>> resultado =
|
|
AppServices.TramiteCatalogService.ListTiposTramite(
|
|
string.Empty,
|
|
false,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
DdlDocumentoTipoTramite.DataSource =
|
|
resultado.Data ?? new List<TipoTramiteModel>();
|
|
DdlDocumentoTipoTramite.DataTextField =
|
|
"TipoTramite";
|
|
DdlDocumentoTipoTramite.DataValueField =
|
|
"CveTipoTramite";
|
|
DdlDocumentoTipoTramite.DataBind();
|
|
DdlDocumentoTipoTramite.Items.Insert(
|
|
0,
|
|
new ListItem("Todos", string.Empty));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlDocumentoTipoTramite,
|
|
seleccionadoValor);
|
|
}
|
|
|
|
private void EstablecerFiltroTramite(
|
|
string nombre,
|
|
string titulo,
|
|
int orden,
|
|
string valor,
|
|
string descripcion)
|
|
{
|
|
FiltroActivo filtro = null;
|
|
|
|
if (!string.IsNullOrWhiteSpace(valor))
|
|
{
|
|
filtro = new FiltroActivo
|
|
{
|
|
Nombre = nombre,
|
|
Titulo = titulo,
|
|
Descripcion = string.IsNullOrWhiteSpace(descripcion)
|
|
? valor
|
|
: descripcion,
|
|
Valor = valor,
|
|
Orden = orden,
|
|
Visible = true
|
|
};
|
|
}
|
|
|
|
UcTramiteFiltros.SetFiltroActivo(
|
|
filtro,
|
|
nombre);
|
|
}
|
|
|
|
private static int? ObtenerCveFiltro(
|
|
FiltroActivo filtro)
|
|
{
|
|
int valor;
|
|
|
|
return filtro != null &&
|
|
int.TryParse(filtro.Valor, out valor) &&
|
|
valor > 0
|
|
? (int?)valor
|
|
: null;
|
|
}
|
|
|
|
private static string ObtenerTextoSeleccionado(
|
|
DropDownList control)
|
|
{
|
|
if (control == null ||
|
|
control.SelectedItem == null ||
|
|
string.IsNullOrWhiteSpace(
|
|
control.SelectedValue))
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
return control.SelectedItem.Text;
|
|
}
|
|
|
|
private void CargarOpcionesEtapaParaAgregarTramite()
|
|
{
|
|
DbResult<List<ModeloEtapaFraccionamiento>> resultado =
|
|
AppServices.ServicioFraccionamiento.ListarEtapas(
|
|
CveFraccionamientoActual,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarValidacionAgregarTramite(resultado.UserMessage);
|
|
return;
|
|
}
|
|
|
|
string seleccionadoValor =
|
|
DdlAgregarTramiteEtapa.SelectedValue;
|
|
|
|
DdlAgregarTramiteEtapa.DataSource =
|
|
(resultado.Data ?? new List<ModeloEtapaFraccionamiento>())
|
|
.Where(elemento => elemento.EsActivo)
|
|
.ToList();
|
|
DdlAgregarTramiteEtapa.DataTextField = "Etapa";
|
|
DdlAgregarTramiteEtapa.DataValueField =
|
|
"CveFraccionamientoEtapa";
|
|
DdlAgregarTramiteEtapa.DataBind();
|
|
DdlAgregarTramiteEtapa.Items.Insert(
|
|
0,
|
|
new ListItem(
|
|
"Seleccione una etapa",
|
|
string.Empty));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlAgregarTramiteEtapa,
|
|
seleccionadoValor);
|
|
}
|
|
|
|
private void CargarOpcionesTipoTramiteParaAgregar()
|
|
{
|
|
DdlAgregarTipoTramite.Items.Clear();
|
|
DdlAgregarTipoTramite.Items.Add(
|
|
new ListItem(
|
|
"Seleccione un tipo de trámite",
|
|
string.Empty));
|
|
|
|
int cveFraccionamientoEtapa;
|
|
|
|
if (!int.TryParse(
|
|
DdlAgregarTramiteEtapa.SelectedValue,
|
|
out cveFraccionamientoEtapa) ||
|
|
cveFraccionamientoEtapa <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
DbResult<List<TramiteSolicitudTipoOptionModel>> resultado =
|
|
AppServices.TramiteSolicitudService
|
|
.ListAvailableTypesForStage(
|
|
CveFraccionamientoActual,
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarValidacionAgregarTramite(resultado.UserMessage);
|
|
return;
|
|
}
|
|
|
|
List<TramiteSolicitudTipoOptionModel> tipos =
|
|
resultado.Data ??
|
|
new List<TramiteSolicitudTipoOptionModel>();
|
|
|
|
foreach (TramiteSolicitudTipoOptionModel elemento in tipos)
|
|
{
|
|
DdlAgregarTipoTramite.Items.Add(
|
|
new ListItem(
|
|
elemento.TipoTramite,
|
|
elemento.CveTipoTramite.ToString(
|
|
CultureInfo.InvariantCulture)));
|
|
}
|
|
|
|
BtnGuardarAgregarTramite.Enabled = tipos.Count > 0;
|
|
|
|
if (tipos.Count == 0)
|
|
{
|
|
MostrarValidacionAgregarTramite(
|
|
"La etapa seleccionada ya tiene solicitud para todos los trámites activos.");
|
|
}
|
|
}
|
|
|
|
private void CargarOpcionesEtapaTramite(
|
|
IList<ModeloEtapaFraccionamiento> etapas)
|
|
{
|
|
string seleccionadoValor = DdlTramiteEtapa.SelectedValue;
|
|
|
|
DdlTramiteEtapa.DataSource =
|
|
etapas ?? new List<ModeloEtapaFraccionamiento>();
|
|
DdlTramiteEtapa.DataTextField = "Etapa";
|
|
DdlTramiteEtapa.DataValueField =
|
|
"CveFraccionamientoEtapa";
|
|
DdlTramiteEtapa.DataBind();
|
|
DdlTramiteEtapa.Items.Insert(
|
|
0,
|
|
new ListItem("Todos", string.Empty));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlTramiteEtapa,
|
|
seleccionadoValor);
|
|
}
|
|
|
|
private void CargarOpcionesTipoTramite()
|
|
{
|
|
string seleccionadoValor = DdlTipoTramite.SelectedValue;
|
|
|
|
DbResult<List<TipoTramiteModel>> resultado =
|
|
AppServices.TramiteCatalogService.ListTiposTramite(
|
|
string.Empty,
|
|
false,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
DdlTipoTramite.DataSource =
|
|
resultado.Data ?? new List<TipoTramiteModel>();
|
|
DdlTipoTramite.DataTextField = "TipoTramite";
|
|
DdlTipoTramite.DataValueField = "CveTipoTramite";
|
|
DdlTipoTramite.DataBind();
|
|
DdlTipoTramite.Items.Insert(
|
|
0,
|
|
new ListItem("Todos", string.Empty));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlTipoTramite,
|
|
seleccionadoValor);
|
|
}
|
|
|
|
private void CargarOpcionesEstatusTramite()
|
|
{
|
|
string seleccionadoValor = DdlEstatusTramite.SelectedValue;
|
|
|
|
DbResult<List<TramiteSolicitudEstatusOptionModel>> resultado =
|
|
AppServices.TramiteSolicitudService.ListStatusOptions(
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
DdlEstatusTramite.DataSource =
|
|
resultado.Data ??
|
|
new List<TramiteSolicitudEstatusOptionModel>();
|
|
DdlEstatusTramite.DataTextField = "EstatusSolicitud";
|
|
DdlEstatusTramite.DataValueField =
|
|
"CveEstatusSolicitud";
|
|
DdlEstatusTramite.DataBind();
|
|
DdlEstatusTramite.Items.Insert(
|
|
0,
|
|
new ListItem("Todos", string.Empty));
|
|
|
|
RestaurarValorSeleccionado(
|
|
DdlEstatusTramite,
|
|
seleccionadoValor);
|
|
}
|
|
|
|
private void CargarOpcionesEtapaLote(
|
|
IList<ModeloEtapaFraccionamiento> etapas)
|
|
{
|
|
string seleccionadoValor = CveFraccionamientoEtapaFiltroLotesActual > 0
|
|
? CveFraccionamientoEtapaFiltroLotesActual.ToString(
|
|
CultureInfo.InvariantCulture)
|
|
: string.Empty;
|
|
|
|
DdlLotesEtapa.DataSource = etapas;
|
|
DdlLotesEtapa.DataTextField = "Etapa";
|
|
DdlLotesEtapa.DataValueField = "CveFraccionamientoEtapa";
|
|
DdlLotesEtapa.DataBind();
|
|
DdlLotesEtapa.Items.Insert(
|
|
0,
|
|
new ListItem("Seleccione una etapa", string.Empty));
|
|
|
|
if (!string.IsNullOrWhiteSpace(seleccionadoValor) &&
|
|
DdlLotesEtapa.Items.FindByValue(seleccionadoValor) != null)
|
|
{
|
|
DdlLotesEtapa.SelectedValue = seleccionadoValor;
|
|
return;
|
|
}
|
|
|
|
CveFraccionamientoEtapaFiltroLotesActual = 0;
|
|
DdlLotesEtapa.SelectedIndex = 0;
|
|
}
|
|
|
|
private void CargarContextoLotesEtapaSeleccionada()
|
|
{
|
|
UcLotesConjunto.CargarConjunto(CveClienteDetalle, CveFraccionamientoActual);
|
|
LitLoteCantidad.Text = UcLotesConjunto.Cantidad.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
private int? ObtenerCveEtapaLotesSeleccionada()
|
|
{
|
|
return CveFraccionamientoEtapaFiltroLotesActual > 0
|
|
? (int?)CveFraccionamientoEtapaFiltroLotesActual
|
|
: null;
|
|
}
|
|
|
|
private void LimpiarContextoLotesEtapaSeleccionada()
|
|
{
|
|
PnlEtapaLotesRequerida.Visible = true;
|
|
PnlContextoLotesEtapa.Visible = false;
|
|
LitEtapaSeleccionadaLotes.Text = string.Empty;
|
|
LitAvanceEtapaSeleccionadaLotes.Text = string.Empty;
|
|
PnlBarraAvanceEtapaSeleccionadaLotes.Style["width"] = "0%";
|
|
PnlBarraAvanceEtapaSeleccionadaLotes.Attributes["aria-valuenow"] = "0";
|
|
PhEtapaGisFaltante.Visible = false;
|
|
ContenedorAccionesGisEtapaExistentes.Visible = false;
|
|
PnlGisEtapaExistente.Visible = false;
|
|
LitEtapaGisNombre.Text = string.Empty;
|
|
LitEtapaGisFechaActualizacion.Text = string.Empty;
|
|
LnkEtapaGisAbrir.NavigateUrl = string.Empty;
|
|
CampoOcultoCveEtapaGis.Value = string.Empty;
|
|
GvLotes.DataSource = new List<ModeloLoteFraccionamiento>();
|
|
GvLotes.DataBind();
|
|
}
|
|
|
|
private void CargarContextoGisEtapa(int cveFraccionamientoEtapa)
|
|
{
|
|
PhEtapaGisFaltante.Visible = false;
|
|
ContenedorAccionesGisEtapaExistentes.Visible = false;
|
|
PnlGisEtapaExistente.Visible = false;
|
|
LitEtapaGisNombre.Text = string.Empty;
|
|
LitEtapaGisFechaActualizacion.Text = string.Empty;
|
|
LnkEtapaGisAbrir.NavigateUrl = string.Empty;
|
|
|
|
DbResult<VistaGisFraccionamiento> resultado =
|
|
AppServices.ServicioGisFraccionamiento.Obtener(
|
|
cveFraccionamientoEtapa,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success ||
|
|
resultado.Data == null ||
|
|
resultado.Data.Contexto == null)
|
|
{
|
|
Alert(
|
|
resultado.Success
|
|
? "No fue posible obtener el contexto GIS de la etapa."
|
|
: resultado.UserMessage,
|
|
resultado.Success
|
|
? TipoMensaje.MsgAdvertencia
|
|
: TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
VistaGisFraccionamiento gis = resultado.Data;
|
|
|
|
if (gis.Contexto.CveFraccionamiento != CveFraccionamientoActual)
|
|
{
|
|
Alert(
|
|
"El GIS consultado no pertenece al fraccionamiento actual.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
if (!gis.TieneArchivo)
|
|
{
|
|
PhEtapaGisFaltante.Visible = true;
|
|
return;
|
|
}
|
|
|
|
ContenedorAccionesGisEtapaExistentes.Visible = true;
|
|
LitEtapaGisNombre.Text = CodificarValorVisualizacion(
|
|
gis.NombreArchivo);
|
|
|
|
if (gis.FechaArchivo.HasValue)
|
|
{
|
|
LitEtapaGisFechaActualizacion.Text = Server.HtmlEncode(
|
|
"Actualizado " + gis.FechaArchivo.Value.ToString(
|
|
"dd/MM/yyyy HH:mm",
|
|
CultureInfo.CurrentCulture));
|
|
}
|
|
|
|
PnlGisEtapaExistente.Visible = true;
|
|
LnkEtapaGisAbrir.NavigateUrl = ResolveUrl(
|
|
"~/Pages/Fraccionamientos/FraccionamientoGis.ashx" +
|
|
"?metodo=File&etapa=" +
|
|
cveFraccionamientoEtapa.ToString(CultureInfo.InvariantCulture) +
|
|
"&download=1");
|
|
}
|
|
|
|
private void EditarLote(int cveFraccionamientoLote)
|
|
{
|
|
DbResult<ModeloLoteFraccionamiento> resultado =
|
|
AppServices.ServicioFraccionamiento.ObtenerLote(
|
|
CveFraccionamientoActual,
|
|
cveFraccionamientoLote,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success || resultado.Data == null)
|
|
{
|
|
Alert(
|
|
resultado.Success
|
|
? "No se encontró el lote seleccionado."
|
|
: resultado.UserMessage,
|
|
resultado.Success
|
|
? TipoMensaje.MsgAdvertencia
|
|
: TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
ModeloLoteFraccionamiento lote = resultado.Data;
|
|
|
|
CveFraccionamientoLoteActual =
|
|
lote.CveFraccionamientoLote;
|
|
CveFraccionamientoEtapaLoteEdicionActual =
|
|
lote.CveFraccionamientoEtapa;
|
|
LitEditarLoteEtapa.Text = Server.HtmlEncode(
|
|
ObtenerValorVisualizacion(lote.Etapa));
|
|
TxtEditarLoteNombre.Text = lote.Nombre;
|
|
TxtEditarLoteTipo.Text = lote.Tipo;
|
|
TxtEditarLoteCalle.Text = lote.Calle;
|
|
TxtEditarLoteCatastro.Text = lote.Catastro;
|
|
TxtEditarLoteMetrosCuadrados.Text =
|
|
FormatearDecimal(lote.MetrosCuadrados);
|
|
TxtEditarLoteDuplicador.Text = lote.Duplicador;
|
|
ChkEditarLoteActivo.Checked = lote.EsActivo;
|
|
OcultarEditarLoteMensaje();
|
|
|
|
UpEditarLoteModal.Update();
|
|
MostrarEditarLoteModal();
|
|
}
|
|
|
|
private void EliminarLote(int cveFraccionamientoLote)
|
|
{
|
|
DbResult<bool> resultado =
|
|
AppServices.ServicioFraccionamiento.EliminarLote(
|
|
CveFraccionamientoActual,
|
|
cveFraccionamientoLote,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return;
|
|
}
|
|
|
|
CargarFraccionamiento();
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
UpResumen.Update();
|
|
UpCantidadLotes.Update();
|
|
ActualizarBitacoraDetalle();
|
|
Alert("Lote eliminado correctamente.", TipoMensaje.ToastExito);
|
|
}
|
|
|
|
private void AbrirLotesModal(int cveFraccionamientoEtapa)
|
|
{
|
|
ListItem etapaItem = DdlLotesEtapa.Items.FindByValue(
|
|
cveFraccionamientoEtapa.ToString(CultureInfo.InvariantCulture));
|
|
|
|
if (etapaItem == null)
|
|
{
|
|
Alert(
|
|
"La etapa seleccionada ya no está disponible.",
|
|
TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
|
|
CveFraccionamientoEtapaLotesActual = cveFraccionamientoEtapa;
|
|
LitLoteEtapaNombre.Text = Server.HtmlEncode(etapaItem.Text);
|
|
CargaArchivoWebHelper.Configurar(
|
|
ArchivoLotes,
|
|
".xlsx",
|
|
null,
|
|
1,
|
|
"Arrastra aquí la plantilla .xlsx o haz clic para seleccionarla.");
|
|
LimpiarCapturaLote();
|
|
UpLotesModal.Update();
|
|
MostrarLoteModal();
|
|
}
|
|
|
|
private void LimpiarCapturaLote()
|
|
{
|
|
OcultarLoteMensaje();
|
|
TxtCantidadLotes.Text = "1";
|
|
TxtLoteBaseNombre.Text = string.Empty;
|
|
ChkAgregarIdentificadorLote.Checked = true;
|
|
TxtLoteNumeroInicial.Text = "1";
|
|
}
|
|
|
|
private bool IntentarCrearLotesRapidos(
|
|
out List<ModeloLoteFraccionamiento> lotes,
|
|
out string mensajeValidacion)
|
|
{
|
|
lotes = new List<ModeloLoteFraccionamiento>();
|
|
mensajeValidacion = null;
|
|
|
|
if (CveFraccionamientoEtapaLotesActual <= 0)
|
|
{
|
|
mensajeValidacion =
|
|
"Seleccione una etapa para agregar los lotes.";
|
|
return false;
|
|
}
|
|
|
|
int cantidad;
|
|
|
|
if (!int.TryParse(TxtCantidadLotes.Text, out cantidad) ||
|
|
cantidad < 1 ||
|
|
cantidad > 1000)
|
|
{
|
|
mensajeValidacion =
|
|
"La cantidad debe estar entre 1 y 1,000 lotes.";
|
|
return false;
|
|
}
|
|
|
|
string nombreBase = (TxtLoteBaseNombre.Text ?? string.Empty).Trim();
|
|
bool agregarIdentificador = ChkAgregarIdentificadorLote.Checked;
|
|
int numeroInicial = 0;
|
|
|
|
if (!agregarIdentificador && cantidad > 1)
|
|
{
|
|
mensajeValidacion =
|
|
"Para agregar varios lotes debe activar el número identificador.";
|
|
return false;
|
|
}
|
|
|
|
if (!agregarIdentificador && string.IsNullOrWhiteSpace(nombreBase))
|
|
{
|
|
mensajeValidacion = "Capture el nombre del lote.";
|
|
return false;
|
|
}
|
|
|
|
if (agregarIdentificador &&
|
|
(!int.TryParse(TxtLoteNumeroInicial.Text, out numeroInicial) ||
|
|
numeroInicial < 0))
|
|
{
|
|
mensajeValidacion =
|
|
"Capture un número inicial mayor o igual a cero.";
|
|
return false;
|
|
}
|
|
|
|
for (int indice = 0; indice < cantidad; indice++)
|
|
{
|
|
string nombre = agregarIdentificador
|
|
? nombreBase + (numeroInicial + indice).ToString(
|
|
CultureInfo.InvariantCulture)
|
|
: nombreBase;
|
|
|
|
if (string.IsNullOrWhiteSpace(nombre) || nombre.Length > 50)
|
|
{
|
|
mensajeValidacion =
|
|
"Los nombres generados deben tener entre 1 y 50 caracteres.";
|
|
lotes.Clear();
|
|
return false;
|
|
}
|
|
|
|
lotes.Add(
|
|
new ModeloLoteFraccionamiento
|
|
{
|
|
CveFraccionamientoEtapa =
|
|
CveFraccionamientoEtapaLotesActual,
|
|
Nombre = nombre,
|
|
EsActivo = true
|
|
});
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private bool GuardarLotes(IList<ModeloLoteFraccionamiento> lotes)
|
|
{
|
|
int cveFraccionamientoEtapa = CveFraccionamientoEtapaLotesActual;
|
|
DbResult<int> resultado =
|
|
AppServices.ServicioFraccionamiento.GuardarLotes(
|
|
CveFraccionamientoActual,
|
|
cveFraccionamientoEtapa,
|
|
lotes,
|
|
CurrentUser.CveUsuario,
|
|
CurrentUser.NombreDominio);
|
|
|
|
if (!resultado.Success)
|
|
{
|
|
MostrarLoteModal();
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
|
return false;
|
|
}
|
|
|
|
MostrarLotesDeEtapa(cveFraccionamientoEtapa);
|
|
ActualizarBitacoraDetalle();
|
|
Alert(
|
|
resultado.Data == 1
|
|
? "Lote guardado correctamente."
|
|
: resultado.Data.ToString(CultureInfo.CurrentCulture) +
|
|
" lotes guardados correctamente.",
|
|
TipoMensaje.ToastExito);
|
|
return true;
|
|
}
|
|
|
|
private void MostrarLotesDeEtapa(int cveFraccionamientoEtapa)
|
|
{
|
|
string valor = cveFraccionamientoEtapa.ToString(
|
|
CultureInfo.InvariantCulture);
|
|
|
|
if (DdlLotesEtapa.Items.FindByValue(valor) != null)
|
|
{
|
|
DdlLotesEtapa.SelectedValue = valor;
|
|
CveFraccionamientoEtapaFiltroLotesActual = cveFraccionamientoEtapa;
|
|
}
|
|
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabLotes));
|
|
CargarFraccionamiento();
|
|
CargarContextoLotesEtapaSeleccionada();
|
|
UpResumen.Update();
|
|
UpCantidadLotes.Update();
|
|
OcultarLoteModal();
|
|
}
|
|
|
|
private void MostrarValidacionLote(string mensaje)
|
|
{
|
|
LblLoteMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblLoteMensaje.Visible = true;
|
|
MostrarLoteModal();
|
|
}
|
|
|
|
private void OcultarLoteMensaje()
|
|
{
|
|
LblLoteMensaje.Visible = false;
|
|
LblLoteMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarLoteModal()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.mostrarLotes();",
|
|
"MostrarModalLotes");
|
|
}
|
|
|
|
private void OcultarLoteModal()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.ocultarLotes();",
|
|
"OcultarModalLotes");
|
|
}
|
|
|
|
private void MostrarValidacionEdicionLote(string mensaje)
|
|
{
|
|
LblEditarLoteMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblEditarLoteMensaje.Visible = true;
|
|
MostrarEditarLoteModal();
|
|
}
|
|
|
|
private void OcultarEditarLoteMensaje()
|
|
{
|
|
LblEditarLoteMensaje.Visible = false;
|
|
LblEditarLoteMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarEditarLoteModal()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.mostrarEdicionLote();",
|
|
"MostrarModalEdicionLote");
|
|
}
|
|
|
|
private void OcultarEditarLoteModal()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.ocultarEdicionLote();",
|
|
"OcultarModalEdicionLote");
|
|
}
|
|
|
|
private void LimpiarEtapa()
|
|
{
|
|
OcultarEtapaMensaje();
|
|
CveFraccionamientoEtapaActual = 0;
|
|
TxtEtapa.Text = string.Empty;
|
|
TxtEtapaHectareas.Text = string.Empty;
|
|
ChkEtapaActivo.Checked = true;
|
|
}
|
|
|
|
private void ConfigurarCuadriculaOrdenEtapas()
|
|
{
|
|
GvEtapas.Attributes["data-sig-order-grid"] = "1";
|
|
GvEtapas.Attributes["data-sig-order-payload"] =
|
|
CampoOcultoMovimientoOrdenEtapa.ClientID;
|
|
GvEtapas.Attributes["data-sig-order-postback"] =
|
|
BtnMoverOrdenEtapa.ClientID;
|
|
}
|
|
|
|
private static bool IntentarInterpretarMovimientoOrdenEtapa(
|
|
string datosMovimiento,
|
|
out int cveFraccionamientoEtapa,
|
|
out int cveFraccionamientoEtapaReferencia,
|
|
out bool colocarDespues)
|
|
{
|
|
cveFraccionamientoEtapa = 0;
|
|
cveFraccionamientoEtapaReferencia = 0;
|
|
colocarDespues = false;
|
|
|
|
string[] partes = (datosMovimiento ?? string.Empty).Split('|');
|
|
|
|
if (partes.Length != 3 ||
|
|
!int.TryParse(partes[0], out cveFraccionamientoEtapa) ||
|
|
!int.TryParse(partes[1], out cveFraccionamientoEtapaReferencia) ||
|
|
(partes[2] != "0" && partes[2] != "1"))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
colocarDespues = partes[2] == "1";
|
|
|
|
return cveFraccionamientoEtapa > 0 &&
|
|
cveFraccionamientoEtapaReferencia > 0 &&
|
|
cveFraccionamientoEtapa != cveFraccionamientoEtapaReferencia;
|
|
}
|
|
|
|
private void MostrarEditarError(string mensaje)
|
|
{
|
|
LblEditarMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblEditarMensaje.Visible = true;
|
|
MostrarEditarModal();
|
|
}
|
|
|
|
private void OcultarEditarMensaje()
|
|
{
|
|
LblEditarMensaje.Visible = false;
|
|
LblEditarMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarEditarModal()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.mostrarEdicion();",
|
|
"MostrarModalEdicionFraccionamiento");
|
|
}
|
|
|
|
private void OcultarEditarModal()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.ocultarEdicion();",
|
|
"OcultarModalEdicionFraccionamiento");
|
|
}
|
|
|
|
private void MostrarModalEtapa()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.mostrarEtapa();",
|
|
"MostrarModalEtapa");
|
|
}
|
|
|
|
private void OcultarModalEtapa()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.ocultarEtapa();",
|
|
"OcultarModalEtapa");
|
|
}
|
|
|
|
private void MostrarCondicionesEtapa()
|
|
{
|
|
SeleccionarPestanaDetalle(
|
|
PestanasDetalleFraccionamiento.Tabs.IndexOf(TabCondiciones));
|
|
}
|
|
|
|
private void MostrarEtapaError(string mensaje)
|
|
{
|
|
LblEtapaMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblEtapaMensaje.Visible = true;
|
|
MostrarModalEtapa();
|
|
}
|
|
|
|
private void OcultarEtapaMensaje()
|
|
{
|
|
LblEtapaMensaje.Visible = false;
|
|
LblEtapaMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private static bool? ObtenerBitAnulable(ListControl lista)
|
|
{
|
|
if (lista == null
|
|
|| string.IsNullOrEmpty(lista.SelectedValue)
|
|
|| lista.SelectedValue == "-1")
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return lista.SelectedValue == "1";
|
|
}
|
|
|
|
private static void SeleccionarBitAnulable(
|
|
ListControl lista,
|
|
bool? valor)
|
|
{
|
|
lista.SelectedValue = valor.HasValue
|
|
? (valor.Value ? "1" : "0")
|
|
: "-1";
|
|
}
|
|
|
|
private void MostrarValidacionAvanceEtapa(string mensaje)
|
|
{
|
|
LblEtapaAvanceMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblEtapaAvanceMensaje.Visible = true;
|
|
UpEtapaAvanceModal.Update();
|
|
MostrarModalAvanceEtapa();
|
|
}
|
|
|
|
private void OcultarMensajeAvanceEtapa()
|
|
{
|
|
LblEtapaAvanceMensaje.Visible = false;
|
|
LblEtapaAvanceMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarModalAvanceEtapa()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.mostrarAvanceEtapa();",
|
|
"MostrarModalAvanceEtapa");
|
|
}
|
|
|
|
private void OcultarModalAvanceEtapa()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.ocultarAvanceEtapa();",
|
|
"OcultarModalAvanceEtapa");
|
|
}
|
|
|
|
private void MostrarModalFiltrosDocumentos()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalDocumentoFiltros').modal('show');",
|
|
"MostrarModalFiltrosDocumentos");
|
|
}
|
|
|
|
private void OcultarModalFiltrosDocumentos()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalDocumentoFiltros').modal('hide');",
|
|
"OcultarModalFiltrosDocumentos");
|
|
}
|
|
|
|
private void MostrarModalCargaDocumento()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalCargaDocumento').modal('show');",
|
|
"MostrarModalCargaDocumento");
|
|
}
|
|
|
|
private void OcultarModalCargaDocumento()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalCargaDocumento').modal('hide');",
|
|
"OcultarModalCargaDocumento");
|
|
}
|
|
|
|
private void MostrarModalRechazoDocumento()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalRechazoDocumento').modal('show');",
|
|
"MostrarModalRechazoDocumento");
|
|
}
|
|
|
|
private void OcultarModalRechazoDocumento()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalRechazoDocumento').modal('hide');",
|
|
"OcultarModalRechazoDocumento");
|
|
}
|
|
|
|
private void MostrarValidacionCargaDocumento(string mensaje)
|
|
{
|
|
LblMensajeCargaDocumento.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblMensajeCargaDocumento.Visible = true;
|
|
UpModalCargaDocumento.Update();
|
|
MostrarModalCargaDocumento();
|
|
}
|
|
|
|
private void OcultarMensajeCargaDocumento()
|
|
{
|
|
LblMensajeCargaDocumento.Visible = false;
|
|
LblMensajeCargaDocumento.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarValidacionRechazoDocumento(string mensaje)
|
|
{
|
|
LblMensajeRechazoDocumento.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblMensajeRechazoDocumento.Visible = true;
|
|
UpModalRechazoDocumento.Update();
|
|
MostrarModalRechazoDocumento();
|
|
}
|
|
|
|
private void OcultarMensajeRechazoDocumento()
|
|
{
|
|
LblMensajeRechazoDocumento.Visible = false;
|
|
LblMensajeRechazoDocumento.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarValidacionAgregarTramite(
|
|
string mensaje)
|
|
{
|
|
LblAgregarTramiteMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblAgregarTramiteMensaje.Visible = true;
|
|
UpAgregarTramiteModal.Update();
|
|
MostrarModalAgregarTramite();
|
|
}
|
|
|
|
private void OcultarAgregarTramiteMensaje()
|
|
{
|
|
LblAgregarTramiteMensaje.Visible = false;
|
|
LblAgregarTramiteMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarModalAgregarTramite()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalAgregarTramite').modal('show');",
|
|
"MostrarModalAgregarTramite");
|
|
}
|
|
|
|
private void OcultarModalAgregarTramite()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalAgregarTramite').modal('hide');",
|
|
"OcultarModalAgregarTramite");
|
|
}
|
|
|
|
private void MostrarModalFiltrosTramites()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalTramiteFiltros').modal('show');",
|
|
"MostrarModalFiltrosTramites");
|
|
}
|
|
|
|
private void OcultarModalFiltrosTramites()
|
|
{
|
|
RegistraScript(
|
|
"$('#ModalTramiteFiltros').modal('hide');",
|
|
"OcultarModalFiltrosTramites");
|
|
}
|
|
|
|
private void MostrarValidacionGisEtapa(string mensaje)
|
|
{
|
|
LblEtapaGisMensaje.Text = Server.HtmlEncode(
|
|
mensaje ?? string.Empty);
|
|
LblEtapaGisMensaje.Visible = true;
|
|
LblEtapaGisMensaje.Style["display"] = "block";
|
|
UpEtapaGisModal.Update();
|
|
MostrarModalGisEtapa();
|
|
}
|
|
|
|
private void OcultarEtapaGisMensaje()
|
|
{
|
|
LblEtapaGisMensaje.Visible = true;
|
|
LblEtapaGisMensaje.Style["display"] = "none";
|
|
LblEtapaGisMensaje.Text = string.Empty;
|
|
}
|
|
|
|
private void MostrarModalGisEtapa()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.mostrarGisEtapa();",
|
|
"MostrarModalGisEtapa");
|
|
}
|
|
|
|
private void OcultarModalGisEtapa()
|
|
{
|
|
RegistraScript(
|
|
"window.SIGDetalle.ocultarGisEtapa();",
|
|
"OcultarModalGisEtapa");
|
|
}
|
|
|
|
protected string CodificarValorVisualizacion(string valor)
|
|
{
|
|
return Server.HtmlEncode(ObtenerValorVisualizacion(valor));
|
|
}
|
|
|
|
protected string ObtenerUrlVentaTramite(
|
|
object valorCveSolicitud,
|
|
object valorCveTramitePago)
|
|
{
|
|
int cveSolicitud;
|
|
int cveTramitePago;
|
|
|
|
if (!int.TryParse(
|
|
Convert.ToString(valorCveSolicitud),
|
|
out cveSolicitud) ||
|
|
!int.TryParse(
|
|
Convert.ToString(valorCveTramitePago),
|
|
out cveTramitePago) ||
|
|
cveSolicitud <= 0 ||
|
|
cveTramitePago <= 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
return ResolveUrl(
|
|
"~/Pages/Ventas/VentaTramite.aspx" +
|
|
"?cveSolicitud=" +
|
|
cveSolicitud.ToString(CultureInfo.InvariantCulture) +
|
|
"&cveTramitePago=" +
|
|
cveTramitePago.ToString(CultureInfo.InvariantCulture));
|
|
}
|
|
|
|
private static string ObtenerValorVisualizacion(string valor)
|
|
{
|
|
return string.IsNullOrWhiteSpace(valor)
|
|
? ValorVisualizacionVacio
|
|
: valor.Trim();
|
|
}
|
|
|
|
private static string FormatearFecha(DateTime valor)
|
|
{
|
|
return valor <= new DateTime(1900, 1, 1)
|
|
? ValorVisualizacionVacio
|
|
: valor.ToString(
|
|
"dd/MM/yyyy",
|
|
CultureInfo.CurrentCulture);
|
|
}
|
|
|
|
|
|
private static int? ObtenerCveSeleccionada(
|
|
DropDownList listaDesplegable)
|
|
{
|
|
int valor;
|
|
|
|
return listaDesplegable != null &&
|
|
int.TryParse(listaDesplegable.SelectedValue, out valor) &&
|
|
valor > 0
|
|
? (int?)valor
|
|
: null;
|
|
}
|
|
|
|
private static void RestaurarValorSeleccionado(
|
|
DropDownList listaDesplegable,
|
|
string seleccionadoValor)
|
|
{
|
|
if (listaDesplegable == null ||
|
|
string.IsNullOrWhiteSpace(seleccionadoValor) ||
|
|
listaDesplegable.Items.FindByValue(seleccionadoValor) == null)
|
|
{
|
|
if (listaDesplegable != null && listaDesplegable.Items.Count > 0)
|
|
{
|
|
listaDesplegable.SelectedIndex = 0;
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
listaDesplegable.SelectedValue = seleccionadoValor;
|
|
}
|
|
|
|
protected static bool ConvertirABooleano(object valor)
|
|
{
|
|
bool valorConvertido;
|
|
|
|
return valor != null &&
|
|
bool.TryParse(
|
|
Convert.ToString(valor),
|
|
out valorConvertido) &&
|
|
valorConvertido;
|
|
}
|
|
|
|
private static string FormatearDecimal(decimal? valor)
|
|
{
|
|
return valor.HasValue
|
|
? valor.Value.ToString(
|
|
"0.####",
|
|
CultureInfo.CurrentCulture)
|
|
: string.Empty;
|
|
}
|
|
|
|
private static bool IntentarConvertirDecimalAnulable(
|
|
string texto,
|
|
out decimal? valor)
|
|
{
|
|
valor = null;
|
|
|
|
if (string.IsNullOrWhiteSpace(texto))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
decimal valorConvertido;
|
|
bool convertido =
|
|
decimal.TryParse(
|
|
texto.Trim(),
|
|
NumberStyles.Number,
|
|
CultureInfo.CurrentCulture,
|
|
out valorConvertido) ||
|
|
decimal.TryParse(
|
|
texto.Trim(),
|
|
NumberStyles.Number,
|
|
CultureInfo.InvariantCulture,
|
|
out valorConvertido);
|
|
|
|
if (convertido)
|
|
{
|
|
valor = valorConvertido;
|
|
}
|
|
|
|
return convertido;
|
|
}
|
|
protected void SolicitarDocumentoConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UcDocumentosEtapa.IniciarSolicitudDocumento();
|
|
}
|
|
|
|
protected void CargarDocumentosConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UcDocumentosEtapa.IniciarCargaMasiva();
|
|
}
|
|
|
|
protected void DescargarDocumentosConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabDocumentos));
|
|
UcDocumentosEtapa.DescargarTodosArchivos();
|
|
}
|
|
|
|
protected void AgregarTipoViviendaConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabLotes));
|
|
UcLotesConjunto.IniciarAgregarTipoVivienda();
|
|
}
|
|
|
|
protected void AgregarLotesConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabLotes));
|
|
UcLotesConjunto.IniciarAgregarLotes();
|
|
}
|
|
|
|
protected void CargarGisConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabLotes));
|
|
UcLotesConjunto.IniciarArchivoGis();
|
|
}
|
|
|
|
protected void LimpiarLotesConjunto(object origen, EventArgs argumentos)
|
|
{
|
|
SeleccionarPestanaDetalle(PestanasDetalleFraccionamiento.Tabs.IndexOf(TabLotes));
|
|
UcLotesConjunto.LimpiarLotes();
|
|
}
|
|
|
|
protected void TramitesConjuntoCambiados(object origen, EventArgs argumentos)
|
|
{
|
|
CargarDocumentos();
|
|
}
|
|
|
|
private int CveClienteDetalle
|
|
{
|
|
get { return (int?)ViewState["CveClienteDetalle"] ?? 0; }
|
|
set { ViewState["CveClienteDetalle"] = value; }
|
|
}
|
|
|
|
protected override void OnPreRender(EventArgs argumentos)
|
|
{
|
|
bool esUsuarioAgua = CurrentUser != null && !CurrentUser.EsDesarrollador;
|
|
BtnSolicitarDocumentoConjunto.Visible = esUsuarioAgua;
|
|
BtnAgregarTipoViviendaConjunto.Visible = esUsuarioAgua;
|
|
BtnAgregarLotesConjunto.Visible = esUsuarioAgua;
|
|
BtnCargarGisConjunto.Visible = esUsuarioAgua;
|
|
BtnLimpiarLotesConjunto.Visible = esUsuarioAgua;
|
|
base.OnPreRender(argumentos);
|
|
}
|
|
|
|
private void ConvenioGuardadoDesdeTramites(object origen, EventArgs argumentos)
|
|
{
|
|
UcConveniosFraccionamiento.Recargar();
|
|
}
|
|
|
|
protected override void OnInit(EventArgs argumentos)
|
|
{
|
|
base.OnInit(argumentos);
|
|
UcTramitesConjunto.ConvenioGuardado += ConvenioGuardadoDesdeTramites;
|
|
PresentadorBloqueos.Registrar(this, () =>
|
|
PresentadorBloqueos.ObtenerClienteFraccionamiento(CveFraccionamientoActual));
|
|
UcEstatusSolicitud.ObtenerCondiciones = UcCondicionesSolicitud.Capturar;
|
|
}
|
|
|
|
|
|
private int CveSolicitudSeguimiento
|
|
{
|
|
get { return (int?)ViewState["CveSolicitudSeguimiento"] ?? 0; }
|
|
set { ViewState["CveSolicitudSeguimiento"] = value; }
|
|
}
|
|
|
|
private int CveFraccionamientoSeguimiento
|
|
{
|
|
get { return (int?)ViewState["CveFraccionamientoSeguimiento"] ?? 0; }
|
|
set { ViewState["CveFraccionamientoSeguimiento"] = value; }
|
|
}
|
|
|
|
private void AbrirSeguimiento(int cveSolicitud, int? cveFraccionamiento = null, string seccion = null)
|
|
{
|
|
DbResult<ModeloContextoCambioEstatus> resultado =
|
|
AppServices.TramiteSolicitudService.ObtenerContextoCambioEstatus(
|
|
cveSolicitud, CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
if (!resultado.Success || resultado.Data == null)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
ModeloContextoCambioEstatus contexto = resultado.Data;
|
|
if (cveFraccionamiento.HasValue &&
|
|
contexto.Solicitud.CveFraccionamiento != cveFraccionamiento.Value)
|
|
{
|
|
Alert("La solicitud no pertenece al fraccionamiento.", TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
CveSolicitudSeguimiento = cveSolicitud;
|
|
CveFraccionamientoSeguimiento = contexto.Solicitud.CveFraccionamiento;
|
|
TituloSeguimiento.Text = contexto.Solicitud.Folio + " · " + contexto.Solicitud.TipoTramite;
|
|
NombreFraccionamientoEtapaSeguimiento.Text = string.Join(" · ",
|
|
new[] { contexto.Solicitud.Fraccionamiento, contexto.Solicitud.Etapa }
|
|
.Where(nombre => !string.IsNullOrWhiteSpace(nombre)));
|
|
EnlaceFraccionamientoSeguimiento.NavigateUrl = ResolveUrl(
|
|
"~/Pages/Fraccionamientos/FraccionamientoDetalle.aspx?id=" +
|
|
CveFraccionamientoSeguimiento.ToString(CultureInfo.InvariantCulture));
|
|
UcCondicionesSolicitud.Cargar(contexto);
|
|
UcEstatusSolicitud.Cargar(contexto);
|
|
UcDocumentosSolicitud.Cargar(cveSolicitud, CveFraccionamientoSeguimiento, contexto.Documentos);
|
|
UcComentariosSolicitud.Cargar(cveSolicitud);
|
|
UcSupervisionesSolicitud.CveFraccionamiento = CveFraccionamientoSeguimiento;
|
|
UcSupervisionesSolicitud.CveFraccionamientoEtapa = contexto.Solicitud.CveFraccionamientoEtapa;
|
|
UcSupervisionesSolicitud.CveSolicitud = cveSolicitud;
|
|
UcSupervisionesSolicitud.Cargar();
|
|
UcPagosSolicitud.Cargar(new ModeloFiltroObligacionesPago { CveSolicitud = cveSolicitud });
|
|
MostrarPagosSeguimiento(contexto.Pagos);
|
|
CargarAccionesPendientesSeguimiento();
|
|
UpEncabezadoSeguimiento.Update();
|
|
MostrarSeguimiento(seccion);
|
|
}
|
|
|
|
private void MostrarSeguimiento(string seccion = null)
|
|
{
|
|
int indice = seccion == "condiciones" ? 1 : seccion == "documentos" ? 2 :
|
|
seccion == "comentarios" ? 3 : seccion == "supervisiones" ? 4 : seccion == "pagos" ? 5 : 0;
|
|
PestanasSeguimiento.ActiveTabIndex = indice;
|
|
// El clic abre el panel. Restaurarlo sólo si una carga de archivo recargó la página.
|
|
if (!ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
|
|
{
|
|
RegistraScript("SIGPanelLateral.abrir('" + PanelSeguimiento.ClientID + "');");
|
|
return;
|
|
}
|
|
RegistraScript(
|
|
"$find('" + PestanasSeguimiento.ClientID + "').set_activeTabIndex(" +
|
|
indice.ToString(CultureInfo.InvariantCulture) + ");");
|
|
}
|
|
|
|
private void ActualizarSeguimiento()
|
|
{
|
|
CargarAccionesPendientesSeguimiento();
|
|
UpEncabezadoSeguimiento.Update();
|
|
SeguimientoTramite_Cambiado(this, EventArgs.Empty);
|
|
}
|
|
|
|
protected void EstatusSeguimiento_SeleccionCambiada(object origen, EventArgs argumentos)
|
|
{
|
|
UcCondicionesSolicitud.AjustarEstatus(UcEstatusSolicitud.EstatusSeleccionado);
|
|
}
|
|
|
|
protected void EstatusSeguimiento_RequisitosPendientes(object origen, EventArgs argumentos)
|
|
{
|
|
RefrescarRequisitosSeguimiento();
|
|
MostrarSeguimiento(UcEstatusSolicitud.SeccionPendiente);
|
|
}
|
|
|
|
protected void EstatusSeguimiento_Cambiado(object origen, EventArgs argumentos)
|
|
{
|
|
bool ofrecerProgramacion = UcEstatusSolicitud.OfrecerProgramacion;
|
|
AbrirSeguimiento(CveSolicitudSeguimiento, CveFraccionamientoSeguimiento);
|
|
SeguimientoTramite_Cambiado(this, EventArgs.Empty);
|
|
if (ofrecerProgramacion)
|
|
{
|
|
UcSupervisionesSolicitud.Programar();
|
|
}
|
|
}
|
|
|
|
protected void CondicionesSeguimiento_Cambiado(object origen, EventArgs argumentos)
|
|
{
|
|
ActualizarSeguimiento();
|
|
MostrarSeguimiento("condiciones");
|
|
}
|
|
|
|
protected void DocumentosSeguimiento_Cambiados(object origen, EventArgs argumentos)
|
|
{
|
|
ActualizarSeguimiento();
|
|
MostrarSeguimiento("documentos");
|
|
}
|
|
|
|
protected void DocumentosSeguimiento_MostrarSolicitado(object origen, EventArgs argumentos)
|
|
{
|
|
MostrarSeguimiento("documentos");
|
|
}
|
|
|
|
protected void ComentariosSeguimiento_Cambiado(object origen, EventArgs argumentos)
|
|
{
|
|
ActualizarSeguimiento();
|
|
MostrarSeguimiento("comentarios");
|
|
}
|
|
|
|
protected void ComentariosSeguimiento_MostrarSolicitado(object origen, EventArgs argumentos)
|
|
{
|
|
MostrarSeguimiento("comentarios");
|
|
}
|
|
|
|
protected void PagosSeguimiento_Cambiados(object origen, EventArgs argumentos)
|
|
{
|
|
UcPagosSolicitud.Cargar(new ModeloFiltroObligacionesPago { CveSolicitud = CveSolicitudSeguimiento });
|
|
RefrescarRequisitosSeguimiento();
|
|
ActualizarSeguimiento();
|
|
MostrarSeguimiento("pagos");
|
|
}
|
|
|
|
private void CargarAccionesPendientesSeguimiento()
|
|
{
|
|
DbResult<List<ModeloAccionPendienteSolicitud>> resultado =
|
|
AppServices.TramiteSolicitudService.ListarAccionesPendientes(
|
|
CveSolicitudSeguimiento, CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
List<ModeloAccionPendienteSolicitud> acciones = resultado.Success && resultado.Data != null
|
|
? resultado.Data : new List<ModeloAccionPendienteSolicitud>();
|
|
SeccionAccionesPendientesSeguimiento.Visible = acciones.Count > 0;
|
|
AccionesPendientesSeguimiento.DataSource = acciones;
|
|
AccionesPendientesSeguimiento.DataBind();
|
|
if (!resultado.Success)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
|
|
private void MostrarPagosSeguimiento(List<ModeloPagoSolicitud> pagos)
|
|
{
|
|
List<ModeloPagoSolicitud> pendientes = pagos.Where(pago => pago.EstaPendiente).ToList();
|
|
AvisoPagosSeguimiento.Text = pendientes.Count == 0 ? string.Empty :
|
|
"<div class=\"alert alert-warning sig-seguimiento-seccion\" role=\"status\">" +
|
|
"<strong>Pagos pendientes:</strong> " +
|
|
System.Web.HttpUtility.HtmlEncode(string.Join(", ", pendientes.Select(pago => pago.NombrePago))) +
|
|
". Realice estos pagos desde el módulo correspondiente.</div>";
|
|
}
|
|
|
|
private bool RefrescarRequisitosSeguimiento()
|
|
{
|
|
DbResult<ModeloContextoCambioEstatus> resultado =
|
|
AppServices.TramiteSolicitudService.ObtenerContextoCambioEstatus(
|
|
CveSolicitudSeguimiento, CurrentUser.CveUsuario, CurrentUser.NombreDominio);
|
|
if (!resultado.Success || resultado.Data == null)
|
|
{
|
|
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
|
return false;
|
|
}
|
|
UcDocumentosSolicitud.Cargar(CveSolicitudSeguimiento, CveFraccionamientoSeguimiento, resultado.Data.Documentos);
|
|
MostrarPagosSeguimiento(resultado.Data.Pagos);
|
|
UpEncabezadoSeguimiento.Update();
|
|
return true;
|
|
}
|
|
|
|
|
|
}
|
|
}
|