Beispiel #1
0
        public static String GuardarRegistroObjeto(RegistroActo registro)
        {
            SqlConnection con = new SqlConnection(Connection.getConnection());

            con.Open();
            using (SqlTransaction transaction = con.BeginTransaction())
            {
                //Si el id. del objeto registro es mayor a 0 se va a actualizar un registro
                if (registro.IdRegistro > 0)
                {
                    SqlCommand comm = new SqlCommand("UPDATE Registro " +
                                                     "SET folio = '" + registro.Folio + "', tipo_predio = '" + registro.TipoPredio + "', superficie = '" + registro.Superficie + "', unidad_superficie = '" + registro.UnidadSuperficie + "', ubicacion_inmueble_calle = " + registro.UbicacionInmuebleCalle + ", ubicacion_inmueble_colonia = " + registro.UbicacionInmuebleColonia + ", ubicacion_inmueble_numero = " + registro.UbicacionInmuebleNumero + ", colonia_texto = '" + registro.ColoniaTexto + "', calle_texto = '" + registro.CalleTexto + "', numero_exterior_texto = '" + registro.NumeroExterior + "', numero_interior_texto = '" + registro.NumeroInterior + "', manzana_texto = '" + registro.Manzana + "', lote_texto = '" + registro.Lote + "', id_municipio = " + registro.Municipio + ", id_poblacion = " + registro.Poblacion + ", clave_catastral = '" + registro.ClaveCatastral + "', norte = '" + registro.Norte + "', sur = '" + registro.Sur + "', este = '" + registro.Este + "', oeste = '" + registro.Oeste + "', noreste = '" + registro.Noreste + "', noroeste = '" + registro.Noroeste + "', sureste = '" + registro.Sureste + "', suroeste = '" + registro.Suroeste + "', fecha_registro = '" + registro.FechaRegistro + "', actual_libro = '" + registro.RegistroActual.Libro + "', actual_seccion = '" + registro.RegistroActual.Seccion + "', actual_partida = '" + registro.RegistroActual.Partida + "', observaciones = '" + registro.Observaciones + "', anotacion_actualizada ='" + registro.AnotacionActualizada + "' " + ", actual_serie = '" + registro.RegistroActual.Serie + "' " +
                                                     "WHERE id_registro = " + registro.IdRegistro, con, transaction);

                    comm.ExecuteNonQuery();

                    SqlCommand comm2 = new SqlCommand("DELETE FROM Adquirientes WHERE id_registro = " + registro.IdRegistro, con, transaction);
                    comm2.ExecuteNonQuery();

                    comm2 = new SqlCommand("DELETE FROM Otorgantes WHERE id_registro = " + registro.IdRegistro, con, transaction);
                    comm2.ExecuteNonQuery();

                    comm2 = new SqlCommand("DELETE FROM AnotacionesMarginales WHERE id_registro = " + registro.IdRegistro, con, transaction);
                    comm2.ExecuteNonQuery();

                    foreach (Persona item in registro.Adquirientes)
                    {
                        String res = registro.GuardarAdquiriente(registro.IdRegistro, item.Nombre, item.Paterno, item.Materno);
                        if (res != "OK")
                        {
                            throw new Exception();
                        }
                    }

                    foreach (Persona item in registro.Otorgantes)
                    {
                        String res = registro.GuardarOtorgante(registro.IdRegistro, item.Nombre, item.Paterno, item.Materno);
                        if (res != "OK")
                        {
                            throw new Exception();
                        }
                    }

                    foreach (Antecedente item in registro.AnotacionesMarginales)
                    {
                        String res = registro.GuardarAnotacionesMarginales(registro.IdRegistro, item.Libro, item.Tomo, item.Semestre, item.Año, item.Seccion, item.Serie, item.Partida, item.Observaciones);
                        if (res != "OK")
                        {
                            throw new Exception();
                        }
                    }

                    transaction.Commit();
                    con.Close();
                }
                else //de lo contrario se va a ingresar un registro nuevo
                {
                    try
                    {
                        SqlCommand comm = new SqlCommand("INSERT INTO Registro " +
                                                         "OUTPUT inserted.id_registro " +
                                                         "VALUES (" + registro.IdPrelacionActo + ", '" + registro.Folio + "', '" + registro.TipoPredio + "', '" + registro.Superficie + "', '" + registro.UnidadSuperficie + "', " + registro.UbicacionInmuebleCalle + ", " + registro.UbicacionInmuebleColonia + ", " + registro.UbicacionInmuebleNumero + ", '" + registro.ColoniaTexto + "', '" + registro.CalleTexto + "', '" + registro.NumeroExterior + "', '" + registro.NumeroInterior + "', '" + registro.Manzana + "', '" + registro.Lote + "', " + registro.Municipio + ", " + registro.Poblacion + ", '" + registro.ClaveCatastral + "', '" + registro.Norte + "', '" + registro.Sur + "', '" + registro.Este + "', '" + registro.Oeste + "','" + registro.Noreste + "', '" + registro.Noroeste + "', '" + registro.Sureste + "', '" + registro.Suroeste + "', '" + registro.FechaRegistro + "', '" + registro.RegistroActual.Libro + "', '" + registro.RegistroActual.Seccion + "', '" + registro.RegistroActual.Partida + "', '" + registro.Observaciones + "', '" + registro.AnotacionActualizada + "', '" + registro.RegistroActual.Serie + "')", con, transaction);

                        int result = (int)comm.ExecuteScalar();
                        registro.IdRegistro = result;
                        if (result > 0)
                        {
                            SqlCommand comm2   = new SqlCommand("UPDATE PrelacionesActos SET estado_movimiento = 'REGISTRADA' WHERE id_prelacion_acto = " + registro.IdPrelacionActo, con, transaction);
                            int        result2 = comm2.ExecuteNonQuery();
                        }

                        foreach (Persona item in registro.Adquirientes)
                        {
                            String res = registro.GuardarAdquiriente(registro.IdRegistro, item.Nombre, item.Paterno, item.Materno);
                            if (res != "OK")
                            {
                                throw new Exception();
                            }
                        }

                        foreach (Persona item in registro.Otorgantes)
                        {
                            String res = registro.GuardarOtorgante(registro.IdRegistro, item.Nombre, item.Paterno, item.Materno);
                            if (res != "OK")
                            {
                                throw new Exception();
                            }
                        }

                        foreach (Antecedente item in registro.AnotacionesMarginales)
                        {
                            String res = registro.GuardarAnotacionesMarginales(registro.IdRegistro, item.Libro, item.Tomo, item.Semestre, item.Año, item.Seccion, item.Serie, item.Partida, item.Observaciones);
                            if (res != "OK")
                            {
                                throw new Exception();
                            }
                        }

                        transaction.Commit();
                        con.Close();
                    }
                    catch (Exception exc)
                    {
                        transaction.Rollback();
                        return("ERROR: " + exc.Message);
                    }
                }
            }
            return("OK");
        }
