예제 #1
0
파일: Form3.cs 프로젝트: pasonx/HospitalMIS
        private void button1_Click(object sender, EventArgs e)
        {
            //传递给update()
            Person p = new Person();
            p.Id = Convert.ToInt32(richTextBox1.Text);
            p.Medicine = richTextBox2.Text;
            new PersonAction().update(p);

            Person p1 = new PersonAction().queryOne(Convert.ToInt32(richTextBox1.Text));
            String str = "挂号业务ID:" + p1.Id + "\n"
                                           + "姓名:" + p1.Name + "\n"
                                           + "年龄:" + p1.Age + "\n"
                                           + "症状:" + p1.Desc + "\n"
                                           + "诊疗方法和建议: " + p1.Medicine + "\n";
            Form5 myForm = new Form5(str);
            myForm.ShowDialog();
        }
예제 #2
0
        private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form5 form5 = new Form5();

            form5.ShowDialog();
            if (Form5.pass == true)
            {
                int index = listView1.FocusedItem.Index;
                listView1.Items.Clear();
                for (int i = index; i < count; i++)
                {
                    mas[i] = mas[i + 1];
                }
                count--;
                for (int i = 0; i < mas.Length; i++)
                {
                    if (mas[i].data != null)
                    {
                        ListViewItem lvi = new ListViewItem(Convert.ToString(mas[i].data));
                        lvi.SubItems.Add(Convert.ToString(mas[i].time));
                        lvi.SubItems.Add(mas[i].action);
                        switch (mas[i].type)
                        {
                        case "Задание":
                            lvi.ImageIndex = 0;
                            break;

                        case "Встреча":
                            lvi.ImageIndex = 1;
                            break;

                        case "Памятка":
                            lvi.ImageIndex = 2;
                            break;
                        }
                        listView1.Items.Add(lvi);
                        count++;
                    }
                }
            }
        }
예제 #3
0
        private void submit_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("please enter your ID ");
            }
            else
            {
                if (m.arr.ContainsKey(int.Parse(textBox1.Text)))

                {
                    this.Hide();
                    Form5 f = new Form5(ref m, textBox1.Text);
                    f.ShowDialog();
                    this.Close();
                }


                else
                {
                    MessageBox.Show("Sorry wrong ID !! ");
                }
            }
        }
