Commit inicial Ventas Productivo
This commit is contained in:
141
RH/CatTurno.aspx.vb
Normal file
141
RH/CatTurno.aspx.vb
Normal file
@@ -0,0 +1,141 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class RH_CatTurno
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDdlChecadorHorario()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDdlChecadorHorario()
|
||||
Dim ObjRH As New ClsRH()
|
||||
If ObjRH.DdlChecadorHorarioGet() Then
|
||||
DdlChecadorHorario.DataSource = ObjRH.DtResultados
|
||||
DdlChecadorHorario.DataBind()
|
||||
|
||||
End If
|
||||
ObjRH.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjRH As New ClsRH()
|
||||
If ObjRH.GetTurnos Then
|
||||
GvTurno.DataSource = ObjRH.DtResultados.FiltraParametros(" CveEmpresa =" & UsuarioActual.CveEmpresa)
|
||||
GvTurno.DataBind()
|
||||
End If
|
||||
ObjRH.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAgregarTurno_Click(sender As Object, e As EventArgs) Handles BtnAgregarTurno.Click
|
||||
Dim ObjRH As New ClsRH
|
||||
Dim Estatus As Boolean = False
|
||||
If ChkEstatus.Checked Then Estatus = True
|
||||
If HdnModalidad.Value = "A" Then
|
||||
If ObjRH.AddTurno(TxtTurno.Text, TxtHorarioDe.Text, TxtHorarioA.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlChecadorHorario.SelectedValue.ToEntero) Then
|
||||
CargaDatos()
|
||||
CargaGlobalDTTurno()
|
||||
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ElseIf HdnModalidad.Value = "U" Then
|
||||
If ObjRH.UpdateTurno(TxtTurno.Text, TxtHorarioDe.Text, TxtHorarioA.Text, Estatus, HdnID.Value.ToEntero, UsuarioActual.CveUsuario, DdlChecadorHorario.SelectedValue.ToEntero) Then
|
||||
CargaDatos()
|
||||
CargaGlobalDTTurno()
|
||||
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddTurno"))
|
||||
ObjRH.Dispose()
|
||||
UpDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HdnModalidad.Value = "U"
|
||||
HdnID.Value = GvRow.DataKey("CveTurno")
|
||||
UpDatos.Update()
|
||||
BtnAgregarTurno.Text = "Actualizar"
|
||||
DdlChecadorHorario.SelectedValueExist(GvRow.DataKey("CveChecadorHorario"))
|
||||
TxtTurno.Text = GvRow.DataKey("Turno")
|
||||
TxtHorarioDe.Text = GvRow.DataKey("HorarioDe")
|
||||
TxtHorarioA.Text = GvRow.DataKey("HorarioA")
|
||||
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
||||
UpAddTurno.Update()
|
||||
|
||||
'CargaGlobalDTTurno()
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddTurno"))
|
||||
End Sub
|
||||
|
||||
Public Sub Agregar()
|
||||
|
||||
HdnModalidad.Value = "A"
|
||||
UpDatos.Update()
|
||||
BtnAgregarTurno.Text = "Agregar"
|
||||
TxtHorarioA.Text = ""
|
||||
TxtHorarioDe.Text = ""
|
||||
TxtTurno.Text = ""
|
||||
CargaDdlChecadorHorario()
|
||||
ChkEstatus.Checked = True
|
||||
UpAddTurno.Update()
|
||||
|
||||
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddTurno"))
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGlobalDTTurno()
|
||||
|
||||
Dim ObjRH As New ClsRH
|
||||
If ObjRH.GetTurnos() Then
|
||||
Application("GlobalDTTurno") = ObjRH.DtResultados
|
||||
Else
|
||||
Application("GlobalDTTurno") = Nothing
|
||||
End If
|
||||
ObjRH.Dispose()
|
||||
|
||||
End Sub
|
||||
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjRH As New ClsRH()
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HdnID.Value = GvRow.DataKey("CveTurno")
|
||||
UpDatos.Update()
|
||||
If ObjRH.RemoveTurno(HdnID.Value.ToEntero) Then
|
||||
CargaDatos()
|
||||
CargaGlobalDTTurno()
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ObjRH.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub LnkTurno_Click(sender As Object, e As EventArgs) Handles LnkTurno.Click
|
||||
Agregar()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GvTurno_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvTurno.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If CBool(e.Row.DBCampo("Estatus")) = True Then
|
||||
e.Row.FCLabel("LblEstatus").Text = "Activo"
|
||||
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Green
|
||||
|
||||
Else
|
||||
e.Row.FCLabel("LblEstatus").Text = "Inactivo"
|
||||
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Red
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user