Beispiel #2
0
        //Función que retorna la lista completa de registros de una prelación recibiendo como parámetro el id de la prelación
        public static List <RegistroActo> ObtenerDatosListaRegistrosPrelacion(int IdPrelacion)
        {
            List <RegistroActo> registros = new List <RegistroActo>();
            RegistroActo        reg       = new RegistroActo();
            SqlConnection       con       = new SqlConnection(Connection.getConnection());

            con.Open();

            SqlCommand comm = new SqlCommand("SELECT Registro.* " +
                                             "FROM PrelacionesActos " +
                                             "INNER JOIN Registro " +
                                             "ON Registro.id_prelacion_acto = PrelacionesActos.id_prelacion_acto " +
                                             "WHERE PrelacionesActos.id_prelacion = " + IdPrelacion, con);
            SqlDataReader reader = comm.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    reg                          = new RegistroActo();
                    reg.IdRegistro               = int.Parse(reader["id_registro"].ToString());
                    reg.IdPrelacionActo          = int.Parse(reader["id_prelacion_acto"].ToString());
                    reg.Folio                    = reader["folio"].ToString();
                    reg.TipoPredio               = reader["tipo_predio"].ToString();
                    reg.Superficie               = reader["superficie"].ToString();
                    reg.UnidadSuperficie         = reader["unidad_superficie"].ToString();
                    reg.UbicacionInmuebleCalle   = int.Parse(reader["ubicacion_inmueble_calle"].ToString());
                    reg.UbicacionInmuebleColonia = int.Parse(reader["ubicacion_inmueble_colonia"].ToString());
                    reg.UbicacionInmuebleNumero  = int.Parse(reader["ubicacion_inmueble_numero"].ToString());
                    reg.ColoniaTexto             = reader["colonia_texto"].ToString();
                    reg.CalleTexto               = reader["calle_texto"].ToString();
                    reg.NumeroExterior           = reader["numero_exterior_texto"].ToString();
                    reg.NumeroInterior           = reader["numero_interior_texto"].ToString();
                    reg.Manzana                  = reader["manzana_texto"].ToString();
                    reg.Lote                     = reader["lote_texto"].ToString();
                    reg.Municipio                = int.Parse(reader["id_municipio"].ToString());
                    reg.Poblacion                = int.Parse(reader["id_poblacion"].ToString());
                    reg.ClaveCatastral           = reader["clave_catastral"].ToString();
                    reg.Norte                    = reader["norte"].ToString();
                    reg.Sur                      = reader["sur"].ToString();
                    reg.Este                     = reader["este"].ToString();
                    reg.Oeste                    = reader["oeste"].ToString();
                    reg.Noreste                  = reader["noreste"].ToString();
                    reg.Noroeste                 = reader["noroeste"].ToString();
                    reg.Sureste                  = reader["sureste"].ToString();
                    reg.Suroeste                 = reader["suroeste"].ToString();
                    reg.FechaRegistro            = reader["fecha_registro"].ToString();
                    reg.registroActual           = new Antecedente();
                    reg.RegistroActual.Libro     = reader["actual_libro"].ToString();
                    reg.RegistroActual.Seccion   = reader["actual_seccion"].ToString();
                    reg.RegistroActual.Partida   = reader["actual_partida"].ToString();
                    reg.Observaciones            = reader["observaciones"].ToString();
                    reg.AnotacionActualizada     = reader["anotacion_actualizada"].ToString();

                    SqlConnection con2 = new SqlConnection(Connection.getConnection());
                    con2.Open();
                    SqlCommand         comm2       = new SqlCommand("SELECT * FROM AnotacionesMarginales WHERE id_registro = " + reg.IdRegistro, con2);
                    SqlDataReader      reader2     = comm2.ExecuteReader();
                    List <Antecedente> anotaciones = new List <Antecedente>();

                    if (reader2.HasRows)
                    {
                        while (reader2.Read())
                        {
                            Antecedente anotacion = new Antecedente();
                            anotacion.ClaveAntecedente = int.Parse(reader2["id_anotacion"].ToString());
                            anotacion.Libro            = reader2["anotacion_libro"].ToString();
                            anotacion.Tomo             = reader2["anotacion_tomo"].ToString();
                            anotacion.Semestre         = reader2["anotacion_semestre"].ToString();
                            anotacion.Año           = reader2["anotacion_anio"].ToString();
                            anotacion.Seccion       = reader2["anotacion_seccion"].ToString();
                            anotacion.Serie         = reader2["anotacion_serie"].ToString();
                            anotacion.Partida       = reader2["anotacion_partida"].ToString();
                            anotacion.Observaciones = reader2["anotacion_observaciones"].ToString();
                            anotaciones.Add(anotacion);
                        }
                    }
                    reg.AnotacionesMarginales = anotaciones;
                    registros.Add(reg);
                    con2.Close();
                }
            }

            con.Close();
            return(registros);
        }
