292 lines
8.9 KiB
VB.net
292 lines
8.9 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Imports Microsoft.Extensions.Primitives
|
|
|
|
Partial Class Ventas_CatEspecialidadesSubEspecialidades
|
|
Inherits ClsPaginas
|
|
|
|
|
|
Public Property CveMedicoEspecialidad As Integer
|
|
Get
|
|
If ViewState("CveMedicoEspecialidad") Is Nothing Then
|
|
ViewState("CveMedicoEspecialidad") = -1
|
|
End If
|
|
Return ViewState("CveMedicoEspecialidad").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMedicoEspecialidad") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CveMedicoSubEspecialidad As Integer
|
|
Get
|
|
If ViewState("CveMedicoSubEspecialidad") Is Nothing Then
|
|
ViewState("CveMedicoSubEspecialidad") = -1
|
|
End If
|
|
Return ViewState("CveMedicoSubEspecialidad").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMedicoSubEspecialidad") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaEspecialidad()
|
|
CargaSubEspecialidad()
|
|
End If
|
|
End Sub
|
|
|
|
#Region "EXCEL"
|
|
|
|
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
|
|
|
|
If Tabs.ActiveTabIndex = 0 Then
|
|
GvEspecialidad.Columns(4).Visible = False
|
|
Dim SbFiltros As New StringBuilder()
|
|
|
|
GvEspecialidad.ExportToExcelGembox("CatEspecialidades", UsuarioActual, "Catálogo de Especialidades", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
|
|
GvEspecialidad.Columns(4).Visible = True
|
|
ElseIf Tabs.ActiveTabIndex = 1 Then
|
|
GvEspecialidad.Columns(5).Visible = False
|
|
Dim SbFiltros As New StringBuilder()
|
|
|
|
GvEspecialidad.ExportToExcelGembox("CatSubEspecialidades", UsuarioActual, "Catálogo De Sub Especialidades", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
|
|
GvEspecialidad.Columns(5).Visible = True
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "Especialidad"
|
|
|
|
|
|
Protected Sub LnkAgregarEspecialidad_Click(sender As Object, e As EventArgs)
|
|
CveMedicoEspecialidad = -1
|
|
DVEstatusEspecialidad.Visible = False
|
|
LimpiarModalEspecialdiad()
|
|
RegistraScript("$('#DVAgregarEspecialidad').modal();")
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgergarEspecialidad_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim ProcesoOK As Boolean = True
|
|
|
|
If CveMedicoEspecialidad > 0 Then
|
|
If Not ObjVentas.UpdateMedicoEspecialidad(CveMedicoEspecialidad, TxtEspecialidad.Text.Trim, ChkEstatusEspecialidad.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = False
|
|
End If
|
|
Else
|
|
If Not ObjVentas.AddMedicoEspecialidad(TxtEspecialidad.Text.Trim, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = False
|
|
End If
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
CargaEspecialidad()
|
|
Alert($"Especialidad {If(CveMedicoEspecialidad > 0, "actualizada", "agregada")} correctamente.")
|
|
RegistraScript("$('#DVAgregarEspecialidad').modal('hide');")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Sub LimpiarModalEspecialdiad()
|
|
TxtEspecialidad.Text = ""
|
|
ChkEstatusEspecialidad.Checked = True
|
|
UpModalEspecialidad.Update()
|
|
End Sub
|
|
Sub CargaEspecialidad()
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If ObjVentas.GetMedicosEspecialidades(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvEspecialidad.DataSource = ObjVentas.DtResultados
|
|
DdlEspecialidad.DataSource = ObjVentas.DtResultados
|
|
Else
|
|
GvEspecialidad.DataSource = Nothing
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
GvEspecialidad.DataBind()
|
|
|
|
DdlEspecialidad.DataBind()
|
|
DdlEspecialidad.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
|
|
|
|
|
UpEspecialidad.Update()
|
|
|
|
End Sub
|
|
|
|
Protected Sub LnkEditarEspecialidad_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
|
|
CveMedicoEspecialidad = GvRow.DataKey("CveMedicoEspecialidad").ToEntero
|
|
TxtEspecialidad.Text = GvRow.DataKey("Especialidad")
|
|
ChkEstatusEspecialidad.Checked = Boolean.Parse(GvRow.DataKey("Estatus").ToString)
|
|
DVEstatusEspecialidad.Visible = True
|
|
UpModalEspecialidad.Update()
|
|
|
|
RegistraScript("$('#DVAgregarEspecialidad').modal();")
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Sub LnkEliminarEspecialidad_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim ProcesoOK As Boolean = True
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
Dim CveMedicoEspecialidadEliminar As Integer = GvRow.DataKey("CveMedicoEspecialidad").ToEntero
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If Not ObjVentas.RemoveMedicoEspecialidad(CveMedicoEspecialidadEliminar, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = False
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
CargaEspecialidad()
|
|
Alert("Especialidad eliminada correctamente")
|
|
End If
|
|
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
#Region "SubEspecialidad"
|
|
|
|
|
|
Protected Sub LnkAgregarSubEspecialidad_Click(sender As Object, e As EventArgs)
|
|
CveMedicoSubEspecialidad = -1
|
|
DVEstatusSubEspecialidad.Visible = False
|
|
LimpiarModalSubEspecialdiad()
|
|
RegistraScript("$('#DVAgregarSubEspecialidad').modal();")
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgergarSubEspecialidad_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim ProcesoOK As Boolean = True
|
|
|
|
If CveMedicoSubEspecialidad > 0 Then
|
|
If Not ObjVentas.UpdateMedicoSubEspecialidad(CveMedicoSubEspecialidad, DdlEspecialidad.SelectedValue.ToEntero, TxtSubEspecialidad.Text.Trim, ChkEstatusSubEspecialidad.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = False
|
|
End If
|
|
Else
|
|
If Not ObjVentas.AddMedicoSubEspecialidad(DdlEspecialidad.SelectedValue.ToEntero, TxtSubEspecialidad.Text.Trim, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = False
|
|
End If
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
CargaSubEspecialidad()
|
|
Alert($"SubEspecialidad {If(CveMedicoSubEspecialidad > 0, "actualizada", "agregada")} correctamente.")
|
|
RegistraScript("$('#DVAgregarSubEspecialidad').modal('hide');")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Sub LimpiarModalSubEspecialdiad()
|
|
DdlEspecialidad.SelectedValueExist(-1)
|
|
TxtSubEspecialidad.Text = ""
|
|
ChkEstatusSubEspecialidad.Checked = True
|
|
UpModalSubEspecialidad.Update()
|
|
End Sub
|
|
Sub CargaSubEspecialidad()
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If ObjVentas.GetMedicosSubEspecialidades(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvSubEspecialidad.DataSource = ObjVentas.DtResultados
|
|
Else
|
|
GvSubEspecialidad.DataSource = Nothing
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
GvSubEspecialidad.DataBind()
|
|
|
|
UpSubEspecialidad.Update()
|
|
|
|
End Sub
|
|
|
|
Protected Sub LnkEditarSubEspecialidad_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
|
|
CveMedicoSubEspecialidad = GvRow.DataKey("CveMedicoSubEspecialidad").ToEntero
|
|
Dim CveMedicoEspecialidad = GvRow.DataKey("CveMedicoEspecialidad").ToEntero
|
|
|
|
DdlEspecialidad.SelectedValueExist(CveMedicoEspecialidad)
|
|
TxtSubEspecialidad.Text = GvRow.DataKey("SubEspecialidad")
|
|
ChkEstatusSubEspecialidad.Checked = Boolean.Parse(GvRow.DataKey("Estatus").ToString)
|
|
DVEstatusSubEspecialidad.Visible = True
|
|
UpModalSubEspecialidad.Update()
|
|
|
|
RegistraScript("$('#DVAgregarSubEspecialidad').modal();")
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Sub LnkEliminarSubEspecialidad_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim ProcesoOK As Boolean = True
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
Dim CveMedicoSubEspecialidadEliminar As Integer = GvRow.DataKey("CveMedicoSubEspecialidad").ToEntero
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If Not ObjVentas.RemoveMedicoSubEspecialidad(CveMedicoSubEspecialidadEliminar, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = False
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
CargaSubEspecialidad()
|
|
Alert("Sub Especialidad eliminada correctamente")
|
|
End If
|
|
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Class
|