232 lines
8.0 KiB
VB.net
232 lines
8.0 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
|
|
Partial Class Acumuladores_CatFoliosGarantia
|
|
Inherits ClsPaginas
|
|
|
|
Private Property CveFolioGarantia As Integer
|
|
Get
|
|
If Not ViewState("CveFolioGarantia") Is Nothing Then
|
|
Return ViewState("CveFolioGarantia").ToString.ToEntero
|
|
Else
|
|
Return -1
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveFolioGarantia") = 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
|
|
CargaSubProyectos()
|
|
CargadatosGvFolioGarantia(-1, "-1")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#Region "Folios Garantía"
|
|
Private Sub CargaSubProyectos()
|
|
DdlSubProyectos.Items.Clear()
|
|
DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
|
DdlSubProyectos.DataBind()
|
|
DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
End Sub
|
|
|
|
Private Sub CargadatosGvFolioGarantia(EstatusValor As Integer, tipoFolioValor As String)
|
|
|
|
Dim objAcum As New ClsAcumuladores
|
|
|
|
If objAcum.FoliosGarantiaGet(-1, UsuarioActual.Empresa.CveEmpresa, Estatus:=EstatusValor, TipoFolio:=tipoFolioValor) Then
|
|
GvFolioGarantia.DataSource = objAcum.DtResultados
|
|
Else
|
|
GvFolioGarantia.DataSource = Nothing
|
|
End If
|
|
|
|
objAcum.Dispose()
|
|
|
|
UPGvFolioGarantia.DataBind()
|
|
UpGral.Update()
|
|
|
|
'CargaGvTamanioBitacora()
|
|
|
|
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 BtnAgregarFolioGarantia_Click(sender As Object, e As EventArgs) Handles BtnAgregarFolioGarantia.Click
|
|
LtlTituloModalFolioGarantia.Text = "Agregar Folio Garantía"
|
|
BtnAgregarFolioGarantiaModal.Text = "Agregar"
|
|
|
|
TxtFolioGarantia.Text = ""
|
|
ChkEstatus.Checked = True
|
|
DdlSubProyectos.SelectedValueExist("-1")
|
|
|
|
Actualizar = False
|
|
UpGral.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolioGarantia"))
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarFolioGarantiaModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarFolioGarantiaModal.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.FoliosGarantiaAdd(TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, DdlTipoFolioModal.SelectedValue, TxtLimite.Text.ToEntero) Then
|
|
|
|
TxtFolioGarantia.Text = ""
|
|
ChkEstatus.Checked = True
|
|
'TxtCargo.Text = ""
|
|
'TxtBonificacion.Text = ""
|
|
'TxtCompra.Text = ""
|
|
'TxtPuntos.Text = ""
|
|
|
|
CargadatosGvFolioGarantia(-1, "-1")
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolioGarantia"), "jsHideModalFolioGarantia")
|
|
UpGral.Update()
|
|
|
|
Alert("Folio de Garantía Agregado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al guardar el Folio de Garantía", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
If ObjAcum.FoliosGarantiaUpdate(CveFolioGarantia, TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, DdlSubProyectos.SelectedValue.ToEntero,
|
|
DdlTipoFolioModal.SelectedValue, TxtLimite.Text.ToEntero) Then
|
|
|
|
TxtFolioGarantia.Text = ""
|
|
ChkEstatus.Checked = True
|
|
'TxtCargo.Text = ""
|
|
'TxtBonificacion.Text = ""
|
|
'TxtCompra.Text = ""
|
|
'TxtPuntos.Text = ""
|
|
|
|
CargadatosGvFolioGarantia(-1, "-1")
|
|
UpModalFolioGarantia.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolioGarantia"), "jsHideModalFolioGarantia")
|
|
|
|
UpGral.Update()
|
|
Alert("Folio de Garantía Actualizado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al Actualizar el Folio de Garantía", TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
|
|
CveFolioGarantia = -1
|
|
Actualizar = False
|
|
|
|
ObjAcum.Dispose()
|
|
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickFolioGarantia(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("CveFolioGarantia")
|
|
|
|
If objAcum.FoliosGarantiaRemove(CveCapacitador, UsuarioActual.CveEmpresa) Then
|
|
CargadatosGvFolioGarantia(-1, "-1")
|
|
|
|
Alert("Capacitador Eliminó Correctamente ", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al Eliminar el Folio de Garantía", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
objAcum.Dispose()
|
|
|
|
CargadatosGvFolioGarantia(-1, "-1")
|
|
|
|
CveFolioGarantia = -1
|
|
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickFolioGarantia(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = 0
|
|
|
|
LtlTituloModalFolioGarantia.Text = "Editar Folio Garantía"
|
|
Actualizar = True
|
|
|
|
CveFolioGarantia = GvRow.DataKey("CveFolioGarantia")
|
|
|
|
TxtFolioGarantia.Text = GvRow.DataKey("FolioGarantia")
|
|
ChkEstatus.Checked = If(GvRow.DataKey("Estatus") = "Activo", True, False)
|
|
TxtLimite.Text = GvRow.DataKey("Limite")
|
|
DdlTipoFolioModal.SelectedValue = GvRow.DataKey("tipoFolio")
|
|
'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")
|
|
|
|
DdlSubProyectos.Items.Clear()
|
|
DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
|
DdlSubProyectos.DataBind()
|
|
DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlSubProyectos.SelectedValueExist(GvRow.DataKey("CveSubProyecto").ToEntero)
|
|
|
|
BtnAgregarFolioGarantiaModal.Text = "Actualizar"
|
|
|
|
UpModalFolioGarantia.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolioGarantia"))
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
|
CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, DdlTipoFolio.SelectedValue)
|
|
End Sub
|
|
|
|
End Class
|