Beispiel #3
0
        //Función que retorna un objeto Registro con la información de los datos de registro recibiendo como parámetro el id de la
        //relación de una prelación con un aco/movimiento.
        public static RegistroActo ObtenerDatosRegistro(int IdPrelacionActo)
        {
            RegistroActo  reg = null;
            SqlConnection con = new SqlConnection(Connection.getConnection());

            con.Open();

            SqlCommand comm = new SqlCommand("SELECT Registro.*, Municipios.nombre AS nombre_municipio, Poblaciones.nombre AS nombre_poblacion " +
                                             "FROM PrelacionesActos " +
                                             "INNER JOIN Registro " +
                                             "ON Registro.id_prelacion_acto = PrelacionesActos.id_prelacion_acto " +
                                             "INNER JOIN Municipios " +
                                             "ON Municipios.id_municipio = Registro.id_municipio " +
                                             "LEFT JOIN Poblaciones " +
                                             "ON Poblaciones.id_poblacion = Registro.id_poblacion " +
                                             "WHERE PrelacionesActos.id_prelacion_acto = " + IdPrelacionActo + " " +
                                             "AND Poblaciones.id_municipio = Registro.id_municipio AND Poblaciones.id_poblacion = Registro.id_poblacion ", con);
            SqlDataReader reader = comm.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    reg                          = new RegistroActo();
                    reg.IdRegistro               = int.Parse(reader["id_registro"].ToString());
                    reg.IdPrelacionActo          = int.Parse(reader["id_prelacion_acto"].ToString());
                    reg.Folio                    = reader["folio"].ToString();
                    reg.TipoPredio               = reader["tipo_predio"].ToString();
                    reg.Superficie               = reader["superficie"].ToString();
                    reg.UnidadSuperficie         = reader["unidad_superficie"].ToString();
                    reg.UbicacionInmuebleCalle   = int.Parse(reader["ubicacion_inmueble_calle"].ToString());
                    reg.UbicacionInmuebleColonia = int.Parse(reader["ubicacion_inmueble_colonia"].ToString());
                    reg.UbicacionInmuebleNumero  = int.Parse(reader["ubicacion_inmueble_numero"].ToString());
                    reg.ColoniaTexto             = reader["colonia_texto"].ToString();
                    reg.CalleTexto               = reader["calle_texto"].ToString();
                    reg.NumeroExterior           = reader["numero_exterior_texto"].ToString();
                    reg.NumeroInterior           = reader["numero_interior_texto"].ToString();
                    reg.Manzana                  = reader["manzana_texto"].ToString();
                    reg.Lote                     = reader["lote_texto"].ToString();
                    reg.Municipio                = int.Parse(reader["id_municipio"].ToString());
                    reg.Poblacion                = int.Parse(reader["id_poblacion"].ToString());
                    reg.ClaveCatastral           = reader["clave_catastral"].ToString();
                    reg.Norte                    = reader["norte"].ToString();
                    reg.Sur                      = reader["sur"].ToString();
                    reg.Este                     = reader["este"].ToString();
                    reg.Oeste                    = reader["oeste"].ToString();
                    reg.Noreste                  = reader["noreste"].ToString();
                    reg.Noroeste                 = reader["noroeste"].ToString();
                    reg.Sureste                  = reader["sureste"].ToString();
                    reg.Suroeste                 = reader["suroeste"].ToString();
                    reg.FechaRegistro            = reader["fecha_registro"].ToString();
                    reg.RegistroActual           = new Antecedente();
                    reg.RegistroActual.Libro     = reader["actual_libro"].ToString();
                    reg.RegistroActual.Seccion   = reader["actual_seccion"].ToString();
                    reg.RegistroActual.Partida   = reader["actual_partida"].ToString();
                    reg.RegistroActual.Serie     = reader["actual_serie"].ToString();
                    reg.Observaciones            = reader["observaciones"].ToString();
                    reg.municipioTexto           = reader["nombre_municipio"].ToString();
                    reg.poblacionTexto           = reader["nombre_poblacion"].ToString();
                    reg.AnotacionActualizada     = reader["anotacion_actualizada"].ToString();

                    SqlConnection con2 = new SqlConnection(Connection.getConnection());
                    con2.Open();
                    SqlCommand         comm2       = new SqlCommand("SELECT * FROM AnotacionesMarginales WHERE id_registro = " + reg.IdRegistro, con2);
                    SqlDataReader      reader2     = comm2.ExecuteReader();
                    List <Antecedente> anotaciones = new List <Antecedente>();

                    if (reader2.HasRows)
                    {
                        while (reader2.Read())
                        {
                            Antecedente anotacion = new Antecedente();
                            anotacion.ClaveAntecedente = int.Parse(reader2["id_anotacion"].ToString());
                            anotacion.Libro            = reader2["anotacion_libro"].ToString();
                            anotacion.Tomo             = reader2["anotacion_tomo"].ToString();
                            anotacion.Semestre         = reader2["anotacion_semestre"].ToString();
                            anotacion.Año           = reader2["anotacion_anio"].ToString();
                            anotacion.Seccion       = reader2["anotacion_seccion"].ToString();
                            anotacion.Serie         = reader2["anotacion_serie"].ToString();
                            anotacion.Partida       = reader2["anotacion_partida"].ToString();
                            anotacion.Observaciones = reader2["anotacion_observaciones"].ToString();
                            anotaciones.Add(anotacion);
                        }
                    }
                    reg.AnotacionesMarginales = anotaciones;
                    con2.Close();

                    SqlConnection con3 = new SqlConnection(Connection.getConnection());
                    con3.Open();
                    SqlCommand     comm3      = new SqlCommand("SELECT * FROM Otorgantes WHERE id_registro = " + reg.IdRegistro, con3);
                    SqlDataReader  reader3    = comm3.ExecuteReader();
                    List <Persona> otorgantes = new List <Persona>();

                    if (reader3.HasRows)
                    {
                        while (reader3.Read())
                        {
                            Persona otorgante = new Persona();
                            otorgante.Nombre  = reader3["otorgante_nombre"].ToString();
                            otorgante.Paterno = reader3["otorgante_paterno"].ToString();
                            otorgante.Materno = reader3["otorgante_materno"].ToString();
                            otorgantes.Add(otorgante);
                        }
                    }
                    reg.Otorgantes = otorgantes;
                    con3.Close();

                    SqlConnection con4 = new SqlConnection(Connection.getConnection());
                    con4.Open();
                    SqlCommand     comm4        = new SqlCommand("SELECT * FROM Adquirientes WHERE id_registro = " + reg.IdRegistro, con4);
                    SqlDataReader  reader4      = comm4.ExecuteReader();
                    List <Persona> adquirientes = new List <Persona>();

                    if (reader4.HasRows)
                    {
                        while (reader4.Read())
                        {
                            Persona adquiriente = new Persona();
                            adquiriente.Nombre  = reader4["adquiriente_nombre"].ToString();
                            adquiriente.Paterno = reader4["adquiriente_paterno"].ToString();
                            adquiriente.Materno = reader4["adquiriente_materno"].ToString();
                            adquirientes.Add(adquiriente);
                        }
                    }
                    reg.Adquirientes = adquirientes;
                    con4.Close();
                }
            }
            con.Close();
            return(reg);
        }
