Ejemplo n.º 1
0
        private void SeleccionarPunto(int x, int y)
        {
            double px = 0, py = 0;

            MapWin.View.PixelToProj(x, y, ref px, ref py);

            direccion           = new Direccion();
            direccion.Ubicacion = new PointD(px, py);

            PostgresDataAccess.DataAccess da = new PostgresDataAccess.DataAccess();
            direccion.Geoz = da.ObtenerGeoz(direccion.Ubicacion.Value.ToString());
            // dibujar
            if (PlugData.DrDireccion.HasValue)
            {
                MapWin.View.Draw.ClearDrawing(PlugData.DrDireccion.Value);
            }
            PlugData.DrDireccion = MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList);
            MapWin.View.Draw.DrawCircle(px, py, 20, Color.Red, true);
            // deshabilitar
            Botones[4].Pressed     = false;
            MapWin.View.MapCursor  = _prevCursor;
            MapWin.View.CursorMode = _prevMode;
            // generar expediente
            PlugData.Direccion = direccion;
            Forms.Expediente2 expediente2 = new Forms.Expediente2();
            expediente2.ShowDialog();
        }
        private bool Ingresar()
        {
            PostgresDataAccess.Expediente exp = new PostgresDataAccess.Expediente();
            bool res;

            // agregar datos
            exp.Activo          = true;
            exp.Block           = textBlock.Text;
            exp.Casa            = textCasa.Text;
            exp.Cero5           = /*textDireccion.Text + " / " + */ TextoFormateado(textEsquina.Text);
            exp.Compania        = comboCompañia.SelectedItem == null ? "" : comboCompañia.SelectedItem.ToString();
            exp.Comuna          = comboComuna.SelectedItem == null ? "" : comboComuna.SelectedItem.ToString();
            exp.Descripcion     = textDescripcion.Text;
            exp.Fecha           = dtFecha.Value;
            exp.Hora            = DateTime.Parse(textHora.Text);
            exp.Poblacion_villa = textPoblacion.Text;
            exp.Quien_llama     = textQuienLlama.Text;
            exp.Seis2           = TextoFormateado(textDireccion.Text);
            //exp.Servicio = comboServicio.SelectedItem == null ? "" : comboServicio.SelectedItem.ToString();
            exp.Codigo_llamado   = (int)textClave.Tag;
            exp.Codigo_principal = exp.Codigo_llamado < 100 ? exp.Codigo_llamado : (exp.Codigo_llamado - (exp.Codigo_llamado % 100)) / 100;
            exp.Telefono         = textTelefono.Text;
            if (edicion)
            {
                exp.Ubicacion = EditExp.Ubicacion;
                exp.Geoz      = EditExp.Geoz;
                exp.Id_area   = EditExp.Id_area;
            }
            else
            {
                exp.Ubicacion = PlugData.Direccion.Ubicacion.Value;
                exp.Geoz      = Datos.ObtenerGeoz(exp.Ubicacion.ToString());
                exp.Id_area   = Datos.ObtenerArea(exp.Ubicacion.ToString());
            }

            this.UseWaitCursor = true;
            if (edicion)
            {
                exp.Id_expediente = EditExp.Id_expediente;
                res = Datos.ActualizarExpediente(exp);
            }
            else
            {
                res = Datos.InsertarExpediente(exp);
            }
            this.UseWaitCursor = false;

            return(res);

            /*else
             * {
             *  this.Close();
             * }*/
        }