private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ComboboxItem item = new ComboboxItem(); item = (ComboboxItem)cbClass.SelectedItem; bool gt = true; if (radNam.Checked == true) { gt = true; } else { gt = false; } if (_state == 1) { if (HocSinhController.ThemHS(txtID.Text.Trim().ToUpper(), txtTen.Text.Trim(), txtDiaChi.Text.Trim(), gt, dateNgaySinh.Value, txtSDT.Text.Trim(), txtTenPhuHuynh.Text.Trim(), txtSDTphuHuynh.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 (HocSinhController.SuaHS(txtID.Text.Trim().ToUpper(), txtTen.Text.Trim(), txtDiaChi.Text.Trim(), gt, dateNgaySinh.Value, txtSDT.Text.Trim(), txtTenPhuHuynh.Text.Trim(), txtSDTphuHuynh.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); } } }
private void Action(char c) { switch (c) { case '1': ErrHelper.Log(hs.ThemHS(new HocSinh(InputType.Insert))); break; case '2': ErrHelper.Log(hs.SuaTTHS(new HocSinh(InputType.Update))); break; case '3': ErrHelper.Log(hs.XoaHS(new HocSinh(InputType.Delete))); break; case '4': ErrHelper.Log(hs.ChuyenLopChoHS(new HocSinh(InputType.Update))); break; } Console.ReadKey(); Menu(); }