1714 lines
No EOL
79 KiB
C#
1714 lines
No EOL
79 KiB
C#
/*===========================================================================================================================
|
||
* Instituto Costarricense de Acueductos y Alcantarillados. - 2015
|
||
* Administración de la Seguridad
|
||
* Nombre de la Pantalla: frwBusquedaSolicitud.aspx
|
||
*
|
||
* Explicación de los contenidos del archivo
|
||
*===========================================================================================================================
|
||
* HISTORIAL
|
||
*
|
||
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
||
* Esteban Gutierrez Rapso 20 – 04 - 2015 Se inicia con el diseño de la pagina
|
||
* …………………………………………………………
|
||
* …………………………………………………………
|
||
*===========================================================================================================================
|
||
* Derechos Reservados (C) 2015 AyA.
|
||
* ESTE CÓDIGO ES PROVEÍDO “TAL CUAL ES” SIN GARANTÍA ALGUNA
|
||
* DE NINGÚN TIPO, SEA IMPLICITA O EXPLICITA.
|
||
* NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL, NI SU COMERCIALIZACIÓN
|
||
*===========================================================================================================================
|
||
*/
|
||
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Web.UI.HtmlControls;
|
||
|
||
using AyABL;
|
||
|
||
using AyABL.AUT.Autenticacion;
|
||
using AyABL.APL;
|
||
using AyADAL;
|
||
using System.Configuration;
|
||
using AyABL.RCS;
|
||
using AyABL.Tran;
|
||
using AyABL.Usuario;
|
||
using AyABL.AUT.Encripta;
|
||
using System.Globalization;
|
||
using AyABL.TRA;
|
||
using System.IO;
|
||
|
||
|
||
public partial class Forms_Trans_frwProgramacionTrabajo : 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 grvListaDatosTemp;
|
||
//string strPKProgramacionSolicitudTMP = "";
|
||
#region variables del estandar
|
||
ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
|
||
#endregion
|
||
|
||
solicitudBL objSolicitudBL;
|
||
//oficinaayaBL objDependenciaBL;
|
||
//regionBL objRegionBL;
|
||
solicitudBL objresponsableActividadBL;
|
||
int nPkSolicitud = 0;
|
||
#endregion
|
||
|
||
#region Eventos Formulario (R2)
|
||
|
||
protected void Page_Load(object sender, EventArgs e) //M0
|
||
{
|
||
try
|
||
|
||
{
|
||
lblMensajeConsulta.Visible = false;
|
||
//Session["Pagina"] = "frwCartaSolicitud.aspx";
|
||
if ((!IsPostBack) && (Session.Count > 0))
|
||
{
|
||
DateTime dteFechaInicio = new DateTime();
|
||
DateTime dteFechaFin = new DateTime();
|
||
lblMensajeConsulta.Visible = true;
|
||
dteFechaFin = DateTime.Now;
|
||
dteFechaInicio = dteFechaFin.AddMonths(-1);
|
||
|
||
AyABL.AyABL objBL = new AyABL.AyABL();
|
||
arlCondicionesFiltroBusqueda = objBL.buscarPorFechas(Tablas.insertasolicitud, DateTime.Now.AddDays(-10), DateTime.Now.AddDays(1), operadorLogico.AND, arlCondicionesFiltroBusqueda);
|
||
|
||
llenarGridViewPendientes(true,"10");
|
||
arlCondicionesFiltroBusqueda = null;
|
||
//llenarDDLActividades(true);
|
||
//llenarDDLEncargado(true);
|
||
lblTituloActividad.Text = "Seleccione una actividad";
|
||
|
||
lblEstadoA1.Text = "Sin seleccionar";
|
||
lblFechaIngresoA1.Text = "Sin seleccionar";
|
||
lblFechaResolucionA1.Text = "Sin seleccionar";
|
||
lblResponsableA1.Items.Add("Sin asignar");
|
||
mostrarFilaTabla(1);
|
||
ComandosxMenu();
|
||
}
|
||
if (Session.Count == 0)
|
||
Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
||
}
|
||
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 grvListaDatos_RowCommand(object sender, GridViewCommandEventArgs e) //M0
|
||
{
|
||
try
|
||
{
|
||
Session["PaginaBack"] = "frwProgramacionTrabajo.aspx";
|
||
if (e.CommandName == "editar")
|
||
{
|
||
EncriptaBL objEncripta = new EncriptaBL();
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaDatos.Rows[i];
|
||
Session["PKSOLICITUD"] = selectedRow.Cells[10].Text;
|
||
Session["SOLICITUD"] = selectedRow.Cells[3].Text;
|
||
Session["PKPROGRAMACION"] = selectedRow.Cells[2].Text;
|
||
Session["FKREUTILIZA"] = selectedRow.Cells[11].Text;
|
||
Session["FKTIPOINSPECCION"] = selectedRow.Cells[12].Text;
|
||
|
||
ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
|
||
if (Session["PKPROGRAMACION"].ToString() != " ") //se verifica que existe la programcicion de la solicitud
|
||
{
|
||
solicitudBL objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 1; //la activida de Ingreso y asignacion de expediente
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0) //se verifica que ya se haya asignado la actividad 1
|
||
{
|
||
Response.Redirect("~/forms/tra/frwNuevaSolicitud.aspx?" + "l=" + objEncripta.Encryptar(Session["LOGIN"].ToString()) + "&u=" + objEncripta.Encryptar(Session["PKUSUARIO"].ToString()) + "&d=deshabilitar");
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("No se han programado las actividades relacionadas con esta solicitud");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("No se han programado las actividades relacionadas con esta solicitud");
|
||
}
|
||
}
|
||
if (e.CommandName == "asignar")
|
||
{
|
||
// ClientScript.RegisterStartupScript(this.GetType(), "AbripPopup", "<script>javascript: abrirPopup();</script>");
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaDatos.Rows[i];
|
||
Session["PKPROGRAMACION"] = selectedRow.Cells[2].Text;
|
||
Session["SOLICITUD"] = selectedRow.Cells[3].Text;
|
||
Session["PKSOLICITUD"] = selectedRow.Cells[10].Text;
|
||
Session["FKTIPOINSPECCION"] = selectedRow.Cells[12].Text;
|
||
Session["FKDEPENDENCIASIGDD"] = selectedRow.Cells[13].Text;
|
||
if (Session["PKPROGRAMACION"].ToString() != " ") //se verifica que existe la programcicion de la solicitud
|
||
{
|
||
int pkSolicitud = int.Parse(selectedRow.Cells[2].Text);
|
||
llenarGridViewActividadesEncargado(pkSolicitud);
|
||
}
|
||
llenarDDLActividades(true);
|
||
llenarDDLEncargado(true);
|
||
EjecutarScript("VentanaAbrir();");
|
||
}
|
||
|
||
if (e.CommandName == "seguimiento")
|
||
{
|
||
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaDatos.Rows[i];
|
||
Session["PKPROGRAMACION"] = selectedRow.Cells[2].Text;
|
||
Session["FKTIPOINSPECCION"] = selectedRow.Cells[12].Text;
|
||
if (Session["PKPROGRAMACION"].ToString() != " ") //se verifica que existe la programcicion de la solicitud
|
||
{
|
||
int pkProgramacionSolicitud = int.Parse(selectedRow.Cells[2].Text);
|
||
Session["SOLICITUD"] = selectedRow.Cells[3].Text;
|
||
Session["PKSOLICITUD"] = selectedRow.Cells[10].Text;
|
||
EjecutarScript("VentanaAbrirActividades();");
|
||
CargarImagenesSeguimientoActividades(pkProgramacionSolicitud);
|
||
lblNumeroSolicitud.Text = selectedRow.Cells[3].Text;
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("No se han asignado las actividades a esta solicitud.");
|
||
}
|
||
|
||
}
|
||
}
|
||
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 grvListaDatos_PageIndexChanging(object sender, GridViewPageEventArgs e) //M1
|
||
{
|
||
try
|
||
{
|
||
grvListaDatos.PageIndex = e.NewPageIndex;
|
||
llenarGridViewPendientes(true, "1000");
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M1", 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) //M2
|
||
{
|
||
try
|
||
{
|
||
llenarGridViewPendientes(true, "10");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M2" + 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) //M3
|
||
{
|
||
try
|
||
{
|
||
llenarGridViewPendientes(true, "1000");
|
||
}
|
||
catch(Exception ex)
|
||
{
|
||
MensajeError("Error en R3M3" + MensajesAplicacion.UsuarioInexistente.ToString(), ex);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// Buscar usuarios en el Active Directory.
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
|
||
protected void btnBuscar_Click(object sender, EventArgs e) //M4
|
||
{
|
||
try
|
||
{
|
||
llenarGridViewPendientes(true, "1000");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M4" + MensajesAplicacion.BusquedaFallido.ToString(), ex);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Salir del popup
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSalirPopup_Click(object sender, EventArgs e) //M5
|
||
{
|
||
try
|
||
{
|
||
Session["PKPROGRAMACION"] = "";
|
||
EjecutarScript("VentanaCerrar();");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M5" + MensajesAplicacion.BusquedaFallido.ToString(), ex);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// Carga el combo de encargados
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ddlActividades_SelectedIndexChanged(object sender, EventArgs e) //M6
|
||
{
|
||
try
|
||
{
|
||
llenarDDLEncargado(true);
|
||
EjecutarScript("VentanaAbrir();");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M6" + MensajesAplicacion.BusquedaFallido.ToString(), ex);
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Asigna actividades a los usuarios
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAsignarActividades_Click(object sender, EventArgs e) //M7
|
||
{
|
||
try
|
||
{
|
||
|
||
ViewState["MODO"] = "Nuevo";
|
||
AsignaActividadesUsuarios();
|
||
|
||
llenarGridViewActividadesEncargado(int.Parse(Session["PKPROGRAMACION"].ToString()));
|
||
EjecutarScript("VentanaAbrir();;toastr.success('Se asignó la actividad exitosamente', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//MensajeError("Error en R3M7" + MensajesAplicacion.GuardadoFallido.ToString(), ex);
|
||
EjecutarScript("VentanaAbrir();;toastr.error('" + "Error en R3M7" + MensajesAplicacion.GuardadoFallido.ToString() + "', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
|
||
}
|
||
protected void btnFinalizar_Click(object sender, EventArgs e) //M8
|
||
{
|
||
try
|
||
{
|
||
string strAccion = string.Empty;
|
||
strAccion = verificarTarea2();
|
||
if (strAccion == "aprobar")
|
||
{
|
||
GuardarDatosActividad(verificarTarea2());
|
||
EjecutarScript("VentanaAbrir();;toastr.success('Se asignó la actividad exitosamente', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
else
|
||
{
|
||
EjecutarScript("VentanaAbrir();;toastr.warning('No se han asignado todas las actividades por lo que no se puede finalizar la actividad.', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
// MensajeError("Se presentó un error al finalizar la actividad.", ex);
|
||
EjecutarScript("VentanaAbrir();;toastr.error('" + "Error en R3M8" + MensajesAplicacion.GuardadoFallido.ToString() + "', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Metodo utilizado para eliminar las actividades asignadas al encargado
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void grvListaAsignaciones_RowCommand(object sender, GridViewCommandEventArgs e) //M8
|
||
{
|
||
try
|
||
{
|
||
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”";
|
||
|
||
|
||
if (e.CommandName == "borrar")
|
||
{
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaAsignaciones.Rows[i];
|
||
|
||
Session["PKACTIVIDAD"] = selectedRow.Cells[1].Text;
|
||
|
||
EliminarActividadesUsuarios(int.Parse(Session["PKACTIVIDAD"].ToString()));
|
||
|
||
llenarGridViewActividadesEncargado(int.Parse(Session["PKPROGRAMACION"].ToString()));
|
||
|
||
Session["PKACTIVIDAD"] = "";
|
||
EjecutarScript("VentanaAbrir();");
|
||
}
|
||
if (e.CommandName == "renotificar")
|
||
{
|
||
int i = Convert.ToInt32(e.CommandArgument);
|
||
GridViewRow selectedRow = grvListaAsignaciones.Rows[i];
|
||
AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
|
||
objcorreoBL.objcorreoEL.FKNUMSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
|
||
objcorreoBL.objcorreoEL.ASUNTO = "Asignación de actividades - SIGDD";
|
||
objcorreoBL.objcorreoEL.CONTENIDO = "La solicitud de disponibilidad " + Session["SOLICITUD"].ToString() + " fue enviada para que se continúe con el proceso de " + selectedRow.Cells[2].Text + ", ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin> SIGDD</a>" + strPiePagina;
|
||
objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(selectedRow.Cells[4].Text);
|
||
objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
||
|
||
int nValorRetornado = objcorreoBL.insertarCorreo();
|
||
#region actualizar actividad
|
||
GuardarDatosActividad(verificarTarea2());
|
||
#endregion
|
||
EjecutarScript("VentanaAbrir();toastr.success('Se envió la notificación al responsable', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M8", ex);
|
||
}
|
||
}
|
||
|
||
protected void grvListaDatos_RowDataBound(object sender, GridViewRowEventArgs e) //M9
|
||
{
|
||
try
|
||
{
|
||
if (e.Row.DataItem != null)
|
||
{
|
||
e.Row.Cells[1].ToolTip = "Solicitud de disponibilidad";
|
||
//e.Row.Cells[8].ToolTip = "Asignar actividades";
|
||
//e.Row.Cells[9].ToolTip = "Reconsiderar documento";
|
||
//e.Row.Cells[10].ToolTip = "Editar documento";
|
||
//e.Row.Cells[11].ToolTip = "Firmar documento";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Se produjo un error al realizar la consulta.", ex);
|
||
}
|
||
|
||
}
|
||
protected void btnSalirActividades_Click(object sender, EventArgs e) //M10
|
||
{
|
||
try
|
||
{
|
||
Session["PKPROGRAMACION"] = "";
|
||
EjecutarScript("VentanaCerrarActividades();");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M5" + MensajesAplicacion.BusquedaFallido.ToString(), ex);
|
||
}
|
||
}
|
||
protected void Image2_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
protected void Image6_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 2);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
protected void Image3_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 3);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
protected void Image7_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 4);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
protected void Image9_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 5);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
protected void Image11_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 6);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
protected void Image13_Click(object sender, ImageClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CargarSeguimientoActividades(int.Parse(Session["PKPROGRAMACION"].ToString()), 7);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error al mostrar el detalle de la actividad seleccionada", ex);
|
||
}
|
||
}
|
||
|
||
protected void grvListaAsignaciones_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
grvListaAsignaciones.PageIndex = e.NewPageIndex;
|
||
llenarGridViewActividadesEncargado(int.Parse(Session["PKPROGRAMACION"].ToString()));
|
||
EjecutarScript("VentanaAbrir();");
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MensajeError("Error en R3M1", ex);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region Metodos Personalizados (R4)
|
||
|
||
/// <summary>
|
||
/// Oculta las filas que lo requieran
|
||
/// </summary>
|
||
/// <param name="p_intFila"></param>
|
||
private void mostrarFilaTabla(int p_intFila) //M0
|
||
{
|
||
try
|
||
{
|
||
divDatosSuperiores.Visible = true;
|
||
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Metodo que se utiliza para contruir el Grid al inicio de la pantalla
|
||
/// </summary>
|
||
private void construirGridView() //M1
|
||
{
|
||
try
|
||
{
|
||
grvListaDatosTemp = (GridView)tdLista.FindControl("grvListaDatos");
|
||
|
||
|
||
GridViewBoundField bdfPkProgramacion = new GridViewBoundField("PKPROGRAMACIONSOLICITUD", "PK", false, false, false);
|
||
GridViewBoundField bdfNumSolicitud = new GridViewBoundField("NUMEROSOLICITUDSOLICITUD", "Número solicitud", true, false, true);
|
||
GridViewBoundField bdfFechaBitacora = new GridViewBoundField("FECHAINSERTASOLICITUD", "Fecha", true, true, true);
|
||
GridViewBoundField bdfPropietario = new GridViewBoundField("DESCRIPCIONTIPODISPONIBILIDAD", "Tipo de trámite", true, false, true);
|
||
GridViewBoundField bdfRegion = new GridViewBoundField("DESCRIPCIONTIPOINSPECCION", "Tipo de servicio", true, false, true);
|
||
GridViewBoundField bdfOficina = new GridViewBoundField("UBICACION", "Localización", true, false, true);
|
||
GridViewBoundField bdfPlano = new GridViewBoundField("CLASIFICACIONSOLICITUD", "Densidad", true, false, true);
|
||
GridViewBoundField bdfEstado = new GridViewBoundField("DESCRIPCIONESTADOPROGRAMACION", "Estado", true, false, true);
|
||
GridViewBoundField bdfPkSolicitud = new GridViewBoundField("PKSOLICITUD", "PK", false, false, false);
|
||
GridViewBoundField bdfFkReutiliza = new GridViewBoundField("FKREUTILIZA", "FK", false, false, false);
|
||
GridViewBoundField bdfFkTipoInspeccion = new GridViewBoundField("FKTIPOINSPECCION", "FK", false, false, false);
|
||
GridViewBoundField bdfFkDependenciaSIGDD = new GridViewBoundField("FKDEPENDENCIASIGDD", "FK", false, false, false);
|
||
|
||
|
||
grvListaDatosTemp.Columns.Add(bdfPkProgramacion);
|
||
grvListaDatosTemp.Columns.Add(bdfNumSolicitud);
|
||
grvListaDatosTemp.Columns.Add(bdfFechaBitacora);
|
||
grvListaDatosTemp.Columns.Add(bdfPropietario);
|
||
grvListaDatosTemp.Columns.Add(bdfRegion);
|
||
grvListaDatosTemp.Columns.Add(bdfOficina);
|
||
grvListaDatosTemp.Columns.Add(bdfPlano);
|
||
grvListaDatosTemp.Columns.Add(bdfEstado);
|
||
grvListaDatosTemp.Columns.Add(bdfPkSolicitud);
|
||
grvListaDatosTemp.Columns.Add(bdfFkReutiliza);
|
||
grvListaDatosTemp.Columns.Add(bdfFkTipoInspeccion);
|
||
grvListaDatosTemp.Columns.Add(bdfFkDependenciaSIGDD);
|
||
|
||
grvListaDatosTemp.Columns[0].ItemStyle.Width = 25;
|
||
grvListaDatosTemp.Columns[1].ItemStyle.Width = 25;
|
||
grvListaDatosTemp.Columns[5].ItemStyle.Width = 200;
|
||
|
||
cuwBusquedaList.LlenarCHKLBusqueda(grvListaDatosTemp);
|
||
ButtonField bf = new ButtonField();
|
||
bf.ButtonType= ButtonType.Image;
|
||
bf.Text = "Asignar actividades";
|
||
|
||
bf.HeaderText = "";
|
||
bf.ImageUrl = "~/Images/MiniBotones/Asignar.png";
|
||
bf.CommandName = "asignar";
|
||
grvListaDatosTemp.Columns.Add(bf);
|
||
ButtonField bfActividades = new ButtonField();
|
||
bfActividades.ButtonType = ButtonType.Image;
|
||
bfActividades.Text = "Seguimiento";
|
||
bfActividades.HeaderText = "Acciones";
|
||
bfActividades.ImageUrl = "~/Images/MiniBotones/Seguimiento.png";
|
||
bfActividades.CommandName = "seguimiento";
|
||
grvListaDatosTemp.Columns.Add(bfActividades);
|
||
//grvListaDatosTemp.RowDataBound += new GridViewRowEventHandler(grvListaDatos_RowDataBound);
|
||
|
||
}
|
||
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
|
||
{
|
||
AyABL.AyABL objBL = new AyABL.AyABL();
|
||
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());
|
||
dteFechaFin = DateTime.Now;
|
||
}
|
||
if (li.Value.Contains("FIN"))
|
||
{
|
||
dteFechaFin = Convert.ToDateTime(li.Text.ToString());
|
||
|
||
if (dteFechaFin != null || dteFechaInicio != null)
|
||
if (dteFechaInicio < dteFechaFin || dteFechaFin == dteFechaInicio)
|
||
{
|
||
objBL = new AyABL.AyABL();
|
||
arlCondicionesFiltroBusqueda = objBL.buscarPorFechas(Tablas.insertasolicitud, 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
|
||
{
|
||
objBL = new AyABL.AyABL();
|
||
arlCondicionesFiltroBusqueda = objBL.buscarPorFechas(Tablas.insertasolicitud, dteFechaInicio, dteFechaFin, operadorLogico.AND, arlCondicionesFiltroBusqueda);
|
||
}
|
||
}
|
||
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() //M3
|
||
{
|
||
try
|
||
{
|
||
llenarGridViewPendientes(true, "1000");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// Metodo que se utiliza para el despliegue de los botones
|
||
/// </summary>
|
||
private void ComandosxMenu() //M4
|
||
{
|
||
try
|
||
{
|
||
DataSet dsComandos = getComandos();
|
||
|
||
if (dsComandos != null)
|
||
{
|
||
foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
|
||
{
|
||
switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
|
||
{
|
||
case "NUEVO":
|
||
|
||
break;
|
||
|
||
case "MODIFICA":
|
||
//Inicio de variable tipo VIEWSTATE
|
||
ViewState["PUEDEMODIFICAR"] = true;
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Limpia los campos
|
||
/// </summary>
|
||
private void limpiarCampos()
|
||
{
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region Metodos Controles a Datos (R5)
|
||
|
||
private int AsignaActividadesUsuarios() //M0
|
||
{
|
||
ActividadesBL objActividadesBL = new ActividadesBL();
|
||
int nValorRetornado = 0;
|
||
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”";
|
||
try
|
||
{
|
||
string strModo = ViewState["MODO"].ToString();
|
||
|
||
if (ddlActividades.SelectedValue != "-1")
|
||
{
|
||
if (ddlEncargado.SelectedValue != "-1")
|
||
{
|
||
|
||
objresponsableActividadBL = new solicitudBL();
|
||
objresponsableActividadBL.objresponsableActividadEL.FECHAASIGNACION = DateTime.Now;
|
||
objresponsableActividadBL.objresponsableActividadEL.FECHARECIBIDO = DateTime.Now.AddDays(-1);
|
||
objresponsableActividadBL.objresponsableActividadEL.FECHADEVOLUCION = DateTime.Now.AddDays(-1);
|
||
objresponsableActividadBL.objresponsableActividadEL.VALIDACIONFIRMA = false;
|
||
|
||
objresponsableActividadBL.objresponsableActividadEL.FKACTIVIDAD = int.Parse(ddlActividades.SelectedValue);
|
||
objresponsableActividadBL.objresponsableActividadEL.FKUSUARIOXDEPENDENCIA = int.Parse(ddlEncargado.SelectedValue);
|
||
objresponsableActividadBL.objresponsableActividadEL.FKESTADO = 1;//asignada
|
||
|
||
objresponsableActividadBL.objresponsableActividadEL.ASTATE = true;
|
||
|
||
if (Session["PKPROGRAMACION"].ToString() == " ") //se verifica que ya se haya asignado la actividad 1
|
||
{
|
||
programacionsolicitudBL objprogramacionsolicitudBL = new programacionsolicitudBL();
|
||
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKESTADOPROGRAMACION = 1;
|
||
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
int nPKProgramacionSolicitud = objprogramacionsolicitudBL.insertarprogramacionsolicitud();
|
||
objresponsableActividadBL.objresponsableActividadEL.FKPROGRAMACIONSOLICITUD = nPKProgramacionSolicitud;
|
||
Session["PKPROGRAMACION"] = nPKProgramacionSolicitud;
|
||
}
|
||
else
|
||
{
|
||
objresponsableActividadBL.objresponsableActividadEL.FKPROGRAMACIONSOLICITUD = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
}
|
||
|
||
|
||
if (strModo == "Nuevo")
|
||
{
|
||
|
||
objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
objSolicitudBL.objSolicitudEL.FKUSUARIOXDEPENDENCIA = int.Parse(ddlEncargado.SelectedValue);
|
||
objSolicitudBL.objSolicitudEL.FKACTIVIDAD = int.Parse(ddlActividades.SelectedValue);
|
||
|
||
DataSet dsActividad = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
|
||
if (dsActividad.Tables[0].Rows.Count == 0)
|
||
{
|
||
nValorRetornado = objresponsableActividadBL.insertarAsignacionActividadEncargado();
|
||
|
||
|
||
|
||
|
||
|
||
if (nValorRetornado > 0)
|
||
{
|
||
|
||
|
||
#region Envio de notificacion
|
||
notificacionBL objNotificacionBL = new notificacionBL();
|
||
|
||
objNotificacionBL.objnotificacionEL.FK_DEPARTAMENTO = Session["DEPENDENCIA"].ToString();
|
||
objNotificacionBL.objnotificacionEL.FK_TIPO_DOCUMENTO = "Memorando";
|
||
|
||
objNotificacionBL.objnotificacionEL.HECHO_POR_USUARIO = Session["LOGIN"].ToString();
|
||
objNotificacionBL.objnotificacionEL.HECHO_POR_NOMBRE = Session["NOMBREEMPLEADO"].ToString();
|
||
objNotificacionBL.objnotificacionEL.HECHO_POR_CORREO = Session["LOGIN"].ToString() + "@aya.go.cr";
|
||
|
||
//obtener los datos del encargado
|
||
arlCondicionesFiltroBusqueda = new ArrayList();
|
||
|
||
|
||
objActividadesBL.objactividadesEL.Activo = true;
|
||
objActividadesBL.objactividadesEL.PK = int.Parse(ddlActividades.SelectedValue);
|
||
objActividadesBL.objactividadesEL.FK = int.Parse(ddlEncargado.SelectedValue);
|
||
|
||
dsActividad = objActividadesBL.dsListaActividad(arlCondicionesFiltroBusqueda);
|
||
|
||
if (dsActividad.Tables[0].Rows.Count != 0)
|
||
{
|
||
objNotificacionBL.objnotificacionEL.PARA_USUARIO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString();
|
||
objNotificacionBL.objnotificacionEL.PARA_NOMBRE = dsActividad.Tables[0].Rows[0]["NOMBRECOMPLETO"].ToString();
|
||
objNotificacionBL.objnotificacionEL.PARA_CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
|
||
|
||
}
|
||
else
|
||
return 0;
|
||
|
||
objNotificacionBL.objnotificacionEL.ID_DOCUMENTO = Session["SOLICITUD"].ToString() + " - " + ddlActividades.SelectedItem.Text + " - " + objNotificacionBL.objnotificacionEL.PARA_USUARIO;
|
||
|
||
objNotificacionBL.objnotificacionEL.ASUNTO = "Atraso en la actividad " + ddlActividades.SelectedItem.Text;
|
||
objNotificacionBL.objnotificacionEL.CUERPO = "La solicitud " + Session["SOLICITUD"].ToString() + " no ha sido atendida en el plazo establecido.</BR></BR>Este es un mensaje generado de forma automática por la cual NO DEBE SER RESPONDIDO. </BR></BR> Ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin.> SIGDD</a>" + strPiePagina;
|
||
objNotificacionBL.objnotificacionEL.ESTADO = 1;//Estado : En proceso
|
||
|
||
//calcular la fecha en base a la actividad, tipo de proyecto,
|
||
|
||
objActividadesBL.objactividadesEL.NUMEROSOLICITUD = Session["SOLICITUD"].ToString();
|
||
DataSet dsActividadTiempo = objActividadesBL.dsListaTiempoActividadxProyecto(arlCondicionesFiltroBusqueda);
|
||
if (dsActividadTiempo.Tables[0].Rows.Count != 0)
|
||
{
|
||
Double nCantidadDias = Double.Parse(dsActividadTiempo.Tables[0].Rows[0]["TIEMPO"].ToString());
|
||
DateTime dtFechaVence = DateTime.Now.AddDays(nCantidadDias + 1);
|
||
objNotificacionBL.objnotificacionEL.FECHA_VENCE = dtFechaVence.ToShortDateString();
|
||
}
|
||
|
||
objNotificacionBL.objnotificacionEL.TIPO_PERIOCIDAD = "DD";
|
||
objNotificacionBL.objnotificacionEL.VALOR_PERIOCIDAD = 1;
|
||
objNotificacionBL.objnotificacionEL.status = "00";
|
||
objNotificacionBL.objnotificacionEL.message = "OK";
|
||
nValorRetornado = objNotificacionBL.insertarNotificacion(objNotificacionBL.objnotificacionEL);
|
||
#endregion
|
||
|
||
#region Envio de correo
|
||
|
||
//arlCondicionesFiltroBusqueda = new ArrayList();
|
||
//condicionesBusqueda();
|
||
//objSolicitudBL = new solicitudBL();
|
||
|
||
//objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
|
||
//{
|
||
|
||
// DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
// if (dsEncargadosActividades.Tables.Count > 0)
|
||
// {
|
||
// nPkSolicitud = Convert.ToInt32(dsEncargadosActividades.Tables[0].Rows[0][1].ToString());//AQUI INSERTAMOS LA PK DE LA SOLICITUD
|
||
|
||
// }
|
||
//}
|
||
|
||
//AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
|
||
//objcorreoBL.objcorreoEL.FKNUMSOLICITUD = nPkSolicitud;
|
||
//// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
|
||
//objcorreoBL.objcorreoEL.ASUNTO = "Asignación de actividades - SIGDD";
|
||
//objcorreoBL.objcorreoEL.CONTENIDO = "La solicitud de disponibilidad " + Session["SOLICITUD"].ToString() + " fue enviada para que se continúe con el proceso de " + ddlActividades.SelectedItem.Text + ", ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin> SIGDD</a>" + strPiePagina;
|
||
//objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(dsActividad.Tables[0].Rows[0]["PKUSUARIOXDEPENDENCIA"].ToString());
|
||
//objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
||
|
||
//nValorRetornado = objcorreoBL.insertarCorreo();
|
||
|
||
#endregion
|
||
|
||
}
|
||
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha ingresado la actividad " + ddlActividades.Text.Trim() + " de la solicitud " + Session["SOLICITUD"].ToString(),
|
||
"frwProgramacionTrabajo.aspx",
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
else
|
||
{
|
||
// MensajeAlerta("El usuario ya tiene asignada la actividad.");
|
||
string p_strMensaje = "El usuario ya tiene asignada la actividad.";
|
||
EjecutarScript("VentanaAbrir();toastr.warning('" + p_strMensaje + "', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
//MensajeAlerta("Debe seleccionar el usuario encargado antes de continuar ");
|
||
string p_strMensaje = "Debe seleccionar el usuario encargado antes de continuar";
|
||
EjecutarScript("VentanaAbrir();toastr.warning('" + p_strMensaje + "', 'Información',toastr.options ={closeButton: true})");
|
||
ddlEncargado.Focus();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//MensajeAlerta("Debe seleccionar la actividad antes de continuar");
|
||
string p_strMensaje = "Debe seleccionar la actividad antes de continuar";
|
||
EjecutarScript("VentanaAbrir();toastr.warning('" + p_strMensaje + "', 'Información',toastr.options ={closeButton: true})");
|
||
ddlActividades.Focus();
|
||
}
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
/// <summary>
|
||
/// guarda y modifica registros en la tabla.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
///
|
||
|
||
|
||
private int GuardarDatosActividad(string p_accion)
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
|
||
//string strModo = ViewState["MODO"].ToString();
|
||
int nPkSolicitud = 0;
|
||
int nResultadoActualizar = 0;
|
||
string strMensajeContenido = "";
|
||
string strAsuntoCorreo = "";
|
||
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”";
|
||
|
||
solicitudBL objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 2;
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
string strEncargadoActividad = dsEncargadosActividades.Tables[0].Rows[0]["PKRESPONSABLEACTIVIDAD"].ToString();
|
||
|
||
//ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
||
////objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
|
||
//objObservacionesBL.objobservacionesEL.DESCRIPCION = "\n" + DateTime.Now.ToString()+ " - " + Session["NOMBREEMPLEADO"].ToString() + " - Se finaliza la actividad programación de trabajo del formulario" + Session["SOLICITUD"].ToString() + " por parte del usuario" + Session["NOMBREEMPLEADO"].ToString();
|
||
//objObservacionesBL.objobservacionesEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
||
//objObservacionesBL.objobservacionesEL.PKRESPONSABLEACTIVIDAD = int.Parse(strEncargadoActividad);
|
||
//objObservacionesBL.objobservacionesEL.Fecha = DateTime.Now;
|
||
//objObservacionesBL.objobservacionesEL.TIPO = 1;
|
||
////objObservacionesBL.objobservacionesEL.FKSOLICITUD = nPKSolicitud;
|
||
////objObservacionesBL.objobservacionesEL.USUARIO = Session["LOGIN"].ToString();
|
||
|
||
//nValorRetornado = objObservacionesBL.insertarObservacionActividad();
|
||
|
||
|
||
//if (nValorRetornado != 0)
|
||
{
|
||
solicitudBL objSolicitud = new solicitudBL();
|
||
//objSolicitud.objresponsableActividadEL.PK = int.Parse(Session["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
//poner la actividad actual en estado correspondiente
|
||
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
|
||
objSolicitud.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
||
objSolicitud.objresponsableActividadEL.FECHADEVOLUCION = DateTime.Now;
|
||
if (p_accion == "aprobar")
|
||
{
|
||
|
||
decimal nTiempoActividad = 0;
|
||
if (row["CLASIFICACIONSOLICITUD"].ToString() == "Crecimiento vegetativo")
|
||
nTiempoActividad = decimal.Parse(row["TIEMPOCVACTIVIDAD"].ToString());
|
||
if (row["CLASIFICACIONSOLICITUD"].ToString() == "Desarrollo urbanistico")
|
||
nTiempoActividad = decimal.Parse(row["TIEMPODUACTIVIDAD"].ToString());
|
||
|
||
|
||
char[] separadorColumna = { '.' };
|
||
string[] strArrayTiempo = nTiempoActividad.ToString().Replace(",", ".").Split(separadorColumna);
|
||
|
||
DateTime dtFechaRecibido = DateTime.Parse(row["FECHAASIGNACIONRESPONSABLEACTIVIDAD"].ToString()).AddDays(double.Parse(strArrayTiempo[0].ToString()));
|
||
if (double.Parse(strArrayTiempo[1].ToString()) > 0)
|
||
dtFechaRecibido = dtFechaRecibido.AddHours(4);
|
||
|
||
|
||
|
||
|
||
if (dtFechaRecibido > DateTime.Now)
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 5;//finalizada a tiempo t_sgm_estadoactividad
|
||
else
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 8;//finalizada fuera de tiempo t_sgm_estadoactividad
|
||
|
||
strMensajeContenido = "La actividad programación de trabajo de la solicitud N° " + Session["SOLICITUD"].ToString() + " ha sido concluida para ver los detalles, ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin.> SIGDD</a>" + strPiePagina;
|
||
strAsuntoCorreo = "Conclusión de actividad - SIGDD";
|
||
|
||
|
||
|
||
nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
|
||
if (nResultadoActualizar > 0)
|
||
{
|
||
#region Envio de correo
|
||
//Requerimiento 13
|
||
//AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
|
||
|
||
//nPkSolicitud = Convert.ToInt32(row[1].ToString());//AQUI INSERTAMOS LA PK DE LA SOLICITUD
|
||
|
||
//objcorreoBL.objcorreoEL.FKNUMSOLICITUD = nPkSolicitud;
|
||
//// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
|
||
//objcorreoBL.objcorreoEL.ASUNTO = "Estado de actividad - SIGDD";
|
||
//objcorreoBL.objcorreoEL.CONTENIDO = strMensajeContenido;
|
||
//objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(row["FKUSUARIOXDEPENDENCIA"].ToString());
|
||
//objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
||
|
||
//nValorRetornado = objcorreoBL.insertarCorreo();
|
||
|
||
|
||
#endregion
|
||
|
||
|
||
|
||
//cancelar notificacion
|
||
notificacionBL objNotificacionBL = new notificacionBL();
|
||
|
||
objNotificacionBL.objnotificacionEL.ID_DOCUMENTO = Session["SOLICITUD"].ToString() + " - Programación de trabajo";
|
||
objNotificacionBL.objnotificacionEL.status = "00";
|
||
objNotificacionBL.objnotificacionEL.message = "OK";
|
||
//nValorRetornado = objNotificacionBL.cancelarNotificacion(objNotificacionBL.objnotificacionEL);
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": La actividad programación de trabajo de la solicitud N° " + Session["SOLICITUD"].ToString() + " ha sido finalizada por parte del encargado de la actividad: " + Session["NOMBREEMPLEADO"].ToString().Trim(),
|
||
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if (p_accion == "pendiente")
|
||
{
|
||
//Poner la actividad 2 programacion en pendiente(3)
|
||
objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 2;
|
||
|
||
dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
|
||
objSolicitud.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString()); ;
|
||
objSolicitud.objresponsableActividadEL.FKESTADO = 3;//pendiente t_sgm_estadoactividad
|
||
nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
//GuardarEventoBitacora(
|
||
// Session["LOGIN"].ToString(),
|
||
// AccionBitacora.INSERT.ToString(),
|
||
// MensajesBitacora.IngresarRegistro + ": Se ingreso una nueva observacion por el estado de la actividad: La actividad 2 ha sido asignada por: " + Session["NOMBREEMPLEADO"].ToString().Trim(),
|
||
// "frwObservacionesActividades.aspx",
|
||
// Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
// );
|
||
|
||
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
|
||
return nValorRetornado;
|
||
}
|
||
|
||
private string verificarTarea2()
|
||
{
|
||
string strValorRetornado = "pendiente";
|
||
|
||
bool bActividad1 = false;
|
||
bool bActividad2 = false;
|
||
bool bActividad3 = false;
|
||
bool bActividad4 = false;
|
||
bool bActividad5 = false;
|
||
bool bActividad6 = false;
|
||
bool bActividad7 = false;
|
||
try
|
||
{
|
||
solicitudBL objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
//objSolicitudBL.objSolicitudEL.ORDEN = 2;
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
int nActividad = int.Parse(row["ORDENACTIVIDAD"].ToString());
|
||
if (nActividad == 1)
|
||
bActividad1 = true;
|
||
|
||
if (nActividad == 2 )
|
||
bActividad2 = true;
|
||
|
||
if (nActividad == 3 || int.Parse(row["FKTIPOINSPECCION"].ToString()) == 2)
|
||
bActividad3 = true;
|
||
|
||
if (nActividad == 4 || int.Parse(row["FKTIPOINSPECCION"].ToString()) ==1 )
|
||
bActividad4 = true;
|
||
|
||
if (nActividad == 5 )
|
||
bActividad5 = true;
|
||
|
||
if (nActividad == 6 )
|
||
bActividad6 = true;
|
||
|
||
if (nActividad == 7 )
|
||
bActividad7 = true;
|
||
|
||
}
|
||
if (bActividad1 == true &&
|
||
bActividad2 == true &&
|
||
bActividad3 == true &&
|
||
bActividad4 == true &&
|
||
bActividad5 == true &&
|
||
bActividad6 == true &&
|
||
bActividad7 == true )
|
||
strValorRetornado = "aprobar";
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return strValorRetornado;
|
||
}
|
||
private int EliminarActividadesUsuarios(int n_pPkActividadUsuario) //M0
|
||
{
|
||
int nValorRetornado = 0;
|
||
|
||
try
|
||
{
|
||
if (Session["SOLICITUD"] != null && Session["PKUSUARIOXDEPENDENCIA"] != null)
|
||
{
|
||
solicitudBL objSolicitudBL = new solicitudBL();
|
||
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
objSolicitudBL.objSolicitudEL.ORDEN = 2;//se valida la tarea 2 si ya esta finalizada no se pueden quitar los responsables de actividades
|
||
objSolicitudBL.objSolicitudEL.FKESTADO = 5;
|
||
objSolicitudBL.objSolicitudEL.FKESTADO2 = 8;
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count == 0)
|
||
{
|
||
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
||
objObservacionesBL.objobservacionesEL.PKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
objObservacionesBL.objobservacionesEL.PKPROGRAMACIONSOLICITUD = int.Parse(Session["PKPROGRAMACION"].ToString());
|
||
//objObservacionesBL.objobservacionesEL.PKACTIVIDAD = int.Parse(Session["NACTIVIDAD"].ToString());
|
||
|
||
objObservacionesBL.objobservacionesEL.PKRESPONSABLEACTIVIDAD = n_pPkActividadUsuario;
|
||
|
||
DataSet dsObservaciones = objObservacionesBL.dsListarObservacionesActividades(null);
|
||
|
||
if (dsObservaciones.Tables[0].Rows.Count == 0)
|
||
{
|
||
objresponsableActividadBL = new solicitudBL();
|
||
objresponsableActividadBL.objresponsableActividadEL.PK = n_pPkActividadUsuario;
|
||
nValorRetornado = objresponsableActividadBL.eliminarAsignacionActividadEncargado();
|
||
|
||
GuardarEventoBitacora(
|
||
Session["LOGIN"].ToString(),
|
||
AccionBitacora.INSERT.ToString(),
|
||
MensajesBitacora.IngresarRegistro + ": Se ha eliminado la actividad " + n_pPkActividadUsuario.ToString(),
|
||
"frwProgramacionTrabajo.aspx",
|
||
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
||
);
|
||
}
|
||
else
|
||
{
|
||
//MensajeAlerta("El registro no puede ser eliminado ya que esta asociado a otro flujo de la solicitud");
|
||
EjecutarScript("VentanaAbrir();toastr.warning('El registro no puede ser eliminado ya que esta asociado a otro flujo de la solicitud', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
EjecutarScript("VentanaAbrir();toastr.warning('El registro no puede ser eliminado la tarea de asignación de actividades se encuentra finalizada', 'Información',toastr.options ={closeButton: true})");
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
return nValorRetornado;
|
||
}
|
||
|
||
#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();
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
|
||
|
||
int nAccesoInformacion = 0;
|
||
|
||
if (Session["ACCESOINSORMACION"] != null)
|
||
nAccesoInformacion = int.Parse(Session["ACCESOINSORMACION"].ToString());
|
||
|
||
if (nAccesoInformacion == 1 ) //1:region -- 0:Todo
|
||
objSolicitudBL.objSolicitudEL.FKREGION = int.Parse(Session["REGION"].ToString());
|
||
|
||
if (nAccesoInformacion == 2 )//2:Dependencia -- 0:Todo
|
||
{
|
||
//objSolicitudBL.objSolicitudEL.FKREGION = int.Parse(Session["REGION"].ToString());
|
||
//objSolicitudBL.objSolicitudEL.FKDEPENDENCIA = int.Parse(Session["DEPENDENCIA"].ToString());
|
||
objSolicitudBL.objSolicitudEL.LISTADODEPENDENCIAS = Session["LISTADEPENDENCIAS"].ToString();
|
||
}
|
||
|
||
|
||
if (arlCondicionesFiltroBusqueda.Count > 0)
|
||
{
|
||
DataSet dsUsuarios = objSolicitudBL.dsListaSolicitudProgramacion(arlCondicionesFiltroBusqueda);
|
||
General.detalleGridView(dsUsuarios, grvListaDatosTemp, lblTotalDatos);
|
||
}
|
||
else
|
||
{
|
||
MensajeAlerta("Debe agregar filtros para la busqueda");
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// Carga el grid principal
|
||
/// </summary>
|
||
/// <param name="p_Llenar"></param>
|
||
private void llenarGridViewPendientes(bool p_Llenar,string strTop) //M0
|
||
{
|
||
try
|
||
{
|
||
if (!IsPostBack || p_Llenar)
|
||
{
|
||
//arlCondicionesFiltroBusqueda = new ArrayList();
|
||
condicionesBusqueda();
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
int nAccesoInformacion = 0;
|
||
|
||
if (Session["ACCESOINSORMACION"] != null)
|
||
nAccesoInformacion = int.Parse(Session["ACCESOINSORMACION"].ToString());
|
||
|
||
if (nAccesoInformacion == 1) //1:region -- 0:Todo
|
||
objSolicitudBL.objSolicitudEL.FKREGION = int.Parse(Session["REGION"].ToString());
|
||
|
||
//if (nAccesoInformacion == 2)//2:Dependencia -- 0:Todo
|
||
//{
|
||
// objSolicitudBL.objSolicitudEL.FKREGION = int.Parse(Session["REGION"].ToString());
|
||
// objSolicitudBL.objSolicitudEL.FKDEPENDENCIA = int.Parse(Session["DEPENDENCIA"].ToString());
|
||
//}
|
||
if (nAccesoInformacion == 2)//2:Dependencia -- 0:Todo
|
||
{
|
||
//objSolicitudBL.objSolicitudEL.FKREGION = int.Parse(Session["REGION"].ToString());
|
||
//objSolicitudBL.objSolicitudEL.FKDEPENDENCIA = int.Parse(Session["DEPENDENCIA"].ToString());
|
||
objSolicitudBL.objSolicitudEL.LISTADODEPENDENCIAS = Session["LISTADEPENDENCIAS"].ToString();
|
||
}
|
||
//objSolicitudBL.objSolicitudEL.TEMPORAL = true;
|
||
{
|
||
DataSet dsUsuarios = objSolicitudBL.dsListaSolicitudProgramacionGrid(arlCondicionesFiltroBusqueda, strTop);
|
||
General.detalleGridView(dsUsuarios, grvListaDatosTemp, lblTotalDatos);
|
||
}
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Carga el grid principal
|
||
/// </summary>
|
||
/// <param name="p_Llenar"></param>
|
||
private void llenarDDLActividades(bool p_Llenar) //M0
|
||
{
|
||
try
|
||
{
|
||
if (!IsPostBack || p_Llenar)
|
||
{
|
||
ddlActividades.Items.Clear();
|
||
arlCondicionesFiltroBusqueda = new ArrayList();
|
||
ActividadesBL objActividadesBL = new ActividadesBL();
|
||
if (Session["PKSOLICITUD"] != null)
|
||
//objActividadesBL.objactividadesEL.PKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
||
objActividadesBL.objactividadesEL.ASTATE = true;
|
||
objActividadesBL.objactividadesEL.FKTIPOINSPECCION = int.Parse(Session["FKTIPOINSPECCION"].ToString());
|
||
|
||
DataSet dsActividad = objActividadesBL.dsListarActividad(arlCondicionesFiltroBusqueda);
|
||
|
||
if (dsActividad.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlActividades.DataSource = dsActividad;
|
||
ddlActividades.DataTextField = dsActividad.Tables[0].Columns["DESCRIPCIONACTIVIDAD"].ColumnName;
|
||
ddlActividades.DataValueField = dsActividad.Tables[0].Columns["PKACTIVIDAD"].ColumnName;
|
||
ddlActividades.DataBind();
|
||
|
||
|
||
ddlActividades.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlActividades.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Carga el grid principal
|
||
/// </summary>
|
||
/// <param name="p_Llenar"></param>
|
||
private void llenarDDLEncargado(bool p_Llenar) //M0
|
||
{
|
||
try
|
||
{
|
||
ddlEncargado.Items.Clear();
|
||
arlCondicionesFiltroBusqueda = new ArrayList();
|
||
ActividadesBL objActividadesBL = new ActividadesBL();
|
||
|
||
objActividadesBL.objactividadesEL.Activo = true;
|
||
objActividadesBL.objactividadesEL.PK = int.Parse(ddlActividades.SelectedValue);
|
||
objActividadesBL.objactividadesEL.FKDEPENDENCIA = int.Parse(Session["FKDEPENDENCIASIGDD"].ToString());
|
||
|
||
DataSet dsActividad = objActividadesBL.dsListaActividad(arlCondicionesFiltroBusqueda);
|
||
|
||
if (dsActividad.Tables[0].Rows.Count != 0)
|
||
{
|
||
ddlEncargado.DataSource = dsActividad;
|
||
ddlEncargado.DataTextField = dsActividad.Tables[0].Columns["NOMBRECOMPLETO"].ColumnName;
|
||
ddlEncargado.DataValueField = dsActividad.Tables[0].Columns["PKUSUARIOXDEPENDENCIA"].ColumnName;
|
||
ddlEncargado.DataBind();
|
||
|
||
|
||
ddlEncargado.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||
}
|
||
else
|
||
ddlEncargado.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Carga el grid de tareas
|
||
/// </summary>
|
||
/// <param name="p_Llenar"></param>
|
||
private void llenarGridViewActividadesEncargado(int n_pProgramacionSolicitud) //M0
|
||
{
|
||
try
|
||
{
|
||
|
||
arlCondicionesFiltroBusqueda = new ArrayList();
|
||
//condicionesBusqueda();
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
objSolicitudBL.objSolicitudEL.PK = n_pProgramacionSolicitud;
|
||
grvListaAsignaciones.Columns[4].Visible = true;
|
||
{
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
nPkSolicitud = Convert.ToInt32(dsEncargadosActividades.Tables[0].Rows[0][1].ToString());//AQUI INSERTAMOS LA PK DE LA SOLICITUD
|
||
grvListaAsignaciones.DataSource = dsEncargadosActividades;
|
||
grvListaAsignaciones.DataBind();
|
||
General.detalleGridView(dsEncargadosActividades, grvListaAsignaciones, lblTotalDatos);
|
||
grvListaAsignaciones.Columns[4].Visible = false;
|
||
}
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Carga el grid de tareas
|
||
/// </summary>
|
||
/// <param name="p_Llenar"></param>
|
||
private void CargarSeguimientoActividades(int n_pProgramacionSolicitud,int n_pActividad) //M0
|
||
{
|
||
try
|
||
{
|
||
|
||
arlCondicionesFiltroBusqueda = new ArrayList();
|
||
//condicionesBusqueda();
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
objSolicitudBL.objSolicitudEL.PK = n_pProgramacionSolicitud;
|
||
objSolicitudBL.objSolicitudEL.ORDEN = n_pActividad;
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
lblTituloActividad.Text = "Actividad N°" + n_pActividad.ToString();
|
||
lblEstadoA1.Text = dsEncargadosActividades.Tables[0].Rows[0]["DESCRIPCIONESTADO"].ToString();
|
||
lblFechaIngresoA1.Text = dsEncargadosActividades.Tables[0].Rows[0]["FECHAASIGNACIONRESPONSABLEACTIVIDAD"].ToString();
|
||
|
||
//Requerimiento 5
|
||
if (dsEncargadosActividades.Tables[0].Rows[0]["FECHADEVOLUCIONRESPONSABLEACTIVIDAD"].ToString() != "")
|
||
{
|
||
int DiasDiferencia = objSolicitudBL.ObtenerDiferenciaDias(Convert.ToDateTime(dsEncargadosActividades.Tables[0].Rows[0]["FECHAASIGNACIONRESPONSABLEACTIVIDAD"]), Convert.ToDateTime(dsEncargadosActividades.Tables[0].Rows[0]["FECHADEVOLUCIONRESPONSABLEACTIVIDAD"]));
|
||
|
||
if (DiasDiferencia > 1)
|
||
{
|
||
lblFechaResolucionA1.Text = "(" + DiasDiferencia + " Días)" + " " + dsEncargadosActividades.Tables[0].Rows[0]["FECHADEVOLUCIONRESPONSABLEACTIVIDAD"].ToString();
|
||
|
||
}
|
||
else if (DiasDiferencia < 1)
|
||
{
|
||
lblFechaResolucionA1.Text = "(" + DiasDiferencia + " Días)" + " " + dsEncargadosActividades.Tables[0].Rows[0]["FECHADEVOLUCIONRESPONSABLEACTIVIDAD"].ToString();
|
||
|
||
}
|
||
else
|
||
{
|
||
lblFechaResolucionA1.Text = "(" + DiasDiferencia + " Día)" + " " + dsEncargadosActividades.Tables[0].Rows[0]["FECHADEVOLUCIONRESPONSABLEACTIVIDAD"].ToString();
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
lblFechaResolucionA1.Text = dsEncargadosActividades.Tables[0].Rows[0]["FECHADEVOLUCIONRESPONSABLEACTIVIDAD"].ToString();
|
||
|
||
}
|
||
//Requerimiento 5
|
||
//lblResponsableA1.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(dsEncargadosActividades.Tables[0].Rows[0]["NOMBRECOMPLETO"].ToString().ToLower());
|
||
}
|
||
else
|
||
{
|
||
lblTituloActividad.Text = "Actividad N°" + n_pActividad.ToString();
|
||
lblEstadoA1.Text = "Sin asignar";
|
||
lblFechaIngresoA1.Text = "Sin asignar";
|
||
lblFechaResolucionA1.Text = "Sin asignar";
|
||
lblResponsableA1.Items.Add("Sin asignar");
|
||
}
|
||
lblResponsableA1.Items.Clear();
|
||
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
string strNombreFormateado = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(row["NOMBRECOMPLETO"].ToString().ToLower());
|
||
lblResponsableA1.Items.Add(strNombreFormateado);
|
||
//lblResponsableA1.Text += strNombreFormateado + "\n";
|
||
}
|
||
EjecutarScript("VentanaAbrirActividades();");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Carga el grid de tareas
|
||
/// </summary>
|
||
/// <param name="p_Llenar"></param>
|
||
private void CargarImagenesSeguimientoActividades(int n_pProgramacionSolicitud) //M0
|
||
{
|
||
try
|
||
{
|
||
int nEstado = 0;
|
||
int nActividad = 0;
|
||
int nEstadoAnterior = 0;
|
||
int nActividadAnterior = 0;
|
||
|
||
arlCondicionesFiltroBusqueda = new ArrayList();
|
||
//condicionesBusqueda();
|
||
objSolicitudBL = new solicitudBL();
|
||
|
||
objSolicitudBL.objSolicitudEL.PK = n_pProgramacionSolicitud;
|
||
|
||
imgActividad1.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
imgActividad2.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
imgActividad3.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
imgActividad4.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
imgActividad5.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
imgActividad6.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
imgActividad7.ImageUrl = "../../Images/Actividades/circulogris.jpg";
|
||
|
||
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
||
{
|
||
foreach(DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
||
{
|
||
ImageButton Imagectr = new ImageButton();//)FindControl("imgActividad" + x.ToString());
|
||
|
||
nEstado = int.Parse(row["FKESTADO"].ToString());
|
||
nActividad = int.Parse(row["ORDENACTIVIDAD"].ToString());
|
||
if (nActividadAnterior != nActividad || (nEstadoAnterior != 5 && nActividadAnterior == nActividad))
|
||
{
|
||
switch (nEstado)
|
||
{
|
||
//Asignada
|
||
case 1: Imagectr.ImageUrl = "../../Images/Actividades/circuloamarillo.jpg"; break;
|
||
//No asignada
|
||
case 2: Imagectr.ImageUrl = "../../Images/Actividades/circulogris.jpg"; break;
|
||
//Pendiente
|
||
case 3: Imagectr.ImageUrl = "../../Images/Actividades/circuloamarillo.jpg"; break;
|
||
//Re inspeccion
|
||
case 4: Imagectr.ImageUrl = "../../Images/Actividades/circuloamarillo.jpg"; break;
|
||
//Finalizada
|
||
case 5: Imagectr.ImageUrl = "../../Images/Actividades/circuloverde.jpg"; break;
|
||
//Devolucion
|
||
case 6: Imagectr.ImageUrl = "../../Images/Actividades/circuloamarillo.jpg"; break;
|
||
//Finalizado fuera de tiempo
|
||
case 8: Imagectr.ImageUrl = "../../Images/Actividades/circulorojo.png"; break;
|
||
}
|
||
switch (nActividad)
|
||
{
|
||
case 1: imgActividad1.ImageUrl = Imagectr.ImageUrl; break;
|
||
case 2: imgActividad2.ImageUrl = Imagectr.ImageUrl; break;
|
||
case 3: imgActividad3.ImageUrl = Imagectr.ImageUrl; break;
|
||
case 4: imgActividad4.ImageUrl = Imagectr.ImageUrl; break;
|
||
case 5: imgActividad5.ImageUrl = Imagectr.ImageUrl; break;
|
||
case 6: imgActividad6.ImageUrl = Imagectr.ImageUrl; break;
|
||
case 7: imgActividad7.ImageUrl = Imagectr.ImageUrl; break;
|
||
|
||
}
|
||
}
|
||
nEstadoAnterior = int.Parse(row["FKESTADO"].ToString());
|
||
nActividadAnterior = int.Parse(row["ORDENACTIVIDAD"].ToString());
|
||
}
|
||
}
|
||
imgActividad3.Enabled = false;
|
||
imgActividad4.Enabled = false;
|
||
|
||
if (dsEncargadosActividades.Tables[0].Rows[0]["FKTIPOINSPECCION"].ToString() == "1")
|
||
imgActividad3.Enabled = true;
|
||
if (dsEncargadosActividades.Tables[0].Rows[0]["FKTIPOINSPECCION"].ToString() == "2")
|
||
imgActividad4.Enabled = true;
|
||
if (dsEncargadosActividades.Tables[0].Rows[0]["FKTIPOINSPECCION"].ToString() == "3")
|
||
{
|
||
imgActividad3.Enabled = true;
|
||
imgActividad4.Enabled = true;
|
||
}
|
||
|
||
EjecutarScript("VentanaAbrirActividades();");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
|
||
|
||
} |