예제 #4
0
파일: Form1.cs 프로젝트: smaug88/Practices
        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.ForeColor = Color.Black;
            using (connection = new MySqlConnection(ConnectionString))
            {
                try
                {
                    Mi_DataSet.Clear();
                    Mi_DataSet.Tables.Clear();
                    dataGridView1.Columns.Clear();
                    //Limpiamos el datagridview

                    if (boton_consultar.Checked)
                    //si hacemos una consulta
                    {
                        if ((Tabla_sel == null) || (Tabla_sel == ""))
                        {
                            if (idioma)
                            {
                                MessageBox.Show(fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/errorSeleccion1").InnerText, fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/errorSeleccion2").InnerText);
                            }
                            else
                            {
                                MessageBox.Show(fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/errorSeleccion1").InnerText, fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/errorSeleccion2").InnerText);
                            }
                            return;
                        }
                        QueryString = "Select * from " + Tabla_sel;
                        //se realizará un Select *
                        connection.Open();
                        adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                        adapter.Fill(Mi_DataSet);
                        dataGridView1.DataSource = Mi_DataSet.Tables[0];
                        dataGridView1.AutoResizeColumns();
                        bindingSource1.DataSource = Mi_DataSet.Tables[0];
                        dataGridView1.ReadOnly    = true;
                        //Se pone el datagridview en modo solo lectura
                        if (idioma)
                        {
                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ConsultaOK").InnerText;
                        }
                        else
                        {
                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ConsultaOK").InnerText;
                        }
                        usuarios = false;
                        get_table_name_Click(sender, e);
                    }
                    else
                    {
                        if (boton_borrar.Checked)
                        //Si queremos eliminar una tabla
                        {
                            usuarios = false;
                            //Se lanza la ventana para pedir confirmación
                            Form2 confirmacion = new Form2(Tabla_sel);
                            if (confirmacion.ShowDialog(this) == DialogResult.Yes)
                            {
                                NonQueryString      = "DROP TABLE " + Tabla_sel;
                                command             = connection.CreateCommand();
                                command.CommandText = NonQueryString;
                                connection.Open();
                                adapter = new MySqlDataAdapter(command);
                                command.ExecuteNonQuery();
                                if (idioma)
                                {
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimTabla1").InnerText
                                                    + Tabla_sel + fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimTabla2").InnerText;
                                }
                                else
                                {
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimTabla1").InnerText
                                                    + Tabla_sel + fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimTabla2").InnerText;
                                }
                                comboBox1.ResetText();
                                get_table_name_Click(sender, e);
                            }
                        }
                        else
                        {
                            if (boton_modificar.Checked)
                            {
                                usuarios = false;
                                //PRIMERO RECUPERAMOS LA TABLA

                                QueryString  = "SELECT  * from " + Tabla_sel;
                                queryDataSet = "SELECT  * from " + Tabla_sel;
                                //se realizará un Select *
                                connection.Open();
                                adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                                adapter.Fill(Mi_DataSet);
                                dataGridView1.DataSource = Mi_DataSet.Tables[0];
                                dataGridView1.AutoResizeColumns();
                                bindingSource1.DataSource = Mi_DataSet.Tables[0];
                                dataGridView1.ReadOnly    = false;
                                button4.Visible           = true;
                                if (idioma)
                                {
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/RecTabla").InnerText;
                                }
                                else
                                {
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/RecTabla").InnerText;
                                }
                            }
                            else
                            {
                                if (boton_insertar.Checked)
                                {
                                    usuarios = false;
                                    Form3 crear = new Form3(idioma);
                                    // Mostramos la ventana de creación de tabla
                                    if (crear.ShowDialog(this) == DialogResult.OK)
                                    {
                                        command             = connection.CreateCommand();
                                        command.CommandText = crear.sentencia;
                                        connection.Open();
                                        adapter = new MySqlDataAdapter(command);
                                        command.ExecuteNonQuery();
                                        if (idioma)
                                        {
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CreateTabla").InnerText;
                                        }
                                        else
                                        {
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CreateTabla").InnerText;
                                        }
                                        get_table_name_Click(sender, e);
                                    }
                                }
                                else
                                {
                                    if (consultar_usuarios.Checked)
                                    {
                                        usuarios    = true;
                                        QueryString = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," +
                                                      "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," +
                                                      "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " +
                                                      "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," +
                                                      "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," +
                                                      "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " +
                                                      "max_user_connections, plugin from mysql.user;";
                                        //se realizará un Select *
                                        connection.Open();
                                        adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                                        adapter.Fill(Mi_DataSet);
                                        dataGridView1.DataSource = Mi_DataSet.Tables[0];
                                        dataGridView1.AutoResizeColumns();
                                        bindingSource1.DataSource = Mi_DataSet.Tables[0];
                                        dataGridView1.ReadOnly    = true;
                                        //Se pone el datagridview en modo solo lectura
                                        if (idioma)
                                        {
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ConsultaOK").InnerText;
                                        }
                                        else
                                        {
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ConsultaOK").InnerText;
                                        }
                                        usuarios = true;
                                        get_table_name_Click(sender, e);
                                    }
                                    else
                                    {
                                        if (crear_usuarios.Checked)
                                        {
                                            usuarios = true;
                                            Form5 crear = new Form5(idioma, servidor);
                                            // Mostramos la ventana de creación de usuario
                                            if (crear.ShowDialog(this) == DialogResult.OK)
                                            {
                                                command             = connection.CreateCommand();
                                                command.CommandText = crear.sentencia;
                                                connection.Open();
                                                adapter = new MySqlDataAdapter(command);
                                                command.ExecuteNonQuery();
                                                if (idioma)
                                                {
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CreateUsuario").InnerText;
                                                }
                                                else
                                                {
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CreateUsuario").InnerText;
                                                }
                                                get_table_name_Click(sender, e);
                                            }
                                        }
                                        else
                                        {
                                            if (mod_usuarios.Checked)
                                            {
                                                usuarios = true;
                                                // PRIMERO RECUPERAMOS LA TABLA
                                                // Con los parámetros necesarios (hay valores que son irrelevantes y dan problemas)
                                                QueryString = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," +
                                                              "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," +
                                                              "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " +
                                                              "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," +
                                                              "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," +
                                                              "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " +
                                                              "max_user_connections, plugin from mysql.user;";
                                                queryDataSet = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," +
                                                               "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," +
                                                               "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " +
                                                               "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," +
                                                               "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," +
                                                               "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " +
                                                               "max_user_connections, plugin from mysql.user;";
                                                //se realizará un Select *
                                                connection.Open();
                                                adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                                                adapter.Fill(Mi_DataSet);
                                                dataGridView1.DataSource = Mi_DataSet.Tables[0];
                                                dataGridView1.AutoResizeColumns();
                                                bindingSource1.DataSource = Mi_DataSet.Tables[0];
                                                dataGridView1.ReadOnly    = false;
                                                button4.Visible           = true;
                                                if (idioma)
                                                {
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CambGuardado").InnerText;
                                                }
                                                else
                                                {
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CambGuardado").InnerText;
                                                }
                                            }
                                            else
                                            {
                                                if (eliminiar_usuarios.Checked)
                                                {
                                                    usuarios = true;
                                                    //Se lanza la ventana para pedir confirmación
                                                    Form2 confirmacion = new Form2(Tabla_sel);
                                                    if (confirmacion.ShowDialog(this) == DialogResult.Yes)
                                                    {
                                                        NonQueryString      = "DROP USER " + Tabla_sel;
                                                        command             = connection.CreateCommand();
                                                        command.CommandText = NonQueryString;
                                                        connection.Open();
                                                        adapter = new MySqlDataAdapter(command);
                                                        command.ExecuteNonQuery();
                                                        if (idioma)
                                                        {
                                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimUsuario1").InnerText
                                                                            + Tabla_sel + fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimUsuario2").InnerText;
                                                        }
                                                        else
                                                        {
                                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimUsuario1").InnerText
                                                                            + Tabla_sel + fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimUsuario2").InnerText;
                                                        }
                                                        comboBox1.ResetText();
                                                        get_table_name_Click(sender, e);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    textBox1.ForeColor = Color.Red;
                    textBox1.Text      = ex.Message;
                }
            }
        }
예제 #5
0
파일: Form1.cs 프로젝트: smaug88/Practices
        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.ForeColor = Color.Black;
            using (connection = new MySqlConnection(ConnectionString))
            {
                try
                {
                    Mi_DataSet.Clear();
                    Mi_DataSet.Tables.Clear();
                    dataGridView1.Columns.Clear();
                    //Limpiamos el datagridview

                    if (boton_consultar.Checked)
                    //si hacemos una consulta
                    {
                        if ((Tabla_sel == null)|| (Tabla_sel == ""))
                        {
                            if ( idioma )
                                MessageBox.Show(fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/errorSeleccion1").InnerText, fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/errorSeleccion2").InnerText);
                            else
                                MessageBox.Show(fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/errorSeleccion1").InnerText, fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/errorSeleccion2").InnerText);
                            return;
                        }
                        QueryString = "Select * from "+ Tabla_sel;
                        //se realizará un Select *
                        connection.Open();
                        adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                        adapter.Fill(Mi_DataSet);
                        dataGridView1.DataSource = Mi_DataSet.Tables[0];
                        dataGridView1.AutoResizeColumns();
                        bindingSource1.DataSource = Mi_DataSet.Tables[0];
                        dataGridView1.ReadOnly = true;
                        //Se pone el datagridview en modo solo lectura
                        if (idioma)
                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ConsultaOK").InnerText;
                        else
                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ConsultaOK").InnerText;
                        usuarios = false;
                        get_table_name_Click(sender, e);

                    }
                    else
                    {
                        if (boton_borrar.Checked)
                        //Si queremos eliminar una tabla
                        {
                            usuarios = false;
                            //Se lanza la ventana para pedir confirmación
                            Form2 confirmacion = new Form2(Tabla_sel);
                            if (confirmacion.ShowDialog(this) == DialogResult.Yes)
                            {
                                NonQueryString = "DROP TABLE " + Tabla_sel;
                                command = connection.CreateCommand();
                                command.CommandText = NonQueryString;
                                connection.Open();
                                adapter = new MySqlDataAdapter(command);
                                command.ExecuteNonQuery();
                                if (idioma)
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimTabla1").InnerText
                                        + Tabla_sel + fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimTabla2").InnerText;
                                else
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimTabla1").InnerText
                                        + Tabla_sel + fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimTabla2").InnerText;
                                comboBox1.ResetText();
                                get_table_name_Click(sender, e);

                            }
                        }
                        else
                        {
                            if (boton_modificar.Checked)
                            {
                                usuarios = false;
                                //PRIMERO RECUPERAMOS LA TABLA

                                QueryString = "SELECT  * from " + Tabla_sel;
                                queryDataSet = "SELECT  * from " + Tabla_sel;
                                //se realizará un Select *
                                connection.Open();
                                adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                                adapter.Fill(Mi_DataSet);
                                dataGridView1.DataSource = Mi_DataSet.Tables[0];
                                dataGridView1.AutoResizeColumns();
                                bindingSource1.DataSource = Mi_DataSet.Tables[0];
                                dataGridView1.ReadOnly = false;
                                button4.Visible = true;
                                if (idioma)
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/RecTabla").InnerText;
                                else
                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/RecTabla").InnerText;
                            }
                            else
                            {
                                if (boton_insertar.Checked)
                                {
                                    usuarios = false;
                                    Form3 crear = new Form3(idioma);
                                    // Mostramos la ventana de creación de tabla
                                    if (crear.ShowDialog(this) == DialogResult.OK)
                                    {
                                        command = connection.CreateCommand();
                                        command.CommandText = crear.sentencia;
                                        connection.Open();
                                        adapter = new MySqlDataAdapter(command);
                                        command.ExecuteNonQuery();
                                        if (idioma)
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CreateTabla").InnerText;
                                        else
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CreateTabla").InnerText;
                                        get_table_name_Click(sender, e);
                                    }
                                }
                                else
                                {
                                    if (consultar_usuarios.Checked)
                                    {
                                        usuarios = true;
                                        QueryString = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv,"+
                                            "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," +
                                            "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, "+
                                            "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv,"+
                                            "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv,"+
                                            "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, "+
                                            "max_user_connections, plugin from mysql.user;";
                                        //se realizará un Select *
                                        connection.Open();
                                        adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                                        adapter.Fill(Mi_DataSet);
                                        dataGridView1.DataSource = Mi_DataSet.Tables[0];
                                        dataGridView1.AutoResizeColumns();
                                        bindingSource1.DataSource = Mi_DataSet.Tables[0];
                                        dataGridView1.ReadOnly = true;
                                        //Se pone el datagridview en modo solo lectura
                                        if (idioma)
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ConsultaOK").InnerText;
                                        else
                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ConsultaOK").InnerText;
                                        usuarios = true;
                                        get_table_name_Click(sender, e);
                                    }
                                    else
                                    {
                                        if (crear_usuarios.Checked)
                                        {
                                            usuarios = true;
                                            Form5 crear = new Form5(idioma, servidor);
                                            // Mostramos la ventana de creación de usuario
                                            if (crear.ShowDialog(this) == DialogResult.OK)
                                            {
                                                command = connection.CreateCommand();
                                                command.CommandText = crear.sentencia;
                                                connection.Open();
                                                adapter = new MySqlDataAdapter(command);
                                                command.ExecuteNonQuery();
                                                if (idioma)
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CreateUsuario").InnerText;
                                                else
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CreateUsuario").InnerText;
                                                get_table_name_Click(sender, e);
                                            }
                                        }
                                        else
                                        {
                                            if (mod_usuarios.Checked)
                                            {
                                                usuarios = true;
                                                // PRIMERO RECUPERAMOS LA TABLA
                                                // Con los parámetros necesarios (hay valores que son irrelevantes y dan problemas)
                                                QueryString = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," +
                                            "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," +
                                            "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " +
                                            "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," +
                                            "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," +
                                            "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " +
                                            "max_user_connections, plugin from mysql.user;";
                                                queryDataSet = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," +
                                            "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," +
                                            "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " +
                                            "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," +
                                            "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," +
                                            "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " +
                                            "max_user_connections, plugin from mysql.user;";
                                                //se realizará un Select *
                                                connection.Open();
                                                adapter = new MySqlDataAdapter(QueryString, ConnectionString);
                                                adapter.Fill(Mi_DataSet);
                                                dataGridView1.DataSource = Mi_DataSet.Tables[0];
                                                dataGridView1.AutoResizeColumns();
                                                bindingSource1.DataSource = Mi_DataSet.Tables[0];
                                                dataGridView1.ReadOnly = false;
                                                button4.Visible = true;
                                                if (idioma)
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CambGuardado").InnerText;
                                                else
                                                    textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CambGuardado").InnerText;

                                            }
                                            else
                                            {
                                                if (eliminiar_usuarios.Checked)
                                                {
                                                    usuarios = true;
                                                    //Se lanza la ventana para pedir confirmación
                                                    Form2 confirmacion = new Form2(Tabla_sel);
                                                    if (confirmacion.ShowDialog(this) == DialogResult.Yes)
                                                    {
                                                        NonQueryString = "DROP USER " + Tabla_sel;
                                                        command = connection.CreateCommand();
                                                        command.CommandText = NonQueryString;
                                                        connection.Open();
                                                        adapter = new MySqlDataAdapter(command);
                                                        command.ExecuteNonQuery();
                                                        if (idioma)
                                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimUsuario1").InnerText
                                                                + Tabla_sel + fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimUsuario2").InnerText;
                                                        else
                                                            textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimUsuario1").InnerText
                                                                + Tabla_sel + fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimUsuario2").InnerText;
                                                        comboBox1.ResetText();
                                                        get_table_name_Click(sender, e);

                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                }
                catch (Exception ex)
                {
                    textBox1.ForeColor = Color.Red;
                    textBox1.Text = ex.Message;
                }
            }
        }
예제 #6
0
        private void bunifuTileButton9_Click(object sender, EventArgs e)
        {
            Form5 lec = new Form5();

            lec.ShowDialog();
        }
예제 #7
0
 private void button_monitorIO_Click(object sender, EventArgs e)
 {
     Form5 FormaPiata = new Form5(this);
     FormaPiata.Owner = this;
     FormaPiata.ShowDialog();
 }
예제 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form5 f = new Form5();

            f.ShowDialog();
        }
예제 #9
0
파일: Form1.cs 프로젝트: chinazxn/MyEIMS
 //登录按键响应事件
 private void ButtonLogin_Click(object sender, EventArgs e)
 {
     //新建ClassSqlConnect类,调用重构的ViewCount方法返回从数据库中查询的结果
     ClassSqlConnect log = new ClassSqlConnect();
     SqlDataReader reader = log.ViewCount(ComboxUserName.Text.ToString(),TxtPassword.Text.ToString());
     if (reader.Read())//判断有数据,说明登录成功
     {
         /*保存账号信息,将这部分信息保存在数据库(XML)中更好*/
         ComboxUserName.Items.Add(ComboxUserName.Text.ToString());
         Form nfm;
         //提取用户名信息
         string UName = reader[1].ToString();
         MessageBox.Show("欢迎你,"+ UName);
         //提取权限信息并选择应打开的界面
         switch((int)reader[2])
         {
             case 0:
                 nfm = new Form2();//系统管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 1:
                 nfm = new Form7();//人事经理管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 2:
                 nfm = new Form3();//人事员工管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 3:
                 nfm = new Form8();//财务经理管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 4:
                 nfm = new Form4();//财务员工管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 5:
                 nfm = new Form9();//销售经理管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 6:
                 nfm = new Form6();//销售员工管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 7:
                 nfm = new Form10();//仓库经理管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             case 8:
                 nfm = new Form5();//仓库员工管理界面
                 this.Hide();
                 if (nfm.ShowDialog() == DialogResult.OK)
                 {
                     this.Show();
                 }
                 break;
             default:
                 MessageBox.Show("你没有登录权限," + UName,"没有权限");
                 ComboxUserName.Text = "";
                 TxtPassword.Text = "";
                 break;
         }
     }
     else
     {
         MessageBox.Show("用户名或密码错误!","错误");
         TxtPassword.Text = "";
     }
     //调用自定义的Close方法关闭sql连接
     log.Close();
 }
예제 #10
0
 private void suppliersToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     Form5 updatesuppform = new Form5();
     if (updatesuppform.ShowDialog() == DialogResult.OK)
     {
         updatesuppform.Close();
         DataTable dt = new DataTable();
         db.dataGrid(dt, "suppliertable");
         dataGridView1.DataSource = dt;
         this.squery = "suppliers";
         textBox1.Font = new Font(textBox1.Font, FontStyle.Italic);
         textBox1.ForeColor = Color.Gray;
         textBox1.Text = "Suppliers";
         textBox1.Enabled = false;
         textBox1.Enabled = true;
     }
 }
예제 #11
0
 // Load Event Editor
 private void button15_Click(object sender, EventArgs e)
 {
     eventIndex = 0;
     Form5 eventEditor = new Form5();
     eventEditor.ShowDialog(this);
 }
예제 #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (SignUp.Checked)
            {
                Form2 F2 = new Form2();
                F2.ShowDialog();
                nombre     = F2.SetNombre();
                usuario    = F2.SetUsuario();
                contraseña = F2.SetContraseña();
                // Quiero saber si me he podido dar de alta o no
                string mensaje = "1/" + nombre + "/" + usuario + "/" + contraseña;
                // Enviamos al servidor el nombre tecleado

                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (LogIn.Checked)
            {
                Form3 F3 = new Form3();

                F3.ShowDialog();
                user_login     = F3.SetUser();
                password_login = F3.SetPassword();
                // Quiere loguearse

                string mensaje = "2/" + user_login + "/" + password_login;
                // Enviamos al servidor el nombre tecleado
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (consulta_fecha.Checked)
            {
                Form4 F4 = new Form4();

                F4.ShowDialog();
                fecha = F4.getFecha();

                string mensaje = "3/" + fecha;
                // Enviamos al servidor el nombre tecleado
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (consulta_duracion.Checked)
            {
                Form5 F5 = new Form5();
                F5.ShowDialog();
                duracion = F5.getDuracion();

                string mensaje = "4/" + duracion;
                // Enviamos al servidor la duracion que nos han pasado por consola
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (consulta_lista.Checked)
            {
                string mensaje = "5/";
                // Enviamos el código pertinente a la solicitud
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (invitar.Checked)
            {
                Form6 F6 = new Form6();
                F6.setListado(conectados);
                F6.ShowDialog();
                string invitados = F6.GetListado();
                string mensaje   = "6/" + usuario + "/" + invitados; //    6/anakilator/1/juanito23
                byte[] msg       = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
        }
예제 #13
0
        //Instrucciones
        private void button4_Click_1(object sender, EventArgs e)
        {
            Form5 f5 = new Form5();

            f5.ShowDialog();
        }
예제 #14
0
 private void editEvolveRateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form5 form5 = new Form5();
     if (form5.ShowDialog(this) == DialogResult.OK)
     {
         evolveRate = form5.Value;
         timer1.Interval = 1000 / evolveRate; // Retrieves value of form5 and divides 1000 by it for tick rate
     }
     form5.Dispose();
 }