Ejemplo n.º 1
0
        private void bbiRefresh_ItemClick(object sender, ItemClickEventArgs e)
        {
            QLNhanVien nv = new QLNhanVien();

            this.Hide();
            nv.Show();
        }
Ejemplo n.º 2
0
        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            QLNhanVien them = new QLNhanVien();

            them.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
        private void btn_return_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            QLNhanVien nv = new QLNhanVien();

            nv.Show();
            this.Hide();
        }
Ejemplo n.º 4
0
        private void btn_sua_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int          manv = int.Parse(manv1);
            DialogResult r;

            r = MessageBox.Show("Bạn có muốn lưu?", "Lưu thông tin", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (r == DialogResult.Yes)
            {
                MySqlConnection conn = getDB.getData();
                conn.Open();
                string tennv   = txtTenNV.Text.Trim();
                string sdt     = txtSDT.Text.Trim();
                string namsinh = txtNS.Text.Trim();
                string email   = txtEmail.Text.Trim();
                string diachi  = txtDC.Text.Trim();


                string sql = "update nhanvien set TenNV ='" + tennv + "', SDT = '" + sdt + "', NamSinh = '" + namsinh + "', Email = '" + email + "', DiaChi = '" + diachi + "' where MaNV =" + manv;
                try
                {
                    MySqlCommand cmd = new MySqlCommand(sql, conn);
                    if (cmd.ExecuteNonQuery() == 1)
                    {
                        MessageBox.Show("Thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Fails", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch
                {
                    MessageBox.Show("Lỗi", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    conn.Close();
                    conn.Dispose();
                    QLNhanVien nv = new QLNhanVien();
                    nv.Show();
                    this.Hide();
                }
            }
        }
Ejemplo n.º 5
0
        private void bbiNew_ItemClick(object sender, ItemClickEventArgs e)
        {
            DialogResult r;

            r = MessageBox.Show("Bạn có muốn lưu?", "Lưu thông tin", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (r == DialogResult.Yes)
            {
                MySqlConnection conn = getDB.getData();
                conn.Open();
                try
                {
                    string tennv   = txtTenNV.Text.Trim();
                    string sdt     = txtSDT.Text.Trim();
                    string namsinh = txtNS.Text.Trim();
                    string email   = txtEmail.Text.Trim();
                    string diachi  = txtDC.Text.Trim();

                    string       sql = "insert into nhanvien(TenNV,SDT,NamSinh,Email,DiaChi) values ('" + tennv + "','" + sdt + "','" + namsinh + "','" + email + "','" + diachi + "')";
                    MySqlCommand cmd = new MySqlCommand(sql, conn);
                    if (cmd.ExecuteNonQuery() == 1)
                    {
                        MessageBox.Show("Thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Fails", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch
                {
                    MessageBox.Show("Lỗi", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    conn.Close();
                    conn.Dispose();
                    QLNhanVien them = new QLNhanVien();
                    them.Show();
                    this.Hide();
                }
            }
        }