private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { gvc = new GiaoVienController(); int gt = 0; if (gvc.CheckErr(txtMaGV.Text.Trim(), txtHoTen.Text.Trim(), dtNgaySinh.Value.ToString(), gt, txtSDT.Text.Trim(), txtQueQuan.Text.Trim())) { if (ckNam.Checked) { gt = 0; } if (ckNu.Checked) { gt = 1; } string _ngaysinh = dtNgaySinh.Value.Year + "/" + dtNgaySinh.Value.Month + "/" + dtNgaySinh.Value.Day; if (_ID == null) { if (gvc.ThemGV(txtMaGV.Text.Trim(), txtHoTen.Text.Trim(), _ngaysinh, gt, txtSDT.Text.Trim(), txtQueQuan.Text.Trim())) { MessageBox.Show("Thành Công", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Lỗi", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (gvc.SuaGV(txtMaGV.Text.Trim(), txtHoTen.Text.Trim(), _ngaysinh, gt, txtSDT.Text.Trim(), txtQueQuan.Text.Trim())) { MessageBox.Show("Thành Công", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Lỗi", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ComboboxItem item = new ComboboxItem(); item = (ComboboxItem)cbMon.SelectedItem; bool gt = true; if (radNam.Checked == true) { gt = true; } else { gt = false; } if (_state == 1) { if (GiaoVienController.ThemGV(txtID.Text.Trim().ToUpper(), txtHoTen.Text.Trim(), dtpNgaySinh.Value, gt, txtSDT.Text.Trim(), txtDiaChi.Text.Trim(), item.Value.ToString())) { MessageBox.Show("Thành Công", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Lỗi", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (_state == 2) { if (GiaoVienController.SuaGV(txtID.Text.Trim().ToUpper(), txtHoTen.Text.Trim(), dtpNgaySinh.Value, gt, txtSDT.Text.Trim(), txtDiaChi.Text.Trim(), item.Value.ToString())) { MessageBox.Show("Thành Công", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Lỗi", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }