Example #1
0
        /// <summary>
        /// Obtiene el nĂºmero total de sociedades que no tienen asignado el tipo de sociedad
        /// </summary>
        /// <returns></returns>
        public int GetTotalEntities()
        {
            ObservableCollection <C_TipoSociedades> tiposCatalogo = new C_TipoSociedadesModel().GetTipoSociedades();

            const string SqlCadena = "SELECT COUNT(Id) Total FROM CaratulasJulio2018 WHERE (TipoSociedadSugerido is null and (CLAVE_FORMA <> 'M9' AND CLAVE_FORMA <> 'M28') and ACTO_FA = '6.- Sociedad en Nombre Colectivo')";

            SqlConnection connection      = new SqlConnection(connectionString);
            SqlCommand    cmd             = null;
            SqlDataReader reader          = null;
            int           totalSociedades = 0;

            try
            {
                connection.Open();

                cmd    = new SqlCommand(SqlCadena, connection);
                reader = cmd.ExecuteReader();
                //int totalReview = 0, totalupdates = 0;

                while (reader.Read())
                {
                    totalSociedades = Convert.ToInt32(reader["Total"]);
                }

                cmd.Dispose();
                reader.Close();
            }
            catch (SqlException ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                ErrorUtilities.SetNewErrorMessage(ex, String.Format("{0} Exception,BasicEntityModel{1}", methodName, totalSociedades), "DGNMTools");
            }
            catch (Exception ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                ErrorUtilities.SetNewErrorMessage(ex, String.Format("{0} Exception,BasicEntityModel{1}", methodName, totalSociedades), "DGNMTools");
            }
            finally
            {
                connection.Close();
            }
            return(totalSociedades);
        }
Example #2
0
        /// <summary>
        /// Obtiene el listado de todas aquellas sociedades que no tienen asignado el tipo de sociedad
        /// </summary>
        /// <returns></returns>
        public void GetEntitiesForReasign(int tipoBusqueda)
        {
            ObservableCollection <C_TipoSociedades> tiposCatalogo = new C_TipoSociedadesModel().GetTipoSociedades();

            //const string SqlCadena = "SELECT Id,dsdensocial FROM CaratulasJulio2018 WHERE (TipoSociedadSugerido is null and (CLAVE_FORMA = 'M9' )) ORDER BY Id desc";
            const string SqlCadena = "SELECT Id,dsdensocial FROM CaratulasJulio2018 WHERE CLAVE_FORMA <> 'M28' and IdTipoSociedadSugerido = 84  and DSDENSOCIAL IS NOT NULL ORDER BY Id desc";

            int totalReview = 0, totalupdates = 0;

            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand    cmd        = null;
            SqlDataReader reader     = null;
            int           idCurrent  = 0;

            try
            {
                connection.Open();

                cmd    = new SqlCommand(SqlCadena, connection);
                reader = cmd.ExecuteReader();
                //int totalReview = 0, totalupdates = 0;

                bool exitoNoSpace = false;

                while (reader.Read())
                {
                    idCurrent = Convert.ToInt32(reader["Id"]);

                    if (tipoBusqueda == 1)
                    {
                        exitoNoSpace = this.NoSpacesProces(Convert.ToInt32(reader["Id"]), reader["Dsdensocial"].ToString(), tiposCatalogo);
                        //if (!exitoNoSpace)
                        //    exitoNoSpace = this.AfterComaProces(Convert.ToInt32(reader["Id"]), reader["Dsdensocial"].ToString(), tiposCatalogo);
                    }
                    else if (tipoBusqueda == 2)
                    {
                        Console.WriteLine(idCurrent);
                        exitoNoSpace = this.GetCoincidencia(idCurrent, StringUtilities.PrepareToAlphabeticalOrder(reader["DSDENSOCIAL"].ToString()), tiposCatalogo[0]);
                    }
                    totalReview++;

                    if (exitoNoSpace)
                    {
                        totalupdates++;
                    }
                }

                cmd.Dispose();
                reader.Close();

                MessageBox.Show(String.Format("Total revisados: {0}", totalReview));
                MessageBox.Show(String.Format("Total actualizados: {0}", totalupdates));
            }
            catch (SqlException ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                ErrorUtilities.SetNewErrorMessage(ex, String.Format("{0} Exception,BasicEntityModel{1}", methodName, idCurrent), "PadronApi");
            }
            catch (Exception ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                ErrorUtilities.SetNewErrorMessage(ex, String.Format("{0} Exception,BasicEntityModel{1}", methodName, idCurrent), "PadronApi");
            }
            finally
            {
                connection.Close();
            }
        }