Пример #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     Person p1 = new PersonAction().queryOne(Convert.ToInt32(textBox1.Text));
     String str = "挂号业务ID:" + p1.Id + "\n"
                                    + "姓名:" + p1.Name + "\n"
                                    + "年龄:" + p1.Age + "\n"
                                    + "症状:" + p1.Desc + "\n"
                                    + "诊疗方法和建议: " + p1.Medicine + "\n";
     Form myForm = new Form7(str);
     myForm.ShowDialog();
 }
Пример #2
0
        /*private void button3_Click(object sender, EventArgs e)
         * {
         *  Form3 f1 = new Form3();
         *  f1.Show();
         * }*/



        private void button5_Click(object sender, EventArgs e)
        {
            /*Form7 f3 = new Form7();
             * f3.Show();*/
            s = dataGridView1[4, dataGridView1.CurrentRow.Index].Value.ToString();
            Form7 f = new Form7();

            f.textBox5.Text = s;
            //get_data();
            f.ShowDialog();
        }
Пример #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            Form7 formulario7 = new Form7();

            formulario7.ShowDialog();
            if (formulario7.DialogResult == DialogResult.OK)
            {
                txtCodigo.Text   = formulario7.dataGridView1.Rows[formulario7.dataGridView1.CurrentRow.Index].Cells[0].Value.ToString();
                txtProducto.Text = formulario7.dataGridView1.Rows[formulario7.dataGridView1.CurrentRow.Index].Cells[1].Value.ToString();
                txtPrecio.Text   = formulario7.dataGridView1.Rows[formulario7.dataGridView1.CurrentRow.Index].Cells[4].Value.ToString();
            }
        }
Пример #4
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            //this.Hide();
            // Form7 = new Form7();
            // aa.Show();
            try
            {
                // Donot make any changes
                connection.Open();
                OleDbCommand command = new OleDbCommand();
                command.Connection  = connection;
                command.CommandText = "SELECT * from Data where username = '******' and Password = '******'";
                OleDbDataReader reader = command.ExecuteReader();

                int count = 0;

                while (reader.Read())
                {
                    //count = count + 1;
                    count++;
                }
                if (count == 1)
                {
                    // MessageBox.Show("Welcome!!!");

                    connection.Close();
                    connection.Dispose();
                    this.Hide();
                    Form7 f7 = new Form7();
                    f7.ShowDialog();
                }
                else if (count > 1)
                {
                    MessageBox.Show(" Incorrect username and password!!!");
                }
                else
                {
                    MessageBox.Show(" Username and Password is not correct!!!");
                }

                connection.Close();
            }

            catch (Exception x)
            {
                MessageBox.Show("Error try again!!!" + x);
            }
        }
        private void button6_Click(object sender, EventArgs e)
        {
            Program.flightnum = new List <string>();
            int i = 1;

            while (i <= Program.FlightList.GetLength())
            {
                Flight flight = Program.FlightList.GetElem(i);
                Program.flightnum.Add(flight.FlightNum);
                i++;
            }

            Form7 form7 = new Form7();

            form7.StartPosition = FormStartPosition.CenterScreen;
            form7.ShowDialog();
        }
Пример #6
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            try
            {
                string       sqlSearch = "select * from AdminPassword where Adm='" + username1 + "'";
                OleDbCommand command   = new OleDbCommand(sqlSearch, connection);
                connection.Open();
                command.Connection = connection;
                OleDbDataReader dr = command.ExecuteReader();
                if (dr.Read())
                {
                    if (txt_new.Text == txt_confirm.Text)
                    {
                        string       sqlUpdate = "update AdminPassword set Pass='******' where Adm='" + username1 + "'";
                        OleDbCommand cmdd      = new OleDbCommand(sqlUpdate, connection);
                        cmdd.ExecuteNonQuery();
                        MessageBox.Show("Successfully updated");

                        this.Hide();
                        Form7 f7 = new Form7(username1);
                        f7.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Please retype your new password correctly");
                    }
                }
                else
                {
                    MessageBox.Show("No record found");
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error   " + ex);
            }
            this.Hide();
            Form3 f3 = new Form3(username1);

            f3.ShowDialog();
        }
Пример #7
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form7 f7 = new Form7();

            f7.ShowDialog();
        }
Пример #8
0
 private void button_prog_edit_Click(object sender, EventArgs e)
 {
     Form7 FormaSiodma = new Form7(this);
     FormaSiodma.Owner = this;
     FormaSiodma.ShowDialog();
 }
Пример #9
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();
 }
Пример #10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Form7 loginform = new Form7();

            if (loginform.ShowDialog() != DialogResult.OK)
            {
                Application.Exit();
            }
            else
            {
                if(loginform.employeeposition == "attendant")
                 {
                     addItemToolStripMenuItem.Enabled = false;
                     addSupplierToolStripMenuItem.Enabled = false;
                     upToolStripMenuItem.Enabled = false;
                     salesToolStripMenuItem.Enabled = false;
                     addCashierSaleToolStripMenuItem.Enabled = false;
                     toolStripButton5.Enabled = false;
                     toolStripButton4.Enabled = false;
                     toolStripButton6.Enabled = false;
                     toolStripButton3.Enabled = false;
                 }
                if (loginform.employeeposition == "cashier")
                {
                    addItemToolStripMenuItem.Enabled = false;
                    addSupplierToolStripMenuItem.Enabled = false;
                    upToolStripMenuItem.Enabled = false;
                    toolStripButton4.Enabled = false;
                    toolStripButton3.Enabled = false;
                }
                this.user = loginform.user;
                this.pos = loginform.employeeposition;
                this.label1.Text = String.Format("Position: {0}", pos.ToUpper());
                this.label2.Text = String.Format("Username: {0}", user);
                this.squery = "items";
                db.connect();
            }
        }
