Imports System.Data Imports Extensiones Partial Class Acumuladores_CatTiposUso Inherits ClsPaginas Private Property CveTipoUso As Integer Get If Not ViewState("CveTipoUso") Is Nothing Then Return ViewState("CveTipoUso").ToString.ToEntero Else Return -1 End If End Get Set(value As Integer) ViewState("CveTipoUso") = value End Set End Property 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 CargadatosGvTiposUso() End If End Sub #Region "Tipos Uso" Private Sub CargadatosGvTiposUso() Dim objAcum As New ClsAcumuladores If objAcum.TiposUsoGet(-1, UsuarioActual.Empresa.CveEmpresa) Then GvTiposUso.DataSource = objAcum.DtResultados Else GvTiposUso.DataSource = Nothing End If objAcum.Dispose() UPGvTiposUso.DataBind() UpGral.Update() 'CargaGvTamanioBitacora() End Sub Private Sub GeneraGlobalDT() Dim ObjAcum As New ClsAcumuladores If ObjAcum.TiposUsoGet(-1, UsuarioActual.Empresa.CveEmpresa) Then Application("GlobalDTAcumTiposUso") = ObjAcum.DtResultados ObjAcum.Dispose() End Sub 'Private Sub CargaGvTamanioBitacora() ' Dim objAcum As New ClsAcumuladores ' If objAcum.TamañoBitacoraGet(UsuarioActual.Empresa.CveEmpresa) Then ' GvBitacora.DataSource = objAcum.DtResultados ' Else ' GvBitacora.DataSource = Nothing ' End If ' objAcum.Dispose() ' UpGvBitacora.DataBind() ' UpGral.Update() 'End Sub Protected Sub BtnAgregarTiposUso_Click(sender As Object, e As EventArgs) Handles BtnAgregarTiposUso.Click LtlTituloModalTiposUso.Text = "Agregar Tipo Uso" BtnAgregarTiposUsoModal.Text = "Agregar" TxtTiposUso.Text = "" ChkEstatus.Checked = True Actualizar = False UpGral.Update() RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposUso")) End Sub Protected Sub BtnAgregarTiposUsoModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarTiposUsoModal.Click Dim ObjAcum As New ClsAcumuladores 'Dim Cargo, Bonificacion, Compra, Puntos As Decimal 'Cargo = If(TxtCargo.Text.ToDecimal > 0, TxtCargo.Text.ToDecimal, -1) 'Bonificacion = If(TxtBonificacion.Text.ToDecimal > 0, TxtBonificacion.Text.ToDecimal, -1) 'Compra = If(TxtCompra.Text.ToDecimal > 0, TxtCompra.Text.ToDecimal, -1) 'Puntos = If(TxtPuntos.Text.ToDecimal > 0, TxtPuntos.Text.ToDecimal, -1) If Not Actualizar Then If ObjAcum.TiposUsoAdd(TxtTiposUso.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then TxtTiposUso.Text = "" ChkEstatus.Checked = True 'TxtCargo.Text = "" 'TxtBonificacion.Text = "" 'TxtCompra.Text = "" 'TxtPuntos.Text = "" CargadatosGvTiposUso() RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposUso"), "jsHideModalTiposUso") UpGral.Update() GeneraGlobalDT() Alert("Tipo de Uso Agregado Correctamente", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al guardar el Tipo de Uso", TipoMensaje.MsgError) End If Else If ObjAcum.TiposUsoUpdate(CveTipoUso, TxtTiposUso.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario) Then TxtTiposUso.Text = "" ChkEstatus.Checked = True 'TxtCargo.Text = "" 'TxtBonificacion.Text = "" 'TxtCompra.Text = "" 'TxtPuntos.Text = "" CargadatosGvTiposUso() UpModalTiposUso.Update() RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposUso"), "jsHideModalTiposUso") UpGral.Update() GeneraGlobalDT() Alert("Tipo de Uso Actualizado Correctamente", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al Actualizar el Tipo de Uso", TipoMensaje.MsgError) End If End If CveTipoUso = -1 Actualizar = False ObjAcum.Dispose() End Sub Public Sub Remove_ClickTiposUso(sender As Object, e As EventArgs) Dim objAcum As New ClsAcumuladores Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim activo As Boolean = 0 Dim CveCapacitador As Integer = GvRow.DataKey("CveTipoUso") If objAcum.TiposUsoRemove(CveCapacitador, UsuarioActual.CveEmpresa) Then CargadatosGvTiposUso() GeneraGlobalDT() Alert("Capacitador Eliminó Correctamente ", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al Eliminar el Tipo de Uso", TipoMensaje.MsgError) End If objAcum.Dispose() CargadatosGvTiposUso() CveTipoUso = -1 End Sub Public Sub Edit_ClickTiposUso(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim activo As Boolean = 0 LtlTituloModalTiposUso.Text = "Editar Tipo Uso" Actualizar = True CveTipoUso = GvRow.DataKey("CveTipoUso") TxtTiposUso.Text = GvRow.DataKey("TipoUso") ChkEstatus.Checked = If(GvRow.DataKey("Estatus") = "Activo", True, False) 'TxtCargo.Text = GvRow.DataKey("Cargo").ToDecimal.ToString("###,###,###.00") 'TxtBonificacion.Text = GvRow.DataKey("Bonificacion").ToDecimal.ToString("###,###,###.00") 'TxtCompra.Text = GvRow.DataKey("Compra").ToDecimal.ToString("###,###,###.00") 'TxtPuntos.Text = GvRow.DataKey("Puntos").ToDecimal.ToString("###,###,###.00") 'DdlPS.Items.Clear() 'DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) 'DdlPS.DataBind() 'DdlPS.SelectedValueExist(GvRow.DataKey("CvePSCargo").ToEntero) BtnAgregarTiposUsoModal.Text = "Actualizar" UpModalTiposUso.Update() RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposUso")) End Sub #End Region End Class