Files
SIG/Bancos/Temporal/RegBoletas.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

112 lines
3.7 KiB
VB.net

Option Strict On
Option Explicit On
Imports Extensiones
Imports System.Data
Partial Class Temporal_RegBoletas
Inherits ClsPaginas
#Region "P R O P I E D A D E S "
Public Property DTConsejeros As DataTable
Get
Return CType(ViewState("DTConsejeros"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTConsejeros") = value
End Set
End Property
Public Property NumBoleta As Integer
Get
Return CType(ViewState("NumBoleta"), Integer)
End Get
Set(value As Integer)
ViewState("NumBoleta") = value
End Set
End Property
Public Property VotosBoleta As Integer
Get
Return CType(ViewState("VotosBoleta"), Integer)
End Get
Set(value As Integer)
ViewState("VotosBoleta") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
VotosBoleta = 0
End If
End Sub
Protected Sub LbAddConsejero_Click(sender As Object, e As EventArgs) Handles LbAddConsejero.Click
Dim Boleta As New ClsTemporal
DTConsejeros = New DataTable()
Dim NumConsejero As Integer = TxtConsejero.Text.ToEntero
Dim CveConsejero As Integer
NumBoleta = TxtBoleta.Text.ToEntero
If Boleta.GetTempConsejeros Then
DTConsejeros = Boleta.DtResultados.FiltraParametros($"NumConsejero = {NumConsejero} ")
If DTConsejeros.Rows.Count > 0 Then
CveConsejero = DTConsejeros.Rows(0)("CveConsejero").ToString.ToEntero
If Boleta.AddTempVotos(CveConsejero, NumBoleta) Then
VotosBoleta += 1
Else
Alert("Ocurrió un error al agregar el voto", TipoMensaje.MsgError)
End If
Else
Alert("El consejero no existe, revise el número de consejero", TipoMensaje.MsgAdvertencia)
End If
End If
TxtConsejero.Text = ""
UpDatos.Update()
Boleta.Dispose()
CargaGrid()
End Sub
Private Sub CargaGrid()
Dim Boleta As New ClsTemporal
If Boleta.GetTempVotos(NumBoleta) AndAlso Boleta.DtResultados.Rows.Count > 0 Then
GVDatos.DataSource = Boleta.DtResultados
Else
GVDatos.DataSource = Nothing
End If
Boleta.Dispose()
GVDatos.DataBind()
UPGv.Update()
End Sub
Private Sub LbAgregarBoleta_Click(sender As Object, e As EventArgs) Handles LbAgregarBoleta.Click
If TxtBoleta.Text <> "" Then
TxtBoleta.Enabled = False
LbAgregarBoleta.Visible = False
trConsejero.Visible = True
End If
UpDatos.Update()
End Sub
Private Sub GVDatos_DataBound(sender As Object, e As EventArgs) Handles GVDatos.DataBound
If GVDatos.Rows.Count >= 25 Then
Alert("Esta boleta está completa, continue con otra boleta por favor.")
TxtBoleta.Text = ""
TxtBoleta.Enabled = True
LbAgregarBoleta.Visible = True
trConsejero.Visible = False
UpDatos.Update()
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVDatos.RowDeleting
Dim Objeto As New ClsTemporal
If Objeto.RemoveTempVotos(GVDatos.Rows(e.RowIndex).DataKey("NumBoleta").ToEntero, GVDatos.Rows(e.RowIndex).DataKey("CveConsejero").ToEntero) Then
Alert("Se eliminó correctamente.")
End If
CargaGrid()
End Sub
End Class