Commit inicial Ventas Productivo
This commit is contained in:
545
Ventas/ConsultaCliente.aspx.vb.exclude
Normal file
545
Ventas/ConsultaCliente.aspx.vb.exclude
Normal file
@@ -0,0 +1,545 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
|
||||
Partial Class Ventas_ConsultaCliente
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
'Configuración
|
||||
Private Property CveCliente As Integer
|
||||
Get
|
||||
Return ViewState("CveCliente").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCliente") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
Session("FileUpload") = ""
|
||||
ViewState("Orden") = ""
|
||||
ViewState("ONombre") = "Nombre DESC"
|
||||
|
||||
CveCliente = UsuarioActual.CveCliente
|
||||
|
||||
CargaDatos()
|
||||
CargaHistorial()
|
||||
CargaCxP()
|
||||
CargaAnticipos()
|
||||
CargarTipoBuzon()
|
||||
CargarClienteSucursal()
|
||||
CargaUsuariosPortal()
|
||||
|
||||
'Configuración de Modalidad Update
|
||||
BtnGuardar.Text = "Guardar"
|
||||
LtlTitulo.Text = "Expediente de:"
|
||||
If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero
|
||||
'End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjClientes As New ClsClientes()
|
||||
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
'Campos para Modificación
|
||||
LtlCliente.Text = ObjClientes.Nombre
|
||||
TxtContacto.Text = ObjClientes.Contacto
|
||||
TxtEmail.Text = ObjClientes.Mail
|
||||
TxtParaMail.Text = ObjClientes.Mail
|
||||
ChkMail.Checked = ObjClientes.EnviarFactura
|
||||
Else
|
||||
Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||
BtnGuardar.Enabled = False
|
||||
End If
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaHistorial()
|
||||
Dim ObjClientes As New ClsClientes()
|
||||
If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente) Then
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
'Carga Generales
|
||||
LtlCantidad.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(2)
|
||||
LtlTotalVendido.Text = ObjClientes.DtResultados.Rows(0)("Total").ToString.FormatoNumero(2)
|
||||
LtlMinima.Text = ObjClientes.DtResultados.Rows(0)("MIN_Total").ToString.FormatoNumero(2)
|
||||
LtlPromedio.Text = ObjClientes.DtResultados.Rows(0)("AVG_Total").ToString.FormatoNumero(2)
|
||||
LtlMaxima.Text = ObjClientes.DtResultados.Rows(0)("MAX_Total").ToString.FormatoNumero(2)
|
||||
'Carga Grid
|
||||
GVHistorial.DataSource = ObjClientes.DtResultados
|
||||
Else
|
||||
GVHistorial.DataSource = Nothing
|
||||
End If
|
||||
Else
|
||||
GVHistorial.DataSource = Nothing
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
GVHistorial.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCxP()
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
'CxC Activas
|
||||
If ObjMovtos.GetCxCCliente(UsuarioActual.CveCliente) Then
|
||||
GvCxC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'")
|
||||
GvCxCHistorial.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Hist'")
|
||||
Else
|
||||
GvCxC.DataSource = Nothing
|
||||
GvCxCHistorial.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjMovtos.Dispose()
|
||||
GvCxC.DataBind()
|
||||
GvCxCHistorial.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaAnticipos()
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetAnticiposCliente(UsuarioActual.CveCliente) Then
|
||||
GVAnticipos.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'")
|
||||
GVAnticiposHistorial.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Hist'")
|
||||
Else
|
||||
GVAnticipos.DataSource = Nothing
|
||||
GVAnticiposHistorial.DataSource = Nothing
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
GVAnticipos.DataBind()
|
||||
GVAnticiposHistorial.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargarTipoBuzon()
|
||||
DdlTipoBuzon.DataSource = GlobalDTTipoBuzon
|
||||
DdlTipoBuzon.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargarClienteSucursal()
|
||||
Dim ObjClienteSucursal As New ClsClientes
|
||||
If ObjClienteSucursal.GetSucursales(UsuarioActual.CveCliente) Then
|
||||
DdlClienteSucursal.DataSource = ObjClienteSucursal.DtResultados
|
||||
Else
|
||||
DdlClienteSucursal.DataSource = Nothing
|
||||
End If
|
||||
ObjClienteSucursal.Dispose()
|
||||
DdlClienteSucursal.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CargaUsuariosPortal()
|
||||
Dim ObjUsrs As New ClsSisUsuarios()
|
||||
|
||||
|
||||
If ObjUsrs.GetUsuariosPortal(-1, CveCliente, -1) Then
|
||||
Dim dtUsr As DataTable = ObjUsrs.DtResultados
|
||||
|
||||
dtUsr = dtUsr.FiltraParametros("Usuario <> 'Admin'")
|
||||
|
||||
ViewState("OrdenUsuarios") = ""
|
||||
|
||||
''busco la clave del admin, si es que existe
|
||||
'Dim dr As DataRow = dtUsr.FiltroPrimero("Usuario = 'Admin'")
|
||||
|
||||
'If dr IsNot Nothing Then
|
||||
' HdnCveUsuarioPortalAdmin.Value = dr("CveUsuarioPortal").ToString
|
||||
|
||||
' If dr("Estatus").ToString = "1" Then
|
||||
' HdnCveUsuarioPortalActivado.Value = "1"
|
||||
' End If
|
||||
|
||||
'End If
|
||||
|
||||
'If HdnCveUsuarioPortalActivado.Value.ToEntero > 0 Then
|
||||
' trEnviarActivacion.Visible = False
|
||||
' trRecuperacionContraseña.Visible = True
|
||||
'End If
|
||||
|
||||
GvUsuariosPortal.DataSource = dtUsr
|
||||
ViewState("DTUsuariosCliente") = dtUsr
|
||||
Else
|
||||
GvUsuariosPortal.DataSource = Nothing
|
||||
ViewState("DTUsuariosCliente") = Nothing
|
||||
End If
|
||||
ObjUsrs.Dispose()
|
||||
GvUsuariosPortal.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.BackColor = Drawing.Color.LightGray
|
||||
DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor).Visible = False
|
||||
End If
|
||||
|
||||
e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("Folio")
|
||||
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
|
||||
DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor).HRef = "javascript:$get('HdnCveVenta').value='" & e.Row.DBCampo("CveVenta") & "';$get('HdnFolioVenta').value='" & e.Row.DBCampo("folio") & "';$('#DivMail').show(1000);PosicionaObjeto('" & DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor).ClientID & "', 'DivMail');"
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxC.RowDataBound, GvCxCHistorial.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Cells(0).ColumnSpan = 4
|
||||
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.FCLiteral("LtlFactura").Text = "Total" & " "
|
||||
e.Row.Cells(1).Visible = False
|
||||
e.Row.Cells(2).Visible = False
|
||||
e.Row.Cells(3).Visible = False
|
||||
'e.Row.Cells(9).ColumnSpan = 2
|
||||
'e.Row.Cells(10).Visible = False
|
||||
e.Row.BackColor = Drawing.Color.LightGray
|
||||
End If
|
||||
If e.Row.RowIndex = 1 Then
|
||||
e.Row.Cells(0).Width = Unit.Pixel(60)
|
||||
e.Row.Cells(1).Width = Unit.Pixel(70)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(80)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(80)
|
||||
e.Row.Cells(4).Width = Unit.Pixel(90)
|
||||
e.Row.Cells(5).Width = Unit.Pixel(90)
|
||||
e.Row.Cells(6).Width = Unit.Pixel(105)
|
||||
e.Row.Cells(7).Width = Unit.Pixel(90)
|
||||
e.Row.Cells(8).Width = Unit.Pixel(105)
|
||||
End If
|
||||
|
||||
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Right
|
||||
|
||||
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(5).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(3).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = ""
|
||||
If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = ""
|
||||
If e.Row.DBCampo("PorRecuperado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlPorRecuperado"), Literal).Text = ""
|
||||
If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = ""
|
||||
If e.Row.DBCampo("PorXRecuperar").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlPorXRecuperar"), Literal).Text = ""
|
||||
|
||||
e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("Folio")
|
||||
If CType(sender, GridView).ID = "GvCxCHistorial" Then
|
||||
DirectCast(e.Row.FindControl("LtlDiasVencido"), Literal).Text = ""
|
||||
Else
|
||||
e.Row.Cells(7).Font.Bold = True
|
||||
e.Row.Cells(8).Font.Bold = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GVAnticipos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowDataBound, GVAnticiposHistorial.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Cells(0).ColumnSpan = 2
|
||||
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.FCLiteral("LtlFactura").Text = "Total" & " "
|
||||
e.Row.BackColor = Drawing.Color.LightGray
|
||||
e.Row.Cells(1).Visible = False
|
||||
End If
|
||||
If e.Row.RowIndex = 1 Then
|
||||
e.Row.Cells(0).Width = Unit.Pixel(60)
|
||||
e.Row.Cells(1).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(80)
|
||||
End If
|
||||
|
||||
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
|
||||
|
||||
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(2).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAnticipos"), Literal).Text = ""
|
||||
|
||||
If e.Row.RowIndex > 0 Then
|
||||
e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("Folio")
|
||||
End If
|
||||
|
||||
If CType(sender, GridView).ID = "GVAnticipos" Then
|
||||
e.Row.Cells(2).Font.Bold = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnSendMail_Click(sender As Object, e As System.EventArgs) Handles BtnSendMail.Click
|
||||
Try
|
||||
|
||||
If HdnCveVenta.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then
|
||||
Dim ObjEmprea As New ClsEmpresas()
|
||||
If ObjEmprea.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
Dim Ruta As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\"
|
||||
|
||||
If File.Exists(Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf") AndAlso File.Exists(Ruta & "XML\" & HdnFolioVenta.Value & ".xml") Then
|
||||
Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf"
|
||||
Dim XML As String = Ruta & "XML\" & HdnFolioVenta.Value & ".xml"
|
||||
Dim ArrayCC() As String = TxtCC.Text.Trim.Split(Convert.ToChar(";"))
|
||||
|
||||
Dim ResultadoMail As Integer = 0
|
||||
If ObjMail.Mandacorreo(ObjEmprea.SendMail, ObjEmprea.SendMailPassword, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then
|
||||
ResultadoMail = 1
|
||||
TxtCC.Text = ""
|
||||
TxtBody.Text = ""
|
||||
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||||
CargaHistorial()
|
||||
UpnHistorial.Update()
|
||||
Else
|
||||
ResultadoMail = 3
|
||||
End If
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero)
|
||||
ObjVentas.Dispose()
|
||||
Else
|
||||
Alert("No se pudo adjuntar el correo electrónica.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
ObjEmprea.Dispose()
|
||||
Else
|
||||
Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar MAIL", ex)
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.UpdateVentaMail(3, HdnCveVenta.Value.ToEntero)
|
||||
ObjVentas.Dispose()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub CargaRHPersonal()
|
||||
Dim ObjRHPersonal As New ClsRHPersonal
|
||||
If ObjRHPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveCliente, TxtHora.PostedTime & ":00", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
|
||||
ViewState("DTRHPersonal") = ObjRHPersonal.DtResultados
|
||||
Else
|
||||
Me.GvRHPersonal.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjRHPersonal.Dispose()
|
||||
CargaGridRHPersonal("")
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvRHPersonal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRHPersonal.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex >= 0 Then
|
||||
e.Row.Cells(0).Width = Unit.Pixel(100)
|
||||
'CARGAR IMAGENES DE PERSONAL
|
||||
If File.Exists(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & e.Row.DBCampo("URL") & ".png") Then
|
||||
e.Row.FCImage("ImgPersonal").ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & e.Row.DBCampo("URL") & ".png"
|
||||
End If
|
||||
|
||||
'If File.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & e.Row.DBCampo("URL")) Then
|
||||
'e.Row.FCLiteral("LtlImgPersonal").Text = "<img src='/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & e.Row.DBCampo("URL") & " ' width='75px' heigth='75px'/>"
|
||||
'Else
|
||||
'e.Row.FCLiteral("LtlImgPersonal").Text = "<img src='/Imagenes/SinImagen.jpg' width='50px' heigth='50px'/>"
|
||||
'End If
|
||||
'FIN CARGAR IMAGENES DE PERSONAL
|
||||
|
||||
e.Row.Cells(1).Width = Unit.Pixel(250)
|
||||
|
||||
End If
|
||||
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGridRHPersonal(Orden As String)
|
||||
If Orden <> String.Empty Then
|
||||
Dim DV As New DataView(CType(ViewState("DTRHPersonal"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
||||
GvRHPersonal.DataSource = DV.ToTable()
|
||||
DV.Dispose()
|
||||
Else
|
||||
GvRHPersonal.DataSource = CType(ViewState("DTRHPersonal"), DataTable)
|
||||
End If
|
||||
GvRHPersonal.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
|
||||
Alert("Gracias por ponerse en contacto con nosotros.<br />Su queja a sido recibida y pronto nos pondremos en contacto con usted.", TipoMensaje.MsgConfirmacion)
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LbNombre_Click(sender As Object, e As System.EventArgs) Handles LbNombre.Click
|
||||
If ViewState("ONombre").ToString() = "Nombre DESC" Then
|
||||
ViewState("ONombre") = "Nombre ASC"
|
||||
ImgNombre.ImageUrl = "/Imagenes/FlechasArriba.gif"
|
||||
Else
|
||||
ViewState("ONombre") = "Nombre DESC"
|
||||
ImgNombre.ImageUrl = "/Imagenes/FlechasAbajo.gif"
|
||||
End If
|
||||
ViewState("Orden") = ViewState("ONombre")
|
||||
CargaGridRHPersonal(ViewState("Orden").ToString())
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultarPersonal_Click(sender As Object, e As System.EventArgs) Handles BtnConsultarPersonal.Click
|
||||
CargaRHPersonal()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEnviar_Click(sender As Object, e As System.EventArgs) Handles BtnEnviar.Click
|
||||
'GvRHPersonal
|
||||
Dim ObjQueja As New ClsRHPersonal
|
||||
For Each Row As GridViewRow In GvRHPersonal.Rows
|
||||
If Row.FCCheckBox("ChbSeleccionado").Checked Then
|
||||
If ObjQueja.AddPersonalBuzon(GvRHPersonal.DataKeys(Row.RowIndex).Value.ToString.ToEntero, UsuarioActual.CveCliente, DdlClienteSucursal.SelectedValue.ToEntero, DdlTipoBuzon.SelectedValue.ToEntero, Convert.ToDateTime(TxtFechaQueja.Text & " " & TxtHora.PostedTime), TxtDescripcion.Text, TxtNombreReporto.Text, TxtTelefonoReporto.Text, TxtMailReporto.Text, TxtObservaciones.Text, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Se Envió Correctamente")
|
||||
End If
|
||||
'Si está seleccionado el check del GridView quiere decir que lo seleccionaron. Hay que hacer el insert
|
||||
'La clave personal se saca de:
|
||||
'(string)this.grid.DataKeys[rowIndex]["myKey"];
|
||||
'GvRHPersonal.DataKeys(Row.RowIndex)("CvePersonal").ToString
|
||||
|
||||
End If
|
||||
Next
|
||||
ObjQueja.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "Usuarios"
|
||||
|
||||
|
||||
Protected Sub LnkAgregarUsuario_Click(sender As Object, e As EventArgs) Handles LnkAgregarUsuario.Click
|
||||
Dim Usuario As New ClsSisUsuarios
|
||||
If Usuario.AddUsuarioPortal(TxtUsuarioPortal.Text, ContraseñaPredeterminada, TxtNombrePortal.Text, CveCliente, 0,
|
||||
ChkPermiso1.Checked, ChkPermiso2.Checked, ChkPermiso3.Checked, ChkPermiso4.Checked, ChkPermiso5.Checked,
|
||||
ChkPermiso6.Checked, ChkPermiso7.Checked, ChkPermiso8.Checked, ChkPermiso9.Checked, ChkPermiso10.Checked, UsuarioActual.CveUsuario, 0) > 0 Then
|
||||
ViewState("DTUsuariosCliente") = Usuario.DtResultados
|
||||
TxtUsuarioPortal.Text = ""
|
||||
TxtNombrePortal.Text = ""
|
||||
End If
|
||||
Usuario.Dispose()
|
||||
If ViewState("OrdenUsuarios").ToString() <> String.Empty Then
|
||||
CargaGridUsuarios(ViewState("OrdenUsuarios").ToString())
|
||||
Else
|
||||
CargaGridUsuarios("")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub GvUsuariosPortal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvUsuariosPortal.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Cells(0).Width = Unit.Pixel(70)
|
||||
e.Row.Cells(1).Width = Unit.Pixel(150)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(4).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(5).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(6).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(7).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(8).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(9).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(10).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(11).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(12).Width = Unit.Pixel(45)
|
||||
e.Row.Cells(13).Width = Unit.Pixel(68)
|
||||
e.Row.Cells(14).Width = Unit.Pixel(70)
|
||||
e.Row.Cells(15).Width = Unit.Pixel(55)
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvUsuariosPortal_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvUsuariosPortal.RowEditing
|
||||
|
||||
GvUsuariosPortal.EditIndex = e.NewEditIndex
|
||||
|
||||
If ViewState("OrdenUsuarios").ToString() <> String.Empty Then
|
||||
CargaGridUsuarios(ViewState("OrdenUsuarios").ToString())
|
||||
Else
|
||||
CargaGridUsuarios("")
|
||||
End If
|
||||
'CargaUsuariosPortal()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvUsuariosPortal_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvUsuariosPortal.RowUpdating
|
||||
|
||||
Dim Usuarios As New ClsSisUsuarios
|
||||
|
||||
Dim Usuario, Nombre As String
|
||||
Dim Estatus As Boolean
|
||||
|
||||
Dim gvr As GridViewRow = GvUsuariosPortal.Rows(e.RowIndex)
|
||||
Usuario = gvr.FCLiteral("LtlUUsuario").Text.Trim
|
||||
Nombre = gvr.FCTextBox("TxtUsuarioPortalEdit").Text.Trim
|
||||
'Rol = GvDatos.Rows(e.RowIndex).FCDropDownList("CbxA").SelectedValue.ToEntero
|
||||
Estatus = gvr.FCCheckBox("ChkEstatus").Checked
|
||||
Dim CveUsuarioPortal As Integer = gvr.DataKey("CveUsuarioPortal").ToEntero
|
||||
Dim pCveCliente As Integer = gvr.DataKey("CveCliente").ToEntero
|
||||
|
||||
'Correo = GvDatos.Rows(e.RowIndex).FCTextBox("TxtCorreo").Text.Trim
|
||||
'CveSupervisa = GvDatos.Rows(e.RowIndex).FCDropDownList("CboSupervisa").SelectedValue.ToEntero
|
||||
'CveAutoriza = GvDatos.Rows(e.RowIndex).FCDropDownList("CboAutoriza").SelectedValue.ToEntero
|
||||
'CveEmpresa = GvDatos.Rows(e.RowIndex).FCDropDownList("CboEmpresa").SelectedValue.ToEntero
|
||||
|
||||
If Usuarios.UpdateUsuarioPortal(Usuario, Nombre, gvr.FCCheckBox("ChkPermiso1").Checked, gvr.FCCheckBox("ChkPermiso2").Checked, gvr.FCCheckBox("ChkPermiso3").Checked, gvr.FCCheckBox("ChkPermiso4").Checked, gvr.FCCheckBox("ChkPermiso5").Checked,
|
||||
gvr.FCCheckBox("ChkPermiso6").Checked, gvr.FCCheckBox("ChkPermiso7").Checked, gvr.FCCheckBox("ChkPermiso8").Checked, gvr.FCCheckBox("ChkPermiso9").Checked, gvr.FCCheckBox("ChkPermiso10").Checked, Estatus, "-1", pCveCliente, -1, CveUsuarioPortal) Then
|
||||
|
||||
GvUsuariosPortal.EditIndex = -1
|
||||
ViewState("DTUsuariosCliente") = Usuarios.DtResultados
|
||||
End If
|
||||
|
||||
Usuarios.Dispose()
|
||||
|
||||
If ViewState("OrdenUsuarios").ToString() <> String.Empty Then
|
||||
CargaGridUsuarios(ViewState("OrdenUsuarios").ToString())
|
||||
Else
|
||||
CargaGridUsuarios("")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvUsuariosPortal_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvUsuariosPortal.RowDeleting
|
||||
|
||||
Dim Usuario As New ClsSisUsuarios
|
||||
If Usuario.RemoveUsuarioPortal(GvUsuariosPortal.DataKeys(e.RowIndex).Value.ToString().ToEntero()) Then
|
||||
GvUsuariosPortal.EditIndex = -1
|
||||
ViewState("DTUsuariosCliente") = Usuario.DtResultados
|
||||
End If
|
||||
|
||||
Usuario.Dispose()
|
||||
|
||||
If ViewState("OrdenUsuarios").ToString() <> String.Empty Then
|
||||
CargaGridUsuarios(ViewState("OrdenUsuarios").ToString())
|
||||
Else
|
||||
CargaGridUsuarios("")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvUsuariosPortal_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs) Handles GvUsuariosPortal.RowCancelingEdit
|
||||
|
||||
GvUsuariosPortal.EditIndex = -1
|
||||
|
||||
If ViewState("OrdenUsuarios").ToString() <> String.Empty Then
|
||||
CargaGridUsuarios(ViewState("OrdenUsuarios").ToString())
|
||||
Else
|
||||
CargaGridUsuarios("")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGridUsuarios(Orden As String)
|
||||
If CType(ViewState("DTUsuariosCliente"), DataTable).Rows.Count > 0 Then
|
||||
If Orden <> String.Empty Then
|
||||
Dim DV As New DataView(CType(ViewState("DTUsuariosCliente"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
||||
GvUsuariosPortal.DataSource = DV.ToTable()
|
||||
DV.Dispose()
|
||||
Else
|
||||
GvUsuariosPortal.DataSource = CType(ViewState("DTUsuariosCliente"), DataTable)
|
||||
End If
|
||||
|
||||
End If
|
||||
GvUsuariosPortal.DataBind()
|
||||
UPPUsuarios.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user