Пример #11
0
 // View Map Matrix
 private void button17_Click(object sender, EventArgs e)
 {
     matrixEditorPath = matrixPath + "\\" + comboBox1.SelectedIndex.ToString("D4");
     Form7 matrixViewer = new Form7();
     matrixViewer.ShowDialog(this);
 }
Пример #12
0
        private void AtenderServidor()
        {
            while (true)
            {
                //Recibimos la respuesta del servidor //  7/invitador
                byte[] msg2 = new byte[80];
                server.Receive(msg2);
                string[] trozos  = Encoding.ASCII.GetString(msg2).Split('/');
                int      codigo  = Convert.ToInt32(trozos[0]);
                string   mensaje = trozos[1].Split('\0')[0];
                Form6    F6      = new Form6();
                Form7    F7      = new Form7();
                string[] seg;
                string   invitador;
                int      numInvitados;
                string   invitado;
                string   respuesta;

                switch (codigo)
                {
                case 1:    //Puedo crear una cuenta

                    MessageBox.Show(mensaje);
                    break;

                case 2:    //Puedo iniciar sesión? Recibo un mensaje de la forma Y_Usuario o N

                    string[] segmentos = mensaje.Split('_');

                    if (segmentos[0] == "Y")
                    {
                        MessageBox.Show("Has sido autenticado correctamente!!!");
                        usuario     = segmentos[1];
                        label1.Text = "Has iniciado sesión como: " + usuario;
                    }
                    else if (segmentos[0] == "N")
                    {
                        MessageBox.Show("Contraseña incorrecta");
                    }
                    else if (segmentos[0] == "USER")
                    {
                        MessageBox.Show("El usuario no existe.");
                    }

                    break;

                case 3:    //Hay ganadores para una fecha?

                    if (mensaje == "NOT_FOUND")
                    {
                        MessageBox.Show("No hay ganadores para esta fecha");
                    }
                    else
                    {
                        MessageBox.Show(mensaje);
                    }
                    break;

                case 4:    //Hay ganadores para una duración?

                    if (mensaje == "NOT_FOUND")
                    {
                        MessageBox.Show("No hay ganadores con la duracion de partida proporcionada ");
                    }
                    else
                    {
                        MessageBox.Show(mensaje);
                    }
                    break;

                case 5:    //Que usuarios hay conectados?

                    F6.setListado(mensaje);
                    F6.setUsuario(usuario);
                    F6.ShowDialog();
                    break;

                case 6:                   //Hay una notificación de nuevo conectado!

                    conectados = mensaje; //  2_anakilator_juanito23
                    F6.setListado(conectados);
                    F6.setUsuario(usuario);
                    F6.ShowDialog();
                    break;

                case 7:    //Hay una invitación: 7/invitador_numInvitados_invitado


                    seg = mensaje.Split(new char[] { '_' }, 3);


                    invitador    = seg[0];
                    numInvitados = Convert.ToInt32(seg[1]);
                    invitado     = seg[2];



                    if (invitador != usuario)
                    {
                        MessageBox.Show("Hola " + usuario + ", " + invitador + " te ha invitado a jugar!");
                        F7.setListado(conectados);
                        F7.setInvitador(invitador);
                        F7.ShowDialog();
                        respuesta = F7.GetRespuesta();
                        //Enviamos petición con la respuesta de la invitacion
                        string mensj = "8/" + invitador + "/" + numInvitados + "/" + invitado + "/" + respuesta;
                        byte[] msg   = System.Text.Encoding.ASCII.GetBytes(mensj);
                        server.Send(msg);
                    }
                    break;

                case 8:     //Recibimos respuesta de la invitacion: 8/invitador/num_invitados/invitado/siOno

                    seg = mensaje.Split(new char[] { '_' }, 4);


                    invitador = seg[0];
                    //numInvitados = Convert.ToInt32(seg[1]);
                    invitado  = seg[2];
                    respuesta = seg[3];

                    if (respuesta == "no")
                    {
                        MessageBox.Show(invitado + " ha rechazado la invitación");
                    }
                    else
                    {
                        F8.setInvitador(invitador);
                        F8.setUsuario(invitado);
                        F8.ShowDialog();
                    }
                    break;
                }
            }
        }
 private void btn_back_Click(object sender, EventArgs e)
 {
     this.Hide();
     Form7 f7 = new Form7(username1);
     f7.ShowDialog();
 }
Пример #14
0
 private void button7_Click(object sender, EventArgs e)
 {
     Form7 form77 = new Form7();
     form77.ShowDialog();
 }