private void bbiRefresh_ItemClick(object sender, ItemClickEventArgs e) { QLChucVu cv = new QLChucVu(); this.Hide(); cv.Show(); }
private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e) { QLChucVu cv = new QLChucVu(); cv.Show(); this.Hide(); }
private void btn_return_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { QLChucVu ban = new QLChucVu(); ban.Show(); this.Hide(); }
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(); string tencv = txtcv.Text.Trim(); string macv = txtmacv.Text.Trim(); if (tencv != "" && macv != "") { try { string sql = "insert into chucvu(MaCV,TenCV) values ('" + tencv + "','" + macv + "')"; 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(); QLChucVu cv = new QLChucVu(); cv.Show(); this.Hide(); } } else { MessageBox.Show("Tên hoặc mã chức vụ không được null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btn_sua_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string macv = macv1; 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 tencv = txtTencv.Text.Trim(); string sql = "update chucvu set TenCV ='" + tencv + "' where MaChucVu = '" + macv + "'"; 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(); QLChucVu ban = new QLChucVu(); ban.Show(); this.Hide(); } } }