コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String archivo;

            archivo = txtArchivo.Text;
            ServicioArchivoEmpleado.setArchivo(archivo);
            MessageBox.Show("Se ha seleccionado la direccion de entrada", "Aviso");
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Double telefono;
            int    cedula;

            telefono = Convert.ToDouble(txtTelefono.Text);
            cedula   = Convert.ToInt32(txtInfoBuscar.Text);
            ServicioArchivoEmpleado.modificarEmpleado(cedula, telefono);
            MessageBox.Show("Se modifico el telefono", "Aviso");
        }
コード例 #3
0
        private void button2Eliminar_Click(object sender, EventArgs e)
        {
            int registro;

            registro = Convert.ToInt32(txtNumeroDeRegistro.Text);

            ServicioArchivoEmpleado.eliminarEmpleado(registro);

            MessageBox.Show("Se eliminò el empleado", "Aviso");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            FileStream fs;
            String     archivo = ServicioArchivoEmpleado.getArchivo();

            if ((fs = new FileStream(archivo, FileMode.Open)) == null)
            {
                throw new IOException("No se puede abrir o leer el archivo.");
            }

            MessageBox.Show("Val =" + fs.Length);
            fs.Close();
        }
コード例 #5
0
        public void mostrarEmpleados()
        {
            ArrayList empleado = ServicioArchivoEmpleado.leerTodoGrilla();

            IEnumerator enumerador = empleado.GetEnumerator();

            grillaMostrar.Rows.Clear();

            for (int i = 0; i < empleado.Count; i++)
            {
                enumerador.MoveNext();
                Mundo.Empleado mostrar = (Empleado)enumerador.Current;
                grillaMostrar.Rows.Add();
                grillaMostrar.Rows[i].Cells[0].Value = mostrar.getCedula();
                grillaMostrar.Rows[i].Cells[1].Value = mostrar.getNombre();
                grillaMostrar.Rows[i].Cells[2].Value = mostrar.getTelefono();
                grillaMostrar.Rows[i].Cells[3].Value = mostrar.getDireccion();
            }
        }
コード例 #6
0
        public void buscarEmpleado()
        {
            int cedula;

            cedula = Convert.ToInt32(txtInfoBuscar.Text);
            Empleado em = ServicioArchivoEmpleado.buscarPorCedula(cedula);

            if (em == null)
            {
                MessageBox.Show("No esta el registro solicitado");
            }
            else
            {
                txtCedula.Text    = em.getCedula().ToString();
                txtNombre.Text    = em.getNombre();
                txtTelefono.Text  = em.getTelefono().ToString();
                txtDireccion.Text = em.getDireccion();
            }
        }
コード例 #7
0
        public void buscar()
        {
            int numero_registro;

            numero_registro = Convert.ToInt32(txtNumeroDeRegistro.Text);

            Empleado em;

            em = ServicioArchivoEmpleado.buscarPorNumeroRegistro(numero_registro);
            if (em == null)
            {
                MessageBox.Show("No esta el registro solicitado");
            }
            else
            {
                txtCedula.Text    = em.getCedula().ToString();
                txtNombre.Text    = em.getNombre();
                txtTelefono.Text  = em.getTelefono().ToString();
                txtDireccion.Text = em.getDireccion();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            int    cedula;
            Double telefono;

            try {
                cedula = Convert.ToInt32(txtCedula.Text);
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message, "Error Cedula");
                return;
            }

            try
            {
                telefono = Convert.ToDouble(txtTelefono.Text);
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message, "Error Telefono");
                return;
            }
            String nombre = txtNombre.Text.Trim();
            String estado = ServicioArchivoEmpleado.AC;

            String direccion = txtDireccion.Text;

            Mundo.Empleado nuevo = new Mundo.Empleado(cedula, nombre, telefono, direccion, estado);
            try
            {
                ServicioArchivoEmpleado.agregarArchivo(nuevo);
                MessageBox.Show("Se agrego el empleado", "Empleado");
            }
            catch (Exception ec)
            {
                MessageBox.Show("No ha seleccionado la ruta del archivo." + "\n" + ec.Message, "Error");
            }
        }