Option Explicit On Option Strict On Imports Extensiones Partial Class OS_PopUpBuscarOS Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then CType(Me.Master, BaseMasterPage).EsPopup = True CType(Me.Master, BaseMasterPage).PopupWidth = 500 RegistraScript("$get('tdContenido').style.height='470px'") CargaClientes() CargaUsuarioRecibio() CargaEstatusOrdenServicio() CargaSucursales() End If End Sub Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click Dim ObjOS As New ClsOS Dim Folio As Integer = -1 Dim CveCliente As Integer = -1 Dim CveUsuarioRecibio As Integer = -1 Dim CveEstatusOrdenServicio As Integer = -1 Dim FechaRecibido As String = "-1" If TxtFolio.Text.Trim <> String.Empty Then Folio = TxtFolio.Text.ToEntero If DdlCliente.SelectedValue <> String.Empty Then CveCliente = DdlCliente.SelectedValue.ToEntero If DdlUsuarioRecibio.SelectedValue <> String.Empty Then CveUsuarioRecibio = DdlUsuarioRecibio.SelectedValue.ToEntero 'If TxtFechaRecibido.Text.Trim <> String.Empty Then FechaRecibido.ToString() If DdlEstatusOrdenServicio.SelectedValue <> String.Empty Then CveEstatusOrdenServicio = DdlEstatusOrdenServicio.SelectedValue.ToEntero If ValidarUnFiltroSeleccionado() Then If ObjOS.GetOrdenesServicios(-1, CveCliente, Folio, CveUsuarioRecibio, CveEstatusOrdenServicio, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then If ObjOS.DtResultados.Rows.Count > 0 Then LtlTotalRegistros.Text = ObjOS.DtResultados.Rows.Count.ToString.FormatoNumero(0) GV.DataSource = ObjOS.DtResultados Else LtlTotalRegistros.Text = "0" GV.DataSource = Nothing Alert("No se encontraron registros con losparámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If End If Else Alert("Seleccione un criterio de búsqueda", TipoMensaje.MsgAdvertencia) End If ObjOS.Dispose() GV.DataBind() UPDatos.Update() TblBusqueda.Visible = True End Sub Protected Sub GV_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowIndex = 0 Then e.Row.Cells(0).Width = Unit.Pixel(70) End If e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Justify Dim Liga As String = String.Empty Liga = "" '
e.Row.FCLiteral("LtlFolio").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("Folio")) e.Row.FCLiteral("LtlCliente").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("Cliente")) e.Row.FCLiteral("LtlCentroCosto").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("SubProyecto")) e.Row.FCLiteral("LtlDescripcion").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("Descripcion")) e.Row.FCLiteral("LtlEstatusOrdenServicio").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("EstatusOrdenServicio")) e.Row.FCLiteral("LtlFechaRecepcion").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("FechaRecepcion").ToDate.ToShortDateString) End If End Sub Private Sub CargaClientes() Dim ObjClientes As New ClsClientes If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then DdlCliente.DataSource = ObjClientes.DtResultados Else DdlCliente.DataSource = Nothing End If ObjClientes.Dispose() DdlCliente.DataBind() End Sub Private Sub CargaUsuarioRecibio() DdlUsuarioRecibio.Items.Clear() DdlUsuarioRecibio.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) DdlUsuarioRecibio.DataBind() DdlUsuarioRecibio.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Private Sub CargaEstatusOrdenServicio() DdlEstatusOrdenServicio.Items.Clear() DdlEstatusOrdenServicio.DataSource = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa) DdlEstatusOrdenServicio.DataBind() DdlEstatusOrdenServicio.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Private Sub CargaSucursales() DdlSubProyecto.Items.Clear() DdlSubProyecto.SelectedValue = Nothing DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1) DdlSubProyecto.DataBind() DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Private Function ValidarUnFiltroSeleccionado() As Boolean If TxtFolio.Text.Trim <> String.Empty Then Return True If DdlCliente.SelectedValue.ToEntero > 0 Then Return True If DdlUsuarioRecibio.SelectedValue.ToEntero > 0 Then Return True 'If TxtFechaRecibido.Text.Trim <> String.Empty Then FechaRecibido.ToString() If DdlEstatusOrdenServicio.SelectedValue.ToEntero > 0 Then Return True Return False End Function End Class