示例#1
0
        private void buttonSiguiente_Click(object sender, EventArgs e)
        {
            if (opcion == 0)
            {
                    System.IO.StreamWriter file = new System.IO.StreamWriter("BDL_ELYON.elyon", true);
                    file.WriteLine(obtenerDatos());
                    file.Flush();
                    file.Close();

                    string seguridad = "";
                    if (radioButtonSeguridadAlto.Checked == true) seguridad = "Alto";
                    if (radioButtonSeguridadMedio.Checked == true) seguridad = "Medio";
                    if (radioButtonSeguridadBajo.Checked == true) seguridad = "Bajo";
                    string text2 = textBoxUsuario.Text + "|" + textBoxContraseña.Text + "|" + textBoxNombre.Text + "|" + seguridad.ToString() + "|";

                    System.IO.StreamWriter file2 = new System.IO.StreamWriter("USU_ELYON.elyon", true);
                    file2.WriteLine(text2);
                    file2.Flush();
                    file2.Close();

                    PanelDatosPersonal panel = new PanelDatosPersonal(opcion,textBoxUsuario.Text, textBoxNombre.Text, textBoxEmailLaboral.Text, textBoxEmailPersonal.Text);
                    panel.Show();
                    this.Close();
                }

            if (opcion == 1)
            {
                editarArchivo(0, obtenerDatos());
                PanelDatosPersonal panel = new PanelDatosPersonal(opcion, textBoxUsuario.Text, textBoxNombre.Text, textBoxEmailLaboral.Text, textBoxEmailPersonal.Text);
                panel.Show();
                this.Close();
            }
        }
示例#2
0
        private void buttonAceptar_Click(object sender, EventArgs e)
        {
            string[] x = util.textoDeArchivoConSplit("USU_ELYON.elyon", '\n');
            bool ok = false;

            for (int i = 0; i < x.Length; i++)
            {
                string[] y = x[i].Split('|');
                if(y.Length >= 2)
                    if (y[2] == listBox1.SelectedItem.ToString())
                        ok = true;
            }

            if (ok)
            {
                if (opcion == "Nuevo")
                {
                    PanelRegistroDatosLaboral panel = new PanelRegistroDatosLaboral("Nuevo", listBox1.SelectedItem.ToString(), nivel);
                    panel.Show();
                    this.Close();
                }

                if (opcion == "Editar")
                {
                    if (nivel == "Alto")
                    {
                        PanelRegistroDatosLaboral panel = new PanelRegistroDatosLaboral("Editar", listBox1.SelectedItem.ToString(), "Alto");
                        panel.Show();
                    }
                    if (nivel == "Medio")
                    {
                        MessageBox.Show(listBox1.SelectedItem.ToString());
                        PanelDatosPersonal panel = new PanelDatosPersonal("Editar", "Medio", usuario, listBox1.SelectedItem.ToString());
                        panel.Show();
                    }
                }
                if (opcion == "Informacion")
                {
                    if (nivel == "Alto")
                    {

                    }
                }
            }
            if (!ok) MessageBox.Show("Usuario No Encontrado.");
        }
示例#3
0
        private void buttonSiguiente_Click(object sender, EventArgs e)
        {
            if (textBoxNombre.Text == "" || textBoxUsuario.Text == "" || textBoxContraseña.Text == "" || (radioButtonSeguridadAlto.Checked == false && radioButtonSeguridadMedio.Checked == false && radioButtonSeguridadBajo.Checked == false))
            {
                MessageBox.Show("Es necesario llenar los campos de Nombre, Usuario, Contraseña y Nivel de Seguridad.");
            }
            else
            {
                if (opcion == "Crear")
                {
                    System.IO.StreamWriter file = new System.IO.StreamWriter("BDL_ELYON.elyon", true);
                    file.WriteLine(obtenerDatos());
                    file.Flush();
                    file.Close();

                    string seguridad = "";
                    if (radioButtonSeguridadAlto.Checked == true) seguridad = "Alto";
                    if (radioButtonSeguridadMedio.Checked == true) seguridad = "Medio";
                    if (radioButtonSeguridadBajo.Checked == true) seguridad = "Bajo";

                    System.IO.StreamWriter file2 = new System.IO.StreamWriter("USU_ELYON.elyon", true);
                    file2.WriteLine(textBoxUsuario.Text + "|" + textBoxContraseña.Text + "|" + textBoxNombre.Text + "|" + seguridad.ToString() + "|");
                    file2.Flush();
                    file2.Close();

                    PanelDatosPersonal panel = new PanelDatosPersonal(opcion, nivel, textBoxUsuario.Text, textBoxNombre.Text, textBoxEmailLaboral.Text, textBoxEmailPersonal.Text);
                    panel.Show();
                    this.Close();

                    if (nivel == "Medio")
                    {
                        util.SMTPMail("*****@*****.**", "Actividades", "Se realizó la actividad de creación de usuario por " + usuario + ".");
                    }
                }

                if (opcion == "Editar")
                {
                    string seguridad = "";
                    if (radioButtonSeguridadAlto.Checked == true) seguridad = "Alto";
                    if (radioButtonSeguridadMedio.Checked == true) seguridad = "Medio";
                    if (radioButtonSeguridadBajo.Checked == true) seguridad = "Bajo";
                    editarArchivo(0, obtenerDatos());
                    editarArchivo(2, textBoxUsuario.Text + "|" + textBoxContraseña.Text + "|" + textBoxNombre.Text + "|" + seguridad + "|" + Environment.NewLine);
                    PanelDatosPersonal panel = new PanelDatosPersonal(opcion, nivel, textBoxUsuario.Text, textBoxNombre.Text, textBoxEmailLaboral.Text, textBoxEmailPersonal.Text);
                    panel.Show();
                    this.Close();
                }
            }
        }