Option Explicit On Option Strict On Imports Extensiones Imports System.Runtime.InteropServices Imports System.IO Imports System.Data Partial Class OI_EventoComentario Inherits ClsPaginas 'Configuración Private ReadOnly Property CveComentario As Integer Get Return ViewState("CveComentario").ToString.ToEntero End Get End Property Private ReadOnly Property ImgConsecutivo As String Get Return ViewState("ImgConsecutivo").ToString End Get End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Session("FileUpload") = "" TRUsuario.Visible = False TRFecha.Visible = False If Request("CveComentario") IsNot Nothing AndAlso IsNumeric(Request("CveComentario")) AndAlso Request("CveComentario").ToEntero > 0 Then ViewState("CveComentario") = Request("CveComentario") CargaDatos() 'Configuración de Modalidad Update BtnGuardar.Text = "Guardar Cambios" LtlTitulo.Text = "Consulta COmentario del evento:" Else ViewState("CveComentario") = -1 BtnEliminar.Visible = False End If End If End Sub Private Sub CargaDatos() 'Dim ObjEventosComentarios As New ClsOIEventos() 'If ObjEventosComentarios.GetEventosComentarios(CveComentario) Then ' If ObjEventosComentarios.DtResultados.Rows.Count > 0 Then ' 'Pestaña Datos Generales ' TxtComentario.Text = ObjEventosComentarios.Comentario ' TxtArchivo.Text = ObjEventosComentarios.Archivo ' TxtFechaIng.Text = ObjEventosComentarios.FechaIng.ToShortTimeString ' TxtUsuario.Text = ObjEventosComentarios.UsuarioDe ' If File.Exists(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & ObjEventosComentarios.Archivo & ".png") Then ' TxtArchivo.Text = "/Empresas/" & UsuarioActual.CveEmpresa & "/OI/Eventos/" & ObjEventosComentarios.Archivo & ".png" ' End If ' Else ' Alert("El Comentario no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) ' BtnGuardar.Enabled = False ' End If 'End If 'ObjEventosComentarios.Dispose() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click 'System.Threading.Thread.Sleep(3000) 'Dim CveEvento As Integer 'Dim Comentario As String = TxtComentario.Text.Trim 'Dim Archivo As String = TxtArchivo.Text.Trim 'Dim CveUsuario As Integer = UsuarioActual.CveUsuario 'Dim ObjEventosComentarios As New ClsOIEventos() 'If CveComentario = -1 Then ' ObjEventosComentarios.AddEventoComentario(CveEvento, Comentario, Archivo, CveUsuario) ' Alert("El Comentario se guardó correctamente.", TipoMensaje.MsgInformacion) ' 'Else ' ' If ObjEventosComentarios.UpdateOrdenesServicios(DdlCliente.SelectedValue.ToEntero, DdlSubTipoEventosComentarios.SelectedValue.ToEntero, TxtNumCtaEquipo.Text.Trim, TxtDescripcion.Text.Trim, TxtPersonaSolicito.Text.Trim, Convert.ToDateTime(TxtFechaCita.Text & " " & TxtHoraCita.PostedTime), DdlUsuarioRecibio.SelectedValue.ToEntero, Convert.ToDateTime(TxtFechaRecibido.Text & " " & TxtHoraRecibido.PostedTime), TxtComentario.Text.Trim, ChkSeFacturara.Checked, ChkSeFacturo.Checked, DdlPersonaAtendio.SelectedValue.ToEntero, Convert.ToDateTime(TxtFechaAtendido.Text & " " & TxtHoraAtendido.PostedTime), DdlEstatusEventosComentarios.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, TxtCveComentario.Text.Trim.ToEntero) Then ' ' UpDatos.Update() ' ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) ' ' End If ' End If ' ObjEventosComentarios.Dispose() End Sub Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click 'Preguntar si existe en temporales If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString) Then Dim Extension As String = Path.GetExtension(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString) If Not Directory.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos") Then Directory.CreateDirectory(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos") If File.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) Then File.Delete(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) File.Move(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) Else File.Move(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) End If Else 'Imagen Default 'If ImgPersonal.ImageUrl = "../Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" Then ' ImgPersonal.ImageUrl = "/Imagenes/SinImagen.jpg" 'End If End If End Sub End Class