Beispiel #4
0
        public static string CrearCompendio(Prelacion prelacion)
        {
            try
            {
                List <Movimientos>  actos        = new List <Movimientos>();
                List <Antecedente>  antecedentes = new List <Antecedente>();
                List <RegistroActo> registros    = new List <RegistroActo>();
                List <Antecedente>  anotaciones  = new List <Antecedente>();

                string actosString     = "";
                string an_reg_libro    = "";
                string an_reg_tomo     = "";
                string an_reg_semestre = "";
                string an_reg_anio     = "";
                string an_reg_seccion  = "";
                string an_reg_serie    = "";
                string an_reg_partida  = "";

                string otorgantes   = "";
                string adquirientes = "";

                string an_marg_observaciones = "";
                string an_marg_libro         = "";
                string an_marg_tomo          = "";
                string an_marg_semestre      = "";
                string an_marg_anio          = "";
                string an_marg_seccion       = "";
                string an_marg_serie         = "";
                string an_marg_partida       = "";

                string tipoPredio       = "";
                string superficie       = "";
                string unidadSuperficie = "";
                string descripcion      = "";
                string municipio        = "";
                string poblacion        = "";
                string claveCatastral   = "";
                string norte            = "";
                string sur              = "";
                string este             = "";
                string oeste            = "";
                string noreste          = "";
                string noroeste         = "";
                string sureste          = "";
                string suroeste         = "";
                string fechaRegistro    = "";
                string reg_act_libro    = "";
                string reg_act_tomo     = "";
                string reg_act_semestre = "";
                string reg_act_anio     = "";
                string reg_act_seccion  = "";
                string reg_act_serie    = "";
                string reg_act_partida  = "";
                string inegiEstado      = "";
                string inegiMunicipio   = "";
                string inegiPoblacion   = "";
                string inegiColonia     = "";
                string inegiCalle       = "";
                string inegiNumeroCalle = "";


                bool flag = true;

                actos        = Prelacion.ObtenerMovimientosPrelacion(prelacion.IdPrelacion, "");
                antecedentes = Prelacion.ObtenerAntecedentesPrelacion(prelacion.IdPrelacion);
                registros    = RegistroActo.ObtenerDatosListaRegistrosPrelacion(prelacion.IdPrelacion);


                foreach (Movimientos item in actos)
                {
                    if (flag)
                    {
                        actosString = actosString + item.NombreActo;
                        flag        = false;
                    }
                    else
                    {
                        actosString = actosString + "|" + item.NombreActo;
                    }
                }
                flag = true;
                foreach (Antecedente item in antecedentes)
                {
                    if (flag)
                    {
                        an_reg_libro    = an_reg_libro + item.Libro;
                        an_reg_tomo     = an_reg_tomo + item.Tomo;
                        an_reg_semestre = an_reg_semestre + item.Semestre;
                        an_reg_anio     = an_reg_anio + item.Año;
                        an_reg_seccion  = an_reg_seccion + item.Seccion;
                        an_reg_serie    = an_reg_serie + item.Serie;
                        an_reg_partida  = an_reg_partida + item.Partida;
                        flag            = false;
                    }
                    else
                    {
                        an_reg_libro    = an_reg_libro + "|" + item.Libro;
                        an_reg_tomo     = an_reg_tomo + "|" + item.Tomo;
                        an_reg_semestre = an_reg_semestre + "|" + item.Semestre;
                        an_reg_anio     = an_reg_anio + "|" + item.Año;
                        an_reg_seccion  = an_reg_seccion + "|" + item.Seccion;
                        an_reg_serie    = an_reg_serie + "|" + item.Serie;
                        an_reg_partida  = an_reg_partida + "|" + item.Partida;
                    }
                }
                flag = true;
                foreach (RegistroActo item in registros)
                {
                    RegistroActo temp = RegistroActo.ObtenerDatosRegistro(item.IdRegistro);

                    if (temp != null)
                    {
                        if (temp.Otorgantes != null)
                        {
                            foreach (Persona otorgante in temp.Otorgantes)
                            {
                                if (otorgantes.Length > 0)
                                {
                                    otorgantes = otorgantes + "|" + otorgante.Nombre;
                                }
                                else
                                {
                                    otorgantes = otorgante.Nombre;
                                }
                            }
                        }
                        if (temp.Adquirientes != null)
                        {
                            foreach (Persona adquiriente in temp.Adquirientes)
                            {
                                if (adquirientes.Length > 0)
                                {
                                    adquirientes = adquirientes + "|" + adquiriente.Nombre;
                                }
                                else
                                {
                                    adquirientes = adquiriente.Nombre;
                                }
                            }
                        }
                        if (temp.AnotacionesMarginales != null)
                        {
                            foreach (Antecedente anotacion in temp.AnotacionesMarginales)
                            {
                                if (anotacion != null)
                                {
                                    if (an_marg_observaciones.Length > 0)
                                    {
                                        an_marg_observaciones = an_marg_observaciones + "|" + anotacion.Observaciones;
                                    }
                                    else
                                    {
                                        an_marg_observaciones = an_marg_observaciones + anotacion.Observaciones;
                                    }

                                    if (an_marg_libro.Length > 0)
                                    {
                                        an_marg_libro = an_marg_libro + "|" + anotacion.Libro;
                                    }
                                    else
                                    {
                                        an_marg_libro = an_marg_libro + anotacion.Libro;
                                    }

                                    if (an_marg_tomo.Length > 0)
                                    {
                                        an_marg_tomo = an_marg_tomo + "|" + anotacion.Tomo;
                                    }
                                    else
                                    {
                                        an_marg_tomo = an_marg_tomo + anotacion.Tomo;
                                    }

                                    if (an_marg_semestre.Length > 0)
                                    {
                                        an_marg_semestre = an_marg_semestre + "|" + anotacion.Semestre;
                                    }
                                    else
                                    {
                                        an_marg_semestre = an_marg_semestre + anotacion.Semestre;
                                    }

                                    if (an_marg_anio.Length > 0)
                                    {
                                        an_marg_anio = an_marg_anio + "|" + anotacion.Año;
                                    }
                                    else
                                    {
                                        an_marg_anio = an_marg_anio + anotacion.Año;
                                    }

                                    if (an_marg_seccion.Length > 0)
                                    {
                                        an_marg_seccion = an_marg_seccion + "|" + anotacion.Seccion;
                                    }
                                    else
                                    {
                                        an_marg_seccion = an_marg_seccion + anotacion.Seccion;
                                    }

                                    if (an_marg_serie.Length > 0)
                                    {
                                        an_marg_serie = an_marg_serie + "|" + anotacion.Serie;
                                    }
                                    else
                                    {
                                        an_marg_serie = an_marg_serie + anotacion.Serie;
                                    }

                                    if (an_marg_partida.Length > 0)
                                    {
                                        an_marg_partida = an_marg_partida + "|" + anotacion.Partida;
                                    }
                                    else
                                    {
                                        an_marg_partida = an_marg_partida + anotacion.Partida;
                                    }
                                }
                            }
                        }

                        tipoPredio       = tipoPredio.Length > 0 ? tipoPredio + "|" + item.TipoPredio : item.TipoPredio;
                        superficie       = superficie.Length > 0 ? superficie + "|" + item.Superficie : item.Superficie;
                        unidadSuperficie = unidadSuperficie.Length > 0 ? unidadSuperficie + "|" + item.UnidadSuperficie : item.UnidadSuperficie;

                        municipio        = municipio.Length > 0 ? municipio + "|" + item.MunicipioTexto : item.MunicipioTexto;
                        poblacion        = poblacion.Length > 0 ? poblacion + "|" + item.PoblacionTexto : item.PoblacionTexto;
                        claveCatastral   = claveCatastral.Length > 0 ? claveCatastral + "|" + item.ClaveCatastral : item.ClaveCatastral;
                        norte            = norte.Length > 0 ? norte + "|" + item.Norte : item.Norte;
                        sur              = sur.Length > 0 ? sur + "|" + item.Sur : item.Sur;
                        este             = este.Length > 0 ? este + "|" + item.Este : item.Este;
                        oeste            = oeste.Length > 0 ? oeste + "|" + item.Oeste : item.Oeste;
                        noreste          = noreste.Length > 0 ? noreste + "|" + item.Noreste : item.Noreste;
                        noroeste         = noroeste.Length > 0 ? noroeste + "|" + item.Noroeste : item.Noroeste;
                        sureste          = sureste.Length > 0 ? sureste + "|" + item.Sureste : item.Sureste;
                        suroeste         = suroeste.Length > 0 ? suroeste + "|" + item.Suroeste : item.Suroeste;
                        fechaRegistro    = fechaRegistro.Length > 0 ? fechaRegistro + "|" + item.FechaRegistro : item.FechaRegistro;
                        reg_act_libro    = reg_act_libro.Length > 0 ? reg_act_libro + "|" + item.RegistroActual.Libro : item.RegistroActual.Libro;
                        reg_act_tomo     = reg_act_tomo.Length > 0 ? reg_act_tomo + "|" + item.RegistroActual.Tomo : item.RegistroActual.Tomo;
                        reg_act_semestre = reg_act_semestre.Length > 0 ? reg_act_semestre + "|" + item.RegistroActual.Semestre : item.RegistroActual.Semestre;
                        reg_act_anio     = reg_act_anio.Length > 0 ? reg_act_anio + "|" + item.RegistroActual.Año : item.RegistroActual.Año;
                        reg_act_seccion  = reg_act_seccion.Length > 0 ? reg_act_seccion + "|" + item.RegistroActual.Seccion : item.RegistroActual.Seccion;
                        reg_act_serie    = reg_act_serie.Length > 0 ? reg_act_serie + "|" + item.RegistroActual.Serie : item.RegistroActual.Serie;
                        reg_act_partida  = reg_act_partida.Length > 0 ? reg_act_partida + "|" + item.RegistroActual.Partida : item.RegistroActual.Partida;

                        /*inegiEstado = inegiEstado.Length > 0 ? inegiEstado + "|" + item : item.Superficie;
                         * inegiMunicipio = superficie.Length > 0 ? superficie + "|" + item.Superficie : item.Superficie;
                         * inegiPoblacion = superficie.Length > 0 ? superficie + "|" + item.Superficie : item.Superficie;
                         * inegiColonia = superficie.Length > 0 ? superficie + "|" + item.Superficie : item.Superficie;
                         * inegiCalle = superficie.Length > 0 ? superficie + "|" + item.Superficie : item.Superficie;
                         * inegiNumeroCalle = superficie.Length > 0 ? superficie + "|" + item.Superficie : item.Superficie;*/
                    }
                }

                SqlConnection con = new SqlConnection(Connection.getConnection());
                con.Open();
                SqlCommand comm = new SqlCommand("INSERT INTO CompendioDigitalizacion VALUES (" +
                                                 "'Escritura Pública', '" + prelacion.NumeroEscritura + "', '" + prelacion.FechaDocumento + "', '" + prelacion.LugarOtorgamiento + "', '" + prelacion.Tramitante + "', '" + actosString + "', '" + an_reg_libro + "', '" + an_reg_tomo + "', '" + an_reg_semestre + "', '" + an_reg_anio + "', '" + an_reg_seccion + "', '" + an_reg_serie + "', '" + an_reg_partida + "', '" + otorgantes + "', '" + adquirientes + "', '" + prelacion.ValorInmueble + "', '" + prelacion.TipoMoneda + "', '" + tipoPredio + "', '" + superficie + "', '" + unidadSuperficie + "', '" + prelacion.DescripcionBien + "', '" + municipio + "', '" + poblacion + "', '" + claveCatastral + "', '" + norte + "', '" + sur + "', '" + este + "', '" + oeste + "', '" + noreste + "', '" + sureste + "', '" + suroeste + "', '" + noroeste + "', '" + fechaRegistro + "', '" + reg_act_libro + "', '" + reg_act_tomo + "', '" + reg_act_semestre + "', '" + reg_act_anio + "', '" + reg_act_seccion + "', '" + reg_act_serie + "', '" + reg_act_partida + "', '" + an_marg_observaciones + "', '', '" + an_marg_libro + "', '" + an_marg_semestre + "', '" + an_marg_semestre + "', '" + an_marg_anio + "', '" + an_marg_seccion + "', '" + an_marg_serie + "', '" + an_marg_partida + "', '" + an_marg_observaciones + "', 'inegiestado', 'inegimunicipio', 'inegipoblacion', 'inegicolonia', 'inegicalle', 'ineginumerocalle', '" + prelacion.Folio + "', '" + prelacion.IdPrelacion + "')", con);
                int result = comm.ExecuteNonQuery();
                if (result > 0)
                {
                    con.Close();
                }
                else
                {
                    con.Close();
                }

                return("OK");
            }
            catch (Exception exc)
            {
                return(exc.Message);
            }
        }