From 7aa18b7b365ba071515e900869e1d2ccccb94e04 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 20 Aug 2020 18:18:28 -0700 Subject: [PATCH] =?UTF-8?q?avance=20de=20cat=C3=A1logos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AF/CatActividades.aspx | 82 +++++++++ AF/CatActividades.aspx.cs | 110 ++++++++++++ AF/CatCheckListActividadesGrupos.aspx | 70 ++++++++ AF/CatCheckListActividadesGrupos.aspx.cs | 100 +++++++++++ AF/CatCheckListTipo.aspx | 70 ++++++++ AF/CatCheckListTipo.aspx.cs | 100 +++++++++++ App_Code/ClsAF.vb | 220 +++++++++++++++++++++++ App_Code/ClsPaginas.vb | 3 + 8 files changed, 755 insertions(+) create mode 100644 AF/CatActividades.aspx create mode 100644 AF/CatActividades.aspx.cs create mode 100644 AF/CatCheckListActividadesGrupos.aspx create mode 100644 AF/CatCheckListActividadesGrupos.aspx.cs create mode 100644 AF/CatCheckListTipo.aspx create mode 100644 AF/CatCheckListTipo.aspx.cs diff --git a/AF/CatActividades.aspx b/AF/CatActividades.aspx new file mode 100644 index 000000000..907d6a766 --- /dev/null +++ b/AF/CatActividades.aspx @@ -0,0 +1,82 @@ +<%@ Page Title="AF - Catálogo de Actividades" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatActividades.aspx.cs" Inherits="AF_CatActividades" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Actividadedes + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatActividades.aspx.cs b/AF/CatActividades.aspx.cs new file mode 100644 index 000000000..8336030ab --- /dev/null +++ b/AF/CatActividades.aspx.cs @@ -0,0 +1,110 @@ +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 AF_CatActividades : ClsPaginas +{ + private int CveActividad + { + get + { + return ViewState["CveActividad"].ToString().ToEntero(); + } + + set + { + ViewState["CveActividad"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + DdlPuesto.DataSource = get_GlobalDTRHPuestos(UsuarioActual.CveEmpresa); + DdlPuesto.DataBind(); + DdlPuesto.Items.Insert(0,new ListItem("-1","Seleccione")); + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadD_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Agregar"; + TxtNombre.Text = ""; + DdlPuesto.SelectedValueExist(-1); + TxtCantidad.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividad = GvRow.DataKey("CveActividad").ToEntero(); + TxtNombre.Text = GvRow.DataKey("Nombre"); + DdlPuesto.SelectedValueExist(GvRow.DataKey("CvePuesto")); + TxtCantidad.Text = GvRow.DataKey("Cantidad"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividad = GvRow.DataKey("CveActividad").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteActividades(CveActividad)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se eliminó la Actividad correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividad_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarActividad.Text == "Agregar") + { + if (ObjAF.AddActividades(TxtNombre.Text, DdlPuesto.SelectedValue.ToEntero(),TxtCantidad.Text.ToDecimal(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se agregó la Actividad correctamente"); + } + } + else + { + if (ObjAF.UpdateActividades(CveActividad,TxtNombre.Text, DdlPuesto.SelectedValue.ToEntero(), TxtCantidad.Text.ToDecimal(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se actualizó la Actividad correctamente"); + } + } + ObjAF.Dispose(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + } +} \ No newline at end of file diff --git a/AF/CatCheckListActividadesGrupos.aspx b/AF/CatCheckListActividadesGrupos.aspx new file mode 100644 index 000000000..77121933f --- /dev/null +++ b/AF/CatCheckListActividadesGrupos.aspx @@ -0,0 +1,70 @@ +<%@ Page Title="AF - Catálogo de Grupos de CheckLists" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListActividadesGrupos.aspx.cs" Inherits="AF_CatCheckListActividadesGrupos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Grupos de CheckLists + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckListActividadesGrupos.aspx.cs b/AF/CatCheckListActividadesGrupos.aspx.cs new file mode 100644 index 000000000..516ccb505 --- /dev/null +++ b/AF/CatCheckListActividadesGrupos.aspx.cs @@ -0,0 +1,100 @@ +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 AF_CatCheckListActividadesGrupos : ClsPaginas +{ + private int CveCheckListActividadGrupo + { + get + { + return ViewState["CveCheckListActividadGrupo"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListActividadGrupo"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListActividadGrupo(-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarGrupoCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarGrupoCheckList.Text = "Agregar"; + TxtGrupoCheckList.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarGrupoCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividadGrupo = GvRow.DataKey("CveCheckListActividadGrupo").ToEntero(); + TxtGrupoCheckList.Text = GvRow.DataKey("CheckListActividadGrupo"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividadGrupo = GvRow.DataKey("CveCheckListActividadGrupo").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListActividadGrupo(CveCheckListActividadGrupo)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + Alert("Se eliminó el Grupo de CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarGrupoCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarGrupoCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListActividadGrupo(TxtGrupoCheckList.Text)) + { + Alert("Se agregó el Grupo de CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListActividadGrupo(CveCheckListActividadGrupo, TxtGrupoCheckList.Text)) + { + Alert("Se actualizó el Grupo de CheckList correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + } +} \ No newline at end of file diff --git a/AF/CatCheckListTipo.aspx b/AF/CatCheckListTipo.aspx new file mode 100644 index 000000000..518b59864 --- /dev/null +++ b/AF/CatCheckListTipo.aspx @@ -0,0 +1,70 @@ +<%@ Page Title="AF - Catálogo de Tipos de CheckLists" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListTipo.aspx.cs" Inherits="AF_CatCheckListTipo" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Tipos de CheckLists + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckListTipo.aspx.cs b/AF/CatCheckListTipo.aspx.cs new file mode 100644 index 000000000..f3cdafa22 --- /dev/null +++ b/AF/CatCheckListTipo.aspx.cs @@ -0,0 +1,100 @@ +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 AF_CatCheckListTipo : ClsPaginas +{ + private int CveCheckListTipo + { + get + { + return ViewState["CveCheckListTipo"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListTipo"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListTipo(-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarTipoCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarTipoCheckList.Text = "Agregar"; + TxtTipoCheckList.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarTipoCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListTipo = GvRow.DataKey("CveCheckListTipo").ToEntero(); + TxtTipoCheckList.Text = GvRow.DataKey("CheckListTipo"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListTipo = GvRow.DataKey("CveCheckListTipo").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListTipo(CveCheckListTipo)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + Alert("Se eliminó el Grupo de CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarTipoCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarTipoCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListTipo(TxtTipoCheckList.Text)) + { + Alert("Se agregó el Tipo de CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListTipo(CveCheckListTipo, TxtTipoCheckList.Text)) + { + Alert("Se actualizó el Tipo de CheckList correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + } +} \ No newline at end of file diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index e1402fd73..c8f341270 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -3775,6 +3775,226 @@ Public Class ClsAF Return Retorno End Function + Public Function AddActividades(Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad + .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 la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividades(CveActividad As Integer, Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad + .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 la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividades(CveActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividadGrupo(CheckListActividadGrupo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CheckListActividadGrupo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckListTipo(CveCheckListTipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListTipo(CheckListTipo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListTipo(CveCheckListTipo As Integer, CheckListTipo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListTipo(CveCheckListTipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #End Region diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 70b5ff422..ddee3fb68 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3955,6 +3955,9 @@ Public Class ClsPaginas PaginaDict.Add("/AF/CatTiposServicios.aspx".ToUpper(), 765) PaginaDict.Add("/AF/CatTiposServiciosActividades.aspx".ToUpper(), 766) PaginaDict.Add("/AF/CatTiposServiciosMateriales.aspx".ToUpper(), 767) + PaginaDict.Add("/AF/CatActividades.aspx".ToUpper(), 768) + PaginaDict.Add("/AF/CatCheckListActividadesGrupos.aspx".ToUpper(), 769) + PaginaDict.Add("/AF/CatCheckListTipo.aspx".ToUpper(), 770) PaginaDict.Add("/AF/TipoOrdenTrabajo.aspx".ToUpper(), -1) PaginaDict.Add("/AF/OrdenTrabajo.aspx".ToUpper(), -1)