private void button1_Click(object sender, EventArgs e)
 {
     oracle.LinkToOracle("orcl", "test", "test");//连接数据库
     OracleCommand cmd = oracle.getConnection().CreateCommand();
     String tno = textBox1.Text;
     String pwd = textBox2.Text;
     if (radioButton1.Checked == true)
     {
         cmd.CommandText = String.Format("select * from teacher where tno='{0}'", tno);//从数据库中选出行
         OracleDataReader reader = cmd.ExecuteReader();//把数据赋给reader
         reader.Read();
         if (reader.HasRows)
             if (reader["pwd"].ToString() == pwd)
             {
                 MessageBox.Show("登录成功");
                 oracle.LinkClose();
                 Form5 form5 = new Form5(textBox1.Text);
                 this.Hide();
                 form5.Show();
                 //return;
             }
             else
             {
                 MessageBox.Show("用户名不存在或者密码错误");
                 oracle.LinkClose();
             }
     }
     else{
         cmd.CommandText = String.Format("select * from teacher where tno='{0}'", "m123");//从数据库中选出行
         OracleDataReader reader = cmd.ExecuteReader();//把数据赋给reader
         reader.Read();
         if (reader.HasRows)
             if (reader["pwd"].ToString() == pwd)
             {
                 MessageBox.Show("登录成功");
                 oracle.LinkClose();
                 Form2 form2 = new Form2();
                 this.Hide();
                 form2.Show();
                 //return;
             }
             else
             {
                 MessageBox.Show("用户名不存在或者密码错误");
                 oracle.LinkClose();
             }
     }
 }
Exemple #2
0
        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();
        }
Exemple #3
0
 //登录按键响应事件
 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();
 }
Exemple #4
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;
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     Form5 fr = new Form5();
     fr.Show();
 }
 private void button3_Click(object sender, EventArgs e)
 {
     this.Visible = false;
     Form5 connectionMode = new Form5();
     connectionMode.Show();
 }
Exemple #7
0
 private void portátilToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form5 form5 = new Form5();
     form5.MdiParent = this;
     form5.Show();
 }
 private void button4_Click(object sender, EventArgs e)
 {
     Form5 f5 = new Form5();
     f5.Show();
 }
Exemple #9
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);
            }
        }
Exemple #10
0
 private void первыйToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form5 f2 = new Form5(Managers);
     f2.ShowInTaskbar = false;
     f2.Owner = this;
     f2.Show();
 }
Exemple #11
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form5 ob1 = new Form5();

            ob1.Show();
        }
Exemple #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form5 a = new Form5();

            a.Show(this);
        }
Exemple #13
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form5 form = new Form5(); //ดึง form มาใช้

            form.Show();              //แสดง from ที่ดึงมา
        }
Exemple #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form5 frm = new Form5();

            frm.ShowDialog();
        }
Exemple #15
0
        //Instrucciones
        private void button4_Click_1(object sender, EventArgs e)
        {
            Form5 f5 = new Form5();

            f5.ShowDialog();
        }
Exemple #16
0
 private void button_monitorIO_Click(object sender, EventArgs e)
 {
     Form5 FormaPiata = new Form5(this);
     FormaPiata.Owner = this;
     FormaPiata.ShowDialog();
 }
Exemple #17
0
        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;
                }
            }
        }
 // Load Event Editor
 private void button15_Click(object sender, EventArgs e)
 {
     eventIndex = 0;
     Form5 eventEditor = new Form5();
     eventEditor.ShowDialog(this);
 }
Exemple #19
0
 private void showForm5ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form5 objektForm5 = new Form5();
     objektForm5.Show();
 }
Exemple #20
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();
 }