From ce74e59d88fd5e9f40030c23ab291d5b5c606e68 Mon Sep 17 00:00:00 2001 From: janeth arvizu Date: Thu, 15 Aug 2019 14:01:28 -0700 Subject: [PATCH] =?UTF-8?q?Se=20cambi=C3=B3=20cat=C3=A1logo=20a=20nuevo=20?= =?UTF-8?q?modelo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OS/CatTiposOrdenesServicios.aspx | 267 ++++++++++++++++----------- OS/CatTiposOrdenesServicios.aspx.vb | 276 +++++++++++++--------------- 2 files changed, 294 insertions(+), 249 deletions(-) diff --git a/OS/CatTiposOrdenesServicios.aspx b/OS/CatTiposOrdenesServicios.aspx index d14ae3451..b7ccee347 100644 --- a/OS/CatTiposOrdenesServicios.aspx +++ b/OS/CatTiposOrdenesServicios.aspx @@ -3,116 +3,175 @@ + - - - + Catálogo de Tipos de Ordenes de Servicio + + - - - + - - - - - - - - - - - - - - - - - -
- - Tipo de Orden de Servicio - - - - - Estatus - - - - - Fecha Ing. - - - - - Usuario - - - Comandos
- - - -     -
-
-
- - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -   -
-
- - - -
- - - - - -
- - -
+
  • + +
  • - + + + + + +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    + +
    + + + + + + + +   + + + + + +   + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + + +
    +
    + +
    + + \ No newline at end of file diff --git a/OS/CatTiposOrdenesServicios.aspx.vb b/OS/CatTiposOrdenesServicios.aspx.vb index d9f07a516..0ff4c01c3 100644 --- a/OS/CatTiposOrdenesServicios.aspx.vb +++ b/OS/CatTiposOrdenesServicios.aspx.vb @@ -6,179 +6,165 @@ Imports System.Linq Imports Extensiones Partial Class OS_CatTiposOrdenesServicios - Inherits ClsPaginas + Inherits ClsPaginas - Public Property PuedeEditar As Boolean - Get - Return CBool(ViewState("PuedeEditar")) - End Get - Set(value As Boolean) - ViewState("PuedeEditar") = value - End Set - End Property + Private Property CveOrdenServicioTipo As Integer + Get + If Not ViewState("CveOrdenServicioTipo") Is Nothing Then + Return ViewState("CveOrdenServicioTipo").ToString.ToEntero + Else + Return -1 + End If - Public Property PuedeEliminar As Boolean - Get - Return CBool(ViewState("PuedeEditar")) - End Get - Set(value As Boolean) - ViewState("PuedeEditar") = value - End Set - End Property + End Get + Set(value As Integer) + ViewState("CveOrdenServicioTipo") = value + End Set - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - ViewState("Orden") = "" - CargaDatos() - End If - End Sub + End Property - Public Sub CargaDatos() - Dim ObjSubTipoOrdenServicios As New ClsOS + Private Property Actualizar As Boolean + Get + If Not ViewState("Actualizar") Is Nothing Then + Return DirectCast(ViewState("Actualizar"), Boolean) + Else + Return False + End If + End Get + Set(value As Boolean) + ViewState("Actualizar") = value + End Set + End Property + + + Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargadatosGvTiposOS() + End If + + End Sub + + Private Sub CargadatosGvTiposOS() + + Dim ObjSubTipoOrdenServicios As New ClsOS If ObjSubTipoOrdenServicios.GetTipoOrdenesServicios(-1) Then - ViewState("DTTipoOrdenServicios") = ObjSubTipoOrdenServicios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + GvTiposOS.DataSource = ObjSubTipoOrdenServicios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) GlobalDTSubTipoOrdenServicios = ObjSubTipoOrdenServicios.DtResultados Else - Me.GvDatos.DataSource = Nothing + GvTiposOS.DataSource = Nothing End If - ObjSubTipoOrdenServicios.Dispose() + ObjSubTipoOrdenServicios.Dispose() - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub + GvTiposOS.DataBind() + UpGral.Update() - Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click - Dim ObjTipoOrdenServicios As New ClsOS - If ObjTipoOrdenServicios.AddTipoOrdenServicio(TxtTipoOrdenServicio.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - TxtTipoOrdenServicio.Text = "" - Alert("El nuevo Tipo de Orden de Servicio se guardó correctamente.", TipoMensaje.MsgInformacion) - UpTitulos.Update() - ViewState("DTTipoOrdenServicios") = ObjTipoOrdenServicios.DtResultados '.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - 'GlobalDTTipoOrdenServicios(-1) = ObjTipoOrdenServicios.DtResultados + End Sub - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End If - ObjTipoOrdenServicios.Dispose() - End Sub + Protected Sub BtnAgregarTiposOS_Click(sender As Object, e As EventArgs) Handles BtnAgregarTiposOS.Click + LtlTituloModalTiposOS.Text = "Agregar Tipo de Orden de Servicio" + BtnAgregarTiposOSModal.Text = "Agregar" + DivEstatus.Visible = False -#Region "G V D A T O S" - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(250) - e.Row.Cells(1).Width = Unit.Pixel(100) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(3).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(100) - e.Row.Cells(5).Width = Unit.Pixel(61) + TxtTiposOS.Text = "" + + Actualizar = False + UpGral.Update() + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposOS")) + + End Sub + + Protected Sub BtnAgregarTiposOSModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarTiposOSModal.Click + + Dim ObjTipoOrdenServicios As New ClsOS + + If Not Actualizar Then + If ObjTipoOrdenServicios.AddTipoOrdenServicio(TxtTiposOS.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + TxtTiposOS.Text = "" + ChkEstatus.Checked = True + + CargadatosGvTiposOS() + + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposOS"), "jsHideModalTiposOS") + 'GeneraGlobalDT() + UpGral.Update() + + Alert("Tipo de Orden de Servicio Agregado Correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrio un error al guardar el Tipo de Orden de Servicio", TipoMensaje.MsgError) End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center - End If - End Sub - - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim ObjTipoOrdenServicios As New ClsOS - If ObjTipoOrdenServicios.RemoveTipoOrdenServicio(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvDatos.EditIndex = -1 - ViewState("DTTipoOrdenServicios") = ObjTipoOrdenServicios.DtResultados '.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - 'GlobalDTTipoOrdenServicios(-1) = ObjTipoOrdenServicios.DtResultados - Alert("El Tipo de Orden de Servicio se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjTipoOrdenServicios.Dispose() - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) Else - CargaGrid("") - End If - End Sub + If ObjTipoOrdenServicios.UpdateTipoOrdenServicio(TxtTiposOS.Text.Trim, False, ChkEstatus.Checked, CveOrdenServicioTipo) Then - Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit - GvDatos.EditIndex = -1 - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub + TxtTiposOS.Text = "" + ChkEstatus.Checked = True - Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating - Dim ObjTipoOrdenServicios As New ClsOS - Dim TipoOrdenServicio As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtTipoOrdenServicio"), TextBox).Text.Trim - Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked - Dim CveTipoOrdenServicio As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero + CargadatosGvTiposOS() + 'GeneraGlobalDT() + UpModalTiposOS.Update() - If ObjTipoOrdenServicios.UpdateTipoOrdenServicio(TipoOrdenServicio, False, Estatus, CveTipoOrdenServicio) Then - GvDatos.EditIndex = -1 - ViewState("DTTipoOrdenServicios") = ObjTipoOrdenServicios.DtResultados '.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - 'GlobalDTTipoOrdenServicios(-1) = ObjTipoOrdenServicios.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposOS"), "jsHideModalTiposOS") + + UpGral.Update() + Alert("Tipo de Orden de Servicio Actualizado Correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrio un error al Actualizar el Tipo de Orden de Servicio", TipoMensaje.MsgError) + End If End If + + CveOrdenServicioTipo = -1 + Actualizar = False + ObjTipoOrdenServicios.Dispose() - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If End Sub - Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing - GvDatos.EditIndex = e.NewEditIndex - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) + Public Sub Remove_ClickTiposOS(sender As Object, e As EventArgs) + + Dim ObjTipoOrdenServicios As New ClsOS + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + CveOrdenServicioTipo = GvRow.DataKey("CveOrdenServicioTipo").ToEntero + + If ObjTipoOrdenServicios.RemoveTipoOrdenServicio(CveOrdenServicioTipo) Then + CargadatosGvTiposOS() + 'GeneraGlobalDT() + + Alert("El Tipo de Orden de Servicio se eliminó Correctamente ", TipoMensaje.MsgInformacion) Else - CargaGrid("") + Alert("Ocurrio un error al Eliminar el Tipo de Orden de Servicio", TipoMensaje.MsgError) End If - End Sub -#End Region -#Region "O R D E N A M I E N T O" - Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) - Dim Orden As String = "" - Dim Campo As String = "" - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String + ObjTipoOrdenServicios.Dispose() - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) + CargadatosGvTiposOS() + + CveOrdenServicioTipo = -1 - If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString - ViewState("Orden") = Orden - CargaGrid(Orden) End Sub - Private Sub CargaGrid(Orden As String) - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTTipoOrdenServicios"), DataTable), "", Orden, DataViewRowState.CurrentRows) - GvDatos.DataSource = DV.ToTable() - DV.Dispose() - Else - GvDatos.DataSource = CType(ViewState("DTTipoOrdenServicios"), DataTable) - End If - GvDatos.DataBind() - UpDatos.Update() + Public Sub Edit_ClickTiposOS(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + LtlTituloModalTiposOS.Text = "Editar Tipo de Orden de Servicio" + Actualizar = True + DivEstatus.Visible = True + + CveOrdenServicioTipo = GvRow.DataKey("CveOrdenServicioTipo").ToEntero + + TxtTiposOS.Text = GvRow.DataKey("OrdenServicioTipo") + ChkEstatus.Checked = If(GvRow.DataKey("Estatus") = "Activo", True, False) + + BtnAgregarTiposOSModal.Text = "Actualizar" + + UpModalTiposOS.Update() + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposOS")) + End Sub -#End Region -End Class + +End Class \ No newline at end of file