Option Explicit On Option Strict On Imports System.Drawing Imports AspMap Imports Extensiones Imports System.Data Imports System.IO Imports System.Text Imports System.Threading Imports AspMap.Web Imports AspMap.Web.Extensions Partial Class Contratos_ContratosSecciones Inherits ClsPaginas '#Region "Propiedades" ' Private Property PorBoton As Boolean ' Private Property CveContratoSeccion As Integer ' Get ' Return ViewState("CveContratoSeccion").ToString.ToEntero ' End Get ' Set(value As Integer) ' ViewState("CveContratoSeccion") = value ' End Set ' End Property ' Private Property CveContrato As Integer ' Get ' Return ViewState("CveContrato").ToString.ToEntero ' End Get ' Set(value As Integer) ' ViewState("CveContrato") = value ' End Set ' End Property ' Private Property CveClasificacion As Integer ' Get ' Return ViewState("CveClasificacion").ToString.ToEntero ' End Get ' Set(value As Integer) ' ViewState("CveClasificacion") = value ' End Set ' End Property ' Private Property Tipo As String ' Get ' Return ViewState("Tipo").ToString ' End Get ' Set(value As String) ' ViewState("Tipo") = value ' End Set ' End Property ' Private Property Modalidad As Integer ' Get ' Return ViewState("Modalidad").ToString.ToEntero ' End Get ' Set(value As Integer) ' ViewState("Modalidad") = value ' End Set ' End Property ' Private Property DtDatos As DataTable ' Get ' Return CType(ViewState("DtDatos"), DataTable) ' End Get ' Set(value As DataTable) ' ViewState("DtDatos") = value ' End Set ' End Property ' Private Property Seleccionado As String ' Get ' Return ViewState("Seleccionado").ToString ' End Get ' Set(value As String) ' ViewState("Seleccionado") = 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 ' ViewState("Orden") = "" ' PorBoton = False ' Modalidad = Request("Contratos").ToEntero ' ConfiguraModalidad() ' 'CveContratoSeccion = -1 ' 'CargaSeccion() ' 'CargaContratos() ' 'CargaClasificacion() ' Seleccionado = "" ' CargaMapaGeom(-52441177.6239012, 3577172.53285846) ' CveContrato = IfNull(Request("CveContrato"), -1).ToString.ToEntero ' CveClasificacion = IfNull(Request("CveClasificacion"), -1).ToString.ToEntero ' Tipo = IfNull(Request("Tipo"), "Con").ToString ' CargaDatos() ' DdlPS.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todas", "-1")) ' 'Me.txtFechaF.Text = Now.ToShortDateString ' 'Dim Row() As DataRow = GlobalDTFechasContratosSecciones.Select("CveContratosQueja = -1 AND CveEstatus = 1") ' 'If Row.Length > 0 Then ' ' txtFechaI.Text = Row(0)("Fecha").ToString.ToDate.ToShortDateString() ' 'End If ' 'RegistraScript("try { Browser();Acomoda(); } catch (e) {alert(e);}") ' End If ' CargaMapa() ' End Sub ' Private Sub ConfiguraModalidad() ' 'If Modalidad = 1 Then ' ' TrProgramar.Visible = True ' LblTitulo.Text = "Contratos Secciones" ' 'ElseIf Modalidad = 2 Then ' ' TrBitacora.Visible = True ' ' LblTitulo.Text = "Bitácoras" ' ' Page.Title = "SAT - Imprimir Bitácoras" ' ' TxtFechaIBit.Text = Now.ToShortDateString ' ' TxtFechaFBit.Text = Now.ToShortDateString ' 'End If ' End Sub ' Private Sub CargaSeccion() ' Dim dt As DataTable = GlobalDTContratosSecciones.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' DdlSeccion.DataSource = dt ' DdlSeccion.DataBind() ' DdlSeccion.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todas", "-1")) ' DdlSeccionAdd.DataSource = dt ' DdlSeccionAdd.DataBind() ' End Sub ' Protected Sub ChkPermitirAvance_CheckedChanged(sender As Object, e As EventArgs) ' Dim ObjContrato As New ClsContratos ' Dim Row As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow) ' ObjContrato.PermitirAvance(GV.DataKeys(Row.RowIndex).Value.ToString.ToEntero, DirectCast(sender, CheckBox).Checked) ' ObjContrato.Dispose() ' Alert("Se ha permitido avance a la sección") ' CargaDatos() ' End Sub ' Protected Sub ChkPermitirEstimacion_CheckedChanged(sender As Object, e As EventArgs) ' Dim ObjContrato As New ClsContratos ' Dim Row As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow) ' ObjContrato.PermitirEstimacion(GV.DataKeys(Row.RowIndex).Value.ToString.ToEntero, DirectCast(sender, CheckBox).Checked) ' ObjContrato.Dispose() ' Alert("Se ha permitido estimar en la sección") ' CargaDatos() ' End Sub '#Region "C O M B O S" ' Private Sub CargaContratosAdd() ' DdlContratoAdd.DataSource = GlobalDTContratos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' DdlContratoAdd.DataBind() ' ' DdlContratoAdd.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todas", "-1")) ' End Sub ' Private Sub CargaClasificacionAdd() ' DdlClasificacionAdd.DataSource = GlobalDTClasificaciones.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' DdlClasificacionAdd.DataBind() ' ' DdlClasificacionAdd.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todas", "-1")) ' End Sub ' Private Sub CargaPSAdd() ' Dim ObjPS As New ClsProductosServicios ' If ObjPS.GetPS(-1, DdlClasificacionAdd.SelectedValue.ToString.ToEntero, UsuarioActual.CveEmpresa) Then ' DdlPSAdd.DataSource = ObjPS.DtResultados ' Else ' DdlPSAdd.DataSource = Nothing ' End If ' DdlPSAdd.DataBind() ' ObjPS.Dispose() ' 'DdlPSAdd.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todas", "-1")) ' End Sub ' Private Sub CargaSeccionAdd() ' 'DdlSeccionAdd.DataSource = GlobalDTContratosSecciones.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' 'DdlSeccionAdd.DataBind() ' 'DdlSeccionAdd.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todas", "-1")) ' Dim ObjSecciones As New ClsContratos ' If ObjSecciones.GetSecciones() Then ' DdlSeccionAdd.DataSource = ObjSecciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' DdlSeccionAdd.DataBind() ' End If ' ObjSecciones.Dispose() ' End Sub ' Private Sub CargaContratos() ' DdlContrato.DataSource = GlobalDTContratos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' DdlContrato.DataBind() ' DdlContrato.Items.Insert(0, New ListItem("Todos", "-1")) ' DdlContrato.SelectedValue = "7" ' End Sub ' Private Sub CargaClasificacion() ' DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) ' DdlClasificacion.DataBind() ' DdlClasificacion.Items.Insert(0, New ListItem("Todas", "-1")) ' End Sub ' 'Private Sub CargaCategorias() ' ' DdlPartidas.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa) ' ' DdlPartidas.DataBind() ' ' DdlPartidas.Items.Insert(0, New ListItem("Todas", "-1")) ' 'End Sub ' Private Sub CargaPS() ' Dim ObjPS As New ClsProductosServicios ' If ObjPS.GetPS(-1, DdlClasificacion.SelectedValue.ToString.ToEntero, UsuarioActual.CveEmpresa) Then ' DdlPS.DataSource = ObjPS.DtResultados.FiltraParametros("", "PS") ' Else ' DdlPS.DataSource = Nothing ' End If ' DdlPS.DataBind() ' ObjPS.Dispose() ' DdlPS.Items.Insert(0, New ListItem("Todas", "-1")) ' End Sub '#End Region ' Protected Sub CmdConsultar_Click(sender As Object, e As System.EventArgs) Handles CmdConsultar.Click ' CargaDatos() ' End Sub ' Private Sub CargaDatos() ' PorBoton = True ' Dim ContratosSecciones As New ClsContratos() ' If ContratosSecciones.GetRepContratosAvancesDetalle(-1, CveContrato, CveClasificacion, Tipo, UsuarioActual.CveEmpresa) Then ' 'If ContratosSecciones.GetContratosSecciones(-1, DdlEstatus.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero, DdlContrato.SelectedValue.ToEntero, -1, -1, FechaI, FechaF) Then ' DtDatos = ContratosSecciones.DtResultados ' 'DtDatos.Rows.RemoveAt(0) ' 'DtDatos.Rows.RemoveAt(0) ' ' Cache("DTProgramacion" & UsuarioActual.CveUsuario.ToString()) = ContratosSecciones.DtResultados ' GV.DataSource = DtDatos ' LblTitulo.Text = "Cliente: " & DtDatos.MAX("Cliente") ' DtDatos = DtDatos.FiltraParametros("CveContratoSeccion > 0") ' Else ' GV.DataSource = Nothing ' End If ' ContratosSecciones.Dispose() ' GV.DataBind() ' CargaMapa() ' mapa.ZoomFull() ' UpDatos.Update() ' End Sub ' Protected Sub GV_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GV.RowCommand ' If e.CommandName = "Sel" Then ' Seleccionado = e.CommandArgument.ToString ' 'GV.SelectRow(e.CommandArgument.ToString.ToEntero - 1) ' CargaMapa() ' End If ' End Sub ' 'Protected Sub GV_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GV.RowCreated ' ' If e.Row.RowType = DataControlRowType.DataRow Then ' ' e.Row.ClientIDMode = ClientIDMode.Static ' ' e.Row.ID = String.Format("Tr-{0}", e.Row.DBCampo("ID_GIS")) ' ' End If ' '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(300) 'Seccion ' e.Row.Cells(1).Width = Unit.Pixel(100) 'SubSeccion ' e.Row.Cells(2).Width = Unit.Pixel(120) 'Cantidad ' e.Row.Cells(3).Width = Unit.Pixel(100) 'PU ' e.Row.Cells(4).Width = Unit.Pixel(100) 'Permitir Avance ' e.Row.Cells(5).Width = Unit.Pixel(100) 'Permitir Estimacion ' 'e.Row.Cells(6).Width = Unit.Pixel(100) 'Número Estimación ' ' e.Row.Cells(7).Width = Unit.Pixel(100) 'Factura ' End If ' e.Row.ClientIDMode = ClientIDMode.Static ' e.Row.ID = String.Format("Tr{0}", e.Row.DBCampo("ID_GIS")) ' e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center ' If e.Row.DBCampo("NumeroContrato") = "" Then ' e.Row.CssClass = "SubTotales3" : e.Row.Height = 25 ' ElseIf e.Row.DBCampo("Partida") = "" Then ' e.Row.CssClass = "SubTotales2" : e.Row.Height = 25 ' ElseIf e.Row.DBCampo("PS") = "" Then ' e.Row.CssClass = "SubTotales" : e.Row.Height = 25 ' ElseIf e.Row.DBCampo("Seccion") = "" Then ' e.Row.CssClass = "SubTotales3" : e.Row.Height = 25 ' End If ' End If ' End Sub ' Private Sub CargaGrid(ByVal Orden As String) ' If Orden <> String.Empty Then ' Dim DV As New DataView(CType(Cache("DTProgramacion" & UsuarioActual.CveUsuario.ToString()), DataTable), "", Orden, DataViewRowState.CurrentRows) ' GV.DataSource = DV.ToTable() ' DV.Dispose() ' Else ' GV.DataSource = CType(Cache("DTProgramacion" & UsuarioActual.CveUsuario.ToString()), DataTable) ' End If ' GV.DataBind() ' UpDatos.Update() ' End Sub ' 'Protected Sub CmdBuscar_Click(sender As Object, e As System.EventArgs) Handles CmdBuscar.Click ' ' Dim ObjBitacora As New ClsBitacora() ' ' Dim FechaI, FechaF As String ' ' FechaI = If(IsDate(TxtFechaIBit.Text.Trim()), TxtFechaIBit.Text.Trim(), "-1") ' ' FechaF = If(IsDate(TxtFechaFBit.Text.Trim()), TxtFechaFBit.Text.Trim(), "-1") ' ' If ObjBitacora.GetBitacora(DdlContratos.SelectedValue, FechaI, FechaF) Then ' ' GVBitacora.DataSource = ObjBitacora.DtResultados ' ' Else ' ' GVBitacora.DataSource = Nothing ' ' End If ' ' ObjBitacora.Dispose() ' ' GVBitacora.DataBind() ' 'End Sub ' Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged ' CargaPS() ' End Sub ' Protected Sub BtnAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnAgregar.Click ' RegistraScript("PosicionaObjeto('BtnAgregar','divContrato','');") ' TrContratos.Visible = True ' divContrato.Visible = True ' CargaContratosAdd() ' CargaClasificacionAdd() ' CargaSeccionAdd() ' UpContratos.Update() ' 'Dim con As New ClsContratos ' 'con.AddContratosSecciones(DdlContrato.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero, DdlSeccion.SelectedValue.ToEntero, 5, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) ' 'con.Dispose() ' End Sub ' Protected Sub DdlClasificacionAdd_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacionAdd.SelectedIndexChanged ' CargaPSAdd() ' End Sub ' Protected Sub BtnAgregarContratoSeccion_Click(sender As Object, e As System.EventArgs) Handles BtnAgregarContratoSeccion.Click ' Dim ObjContratosSecciones As New ClsContratos ' If ObjContratosSecciones.AddContratosSecciones(DdlContratoAdd.SelectedValue.ToEntero, DdlSeccionAdd.SelectedValue.ToEntero, DdlPSAdd.SelectedValue.ToEntero, TxtCantidad.Text.Trim.ToDouble, TxtPU.Text.Trim.ToDouble, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then ' TxtCantidad.Text = "" ' TxtPU.Text = "" ' Alert("El Nuevo Contrato Sección se Agregó Correctamente.", TipoMensaje.MsgInformacion) ' UpContratos.Update() ' ViewState("DTContratosSecciones") = ObjContratosSecciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' CargaDatos() ' End If ' ObjContratosSecciones.Dispose() ' End Sub ' Protected Sub LBFoto_OnClick(ByVal Sender As Object, ByVal E As EventArgs) ' Dim LB As LinkButton = CType(Sender, LinkButton) ' divFotos.Visible = True ' Dim Con As New ClsContratos ' If Con.GetContratoSeccion(LB.CommandArgument.ToEntero, UsuarioActual.CveEmpresa) Then ' Dim dt As DataTable = Con.DtResultados ' RegistraScript("PosicionaObjeto('" & LB.ClientID & "','divFotos','');") ' If dt.Rows.Count > 0 Then ' Img1.ImageUrl = "/Empresas/66/Avances/Imagenes/" & dt.Rows(0)("Img1").ToString ' If dt.Rows(0)("Img2").ToString <> "" Then ' Img2.Visible = True ' Img2.ImageUrl = "/Empresas/66/Avances/Imagenes/" & dt.Rows(0)("Img2").ToString ' End If ' If dt.Rows(0)("Img3").ToString <> "" Then ' Img3.Visible = True ' Img3.ImageUrl = "/Empresas/66/Avances/Imagenes/" & dt.Rows(0)("Img3").ToString ' End If ' End If ' UPFoto.Update() ' End If ' Con.Dispose() ' End Sub ' Protected Sub LBGeom_OnClick(ByVal Sender As Object, ByVal E As EventArgs) ' Dim LB As LinkButton = CType(Sender, LinkButton) ' divGeom.Visible = True ' Dim Con As New ClsContratos ' If Con.GetContratoSeccion(LB.CommandArgument.ToEntero, UsuarioActual.CveEmpresa) Then ' Dim dt As DataTable = Con.DtResultados ' RegistraScript("PosicionaObjeto('" & LB.ClientID & "','divGeom','');") ' CargaMapaGeom(dt.Rows(0)("x").ToString.ToDouble, dt.Rows(0)("y").ToString.ToDouble) ' UPGPS.Update() ' End If ' Con.Dispose() ' End Sub ' Private Sub CargaMapaGeom(x As Double, y As Double) ' Dim gml As GoogleMapsLayer = New GoogleMapsLayer() ' gml.MapType = GoogleMapType.Normal ' MapGeom.BackgroundLayer = gml ' '' set the transparency of the main map image to display other layers over the satellite map ' MapGeom.ImageFormat = ImageFormat.Png ' MapGeom.ImageOpacity = 0.8 ' 'MapGeom.Markers.Add(New Marker(New AspMap.Point(x, y), "x", "y")) ' 'MapGeom.Markers.Add(New Marker(New AspMap.Point(-52441177.6239012, 3577172.53285846), "x", "y")) ' 'If Mapa.Markers.Count > 0 Then ' 'MapGeom.ZoomScale(New AspMap.Point(Mapa.Markers(0).Position.X, Mapa.Markers(0).Position.Y), 750000) ' 'End If ' End Sub ' Private Sub CargaMapa() ' Dim dbLayer As AspMap.Layer ' Dim feature As AspMap.Feature ' 'Dim FillColor, LineColor As Color ' Mapa.RemoveAllLayers() ' dbLayer = Mapa.AddLayer(ModExtensiones.DirectorioBaseEmpresas & "GIS\Carretera.tab") ' If dbLayer IsNot Nothing AndAlso DtDatos IsNot Nothing Then ' If (Not dbLayer.AddRelate("ID_GIS", DtDatos, "ID_GIS")) Then ' Alert("No se puede vincular las tablas") ' End If ' Dim renderer As FeatureRenderer = dbLayer.Renderer ' 'Seleccionado ' If Seleccionado <> "" Then ' feature = renderer.Add() : feature.Expression = String.Format("ID_Gis = {0}", Seleccionado) : feature.Symbol.FillStyle = FillStyle.Solid : feature.Symbol.FillColor = Color.LightSkyBlue : feature.Symbol.LineColor = Color.FromArgb(120, 168, 192) : feature.Tag = "-3" ' End If ' ''Estimado ' feature = renderer.Add() : feature.Expression = "NumeroEstimacionNum > 0 " : feature.Symbol.FillStyle = FillStyle.Solid : feature.Symbol.FillColor = Color.Green : feature.Symbol.LineColor = Color.FromArgb(192, 144, 96) : feature.Tag = "-2" ' ''Estimado ' feature = renderer.Add() : feature.Expression = "PermitirAvanceNum > 0 " : feature.Symbol.FillStyle = FillStyle.Solid : feature.Symbol.FillColor = Color.Yellow : feature.Symbol.LineColor = Color.FromArgb(192, 144, 96) : feature.Tag = "-2" ' ''Por Estimar ' feature = renderer.Add() : feature.Expression = "PermitirEstimacionNum = 1 " : feature.Symbol.FillStyle = FillStyle.Solid : feature.Symbol.FillColor = Color.LightGray : feature.Symbol.LineColor = Color.FromArgb(120, 168, 192) : feature.Tag = "-3" ' End If ' End Sub ' Protected Sub Map1_InfoTool(ByVal sender As Object, ByVal e As InfoToolEventArgs) ' If e.Argument = "" Then ' Dim records As AspMap.Recordset = Mapa.Identify(e.InfoPoint, 10) ' Seleccionado = records("ID_Gis").ToString ' GV.SelectRow(records("ID_Gis").ToString.ToEntero - 1) ' 'RegistraScript(String.Format("Colorea(Tr{0})", records("ID_GIS"))) ' Dim dbLayer As AspMap.Layer = Mapa.Layer(0) ' Dim feature = New AspMap.Feature() ' feature.Expression = String.Format("ID_Gis = " & Seleccionado) ' feature.Symbol.FillColor = Color.LightSkyBlue ' dbLayer.Renderer.Add(feature) ' End If ' End Sub '#Region "O R D E N A M I E N T O" ' Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) ' Dim Orden As String = "" ' Dim Campo As String = "" ' Dim Literal As Literal = Nothing ' Const OrdenInicial As String = "" ' Dim Arg(2) As String ' Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) ' Campo = Arg(0) ' Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) ' If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then ' ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) ' Literal.Text = String.Format("") ' Else ' ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) ' Literal.Text = String.Format("") ' End If ' Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString ' ViewState("Orden") = Orden ' CargaGrid(Orden) ' End Sub '#End Region End Class