private void btnSVLuu_Click(object sender, EventArgs e) { if (btnSVLuu.Tag.ToString() == "Them") { var db = new Quanlykiluat1Entities(); var i = db.insert_giamsat(txtgs.Text, txttengs.Text, txtchucvu.Text, txtcapbac.Text); if (i == 0) { MessageBox.Show("Thêm mới thất bại !"); } else { MessageBox.Show("Thêm mới thành công !"); hienthidanhsach(); } } if (btnSVLuu.Tag.ToString() == "Sua") { var db = new Quanlykiluat1Entities(); var i = db.update_giamsat(txtgs.Text, txttengs.Text, txtchucvu.Text, txtcapbac.Text); if (i == 0) { MessageBox.Show("Sửa thất bại !"); } else { MessageBox.Show("Sửa thành công !"); hienthidanhsach(); } } }
private void btnSVXoa_Click(object sender, EventArgs e) { var db = new Quanlykiluat1Entities(); var i = db.delete_giamsat(txtgs.Text); if (i == 0) { MessageBox.Show("Xóa thất bại !"); } else { MessageBox.Show("Xóa thành công !"); hienthidanhsach(); } }
private void TK_Load(object sender, EventArgs e) { var db = new Quanlykiluat1Entities(); var table = db.getPLRL_DaiDoi_2().ToList(); chart1.DataSource = table; chart1.Series[0].XValueMember = "TenPLRL"; chart1.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.String; chart1.Series[0].YValueMembers = "Soluong"; chart1.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32; chart2.DataSource = db.getPLKL_DaiDoi(); chart2.Series[0].XValueMember = "TenPLKL"; chart2.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.String; chart2.Series[0].YValueMembers = "Soluong"; chart2.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32; }