示例#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
        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 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();
                }
            }
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
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);
        }