80 lines
2.6 KiB
VB.net
80 lines
2.6 KiB
VB.net
Imports System.Data
|
|
Imports System.Linq
|
|
Imports Extensiones
|
|
|
|
Partial Class OI_CircularDetalle
|
|
Inherits ClsPaginas
|
|
|
|
Private Property CveCircular As Integer
|
|
Get
|
|
Return ViewState("CveCircular").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCircular") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargarCve()
|
|
ConfigurarBotones()
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargarCve()
|
|
Dim PreCveCircular As String = Request.Params("CveCircular").ToString
|
|
If IsNumeric(PreCveCircular) Then
|
|
CveCircular = PreCveCircular.ToEntero
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ConfigurarBotones()
|
|
If CveCircular > 0 Then
|
|
BtnGuardar.Text = "Guardar"
|
|
BtnEliminar.Visible = True
|
|
Else
|
|
BtnGuardar.Text = "Actualizar"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
If CveCircular > 0 Then
|
|
Dim ObjOI As New ClsOIEventos
|
|
If ObjOI.GetCircular(UsuarioActual.CveEmpresa, CveCircular) Then
|
|
Dim Circular As DataRow = ObjOI.DtResultados(0)
|
|
|
|
TxtAsunto.Text = Circular.Item("Asunto")
|
|
TxtCorreo.Value = Circular.Item("CorreosInternos")
|
|
TxtCorreoAdicional.Value = Circular.Item("CorreosExternos")
|
|
TxtCircular.Value = Circular.Item("Circular")
|
|
|
|
UpCliente.Update()
|
|
End If
|
|
ObjOI.Dispose()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BtnGuardar_Click() Handles BtnGuardar.Click
|
|
Dim ObjOI As New ClsOIEventos
|
|
If CveCircular > 0 Then
|
|
If ObjOI.UpdateCircular(CveCircular, TxtAsunto.Text, TxtCircular.Value, TxtCorreo.Value, TxtCorreoAdicional.Value, UsuarioActual.CveUsuario) Then
|
|
Alert("Actualizado correctamente")
|
|
End If
|
|
Else
|
|
Dim CorreoExtra As String = If(TxtCorreoAdicional.Value = "", "-1", TxtCorreoAdicional.Value)
|
|
If ObjOI.AddCircular(TxtAsunto.Text, TxtCircular.Value, TxtCorreo.Value, Today.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CorreoExtra) Then
|
|
Alert("Ingresado correctamente")
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BtnEliminar_Click() Handles BtnEliminar.Click
|
|
Dim ObjOI As New ClsOIEventos
|
|
If ObjOI.DeleteCircular(CveCircular) Then
|
|
Response.Redirect("~/OI/CircularDetalle.aspx?CveCircular=-1")
|
|
End If
|
|
ObjOI.Dispose()
|
|
End Sub
|
|
End Class
|