Пример #1
0
        private void BtnAceptar_Click(object sender, RoutedEventArgs e)
        {
            TxtObservacion.Text = VerificationUtilities.TextBoxStringValidation(TxtObservacion.Text);

            if (TxtObservacion.Text.Length < 10)
            {
                MessageBox.Show("Debes ingresar alguna observación de lo contrario oprime el botón cancelar");
                return;
            }

            AsistenciaModel model = new AsistenciaModel();

            int idAsistencia = model.DoUserCheckInToday(usuario);

            bool complete = model.SetObservacionEntrada(usuario, idAsistencia, TxtObservacion.Text);

            if (complete)
            {
                DialogResult = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("No se pudo completar el registro de las observaciones, favor de volverlo a intentar");
            }
        }
Пример #2
0
        private void TxtsLostFocus(object sender, RoutedEventArgs e)
        {
            TextBox box = sender as TextBox;

            if (!String.IsNullOrEmpty(box.Text) || !String.IsNullOrWhiteSpace(box.Text))
            {
                box.Text = VerificationUtilities.TextBoxStringValidation(box.Text);
            }
        }
Пример #3
0
        private void TxtPreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            if (TxtCp.Text.Length >= 5)
            {
                e.Handled = true;
                return;
            }

            e.Handled = VerificationUtilities.IsNumber(e.Text);
            TxtCp.Text.Trim();
        }
