1280 lines
47 KiB
C#
1280 lines
47 KiB
C#
|
|
/*===========================================================================================================================
|
|||
|
|
* Instituto Costarricense de Acueductos y Alcantarillados. - 2015
|
|||
|
|
* Administración de la Seguridad
|
|||
|
|
* Nombre de la Pantalla: frwUsuario.aspx
|
|||
|
|
*
|
|||
|
|
* Explicación de los contenidos del archivo
|
|||
|
|
*===========================================================================================================================
|
|||
|
|
* HISTORIAL
|
|||
|
|
*
|
|||
|
|
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
|||
|
|
* Esteban Gutierrez Rapso 20 – 04 - 2015 Se inicia con el diseño de la pagina
|
|||
|
|
* …………………………………………………………
|
|||
|
|
* …………………………………………………………
|
|||
|
|
*===========================================================================================================================
|
|||
|
|
* Derechos Reservados (C) 2015 AyA.
|
|||
|
|
* ESTE CÓDIGO ES PROVEÍDO “TAL CUAL ES” SIN GARANTÍA ALGUNA
|
|||
|
|
* DE NINGÚN TIPO, SEA IMPLICITA O EXPLICITA.
|
|||
|
|
* NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL, NI SU COMERCIALIZACIÓN
|
|||
|
|
*===========================================================================================================================
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using System.Web.UI.HtmlControls;
|
|||
|
|
using AyABL;
|
|||
|
|
using AyABL.AUT.Autenticacion;
|
|||
|
|
//using AyABL.APL;
|
|||
|
|
using AyADAL;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using AyABL.RCS;
|
|||
|
|
|
|||
|
|
using AyABL.Usuario;
|
|||
|
|
using AyABL.APL;
|
|||
|
|
|
|||
|
|
public partial class Forms_Usuarios_frwCantonales : General
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
#region Inicializar Formulario (R0)
|
|||
|
|
|
|||
|
|
override protected void OnInit(EventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
base.OnInit(e);
|
|||
|
|
|
|||
|
|
InicializarFormulario();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R0M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void InicializarFormulario() //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
|||
|
|
|
|||
|
|
construirGridView();
|
|||
|
|
|
|||
|
|
|
|||
|
|
Javascript.CheckAllGridViewItems(Page);
|
|||
|
|
|
|||
|
|
cuwBusquedaList.Buscar += new _controlesusuario_Estandar_cuwBusquedaList.SearchEvent(Buscar);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R0M1", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Variables (R1)
|
|||
|
|
|
|||
|
|
GridView grvListaDatosCantonalesTemp, grvCantonalesADTemp;
|
|||
|
|
|
|||
|
|
oficinaayaBL objOficinaBL;
|
|||
|
|
AutenticacionBL objAutenticacionBL;
|
|||
|
|
UsuarioRolBL objUsuarioRolBL;
|
|||
|
|
RolItemMenuComandoBL objRolItemMenuComandoBL;
|
|||
|
|
|
|||
|
|
|
|||
|
|
AplicacionBL objAplicacionBL;
|
|||
|
|
RolBL objRolBL;
|
|||
|
|
regionBL objRegionBL;
|
|||
|
|
usuarioBL objUsuarioBL;
|
|||
|
|
ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
|
|||
|
|
UsuarioBL objUsuarioAyABL;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Formulario (R2)
|
|||
|
|
|
|||
|
|
protected void Page_Load(object sender, EventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
//Este codigo es para obligar al boton a hacer un postback completo y no uno parcial que se da cuando el boton esta dentro del updatepanel
|
|||
|
|
ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnImprimir);
|
|||
|
|
if ((!IsPostBack) && (Session.Count > 0))
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
llenarDDLregion();
|
|||
|
|
llenarDDLjefatura();
|
|||
|
|
llenarTipoDependencia();
|
|||
|
|
llenarDDLProvincia();
|
|||
|
|
llenarDDLCanton();
|
|||
|
|
llenarDDLDistrito();
|
|||
|
|
ComandosxMenu();
|
|||
|
|
}
|
|||
|
|
// Trace.IsEnabled = true;
|
|||
|
|
|
|||
|
|
// string strURL = Request.Url.AbsoluteUri.Replace("http://" + Request.Url.Authority + Request.ApplicationPath.ToString(), "~/").ToString().Replace("//", "/");
|
|||
|
|
// Trace.Write(strURL);
|
|||
|
|
// strURL = strURL.Replace(".aspx", string.Empty);
|
|||
|
|
|
|||
|
|
// Trace.Write(strURL);
|
|||
|
|
////Trace.Write(ViewState["MODO"].ToString());
|
|||
|
|
//Trace.Write(ViewState["PUEDEMODIFICAR"].ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R2M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Controles Web (R3)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para extraer información del registro de la base de datos y ser mostrado en el acordeon de Controles
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void grvListaDatosUsuarios_RowCommand(object sender, GridViewCommandEventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (e.CommandName == "editar")
|
|||
|
|
{
|
|||
|
|
llenarDDLjefatura();
|
|||
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|||
|
|
GridViewRow selectedRow = grvListaDatosUsuarios.Rows[i];
|
|||
|
|
int intPKDEPENDENCIASIGDD = Convert.ToInt32(selectedRow.Cells[2].Text);
|
|||
|
|
ViewState["PKDEPENDENCIASIGDD"] = intPKDEPENDENCIASIGDD;
|
|||
|
|
ViewState["MODO"] = "Modifica";
|
|||
|
|
|
|||
|
|
mostrarFilaTabla(2);
|
|||
|
|
|
|||
|
|
mostrarDatos(intPKDEPENDENCIASIGDD);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para la paginación del Grid en caso de que el usuario desee ver mas registros
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void grvListaDatosUsuarios_PageIndexChanging(object sender, GridViewPageEventArgs e) //M3
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvListaDatosUsuarios.PageIndex = e.NewPageIndex;
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M3", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
///<summary>
|
|||
|
|
///Activar el botón de Refrescar
|
|||
|
|
///</summary>
|
|||
|
|
///<param name="sender"></param>
|
|||
|
|
///<param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void btnRefrescar_Click(object sender, System.Web.UI.ImageClickEventArgs e) //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M4" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Activa el evento del botón Buscar (binoculares)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void btnBuscar_Click(object sender, System.Web.UI.ImageClickEventArgs e) //M7
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch(Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M7" + MensajesAplicacion.UsuarioInexistente.ToString(), ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Activa el evento del boton Nuevo
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void btnNuevo_Click(object sender, EventArgs e) //M8
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
ViewState["MODO"] = "Nuevo";
|
|||
|
|
mostrarFilaTabla(2);
|
|||
|
|
//Limpia el grid de Active Directory
|
|||
|
|
|
|||
|
|
ddlRegion.Focus();
|
|||
|
|
ddlTipoDependencia.Focus();
|
|||
|
|
ddlJefatura.Focus();
|
|||
|
|
ddlProvincia.Focus();
|
|||
|
|
ddlCanton.Focus();
|
|||
|
|
ddlDistrito.Focus();
|
|||
|
|
limpiarCampos();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M8" + MensajesAplicacion.GuardadoFallido.ToString(), ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que activa el botón de Eliminar
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void btnActivar_Click(object sender, EventArgs e) //M9
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
foreach (GridViewRow row in grvListaDatosUsuarios.Rows)
|
|||
|
|
{
|
|||
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|||
|
|
if (chkTemp != null)
|
|||
|
|
{
|
|||
|
|
// si el registro esta marcado
|
|||
|
|
if (chkTemp.Checked)
|
|||
|
|
{
|
|||
|
|
int intPkEliminar = Convert.ToInt32(row.Cells[2].Text);
|
|||
|
|
ActivarDesactivar(intPkEliminar);
|
|||
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
llenarGridView(true);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M9", ex);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Activa el evento del ddlApp para cargar el listado de roles de la aplicación seleccionada
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void ddlAplicacion_SelectedIndexChanged(object sender, EventArgs e) //M10
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarDDLregion();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M10", ex);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
///<summary>
|
|||
|
|
///Activa el metodo del boton Anterior, regresa a la primera fila de la tabla
|
|||
|
|
///</summary>
|
|||
|
|
///<param name="sender"></param>
|
|||
|
|
///<param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void btnAnterior_Click(object sender, EventArgs e) //M12
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
divDatosSuperiores.Visible = true;
|
|||
|
|
divDatosMedios.Visible = false;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M12", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Activa el evento del boton guardar.1
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
protected void btnGuardar_Click(object sender, EventArgs e) //M14
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//if (Page.IsValid)
|
|||
|
|
{
|
|||
|
|
if (txtCantonal.Text != "" && ddlRegion.SelectedValue != "-1" && ddlJefatura.SelectedValue != "-1" && ddlTipoDependencia.SelectedValue != "-1"
|
|||
|
|
&& ddlProvincia.SelectedValue != "-1" && ddlCanton.SelectedValue != "-1" && ddlDistrito.SelectedValue != "-1")
|
|||
|
|
{
|
|||
|
|
int pkRegistro = GuardarDatos();
|
|||
|
|
llenarGridView(true);
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
|
|||
|
|
|
|||
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString() + ViewState["MODO"].ToString() + ViewState["PUEDEMODIFICAR"].ToString() + pkRegistro.ToString());
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MensajeAlerta("Debe seleccionar todos los campos antes de guardar la información.");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M14", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Imprime el contendo del gridview
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void Imprimir(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
condicionesBusqueda();
|
|||
|
|
|
|||
|
|
DataSet dsCantonales = objOficinaBL.dsListaCantonal(arlCondicionesFiltroBusqueda);
|
|||
|
|
|
|||
|
|
DataTable dt = dsCantonales.Tables[0];
|
|||
|
|
String FileName = "Reporte Dependencias";
|
|||
|
|
|
|||
|
|
if (dt.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string filename = "Dependencias" + ".xls";
|
|||
|
|
System.IO.StringWriter tw = new System.IO.StringWriter();
|
|||
|
|
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
|
|||
|
|
DataGrid dgGrid = new DataGrid();
|
|||
|
|
dgGrid.DataSource = dt;
|
|||
|
|
dgGrid.DataBind();
|
|||
|
|
|
|||
|
|
//Get the HTML for the control.
|
|||
|
|
dgGrid.RenderControl(hw);
|
|||
|
|
//Write the HTML back to the browser.
|
|||
|
|
//Response.ContentType = application/vnd.ms-excel;
|
|||
|
|
Response.ContentType = "application/vnd.ms-excel";
|
|||
|
|
Response.AppendHeader("Content-Disposition",
|
|||
|
|
"inline; filename=" + filename + "");
|
|||
|
|
this.EnableViewState = false;
|
|||
|
|
Response.Write(tw.ToString());
|
|||
|
|
Response.End();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Imprime el contendo del gridview
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
|
|||
|
|
|
|||
|
|
protected void ddlJefatura_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
objUsuarioBL = new usuarioBL();
|
|||
|
|
|
|||
|
|
objUsuarioBL.objusuarioEL.PK = Int32.Parse(ddlJefatura.SelectedValue);
|
|||
|
|
|
|||
|
|
txtCorreo.Text = objUsuarioBL.strUsuario() + "@aya.go.cr";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void ddlProvincia_SelectedIndexChanged(object sender, EventArgs e) //M8
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarDDLCanton();
|
|||
|
|
llenarDDLDistrito();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M9", ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
//EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void ddlCanton_SelectedIndexChanged(object sender, EventArgs e) //M10
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarDDLDistrito();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M11", ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void ddlDistrito_SelectedIndexChanged(object sender, EventArgs e) //M9
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M11", ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
// EjecutarScript("inicializaAcordeon('datosCliente');"); //esta linea es para que se limpie el acordeon y se posicione sobre la pestanna actual ya que se pierde al hacer postback
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Personalizados (R4)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Oculta las filas que lo requieran
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intFila"></param>
|
|||
|
|
private void mostrarFilaTabla(int p_intFila) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
divDatosSuperiores.Visible = false;
|
|||
|
|
divDatosMedios.Visible = false;
|
|||
|
|
|
|||
|
|
|
|||
|
|
switch (p_intFila)
|
|||
|
|
{
|
|||
|
|
case 1:
|
|||
|
|
llenarGridView(true);
|
|||
|
|
divDatosSuperiores.Visible = true;
|
|||
|
|
break;
|
|||
|
|
case 2:
|
|||
|
|
llenarGridView(true);
|
|||
|
|
divDatosMedios.Visible = true;
|
|||
|
|
break;
|
|||
|
|
case 3:
|
|||
|
|
llenarGridView(true);
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para contruir el Grid al inicio de la pantalla
|
|||
|
|
/// </summary>
|
|||
|
|
private void construirGridView() //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvListaDatosCantonalesTemp = (GridView)tdLista.FindControl("grvListaDatosUsuarios");
|
|||
|
|
|
|||
|
|
GridViewBoundField bdfPKDEPENDENCIA = new GridViewBoundField("PKDEPENDENCIASIGDD", "PK", false, false, false);
|
|||
|
|
GridViewBoundField bdfDESCRIPCION = new GridViewBoundField("DESCRIPCIONDEPENDENCIASIGDD", "Dependencias", true, false, true);
|
|||
|
|
GridViewBoundField bdfRegion = new GridViewBoundField("DESCRIPCIONREGION", "Región", true, false, true);
|
|||
|
|
GridViewBoundField bdfDependencia = new GridViewBoundField("DESCRIPCIONTIPODEPENDENCIA", "Cobertura", true, false, true);
|
|||
|
|
GridViewBoundField bdfTELEFONO = new GridViewBoundField("TELEFONODEPENDENCIASIGDD", "Teléfono", true, false, true);
|
|||
|
|
GridViewBoundField bdfFAX = new GridViewBoundField("FAXDEPENDENCIASIGDD", "Fax", true, false, true);
|
|||
|
|
GridViewBoundField bdfAPARTADO = new GridViewBoundField("APARTADODEPENDENCIASIGDD", "Apartado", true, false, true);
|
|||
|
|
GridViewBoundField bdfASTATE = new GridViewBoundField("ASTATEDEPENDENCIASIGDD", "Activo", true, "Si", "No", true);
|
|||
|
|
GridViewBoundField bdfUSUARIO = new GridViewBoundField("USUARIOUSUARIOXDEPENDENCIA", "correo", false, false, false);
|
|||
|
|
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfPKDEPENDENCIA);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfDESCRIPCION);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfRegion);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfDependencia);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfTELEFONO);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfFAX);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfAPARTADO);
|
|||
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfASTATE);
|
|||
|
|
//grvListaDatosCantonalesTemp.Columns.Add(bdfUSUARIO);
|
|||
|
|
|
|||
|
|
|
|||
|
|
grvListaDatosCantonalesTemp.Columns[0].ItemStyle.Width = 25;
|
|||
|
|
grvListaDatosCantonalesTemp.Columns[1].ItemStyle.Width = 25;
|
|||
|
|
|
|||
|
|
cuwBusquedaList.LlenarCHKLBusqueda(grvListaDatosCantonalesTemp);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se encarga de agregar el filtro de busqueda seleccionado por el usuario
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private void condicionesBusqueda() //M2
|
|||
|
|
{
|
|||
|
|
objOficinaBL = new oficinaayaBL();
|
|||
|
|
CondicionDAL condicion;
|
|||
|
|
DateTime dteFechaInicio = new DateTime();
|
|||
|
|
DateTime dteFechaFin = new DateTime();
|
|||
|
|
ListItem li = new ListItem();
|
|||
|
|
string p_parametros;
|
|||
|
|
p_parametros = this.cuwBusquedaList.getValorBusqueda();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (p_parametros != "")
|
|||
|
|
{
|
|||
|
|
//aqui se construye el listItem con los datos que vienen del control en formato {valor : texto , valor : texto}
|
|||
|
|
char[] separadorTuplas = { ',' };
|
|||
|
|
char[] separadorValores = { ':' };
|
|||
|
|
string[] arrayTupla = p_parametros.Split(separadorTuplas);
|
|||
|
|
|
|||
|
|
for (int i = 0; i <= (arrayTupla.Length - 1); i++)
|
|||
|
|
{
|
|||
|
|
if (arrayTupla[i].ToString() != "")
|
|||
|
|
{
|
|||
|
|
string[] arrayValores = arrayTupla[i].ToString().Split(separadorValores);
|
|||
|
|
li = new ListItem(arrayValores[1], arrayValores[0]);
|
|||
|
|
|
|||
|
|
if (li.Value.Contains("FECHA") && li.Text != string.Empty)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (li.Value.Contains("INICIO"))
|
|||
|
|
{
|
|||
|
|
dteFechaInicio = Convert.ToDateTime(li.Text.ToString());
|
|||
|
|
}
|
|||
|
|
if (li.Value.Contains("FIN"))
|
|||
|
|
{
|
|||
|
|
dteFechaFin = Convert.ToDateTime(li.Text.ToString());
|
|||
|
|
|
|||
|
|
if (dteFechaFin != null || dteFechaInicio != null)
|
|||
|
|
if (dteFechaInicio < dteFechaFin || dteFechaFin == dteFechaInicio)
|
|||
|
|
{
|
|||
|
|
objOficinaBL = new oficinaayaBL();
|
|||
|
|
arlCondicionesFiltroBusqueda = objOficinaBL.buscarPorFechas(Tablas.dependenciasigdd, dteFechaInicio, dteFechaFin, operadorLogico.AND, arlCondicionesFiltroBusqueda);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + "Verifique que la Fecha de Inicio sea menor que la Fecha Final" + "M2");
|
|||
|
|
else
|
|||
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + "Verifique que los campos de las fechas no estén vacíos" + "M2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (li.Value.Contains("booleano") && li.Text != "2")
|
|||
|
|
{
|
|||
|
|
condicion = new CondicionDAL();
|
|||
|
|
char[] separadorColumna = { '|' };
|
|||
|
|
string[] strColumna = li.Value.Split(separadorColumna);
|
|||
|
|
condicion.valorIzquierdo = strColumna[1].ToString();
|
|||
|
|
condicion.operadorGeneral = operadorGeneral.EQUAL;
|
|||
|
|
condicion.operadorLogico = operadorLogico.AND;
|
|||
|
|
condicion.valorDerecho = li.Text.Trim();
|
|||
|
|
arlCondicionesFiltroBusqueda.Add(condicion);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (li.Text != string.Empty && !li.Value.Contains("booleano"))
|
|||
|
|
{
|
|||
|
|
condicion = new CondicionDAL();
|
|||
|
|
condicion.valorIzquierdo = li.Value;
|
|||
|
|
condicion.operadorGeneral = operadorGeneral.LIKEALL;
|
|||
|
|
condicion.operadorLogico = operadorLogico.AND;
|
|||
|
|
condicion.valorDerecho = "%" + li.Text.Trim() + "%";
|
|||
|
|
arlCondicionesFiltroBusqueda.Add(condicion);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza con el buscador de la parte superior de la pantalla, y hace que se despliegue la información de acuerdo
|
|||
|
|
/// a lo solicitado
|
|||
|
|
/// </summary>|
|
|||
|
|
private void Buscar() //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llenarGridView(true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Metodo que se utiliza para el despliegue de los botones
|
|||
|
|
/// </summary>
|
|||
|
|
private void ComandosxMenu() //M6
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DataSet dsComandos = getComandos();
|
|||
|
|
|
|||
|
|
if (dsComandos != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
|
|||
|
|
{
|
|||
|
|
case "NUEVO":
|
|||
|
|
btnNuevo.Visible = true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "MODIFICA":
|
|||
|
|
//Inicio de variable tipo VIEWSTATE
|
|||
|
|
ViewState["PUEDEMODIFICAR"] = true;
|
|||
|
|
btnGuardar.Visible = true;
|
|||
|
|
btnActivar.Visible = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Limpia los campos
|
|||
|
|
/// </summary>
|
|||
|
|
private void limpiarCampos()
|
|||
|
|
{
|
|||
|
|
txtApartado.Text = string.Empty;
|
|||
|
|
txtCantonal.Text = string.Empty;
|
|||
|
|
txtDireccion.Text = string.Empty;
|
|||
|
|
txtFax.Text = string.Empty;
|
|||
|
|
txtTelefono.Text = string.Empty;
|
|||
|
|
ddlRegion.SelectedValue = "-1";
|
|||
|
|
ddlJefatura.SelectedValue = "-1";
|
|||
|
|
ddlTipoDependencia.SelectedValue = "-1";
|
|||
|
|
ddlProvincia.SelectedValue = "-1";
|
|||
|
|
ddlCanton.SelectedValue = "-1";
|
|||
|
|
ddlDistrito.SelectedValue = "-1";
|
|||
|
|
txtCorreo.Text = string.Empty;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Controles a Datos (R5)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// guarda y modifica registros en la tabla.
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private int GuardarDatos() //M0
|
|||
|
|
{
|
|||
|
|
int nValorRetornado = 0;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string strModo = ViewState["MODO"].ToString();
|
|||
|
|
|
|||
|
|
objOficinaBL = new oficinaayaBL();
|
|||
|
|
//objOficinaBL.objoficinaayaEL.CODCANTONAL = Int32.Parse(ddlRegion.SelectedValue);
|
|||
|
|
objOficinaBL.objoficinaayaEL.DESCRIPCION = txtCantonal.Text;
|
|||
|
|
objOficinaBL.objoficinaayaEL.DIRECCION = txtDireccion.Text;
|
|||
|
|
objOficinaBL.objoficinaayaEL.TELEFONO = txtTelefono.Text;
|
|||
|
|
objOficinaBL.objoficinaayaEL.FAX = txtFax.Text;
|
|||
|
|
objOficinaBL.objoficinaayaEL.APARTADO = txtApartado.Text;
|
|||
|
|
objOficinaBL.objoficinaayaEL.ASTATE = true;
|
|||
|
|
objOficinaBL.objoficinaayaEL.FECHA = DateTime.Now;
|
|||
|
|
objOficinaBL.objoficinaayaEL.USUARIOXDEPENDENCIA = Int32.Parse(ddlJefatura.SelectedValue);//asumo que este es el campo de jefatura Session["LOGIN"].ToString();
|
|||
|
|
objOficinaBL.objoficinaayaEL.TIPODEPENDENCIA = Int32.Parse(ddlTipoDependencia.SelectedValue);
|
|||
|
|
objOficinaBL.objoficinaayaEL.REGION = Int32.Parse(ddlRegion.SelectedValue);
|
|||
|
|
objOficinaBL.objoficinaayaEL.FKPROVINCIA = Int32.Parse(ddlProvincia.SelectedValue);
|
|||
|
|
objOficinaBL.objoficinaayaEL.FKCANTON = Int32.Parse(ddlCanton.SelectedValue);
|
|||
|
|
objOficinaBL.objoficinaayaEL.FKDISTRITO = Int32.Parse(ddlDistrito.SelectedValue);
|
|||
|
|
|
|||
|
|
if (strModo == "Nuevo")
|
|||
|
|
{
|
|||
|
|
nValorRetornado = objOficinaBL.insertarOficina();
|
|||
|
|
llenarDDLregion();
|
|||
|
|
llenarDDLjefatura();
|
|||
|
|
llenarTipoDependencia();
|
|||
|
|
llenarDDLProvincia();
|
|||
|
|
llenarDDLCanton();
|
|||
|
|
llenarDDLDistrito();
|
|||
|
|
limpiarCampos();
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ha ingresado la cantonal " + txtCantonal.Text.Trim(),
|
|||
|
|
"frwDependencias.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (strModo == "Modifica" && bool.Parse(ViewState["PUEDEMODIFICAR"].ToString()) == true)
|
|||
|
|
{
|
|||
|
|
objOficinaBL.objoficinaayaEL.PK = Convert.ToInt32(ViewState["PKDEPENDENCIASIGDD"]);
|
|||
|
|
nValorRetornado = objOficinaBL.modificarOficina();
|
|||
|
|
//llenarDDLregion();
|
|||
|
|
//llenarDDLjefatura();
|
|||
|
|
//llenarTipoDependencia();
|
|||
|
|
//llenarDDLProvincia();
|
|||
|
|
//llenarDDLCanton();
|
|||
|
|
//llenarDDLDistrito();
|
|||
|
|
//limpiarCampos();
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ha modificado la cantonal " + txtCantonal.Text.Trim(),
|
|||
|
|
"frwCantonales.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return nValorRetornado;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Activa o desactiva el usuario
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
|
|||
|
|
private bool ActivarDesactivar(int p_intPkEliminar) //M2
|
|||
|
|
{
|
|||
|
|
bool blnValorRetornado = false;
|
|||
|
|
bool blnActivo = false;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
objOficinaBL = new oficinaayaBL();
|
|||
|
|
objOficinaBL.objoficinaayaEL.PK = p_intPkEliminar;
|
|||
|
|
DataSet dsOficinasDS = objOficinaBL.listarOficinas(null, false, null);
|
|||
|
|
|
|||
|
|
//Verifica que el usuario se encuentre en la BD
|
|||
|
|
if (dsOficinasDS.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
//Si esta activado que lo desactive
|
|||
|
|
if (Convert.ToBoolean(dsOficinasDS.Tables[0].Rows[0][Concepto.ASTATE.ToString() + Tablas.dependenciasigdd.ToString()]))
|
|||
|
|
blnActivo = false;
|
|||
|
|
//Si esta desactivado que lo active
|
|||
|
|
else
|
|||
|
|
blnActivo = true;
|
|||
|
|
|
|||
|
|
objOficinaBL.objoficinaayaEL.ASTATE = blnActivo;
|
|||
|
|
//objOficinaBL.objoficinaayaEL.PK = (int) dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigpc.PK.ToString() + Tablas.dependenciasigpc.ToString()];
|
|||
|
|
objOficinaBL.objoficinaayaEL.DESCRIPCION = dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.DESCRIPCION.ToString() + Tablas.dependenciasigdd.ToString()].ToString();
|
|||
|
|
objOficinaBL.objoficinaayaEL.DIRECCION = dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.DIRECCION.ToString() + Tablas.dependenciasigdd.ToString()].ToString();
|
|||
|
|
objOficinaBL.objoficinaayaEL.TELEFONO = dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.TELEFONO.ToString() + Tablas.dependenciasigdd.ToString()].ToString();
|
|||
|
|
objOficinaBL.objoficinaayaEL.FAX = dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FAX.ToString() + Tablas.dependenciasigdd.ToString()].ToString();
|
|||
|
|
objOficinaBL.objoficinaayaEL.APARTADO = dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.APARTADO.ToString() + Tablas.dependenciasigdd.ToString()].ToString();
|
|||
|
|
objOficinaBL.objoficinaayaEL.FECHA = Convert.ToDateTime(dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FECHAINGRESO.ToString() + Tablas.dependenciasigdd.ToString()]);
|
|||
|
|
objOficinaBL.objoficinaayaEL.USUARIOXDEPENDENCIA = (int)dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FKUSUARIOXDEPENDENCIA.ToString()];
|
|||
|
|
objOficinaBL.objoficinaayaEL.TIPODEPENDENCIA = (int)dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FKTIPODEPENDENCIA.ToString()];
|
|||
|
|
objOficinaBL.objoficinaayaEL.REGION = (int) dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FKREGION.ToString()];
|
|||
|
|
objOficinaBL.objoficinaayaEL.FKPROVINCIA = (int)dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FKPROVINCIA.ToString()];
|
|||
|
|
objOficinaBL.objoficinaayaEL.FKCANTON = (int)dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FKCANTON.ToString()];
|
|||
|
|
objOficinaBL.objoficinaayaEL.FKDISTRITO = (int)dsOficinasDS.Tables[0].Rows[0][t_adm_dependenciasigdd.FKDISTRITO.ToString()];
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
objOficinaBL.modificarOficina();
|
|||
|
|
}
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.ModificarRegistro + ": Se ha puesto el registro de la PK=" + p_intPkEliminar + " en " + blnActivo,
|
|||
|
|
"frwDependencias.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return blnValorRetornado;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Datos a Controles (R6)
|
|||
|
|
/// <summary>
|
|||
|
|
/// Carga el grid principal
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_Llenar"></param>
|
|||
|
|
private void llenarGridView(bool p_Llenar) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack || p_Llenar)
|
|||
|
|
{
|
|||
|
|
condicionesBusqueda();
|
|||
|
|
|
|||
|
|
DataSet dsCantonales = objOficinaBL.dsListaCantonal(arlCondicionesFiltroBusqueda);
|
|||
|
|
General.detalleGridView(dsCantonales, grvListaDatosCantonalesTemp, lblTotalDatos);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Muestra los datos del registro
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intPkConsultar"></param>
|
|||
|
|
private void mostrarDatos(int p_intPkConsultar) //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
objOficinaBL = new oficinaayaBL();
|
|||
|
|
objOficinaBL.objoficinaayaEL.PK = p_intPkConsultar;
|
|||
|
|
DataSet dsUsuario = objOficinaBL.dsListaCantonal(null);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (dsUsuario.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
//Información de la cantonal
|
|||
|
|
ddlRegion.SelectedValue = dsUsuario.Tables[0].Rows[0]["PKREGION"].ToString();
|
|||
|
|
ddlTipoDependencia.SelectedValue = dsUsuario.Tables[0].Rows[0]["PKTIPODEPENDENCIA"].ToString();
|
|||
|
|
ddlJefatura.SelectedValue = dsUsuario.Tables[0].Rows[0]["PKUSUARIOXDEPENDENCIA"].ToString();
|
|||
|
|
txtCantonal.Text = dsUsuario.Tables[0].Rows[0]["DESCRIPCIONDEPENDENCIASIGDD"].ToString();
|
|||
|
|
txtDireccion.Text = dsUsuario.Tables[0].Rows[0]["DIRECCIONDEPENDENCIASIGDD"].ToString();
|
|||
|
|
txtTelefono.Text = dsUsuario.Tables[0].Rows[0]["TELEFONODEPENDENCIASIGDD"].ToString();
|
|||
|
|
txtFax.Text = dsUsuario.Tables[0].Rows[0]["FAXDEPENDENCIASIGDD"].ToString();
|
|||
|
|
txtApartado.Text = dsUsuario.Tables[0].Rows[0]["APARTADODEPENDENCIASIGDD"].ToString();
|
|||
|
|
txtCorreo.Text = dsUsuario.Tables[0].Rows[0]["USUARIOUSUARIOXDEPENDENCIA"].ToString() + "@aya.go.cr";
|
|||
|
|
ddlProvincia.SelectedValue = dsUsuario.Tables[0].Rows[0]["PKPROVINCIA"].ToString();
|
|||
|
|
llenarDDLCanton();
|
|||
|
|
ddlCanton.SelectedValue = dsUsuario.Tables[0].Rows[0]["PKCANTON"].ToString();
|
|||
|
|
llenarDDLDistrito();
|
|||
|
|
ddlDistrito.SelectedValue = dsUsuario.Tables[0].Rows[0]["PKDISTRITO"].ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Muestra los datos del registro
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intPkConsultar"></param>
|
|||
|
|
|
|||
|
|
//private void mostrarcorreo(int p_intPkConsultar) //M2 -- Para desplegar correo.
|
|||
|
|
//{
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
|
|||
|
|
// //objOficinaBL = new oficinaayaBL();
|
|||
|
|
// //objOficinaBL.objoficinaayaEL.PK = p_intPkConsultar;
|
|||
|
|
// //DataSet dsUsuario = objOficinaBL.dsListaCantonal(null);
|
|||
|
|
|
|||
|
|
// objUsuarioAyABL = new UsuarioBL();
|
|||
|
|
// objUsuarioAyABL.objUsuarioEL.PK = p_intPkConsultar;
|
|||
|
|
// DataSet ds2 = objUsuarioAyABL.dsListaUsuarios(null);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if (ds2.Tables[0].Rows.Count > 0)
|
|||
|
|
// {
|
|||
|
|
// ////Información del correo
|
|||
|
|
// //ddlJefatura.SelectedValue = ds2.Tables[0].Rows[0]["CORREO"].ToString();
|
|||
|
|
// txtCorreo.Text = ds2.Tables[0].Rows[0]["CORREO"].ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// catch (Exception ex)
|
|||
|
|
// {
|
|||
|
|
// throw ex;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de Cantonales según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarDDLregion() //M2
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlRegion.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
objRegionBL = new regionBL ();
|
|||
|
|
//Asigna datos al atributo
|
|||
|
|
|
|||
|
|
objRegionBL.objregionEL.PK = 0;
|
|||
|
|
objRegionBL.objregionEL.Descripcion = "";
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
DataSet dsRegion = objRegionBL.dsListaRegiones(arlCondicionesFiltroBusqueda);
|
|||
|
|
if (dsRegion.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlRegion.DataSource = dsRegion;
|
|||
|
|
ddlRegion.DataTextField = dsRegion.Tables[0].Columns["DESCRIPCIONREGION"].ColumnName;
|
|||
|
|
ddlRegion.DataValueField = dsRegion.Tables[0].Columns["PKREGION"].ColumnName;
|
|||
|
|
ddlRegion.DataBind();
|
|||
|
|
|
|||
|
|
ddlRegion.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
ddlRegion.Items.Insert(0, new ListItem("----- Vacio -----", "-1"));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de Cantonales según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarDDLjefatura() //M3
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlJefatura.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
objUsuarioBL = new usuarioBL();
|
|||
|
|
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
DataSet dsRegion = objUsuarioBL.dsListaUsuariosJefatura(arlCondicionesFiltroBusqueda);
|
|||
|
|
|
|||
|
|
objUsuarioAyABL = new UsuarioBL();
|
|||
|
|
DataSet ds2 = objUsuarioAyABL.dsListaUsuarios(arlCondicionesFiltroBusqueda);
|
|||
|
|
|
|||
|
|
DataTable dtJefes = new DataTable();
|
|||
|
|
dtJefes.Columns.Add("PKUSUARIOXDEPENDENCIA");
|
|||
|
|
//dtJefes.Columns.Add("USUARIOUSUARIOXDEPENDENCIA");
|
|||
|
|
dtJefes.Columns.Add("NOMBRECOMPLETO");
|
|||
|
|
|
|||
|
|
if (dsRegion.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow row in dsRegion.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow rowUsuario in ds2.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
var region = row[1].ToString();
|
|||
|
|
var Usuario = rowUsuario[1].ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (row[1].ToString() == rowUsuario[1].ToString())
|
|||
|
|
{
|
|||
|
|
DataRow rowFinal = dtJefes.NewRow();
|
|||
|
|
rowFinal["PKUSUARIOXDEPENDENCIA"] = row[0].ToString();
|
|||
|
|
//rowFinal["USUARIOUSUARIOXDEPENDENCIA"] = row[1].ToString();
|
|||
|
|
rowFinal["NOMBRECOMPLETO"] = rowUsuario[12].ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
dtJefes.Rows.Add(rowFinal);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (dtJefes.Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlJefatura.DataSource = dtJefes;
|
|||
|
|
ddlJefatura.DataTextField = dtJefes.Columns["NOMBRECOMPLETO"].ColumnName;
|
|||
|
|
//ddlJefatura.DataTextField = dtJefes.Columns["USUARIOUSUARIOXDEPENDENCIA"].ColumnName;
|
|||
|
|
ddlJefatura.DataValueField = dtJefes.Columns["PKUSUARIOXDEPENDENCIA"].ColumnName;
|
|||
|
|
|
|||
|
|
|
|||
|
|
ddlJefatura.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
ddlJefatura.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
else
|
|||
|
|
ddlJefatura.Items.Insert(0, new ListItem("----- Vacio -----", "-1"));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de grado academico según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarTipoDependencia() //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlTipoDependencia.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
|
|||
|
|
oficinaayaBL objoficinaayaBL;
|
|||
|
|
objoficinaayaBL = new oficinaayaBL();
|
|||
|
|
|
|||
|
|
//Asigna datos al atributo
|
|||
|
|
|
|||
|
|
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
|
|||
|
|
|
|||
|
|
DataSet dsDependencia = objoficinaayaBL.dsListaTipoDependencia(null);
|
|||
|
|
|
|||
|
|
if (dsDependencia.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlTipoDependencia.DataSource = dsDependencia;
|
|||
|
|
ddlTipoDependencia.DataTextField = dsDependencia.Tables[0].Columns["DESCRIPCIONTIPODEPENDENCIA"].ColumnName;
|
|||
|
|
ddlTipoDependencia.DataValueField = dsDependencia.Tables[0].Columns["PKTIPODEPENDENCIA"].ColumnName;
|
|||
|
|
ddlTipoDependencia.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
ddlTipoDependencia.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
ddlTipoDependencia.Items.Insert(0, new ListItem("---- - Vacio-----", "-1"));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de grado academico según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarDDLProvincia() //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlProvincia.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
|
|||
|
|
provinciaBL objprovinciaBL = new provinciaBL();
|
|||
|
|
//Asigna datos al atributo
|
|||
|
|
|
|||
|
|
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
|
|||
|
|
|
|||
|
|
DataSet ds = objprovinciaBL.dsListaProvincias(null);
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlProvincia.DataSource = ds;
|
|||
|
|
ddlProvincia.DataTextField = ds.Tables[0].Columns["DESCRIPCIONPROVINCIA"].ColumnName;
|
|||
|
|
ddlProvincia.DataValueField = ds.Tables[0].Columns["PKPROVINCIA"].ColumnName;
|
|||
|
|
ddlProvincia.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
ddlProvincia.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
|
|||
|
|
ddlProvincia.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de grado academico según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarDDLCanton() //M5
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlCanton.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
|
|||
|
|
cantonBL objcantonBL = new cantonBL();
|
|||
|
|
//Asigna datos al atributo
|
|||
|
|
|
|||
|
|
objcantonBL.objcantonEL.FKPROVINCIA = int.Parse(ddlProvincia.SelectedValue);
|
|||
|
|
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
|
|||
|
|
|
|||
|
|
DataSet ds = objcantonBL.dsListaCanton(null);
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlCanton.DataSource = ds;
|
|||
|
|
ddlCanton.DataTextField = ds.Tables[0].Columns["DESCRIPCIONCANTON"].ColumnName;
|
|||
|
|
ddlCanton.DataValueField = ds.Tables[0].Columns["PKCANTON"].ColumnName;
|
|||
|
|
ddlCanton.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
ddlCanton.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ddlCanton.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Llena el dropdownlist de grado academico según la aplicación
|
|||
|
|
/// </summary>
|
|||
|
|
private void llenarDDLDistrito() //M6
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Limpia el control
|
|||
|
|
ddlDistrito.Items.Clear();
|
|||
|
|
//Instancia el bjeto
|
|||
|
|
|
|||
|
|
distritoBL objdistritoBL = new distritoBL();
|
|||
|
|
//Asigna datos al atributo
|
|||
|
|
objdistritoBL.objdistritoEL.FKCANTON = int.Parse(ddlCanton.SelectedValue);
|
|||
|
|
|
|||
|
|
//Carga la información en un dataset
|
|||
|
|
|
|||
|
|
|
|||
|
|
DataSet ds = objdistritoBL.dsListaDistritos(null);
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
ddlDistrito.DataSource = ds;
|
|||
|
|
ddlDistrito.DataTextField = ds.Tables[0].Columns["DESCRIPCIONDISTRITO"].ColumnName;
|
|||
|
|
ddlDistrito.DataValueField = ds.Tables[0].Columns["PKDISTRITO"].ColumnName;
|
|||
|
|
ddlDistrito.DataBind();
|
|||
|
|
|
|||
|
|
|
|||
|
|
ddlDistrito.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
ddlDistrito.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|