RepServicioDomicilio base

This commit is contained in:
rakcsle
2022-09-01 08:18:09 -07:00
parent dcd4db994a
commit 53cb2bbbc8
9 changed files with 1657 additions and 19 deletions

View File

@@ -0,0 +1,272 @@
Option Explicit On
Option Strict On
Imports Extensiones
Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports System.Web.Services
Partial Class OS_RepServicioDomicilio
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property DtColor As DataTable
Get
Return DirectCast(ViewState("DtColor"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtColor") = value
End Set
End Property
Private Property Agrupador As String
Get
Return ViewState("Agrupador").ToString
End Get
Set(value As String)
ViewState("Agrupador") = value
End Set
End Property
Private Property TCEspecifico As Double
Get
Return ViewState("TCEspecifico").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TCEspecifico") = value
End Set
End Property
Private Property TipoCambio As Integer
Get
Return ViewState("TipoCambio").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("TipoCambio") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
InicializaCalendar()
End If
End Sub
#Region "CARGAS"
Private Sub SetValues()
End Sub
Private Sub CargaDatos()
End Sub
#End Region
#Region " FULL CALENDAR "
Private Sub InicializaCalendar()
RegistraScript("InitCalendar();")
HdnU.Value = UsuarioActual.CveUsuario.ToString
HdnE.Value = UsuarioActual.CveEmpresa.ToString
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
CargaTiposAgenda()
CheckRecurrencia.Attributes.Add("onclick", "CheckAdd(this);")
End Sub
Private Sub CargaTiposAgenda()
Dim ObjEventos As New ClsOIEventos
If ObjEventos.GetAgendaTipo() Then
DdlAgedaTipo.DataSource = ObjEventos.DtResultados
DdlAgedaTipo.DataBind()
DdlAgedaTipo.Items.Insert(0, New ListItem("Seleccione", "-1"))
Else
Alert("Ocurrió un error al obtener los tipos de agenda. Por favor recargue la página", TipoMensaje.MsgError)
End If
ObjEventos.Dispose()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
Dim ObjEventos As New ClsOIEventos
Dim FechaInicio = TxtFechaInicioAgenda.Text.ToDateTime()
Dim FechaFin = TxtFechaFinAgenda.Text.ToDateTime()
RegistraScript("GetView();")
Dim RecurrenciaTipo = 0, Frecuencia = -1, DiasSemana = "-1", Dias = -1, Mes = -1, RecurrenciaFin = "-1"
If CheckRecurrencia.Checked Then
RecurrenciaTipo = RBLRecurrencia.SelectedValue.ToEntero
Frecuencia = TxtFrecuencia.Text.ToEntero
'OBTENEMOS LOS DIAS SELECCIONADOS EN LA OPCION DE RECURRENCIA POR SEMANA
Select Case RecurrenciaTipo
Case 3
Dim StringDias = ""
For Each item As ListItem In CheckDiasSemana.Items
If item.Selected Then
If StringDias.Length > 0 Then
StringDias += ","
End If
StringDias += item.Value
End If
Next
If StringDias.Length > 0 Then
DiasSemana = StringDias
End If
End Select
'If RBSinFechaFinAdd.Checked Then
' RecurrenciaFin = "-1"
'Else
If RBNumeroOcurrencias.Checked Then
RecurrenciaFin = TxtNumeroOcurrencias.Text
ElseIf RBFechaFin.Checked Then
RecurrenciaFin = TxtFechaFinRecurrencia.Text
Else
RecurrenciaFin = "-1"
End If
Else
If HdnCveEvento.Value.ToEntero > 0 Then
Frecuencia = -2 : DiasSemana = "-2" : Dias = -2 : Mes = -2 : RecurrenciaFin = "-2"
End If
End If
'11/05/2018 - GASTO RECURRENTE
Dim CveTipoEvento As Integer = IIf(ChkGastoRecurrente.Checked, 10, 2).ToString().ToEntero()
Dim Importe As Double = Convert.ToDouble(IIf(ChkGastoRecurrente.Checked, TxtImporteGastoRecurrente.Text, "-1"))
If HdnCveEvento.Value.ToEntero > 0 Then
If ObjEventos.UpdateEvento(TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, DdlAgedaTipo.SelectedValue.ToEntero, -1, FechaInicio, FechaFin, -1, "-1", HdnCveEvento.Value.ToEntero, "-1",
RecurrenciaTipo, Frecuencia, DiasSemana, Dias, Mes, RecurrenciaFin, Importe:=Importe) Then
Alert("El Evento se actualizó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al actualizar el evento", TipoMensaje.MsgAdvertencia)
End If
Else
If ObjEventos.AddEventoAgenda(DdlAgedaTipo.SelectedValue.ToEntero, TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, FechaInicio, FechaFin, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=CveTipoEvento, Importe:=Importe) Then
Alert("El Evento se guardó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al Guardar el evento", TipoMensaje.MsgAdvertencia)
End If
End If
ObjEventos.Dispose()
RegistraScript("Calendario();SetView();$('#ModalAgenda').modal('hide');", "1234")
LimpiaModalAgenda()
End Sub
Private Sub LimpiaModalAgenda()
TxtDescripcionAgenda.Text = ""
TxtAsuntoAgenda.Text = ""
DdlPrioridad.SelectedValue = "1"
TxtNumeroOcurrencias.Text = ""
TxtFechaFinRecurrencia.Text = ""
RBFechaFin.Checked = False
RBNumeroOcurrencias.Checked = False
RBLRecurrencia.SelectedValue = "1"
CheckDiasSemana.ClearSelection()
RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty)
TxtFrecuencia.Text = "1"
LblEmpresaCRM.Text = ""
End Sub
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs)
Dim ObjEventos As New ClsOIEventos
RegistraScript("GetView();")
If ObjEventos.RemoveEvento(HdnCveEvento.Value.ToEntero, UsuarioActual.CveEmpresa) Then
RegistraScript("Calendario();SetView();$('#ModalAgenda').modal('hide');", "1234")
Alert("El evento se eliminó correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al eliminar el evento, por favor intente de nuevo.", TipoMensaje.MsgError)
End If
ObjEventos.Dispose()
End Sub
<WebMethod()> <Script.Services.ScriptMethodAttribute()>
Public Shared Function EliminaEvento(CveEvento As Integer, CveEmpresa As Integer) As String
Dim ObjEventos As New ClsOIEventos
ObjEventos.RemoveEvento(CveEvento, CveEmpresa)
ObjEventos.Dispose()
Return CveEvento.ToString
End Function
<WebMethod()> <Script.Services.ScriptMethodAttribute()>
Public Shared Function ActualizaEvento(ClsEvent As CalendarEvent) As String
Dim ObjEventos As New ClsOIEventos
Dim FechaInicio = DateTimeOffset.Parse(ClsEvent.start).DateTime
Dim FechaFin = DateTimeOffset.Parse(ClsEvent.end).DateTime
If ObjEventos.UpdateEvento("-1", "-1", -1, -1, -1, FechaInicio, FechaFin, -1, "-1", ClsEvent.id) Then
End If
ObjEventos.Dispose()
Return "a"
End Function
Protected Sub RBLRecurrencia_SelectedIndexChanged(sender As Object, e As EventArgs)
Select Case RBLRecurrencia.SelectedValue.ToEntero
Case 1
LblTextoFrecuencia.Text = "Hora(s)"
TrDiasSemanaAdd.Style("display") = "none"
Case 2
LblTextoFrecuencia.Text = "Dia(s)"
TrDiasSemanaAdd.Style("display") = "none"
Case 3
LblTextoFrecuencia.Text = "Semana(s)"
TrDiasSemanaAdd.Style("display") = "block"
'Chequea los dias seleccionados en la recurrencia
For Each item As ListItem In CheckDiasSemana.Items
If HdnDiasSemanaAgendar.Value.Contains(item.Value) Then
item.Selected = True
Else
item.Selected = False
End If
Next
Case 4
LblTextoFrecuencia.Text = "Mes(es)"
TrDiasSemanaAdd.Style("display") = "none"
Case 5
LblTextoFrecuencia.Text = "Año(s)"
TrDiasSemanaAdd.Style("display") = "none"
Case Else
End Select
UpRecurrencia.Update()
End Sub
Protected Sub BtnActualizaAdd_Click(sender As Object, e As EventArgs)
RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty)
End Sub
#End Region
End Class