Пример #1
0
        private void Modify_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = imageList1.Images[0];
            timer1.Enabled    = true;
            label4.Enabled    = false;
            timer1.Interval   = 1000;
            label4.Text       = DateTime.Now.ToLocalTime().ToString();
            try
            {
                string  sql = @"select * from staff";
                DataSet ds  = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }
            //在datagridview中添加新的一列按钮控件
            DataGridViewButtonColumn modify = new DataGridViewButtonColumn
            {
                Name       = "修改",
                HeaderText = "修改",
            };

            modify.DefaultCellStyle.NullValue = "修改";
            dataGridView1.Columns.Add(modify);
        }
Пример #2
0
        private void delete_Click(object sender, EventArgs e)
        {
            mysql Mysql = new mysql();

            if (comboBox1.SelectedItem == null)
            {
                MessageBox.Show("请选择要删除的员工");
            }
            else
            {
                try
                {
                    string Name       = comboBox1.SelectedItem.ToString();
                    string sql_delete = @"delete from staff where name='" + Name + "'";
                    int    result     = Mysql.ExecuteNonQuery(sql_delete);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    string  sql = @"select * from staff";
                    DataSet ds  = Mysql.GetDataSet(sql);
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
Пример #3
0
        private void Display_Click(object sender, EventArgs e)
        {
            mysql Mysql = new mysql();

            try
            {
                string  sql = @"select room_id,room_state,room_price,roomtype.roomtype_id,roomtype_name,room_area from roomtype,room where roomtype.roomtype_id=room.roomtype_id";
                DataSet ds  = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            mysql Mysql = new mysql();

            try
            {
                string  sql = @"select id,name,position,rest_holiday,salary from pay";
                DataSet ds  = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally { }
        }
Пример #5
0
        private void LeftRoom_Load(object sender, EventArgs e)
        {
            mysql Mysql = new mysql();

            time.Enabled    = true;
            timer1.Enabled  = true;
            timer1.Interval = 1000;
            try
            {
                string  sql = @"select * from room,roomtype where room.roomtype_id=room.roomtype_id and room_state='为空'";
                DataSet ds  = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         mysql           Mysql = new mysql();
         MySqlConnection conn  = Mysql.Connection();
         string          sql   = @"select * from staff";
         DataSet         ds    = Mysql.GetDataSet(sql);
         dataGridView1.DataSource = ds.Tables[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("异常为:" + ex.Message);
     }
     finally
     {
     }
 }
Пример #7
0
        private void StayInfo_Load(object sender, EventArgs e)
        {
            timer1.Enabled  = true;
            timer1.Interval = 1000;
            time.Enabled    = false;
            mysql Mysql = new mysql();

            pictureBox1.Image = QR.QrCodeBitmap("www.baidu.com", 5, 3);
            try
            {
                string  sql = @"select * from stayinfo";
                DataSet ds  = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #8
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string Name = comboBox1.SelectedItem.ToString();

            try
            {
                mysql           Mysql = new mysql();
                MySqlConnection conn  = Mysql.Connection();
                string          sql   = @"select * from staff where name='" + Name + "'";
                DataSet         ds    = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常为:" + ex.Message);
            }
            finally
            {
            }
        }