diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 551593b30..8a65a1f30 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -2743,8 +2743,291 @@ Public Class ClsOIEventos Return Retorno End Function + + #End Region +#Region "OI_Documentos" + +#Region "OI_DocumentosCategorias" + Public Function GetDocumentoCategoria(Optional CveCategoria As Integer = -1, Optional Categoria As String = "-1") As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + .Add("@Categoria", SqlDbType.NVarChar).Value = Categoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddDocumentoCategoria(Categoria As String, Estado As Boolean) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Categoria", SqlDbType.NVarChar).Value = Categoria + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateDocumentoCategoria(CveCategoria As Integer, Categoria As String, Estado As Boolean) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + .Add("@Categoria", SqlDbType.NVarChar).Value = Categoria + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveDocumentoCategoria(CveCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCategoria", SqlDbType.NVarChar).Value = CveCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "OI_DocumentosSubCategoria" + Public Function GetDocumentoSubCategoria(Optional CveSubCategoria As Integer = -1, Optional SubCategoria As String = "-1") As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@SubCategoria", SqlDbType.NVarChar).Value = SubCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddDocumentoSubCategoria(SubCategoria As String, CveCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@SubCategoria", SqlDbType.NVarChar).Value = SubCategoria + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateDocumentoSubCategoria(CveSubCategoria As Integer, SubCategoria As String, CveCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@SubCategoria", SqlDbType.NVarChar).Value = SubCategoria + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveDocumentoSubCategoria(CveSubCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.NVarChar).Value = CveSubCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "Documentos" + Public Function GetDocumento(CveDocumento As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddDocumento(CveSubCategoria As Integer, Descripcion As String, Observacion As String, Version As String, CveEstatus As Integer, ArchivoFisico As String, + Responsable As String, FechaAprobacion As Date, CveDocumentoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@Descripcion", SqlDbType.NVarChar).Value = Descripcion + .Add("@Observacion", SqlDbType.NVarChar).Value = Observacion + .Add("@Version", SqlDbType.NVarChar).Value = Version + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@ArchivoFisico", SqlDbType.NVarChar).Value = ArchivoFisico + .Add("@Responsable", SqlDbType.NVarChar).Value = Responsable + .Add("@FechaAprobacion", SqlDbType.Date).Value = FechaAprobacion + .Add("@CveDocumentoPadre", SqlDbType.Int).Value = CveDocumentoPadre + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateDocumento(CveDocumento As Integer, CveSubCategoria As Integer, Descripcion As String, Observacion As String, Version As String, CveEstatus As Integer, ArchivoFisico As String, + Responsable As String, FechaAprobacion As Date, CveDocumentoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@Descripcion", SqlDbType.NVarChar).Value = Descripcion + .Add("@Observacion", SqlDbType.NVarChar).Value = Observacion + .Add("@Version", SqlDbType.NVarChar).Value = Version + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@ArchivoFisico", SqlDbType.NVarChar).Value = ArchivoFisico + .Add("@Responsable", SqlDbType.NVarChar).Value = Responsable + .Add("@FechaAprobacion", SqlDbType.Date).Value = FechaAprobacion + .Add("@CveDocumentoPadre", SqlDbType.Int).Value = CveDocumentoPadre + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveDocumento(CveDocumento As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#End Region ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 9a4c0c915..5e207a0c5 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4552,6 +4552,8 @@ Public Class ClsPaginas PaginaDict.Add("/OI/RepDesarrollo.aspx".ToUpper(), 475) PaginaDict.Add("/OI/DesarrolloWizard.aspx".ToUpper(), 474) PaginaDict.Add("/OI/SubidasADS.aspx".ToUpper(), 476) + PaginaDict.Add("/OI/CatDocumentoCategoria.aspx".ToUpper(), 760) + PaginaDict.Add("/OI/CatDocumentoSubCategoria.aspx".ToUpper(), 761) #End Region #Region "Planeacion" 'PLANEACIÓN diff --git a/OI/CatDocumentoCategoria.aspx b/OI/CatDocumentoCategoria.aspx new file mode 100644 index 000000000..e935eec64 --- /dev/null +++ b/OI/CatDocumentoCategoria.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="OI - Catálogo de Categorías de Documentos" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatDocumentoCategoria.aspx.cs" Inherits="OI_CatDocumentoCategoria" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Categorías de Documentos + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + <%----%> + + + + + + + + + + + diff --git a/OI/CatDocumentoCategoria.aspx.cs b/OI/CatDocumentoCategoria.aspx.cs new file mode 100644 index 000000000..8efdf08c4 --- /dev/null +++ b/OI/CatDocumentoCategoria.aspx.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class OI_CatDocumentoCategoria : ClsPaginas +{ + + private int CveCategoria + { + get + { + return ViewState["CveCategoria"].ToString().ToEntero(); + } + + set + { + ViewState["CveCategoria"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoCategoria()) + { + GvDatos.DataSource = ObjOI.DtResultados; + GvDatos.DataBind(); + } + ObjOI.Dispose(); + } + + protected void BtnAgregarCategoria_Click(object sender, EventArgs e) + { + BtnAgregarCategoriaDoc.Text = "Agregar"; + TxtCategoria.Text = ""; + ChkEstatus.Checked = true; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarCategoriaDoc.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCategoria = GvRow.DataKey("CveCategoria").ToEntero(); + TxtCategoria.Text = GvRow.DataKey("Categoria"); + ChkEstatus.Checked = GvRow.DataKey("Estado").ToString() == "True"; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCategoria = GvRow.DataKey("CveCategoria").ToEntero(); + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.RemoveTipoGasto(CveCategoria)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se eliminó la Categoría de Documento correctamente"); + } + ObjCompras.Dispose(); + } + + protected void BtnAgregarCategoriaDoc_Click(object sender, EventArgs e) + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (BtnAgregarCategoriaDoc.Text == "Agregar") + { + if (ObjOI.AddDocumentoCategoria(TxtCategoria.Text,ChkEstatus.Checked)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se agregó la Categoría de Documento correctamente"); + } + }else + { + if (ObjOI.UpdateDocumentoCategoria(CveCategoria,TxtCategoria.Text,ChkEstatus.Checked)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se actualizó la Categoría de Documento correctamente"); + } + } + ObjOI.Dispose(); + } +} \ No newline at end of file diff --git a/OI/CatDocumentoSubCategoria.aspx b/OI/CatDocumentoSubCategoria.aspx new file mode 100644 index 000000000..a7986a1bd --- /dev/null +++ b/OI/CatDocumentoSubCategoria.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="OI - Catálogo de Subcategorías de Documentos" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatDocumentoSubCategoria.aspx.cs" Inherits="OI_CatDocumentoSubCategoria" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Subcategorías de Documentos + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + <%----%> + + + + + + + + + + + diff --git a/OI/CatDocumentoSubCategoria.aspx.cs b/OI/CatDocumentoSubCategoria.aspx.cs new file mode 100644 index 000000000..709f6e89a --- /dev/null +++ b/OI/CatDocumentoSubCategoria.aspx.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class OI_CatDocumentoSubCategoria : ClsPaginas +{ + private int CveSubCategoria + { + get + { + return ViewState["CveSubCategoria"].ToString().ToEntero(); + } + + set + { + ViewState["CveSubCategoria"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + CargaCategoria(); + } + } + + private void CargaDatos() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoSubCategoria()) + { + GvDatos.DataSource = ObjOI.DtResultados; + GvDatos.DataBind(); + } + ObjOI.Dispose(); + } + + private void CargaCategoria() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoCategoria()) + { + DdlCategorias.DataSource = ObjOI.DtResultados.FiltraParametros("Estado = 1"); + DdlCategorias.DataBind(); + } + ObjOI.Dispose(); + } + + protected void BtnAgregarSubCategoria_Click(object sender, EventArgs e) + { + BtnAgregarSubCategoriaDoc.Text = "Agregar"; + TxtSubCategoria.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarSubCategoriaDoc.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveSubCategoria = GvRow.DataKey("CveSubCategoria").ToEntero(); + TxtSubCategoria.Text = GvRow.DataKey("SubCategoria"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveSubCategoria = GvRow.DataKey("CveSubCategoria").ToEntero(); + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.RemoveTipoGasto(CveSubCategoria)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se eliminó la Categoría de Documento correctamente"); + } + ObjCompras.Dispose(); + } + + protected void BtnAgregarSubCategoriaDoc_Click(object sender, EventArgs e) + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (BtnAgregarSubCategoriaDoc.Text == "Agregar") + { + if (ObjOI.AddDocumentoSubCategoria(TxtSubCategoria.Text, DdlCategorias.SelectedValue.ToEntero())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se agregó la Categoría de Documento correctamente"); + } + } + else + { + if (ObjOI.UpdateDocumentoSubCategoria(CveSubCategoria, TxtSubCategoria.Text, DdlCategorias.SelectedValue.ToEntero())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se actualizó la Categoría de Documento correctamente"); + } + } + ObjOI.Dispose(); + } +} \ No newline at end of file diff --git a/OI/Documentos.aspx b/OI/Documentos.aspx new file mode 100644 index 000000000..31ddb86a4 --- /dev/null +++ b/OI/Documentos.aspx @@ -0,0 +1,49 @@ +<%@ Page Title="OI - Documentos" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Documentos.aspx.cs" Inherits="OI_Documentos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Documentos + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + diff --git a/OI/Documentos.aspx.cs b/OI/Documentos.aspx.cs new file mode 100644 index 000000000..e087c71c9 --- /dev/null +++ b/OI/Documentos.aspx.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class OI_Documentos : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumento(-1,UsuarioActual.CveEmpresa)) + { + GvDatos.DataSource = ObjOI.DtResultados; + GvDatos.DataBind(); + } + ObjOI.Dispose(); + } +} \ No newline at end of file