Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

748
GPS/WizardModelo.aspx.vb Normal file
View File

@@ -0,0 +1,748 @@
Option Strict On
Option Explicit On
Imports System.IO
Imports System.Data
Imports Extensiones
Partial Class GPS_WizardModelo
Inherits ClsPaginas
#Region "PROPIEDADES"
Public Property EsEditar As Integer
Get
Return ViewState("EsEditar").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("EsEditar") = value
End Set
End Property
Public Property CveMarca As Integer
Get
Return ViewState("CveMarca").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveMarca") = value
End Set
End Property
Public Property CveModelo As Integer
Get
Return ViewState("CveModelo").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveModelo") = value
End Set
End Property
Public Property CveTipoEquipoM As Integer
Get
Return ViewState("CveTipoEquipoM").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveTipoEquipoM") = value
End Set
End Property
Public Property CveMarcaM As Integer
Get
Return ViewState("CveMarcaM").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveMarcaM") = value
End Set
End Property
Public Property CveTipoEquipo As Integer
Get
Return ViewState("CveTipoEquipo").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveTipoEquipo") = value
End Set
End Property
Public Property CveEvento As Integer
Get
Return ViewState("CveEvento").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveEvento") = value
End Set
End Property
Public Property Paso As Integer
Get
Return ViewState("Paso").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("Paso") = value
End Set
End Property
Public Property NoEntradasA As Integer
Get
Return ViewState("NoEntradasA").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("NoEntradasA") = value
End Set
End Property
Public Property NoSalidasA As Integer
Get
Return ViewState("NoSalidasA").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("NoSalidasA") = value
End Set
End Property
Public Property NoEntradasD As Integer
Get
Return ViewState("NoEntradasD").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("NoEntradasD") = value
End Set
End Property
Public Property NoSalidasD As Integer
Get
Return ViewState("NoSalidasD").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("NoSalidasD") = value
End Set
End Property
Public Property Sonido As String
Get
Return ViewState("Sonido").ToString
End Get
Set(value As String)
ViewState("Sonido") = value
End Set
End Property
Public Property Imagen As String
Get
Return ViewState("Imagen").ToString
End Get
Set(value As String)
ViewState("Imagen") = value
End Set
End Property
Private Property TmpDT As DataTable
Get
Return CType(ViewState("TmpDT"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDT") = 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
EsEditar = 0
If Request("CveModelo") IsNot Nothing AndAlso IsNumeric(Request("CveModelo")) AndAlso Request("CveModelo").ToEntero > 0 Then
ViewState("CveModelo") = Request("CveModelo").ToEntero
EsEditar = 1
CargaDatos()
Else
CveModelo = -1
CveMarca = -1
End If
CargaMarcas()
Paso = 1
End If
End Sub
Private Sub CargaDatos()
Dim GPS As New ClsGPS
If GPS.ModeloGet(CveModelo, -1) AndAlso GPS.DtResultados.Rows.Count > 0 Then
CveMarca = GPS.DtResultados.Rows(0)("CveMarca").ToString.ToEntero
TxtModelo.Text = GPS.DtResultados.Rows(0)("Modelo").ToString
End If
GPS.Dispose()
End Sub
Private Sub CargaModelo()
Dim GPS As New ClsGPS
If GPS.ModeloEntradaSalidaGet(CveModelo) AndAlso GPS.DtResultados.Rows.Count > 0 Then
TxtNoEntradasA.Text = GPS.DtResultados.FiltraParametros("TipoModeloEntradaSalida = 0 AND Tipo = 'Entrada'").Rows.Count.ToString
TxtNoEntradasD.Text = GPS.DtResultados.FiltraParametros("TipoModeloEntradaSalida = 1 AND Tipo = 'Entrada'").Rows.Count.ToString
TxtEntradasDts.Text = GPS.DtResultados.FiltraParametros("TipoModeloEntradaSalida = 2 AND Tipo = 'Entrada'").Rows.Count.ToString
TxtNoSalidasA.Text = GPS.DtResultados.FiltraParametros("TipoModeloEntradaSalida = 0 AND Tipo = 'Salida'").Rows.Count.ToString
TxtNoSalidasD.Text = GPS.DtResultados.FiltraParametros("TipoModeloEntradaSalida = 1 AND Tipo = 'Salida'").Rows.Count.ToString
TxtSalidasDts.Text = GPS.DtResultados.FiltraParametros("TipoModeloEntradaSalida = 2 AND Tipo = 'Salida'").Rows.Count.ToString
End If
GPS.Dispose()
UpModelo.Update()
End Sub
Protected Sub BtnMain_Click(sender As Object, e As EventArgs) Handles BtnMain.Click
GuardarPasos(Paso)
End Sub
Private Sub GuardarPasos(PasoActual As Integer)
Dim GPS As New ClsGPS
Select Case PasoActual
Case 1
If hdnMarca.Value.ToEntero <= 0 Then
Alert("Por favor, escoja una marca (Puede dar de alta una desde Acciones)", TipoMensaje.MsgAdvertencia)
Else
CveMarcaM = hdnMarca.Value.ToEntero
RegistraScript("$('a.button-next').click()")
Paso = 2
BtnBack.Visible = True
If CveModelo > 0 Then
CargaModelo()
End If
End If
Case 2
Dim huboerror As Boolean
If Not TxtModelo.Text <> "" AndAlso CveMarcaM > 0 Then
'huboerror = True
Alert("Por favor, llene todos los datos requeridos", TipoMensaje.MsgAdvertencia)
huboerror = True
End If
If Not huboerror Then
Paso = 3
NoEntradasA = TxtNoEntradasA.Text.ToEntero
NoSalidasA = TxtNoSalidasA.Text.ToEntero
NoEntradasD = TxtNoEntradasD.Text.ToEntero
NoSalidasD = TxtNoSalidasD.Text.ToEntero
RegistraScript("$('a.button-next').click()")
' CveModelo = GPS.CveModelo
CargaEventos()
UpEventos.Update()
BtnMain.Text = "Finalizar"
End If
Case 3
GuardarModelo()
End Select
GPS.Dispose()
End Sub
Private Sub GuardarModelo()
Dim GPS As New ClsGPS
GPS.IniciaTransacSQL()
Dim huboerror = False
Dim EntradasDatos As Integer = TxtEntradasDts.Text.Trim.ToEntero
Dim SalidasDatos As Integer = TxtSalidasDts.Text.Trim.ToEntero
Dim Mensaje As String = ""
If CveModelo > 0 Then
If Not GPS.ModeloUpdate(TxtModelo.Text, CveMarcaM, 1, CveModelo) Then huboerror = True
If Not huboerror Then
For Each row As GridViewRow In GvEventos.Rows
If Not GPS.ModeloEventoUpdate(row.DataKey("CveEvento").ToString.ToEntero, CveModelo, If(row.FCCheckBox("chkEv").Checked, 1, 0)) Then
huboerror = True
Exit For
End If
Next
End If
If Not GPS.ModeloEntradaSalidaDelete(CveModelo) Then huboerror = True
If Not huboerror Then
For I As Integer = 1 To NoEntradasA
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 0, 0, I) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoEntradasD
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 0, 1, I + NoEntradasA) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To EntradasDatos
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 0, 2, I + NoEntradasA + NoEntradasD) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoSalidasA
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 1, 0, I) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoSalidasD
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 1, 1, I + NoSalidasA) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To SalidasDatos
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 1, 2, I + NoSalidasA + NoSalidasD) Then
huboerror = True
Exit For
End If
Next
Mensaje = "El modelo se actualizó correctamente"
End If
Else
If Not GPS.ModeloAdd(TxtModelo.Text, CveMarcaM, 1, UsuarioActual.CveUsuario) Then huboerror = True
If Not huboerror Then
Dim CveEvento As Integer
CveModelo = GPS.CveModelo
For Each row As GridViewRow In GvEventos.Rows
If row.FCCheckBox("chkEv").Checked Then
CveEvento = row.DataKey("CveEvento").ToString.ToEntero
If Not GPS.ModeloEventoAdd(CveEvento, CveModelo) Then
huboerror = True
Exit For
End If
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoEntradasA
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 0, 0, I) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoEntradasD
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 0, 1, I + NoEntradasA) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To EntradasDatos
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 0, 2, I + NoEntradasA + NoEntradasD) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoSalidasA
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 1, 0, I) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To NoSalidasD
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 1, 1, I + NoSalidasA) Then
huboerror = True
Exit For
End If
Next
End If
If Not huboerror Then
For I As Integer = 1 To SalidasDatos
If Not GPS.ModeloEntradaSalidaAdd(CveModelo, 1, 2, I + NoSalidasA + NoSalidasD) Then
huboerror = True
Exit For
End If
Next
Mensaje = "El módelo se agregó correctamente"
End If
End If
If Not huboerror Then
GPS.Commit()
Alert(Mensaje, TipoMensaje.MsgInformacion, "document.location.href=""/GPS/CatModelos.aspx"";")
Else
GPS.RollBack()
End If
GPS.Dispose()
End Sub
#Region "Marca"
Private Sub CargaMarcas()
dvEstatusM.Visible = False
hdnMarca.Value = "0"
Dim GPS As New ClsGPS
If GPS.GetMarca(-1, -1) Then
gvMarcas.DataSource = GPS.DtResultados
Else
gvMarcas.DataSource = Nothing
End If
GPS.Dispose()
gvMarcas.DataBind()
End Sub
Protected Sub BtnAgregarTipoMarca_Click(sender As Object, e As EventArgs) Handles BtnAddMarca.Click
Dim GPS As New ClsGPS
If EsEditar = 0 Then
If GPS.AddMarca(TxtMarca.Text.Trim, True, UsuarioActual.CveUsuario) Then
Alert("La marca se agregó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al agregar la marca", TipoMensaje.MsgError)
End If
ElseIf EsEditar = 1 Then
If GPS.UpdateMarca(TxtMarca.Text, chkEstatusMarca.Checked, CveMarca) Then
Alert("La marca se editó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al editar la marca", TipoMensaje.MsgError)
End If
EsEditar = 0
BtnAddMarca.Text = "Agregar"
dvEstatusM.Visible = False
End If
RegistraScript("$('#divMarca').modal('hide')")
GPS.Dispose()
TxtMarca.Text = ""
CargaMarcas()
UpMarcas.Update()
UpBodyMarca.Update()
End Sub
Protected Sub imgEM_Click(sender As Object, e As EventArgs)
Dim Boton = CType(sender, LinkButton)
dvEstatusM.Visible = True
CveMarca = Boton.CommandArgument.ToEntero
hdnMarca.Value = "0"
Dim GvRow As GridViewRow = DirectCast(Boton.NamingContainer, GridViewRow)
TxtMarca.Text = GvRow.DataKey("Marca").ToString
chkEstatusMarca.Checked = CBool(GvRow.DataKey("Estatus").ToString)
EsEditar = 1
myModalLabel2.InnerHtml = "Actualizar Marca"
BtnAddMarca.Text = "Actualizar"
UpBodyMarca.Update()
UpdatePanel1.Update()
UpFooterMarca.Update()
RegistraScript("$('#divMarca').modal()")
End Sub
Protected Sub gvMarcas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gvMarcas.RowDeleting
Dim GPS As New ClsGPS
Dim CveMarca As Integer = gvMarcas.Rows(e.RowIndex).DataKey("CveMarca").ToEntero
If GPS.DeleteMarca(CveMarca) Then
Alert("La marca se eliminó correctamente", TipoMensaje.MsgInformacion)
End If
GPS.Dispose()
CargaMarcas()
UpMarcas.Update()
End Sub
Protected Sub gvMarcas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvMarcas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If CveMarca = e.Row.DBCampo("CveMarca").ToEntero Then
RegistraScript($"CargaDatosSeleccionados({e.Row.RowIndex}, '{e.Row.DBCampo("CveMarca")}')")
End If
e.Row.VerticalAlign = VerticalAlign.Middle
e.Row.Attributes.Add("onClick", $"CargaDatosSeleccionados({e.Row.RowIndex}, '{e.Row.DBCampo("CveMarca").ToString}');")
e.Row.FCLinkButton("ImgE").CommandArgument = e.Row.DataKey("CveMarca").ToString
End If
End Sub
Protected Sub btnCancelarMarca_Click(sender As Object, e As EventArgs) Handles BtnOpenDivMarca.Click
EsEditar = 0
TxtMarca.Text = ""
RegistraScript("$('#divMarca').modal()")
dvEstatusM.Visible = False
BtnAddMarca.Text = "Agregar"
myModalLabel2.InnerHtml = "Agregar Marca"
UpBodyMarca.Update()
End Sub
#End Region
#Region "Evento"
Private Sub CargaEventos()
Dim GPS As New ClsGPS
If GPS.EventoGet(-1, 1, 1) Then
GvEventos.DataSource = GPS.DtResultados
Else
GvEventos.DataSource = Nothing
End If
If CveModelo > 0 Then
If GPS.ModeloEventoGet(CveModelo) Then
TmpDT = GPS.DtResultados
End If
Else
TmpDT = Nothing
End If
GPS.Dispose()
GvEventos.DataBind()
UpBodyEvento.Update()
End Sub
'Private Sub CargaDdl()
' Dim GPS As New ClsGPS
' If GPS.ControladorGraficoGet(-1) Then
' DdlControladorGrafico.DataSource = GPS.DtResultados.FiltraParametros("Estatus = 1")
' Else
' DdlControladorGrafico.DataSource = Nothing
' End If
' GPS.Dispose()
' DdlControladorGrafico.DataBind()
' DdlControladorGrafico.Items.Insert(0, New ListItem("Seleccione", "-1"))
' UpBodyEvento.Update()
'End Sub
Protected Sub BtnAgregarTipoEvento_Click(sender As Object, e As EventArgs) Handles BtnAddEvento.Click
Dim GPS As New ClsGPS
Dim huboerror As Boolean = False
If EsEditar = 0 Then
Imagen = ""
Sonido = ""
Try
If TxtUpImagen.getfiles().Archivos.Count > 0 Then
Dim ArchivoImagen As Archivo = TxtUpImagen.getfiles().Archivos(0)
Imagen = FormatearNombreArchivo(ArchivoImagen.filenameO)
Dim Path As String = $"{AppDomain.CurrentDomain.BaseDirectory}Imagenes"
If Not Directory.Exists(Path) Then
Directory.CreateDirectory(Path)
End If
Dim directorioNew As String = String.Format("{0}\{1}", Path, Imagen)
If File.Exists(directorioNew) Then
My.Computer.FileSystem.DeleteFile(directorioNew)
End If
My.Computer.FileSystem.MoveFile(ArchivoImagen.FileUrl, directorioNew)
End If
If TxtUpSonido.getfiles().Archivos.Count > 0 Then
Dim ArchivoSonido As Archivo = TxtUpSonido.getfiles().Archivos(0)
Dim PathSonido As String = $"{AppDomain.CurrentDomain.BaseDirectory}Sonidos"
Sonido = FormatearNombreArchivo(ArchivoSonido.filenameO)
Dim dirSonido As String = String.Format("{0}\{1}", PathSonido, Sonido)
If File.Exists(dirSonido) Then
My.Computer.FileSystem.DeleteFile(dirSonido)
End If
My.Computer.FileSystem.MoveFile(ArchivoSonido.FileUrl, dirSonido)
End If
Catch ex As Exception
huboerror = True
OnError(ex.Message, ex)
End Try
If Not huboerror Then
If GPS.EventoAdd(TxtEvento.Text.Trim, 1, True, TxtCSS.Text.Trim, Imagen, Sonido, UsuarioActual.CveUsuario, -1) Then
Alert("El evento se agregó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al agregar el evento", TipoMensaje.MsgError)
End If
End If
ElseIf EsEditar = 1 Then
Try
If TxtUpImagen.getfiles().Archivos.Count > 0 Then
Dim ArchivoImagen As Archivo = TxtUpImagen.getfiles().Archivos(0)
Imagen = FormatearNombreArchivo(ArchivoImagen.filenameO)
Dim Path As String = $"{AppDomain.CurrentDomain.BaseDirectory}Imagenes"
If Not Directory.Exists(Path) Then
Directory.CreateDirectory(Path)
End If
Dim directorioNew As String = String.Format("{0}\{1}", Path, Imagen)
If File.Exists(directorioNew) Then
My.Computer.FileSystem.DeleteFile(directorioNew)
End If
My.Computer.FileSystem.MoveFile(ArchivoImagen.FileUrl, directorioNew)
End If
If TxtUpSonido.getfiles().Archivos.Count > 0 Then
Dim ArchivoSonido As Archivo = TxtUpSonido.getfiles().Archivos(0)
Sonido = FormatearNombreArchivo(ArchivoSonido.filenameO)
Dim PathSonido As String = $"{AppDomain.CurrentDomain.BaseDirectory}Sonidos"
Dim dirSonido As String = String.Format("{0}\{1}", PathSonido, Sonido)
If File.Exists(dirSonido) Then
My.Computer.FileSystem.DeleteFile(dirSonido)
End If
My.Computer.FileSystem.MoveFile(ArchivoSonido.FileUrl, dirSonido)
End If
Catch ex As Exception
huboerror = True
OnError(ex.Message, ex)
End Try
If Not huboerror Then
If GPS.EventoUpdate(CveEvento, TxtEvento.Text.Trim, 1, True, TxtCSS.Text.Trim, Imagen, Sonido, -1) Then
Alert("El evento se editó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al editar el evento", TipoMensaje.MsgError)
End If
End If
EsEditar = 0
BtnAddEvento.Text = "Agregar"
End If
RegistraScript("$('#divEventos').modal('hide')")
GPS.Dispose()
TxtEvento.Text = ""
TxtCSS.Text = ""
' TxtImagen.Text = ""
ImgImagen.ImageUrl = "/Imagenes/AddArchivo.png"
PlaySonidoTmp.Visible = False
TxtUpImagen.Text = "[]"
TxtUpSonido.Text = "[]"
CargaEventos()
UpEventos.Update()
UpBodyEvento.Update()
End Sub
Protected Sub imgEE_Click(sender As Object, e As EventArgs)
Dim Boton = CType(sender, LinkButton)
CveEvento = Boton.CommandArgument.ToEntero
Dim GvRow As GridViewRow = DirectCast(Boton.NamingContainer, GridViewRow)
TxtEvento.Text = GvRow.DataKey("Evento").ToString
TxtCSS.Text = GvRow.DataKey("CSS").ToString
If GvRow.DataKey("Imagen").ToString <> "" Then
ImgImagen.ImageUrl = $"/Imagenes/{GvRow.DataKey("Imagen").ToString}"
Else
ImgImagen.ImageUrl = $"/Imagenes/AddArchivo.png"
End If
Imagen = GvRow.DataKey("Imagen").ToString
Sonido = GvRow.DataKey("Sonido").ToString
myModalLabel3.InnerHtml = "Actualizar Evento"
If Not Sonido.Equals("") Then
PlaySonidoTmp.Visible = True
PlaySonidoTmp.OnClientClick = $"javascript:PlaySonidito('{Sonido}');return false;"
End If
EsEditar = 1
BtnAddEvento.Text = "Actualizar"
UpBodyEvento.Update()
UpdatePanel2.Update()
UpFooterEvento.Update()
RegistraScript("$('#divEventos').modal()")
End Sub
Protected Sub GvEventos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvEventos.RowDeleting
Dim GPS As New ClsGPS
Dim CveEvento As Integer = GvEventos.Rows(e.RowIndex).DataKey("CveEvento").ToEntero
If GPS.EventoDelete(CveEvento) Then
Alert("El evento se eliminó correctamente", TipoMensaje.MsgInformacion)
End If
GPS.Dispose()
CargaEventos()
UpMarcas.Update()
End Sub
Protected Sub gvEventos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvEventos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If TmpDT IsNot Nothing Then
For Each dr As DataRow In TmpDT.Rows
If dr("CveEvento").ToString = e.Row.DBCampo("CveEvento") Then
e.Row.FCCheckBox("chkEv").Checked = True
End If
Next
End If
e.Row.VerticalAlign = VerticalAlign.Middle
e.Row.FCLinkButton("ImgE").CommandArgument = e.Row.DataKey("CveEvento").ToString
If e.Row.DBCampo("Sonido").ToString <> "" AndAlso File.Exists($"{AppDomain.CurrentDomain.BaseDirectory}/Sonidos/{e.Row.DataKey("Sonido").ToString}") Then
e.Row.FCLinkButton("PlaySonido").Visible = True
e.Row.FCLinkButton("PlaySonido").OnClientClick = $"javascript:PlaySonidito('{e.Row.DataKey("Sonido").ToString}');return false;"
End If
End If
End Sub
Protected Sub btnCancelarE_Click(sender As Object, e As EventArgs) Handles BtnOpenDivEventos.Click
EsEditar = 0
RegistraScript("$('#divEventos').modal()")
myModalLabel3.InnerHtml = "Agregar Evento"
TxtEvento.Text = ""
TxtCSS.Text = ""
TxtUpImagen.Text = "[]"
TxtUpSonido.Text = "[]"
PlaySonidoTmp.Visible = False
ImgImagen.ImageUrl = "/Imagenes/AddArchivo.png"
BtnAddEvento.Text = "Agregar"
UpBodyEvento.Update()
End Sub
#End Region
#Region "UPLOADS"
Protected Sub btnAddImagen_Click(sender As Object, e As EventArgs) Handles btnAddImagen.Click
Dim Filesgral As List(Of Archivo) = TxtUpImagen.getfiles().Archivos
For Each fileItem As Archivo In Filesgral
Dim Imagen = FormatearNombreArchivo(fileItem.filenameO)
If Imagen.Length > 199 Then
Alert("El nombre del archivo excede los 200 Caracteres permitidos favor de modificarlo.", TipoMensaje.MsgAdvertencia)
Exit Sub
Else
ImgImagen.ImageUrl = $"/Temp/{fileItem.filename}"
End If
Next
RegistraScript("$('#DivImagen').modal('hide');")
UpBodyEvento.Update()
End Sub
Protected Sub btnAddSonido_Click(sender As Object, e As EventArgs) Handles btnAddSonido.Click
Dim Filesgral As List(Of Archivo) = TxtUpSonido.getfiles().Archivos
For Each fileItem As Archivo In Filesgral
Dim Sonido = FormatearNombreArchivo(fileItem.filenameO)
If Sonido.Length > 199 Then
Alert("El nombre del archivo excede los 200 Caracteres permitidos favor de modificarlo.", TipoMensaje.MsgAdvertencia)
Exit Sub
Else
PlaySonidoTmp.Visible = True
PlaySonidoTmp.OnClientClick = $"javascript:PlaySoniditoTmp('{fileItem.filename}');return false;"
End If
Next
RegistraScript("$('#DivSonido').modal('hide');")
UpBodyEvento.Update()
End Sub
Public Function FormatearNombreArchivo(nombreArchivoOriginal As String) As String
Dim nombreArchivoFormateado As String
nombreArchivoFormateado = nombreArchivoOriginal.Replace(" ", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("'", "")
nombreArchivoFormateado = nombreArchivoFormateado.Replace(Chr(34), "")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("$", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("#", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("%", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("!", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("&", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("?", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("¿", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("¡", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("*", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("~", "_")
nombreArchivoFormateado = nombreArchivoFormateado.Replace("^", "_")
Return nombreArchivoFormateado
End Function
#End Region
Protected Sub BtnBack_Click(sender As Object, e As EventArgs) Handles BtnBack.Click
RegistraScript("$('a.button-previous').click()")
Paso = Paso - 1
BtnMain.Text = "Continuar"
If Paso = 1 Then
BtnBack.Visible = False
End If
End Sub
End Class