Пример #4
0
        public void GetMissingData(DataFromTexto datos)
        {
            try
            {
                int startIndex = datos.Texto.IndexOf("ANTE NOTARIO");

                if (startIndex != -1)
                {
                    string tempString = datos.Texto.Substring(startIndex);

                    int endIndex = tempString.IndexOf("A CONSTITUIR");

                    if (endIndex != -1)
                    {
                        tempString = tempString.Substring(0, endIndex);
                        tempString = tempString.Replace("ANTE ", "");

                        int indezNum = tempString.IndexOf("NO.");

                        datos.TipoFedatarios = tempString.Substring(0, indezNum);

                        tempString = VerificationUtilities.TextBoxStringValidation(tempString.Substring(indezNum + 3));

                        int defaultNumber = 0;
                        Int32.TryParse(tempString.Split(' ')[0], out defaultNumber);
                        datos.NumFedObt = defaultNumber;

                        if (tempString.Contains("MUNICIPIO"))
                        {
                            tempString         = tempString.Substring(tempString.IndexOf("MUNICIPIO"));
                            datos.MunicipioObt = VerificationUtilities.TextBoxStringValidation(tempString.Substring(0, tempString.IndexOf("ESTADO")).Replace("MUNICIPIO", ""));
                        }

                        if (tempString.Contains("ESTADO"))
                        {
                            tempString = tempString.Substring(tempString.IndexOf("ESTADO"));

                            datos.EstadoObt = tempString.Substring(0, tempString.IndexOf("NOMBRE")).Replace("ESTADO", "");
                        }

                        datos.FedatarioObt = tempString.Substring(tempString.IndexOf("NOMBRE")).Replace("NOMBRE", "").Replace("COMPARECE (N)", "").Replace("-", "");

                        this.SetMissingInfo(datos);
                    }
                }
                else
                {
                    MessageBox.Show(datos.Id.ToString());
                }
            }
            catch (ArgumentOutOfRangeException) { }
        }
 private void TxtPreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
 {
     e.Handled = VerificationUtilities.ContieneCaractNoPermitidos(e.Text);
 }
        private void BtnGuardar_Click(object sender, RoutedEventArgs e)
        {
            if (CbxGrado.SelectedIndex == -1)
            {
                MessageBox.Show("Selecciona el título del encargado", "Seleccionar título", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (String.IsNullOrEmpty(TxtNombre.Text) || String.IsNullOrEmpty(TxtApellidos.Text))
            {
                MessageBox.Show("Ingresa el nombre y los apellidos del encargado", "Agregar encargado", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            encargado.IdTitulo  = Convert.ToInt32(CbxGrado.SelectedValue);
            encargado.NombreStr = StringUtilities.PrepareToAlphabeticalOrder(encargado.Nombre) + " " + StringUtilities.PrepareToAlphabeticalOrder(encargado.Apellidos);

            EncargadosModel model = new EncargadosModel();
            bool            exito = false;

            if (!isUpdating)
            {
                if (model.DoEncargadoExist(encargado.NombreStr))
                {
                    MessageBox.Show("El encargado que deseas agregar ya existe", "Encargados", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
            }

            encargado.Nombre    = VerificationUtilities.TextBoxStringValidation(encargado.Nombre);
            encargado.Apellidos = VerificationUtilities.TextBoxStringValidation(encargado.Apellidos);

            if (isUpdating)
            {
                exito = model.UpdateEncargado(encargado);

                if (!exito)
                {
                    MessageBox.Show("Hubo un problema con la actualización intentelo nuevamente");
                    return;
                }

                encargado.TotalAdscripciones = encargado.Adscripciones.Count;

                this.Close();
            }
            else
            {
                exito = model.InsertaEncargado(encargado);

                if (!exito)
                {
                    MessageBox.Show("Hubo un problema al ingresar el titular intentelo nuevamente");
                    return;
                }
                else
                {
                    EncargadosSingleton.Encargados.Add(encargado);
                    this.Close();
                }
            }
        }
Пример #7
0
        public ObservableCollection <DataFromTexto> GetCampoTextoSinGuinoes()
        {
            ObservableCollection <DataFromTexto> listaTexto = new ObservableCollection <DataFromTexto>();

            //string oleDbCadena = "select * from Municipio where esConstitucion = 1";
            string oleDbCadena = "select * from FechasRelex where expedienteRelex is null Order by id desc";

            OleDbConnection connection = new OleDbConnection(connectionString);
            OleDbCommand    cmd        = null;
            OleDbDataReader reader     = null;

            int folio = 0;

            try
            {
                connection.Open();

                cmd    = new OleDbCommand(oleDbCadena, connection);
                reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        DataFromTexto datos = new DataFromTexto();
                        datos.Id    = Convert.ToInt32(reader["Id"]);
                        datos.Folio = Convert.ToInt32(reader["Folio"]);
                        folio       = datos.Folio;
                        datos.Texto = reader["Texto"].ToString();

                        if (!String.IsNullOrWhiteSpace(datos.Texto) && !String.IsNullOrEmpty(datos.Texto))
                        {
                            datos.TextoStr = VerificationUtilities.TextBoxStringValidation(StringUtilities.PrepareToAlphabeticalOrder(datos.Texto)).Replace("-", "");
                            listaTexto.Add(datos);
                        }
                        Console.WriteLine(datos.Id);
                    }
                }
                cmd.Dispose();
                reader.Close();
            }
            catch (OleDbException ex)
            {
                MessageBox.Show(folio.ToString());
                //                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                //              ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,PadronModel", "Padron");
            }
            catch (Exception ex)
            {
                MessageBox.Show(folio.ToString());
                //string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                //ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,PadronModel", "Padron");
            }
            finally
            {
                connection.Close();
            }

            int totalErrores = 0;

            foreach (DataFromTexto data in listaTexto)
            {
                if (!this.GetRelexInfo(data, totalErrores))
                {
                    totalErrores++;
                }
            }

            MessageBox.Show(String.Format("{0} Errores de {1} registros", totalErrores, listaTexto.Count));
            return(listaTexto);
        }
Пример #8
0
        public ObservableCollection <DataFromTexto> GetTextoForAcciones(int processNumber)
        {
            ObservableCollection <DataFromTexto> listaTexto = new ObservableCollection <DataFromTexto>();

            //string oleDbCadena = "select * from Municipio where esConstitucion = 1";
            string oleDbCadena = "select * from Acciones2 where Folio NOT IN (351506,270853,342197,358941,261041,257856) and TextValorAccion = '' ";

            SqlConnection connection = new SqlConnection(connectionStringSql);
            SqlCommand    cmd        = null;
            SqlDataReader reader     = null;

            int folio    = 0;
            int contador = 1;

            try
            {
                connection.Open();

                cmd    = new SqlCommand(oleDbCadena, connection);
                reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        DataFromTexto datos = new DataFromTexto();
                        datos.Folio = Convert.ToInt32(reader["Folio"]);
                        folio       = datos.Folio;
                        datos.Texto = reader["Texto"].ToString();

                        if (!String.IsNullOrWhiteSpace(datos.Texto) && !String.IsNullOrEmpty(datos.Texto))
                        {
                            //datos.TextoStr = VerificationUtilities.TextBoxStringValidation(StringUtilities.PrepareToAlphabeticalOrder(datos.Texto)).Replace("-", "");
                            datos.TextoStr = VerificationUtilities.TextBoxStringValidation(datos.Texto).Replace("-", "");
                            listaTexto.Add(datos);
                        }

                        if (processNumber == 1)
                        {
                            this.GetNumeroAccionesMetodoRegex(datos, 0);
                            this.SetNumeroAcciones(datos);
                        }
                        else if (processNumber == 2)
                        {
                            bool exito = this.GetCostoAccionesMet2(datos, 0);

                            if (exito)
                            {
                                this.SetCostoAcciones(datos);
                            }
                        }
                        Console.WriteLine(String.Format("{0}. ---  {1}", contador, datos.Folio));
                        contador++;
                    }
                }
                cmd.Dispose();
                reader.Close();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(folio.ToString());
                //                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                //              ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,PadronModel", "Padron");
            }
            catch (Exception ex)
            {
                MessageBox.Show(folio.ToString());
                //string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                //ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,PadronModel", "Padron");
            }
            finally
            {
                connection.Close();
            }

            //int totalErrores = 0;



            //MessageBox.Show(String.Format("{0} Errores de {1} registros", totalErrores, listaTexto.Count));
            return(listaTexto);
        }
Пример #9
0
        public bool GetRelexInfo(DataFromTexto datos, int errores)
        {
            try
            {
                int startIndex = datos.TextoStr.IndexOf("RELACIONES EXTERIORES");

                if (startIndex != -1)
                {
                    string tempString = datos.TextoStr.Substring(startIndex);

                    int endIndex = tempString.IndexOf("NO");

                    if (endIndex != -1)
                    {
                        tempString = tempString.Substring(endIndex + 3);

                        string permisoRelex = tempString.Substring(0, tempString.IndexOf(' '));

                        datos.PermisoRelex = permisoRelex;

                        Match largeDate = Regex.Match(tempString, largeDateRegex);

                        if (largeDate.Value != null)
                        {
                            DateTime fechaRegex = Convert.ToDateTime(largeDate.Value.ToString().Replace("DEL", "DE"));
                            datos.FechaPermisoRelex = fechaRegex.ToString("dd/MM/yyyy");
                        }
                        else
                        {
                            tempString = tempString.Substring(tempString.IndexOf(' ') + 1).Replace("DE FECHA ", "");

                            string[] completeText = tempString.Split(' ');


                            string fechaRelex = String.Format(completeText[0] + "{0}" + this.SetMonthLanguaje(completeText[1]) + "{0}" + completeText[2], "-");

                            DateTime dt = Convert.ToDateTime(fechaRelex, new CultureInfo("es-ES"));
                            datos.FechaPermisoRelex = dt.ToString("dd/MM/yyyy");
                        }

                        Console.WriteLine(String.Format("{0}    {1}", datos.Id, datos.FechaPermisoRelex));

                        try
                        {
                            tempString = tempString.Substring(tempString.IndexOf("NO")).Replace("NO ", "");

                            //string expedienteRelex = tempString.Substring(0, tempString.IndexOf(' '));
                            //datos.ExpedienteRelex = expedienteRelex;

                            string originalSinGuion = StringUtilities.ReplaceDoubleSpaces(Regex.Replace(datos.Texto, "--+", "-"));

                            startIndex = datos.Texto.IndexOf("EXPEDIENTE NO.");

                            string[] orgString = datos.Texto.Substring(startIndex).Replace("EXPEDIENTE NO. ", "").Split(new[] { " ", "" }, StringSplitOptions.RemoveEmptyEntries);

                            char[] expediente = orgString[0].ToCharArray();


                            if (!VerificationUtilities.IsNumber(Char.ToString(expediente[0])))
                            {
                                datos.ExpedienteRelex = orgString[0];
                            }
                            else
                            {
                                datos.ExpedienteRelex = "0";
                            }
                        }
                        catch (Exception)
                        {
                            datos.ExpedienteRelex = "0";
                        }


                        // datos.TipoFedatarios = tempString.Substring(0, indezNum);

                        this.SetRelexInfo(datos);
                    }
                }
                else
                {
                    //MessageBox.Show(datos.Id.ToString());
                }
            }
            catch (ArgumentOutOfRangeException) {
                //MessageBox.Show(datos.Id.ToString() + "Error");
                return(false);
            }
            catch (FormatException)
            {
                //MessageBox.Show(datos.Id.ToString() + "Error");
                return(false);
            }
            return(true);
        }
Пример #10
0
        public ObservableCollection <DataFromTexto> GetCampoTexto()
        {
            ObservableCollection <DataFromTexto> listaTexto = new ObservableCollection <DataFromTexto>();

            //string oleDbCadena = "select * from Municipio where esConstitucion = 1";
            string oleDbCadena = "select * from FedatariosNull";

            OleDbConnection connection = new OleDbConnection(connectionString);
            OleDbCommand    cmd        = null;
            OleDbDataReader reader     = null;

            int folio = 0;

            try
            {
                connection.Open();

                cmd    = new OleDbCommand(oleDbCadena, connection);
                reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        DataFromTexto datos = new DataFromTexto();
                        datos.Id       = Convert.ToInt32(reader["Id"]);
                        datos.Folio    = Convert.ToInt32(reader["Folio"]);
                        folio          = datos.Folio;
                        datos.Texto    = reader["Texto"].ToString();
                        datos.TextoStr = VerificationUtilities.TextBoxStringValidation(StringUtilities.PrepareToAlphabeticalOrder(datos.Texto));

                        //if(!datos.TextoStr.Contains("SOCIEDAD COOPERATIVA"))
                        listaTexto.Add(datos);
                    }
                }
                cmd.Dispose();
                reader.Close();
            }
            catch (OleDbException ex)
            {
                MessageBox.Show(folio.ToString());
//                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
//              ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,PadronModel", "Padron");
            }
            catch (Exception ex)
            {
                MessageBox.Show(folio.ToString());
                //string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                //ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,PadronModel", "Padron");
            }
            finally
            {
                connection.Close();
            }

            foreach (DataFromTexto data in listaTexto)
            {
                this.GetMissingData(data);
            }

            MessageBox.Show("Finito");
            return(listaTexto);
        }
Пример #11
0
 private void TxtTelValidation(object sender, TextCompositionEventArgs e)
 {
     e.Handled = VerificationUtilities.IsNumberOrGuion(e.Text);
 }
 private void Txt_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     e.Handled = VerificationUtilities.IsNumber(e.Text);
 }