private void btnDelete_Click(object sender, EventArgs e) { string mshs = picMHSFalse.CurrentRow.Cells["MaHS"].Value.ToString(); if (XepLopDAO.Instance.CheckExist(mshs) == false) { if (HocSinhDAO.Instance.deleteHocSinh(mshs)) { toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 110; toolStripProgressBar1.Value = 0; toolStripProgressBar1.Step = 10; timer1.Start(); //MessageBox.Show("Xóa thành công học sinh có mã " + mshs + " !", "Thông báo", MessageBoxButtons.OK); loadStu(); Reset.ResetAllControls(navigationPage2); Reset.ResetAllControls(navigationPageAddHocSinh); Reset.ResetFocus(txtMahocsinh, txtNhapthongtincantimkiem); } } else { MessageBox.Show("Học sinh đã có lớp, không thể xóa được!!", "Thông báo", MessageBoxButtons.OK); } }
private void btnDelete_Click(object sender, EventArgs e) { string magv = dGVGiaovien.CurrentRow.Cells["colMagiaovien"].Value.ToString(); if (magv != "") { if (ClassDAO.Instance.CheckGVCNinClass(magv) == false) { if (GiaoVienDAO.Instance.XoaGiaoVien(magv)) { //MessageBox.Show("Xóa thành công", "Thông báo"); toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 110; toolStripProgressBar1.Value = 0; toolStripProgressBar1.Step = 10; timer1.Start(); LoadGiaoVien(); } else { MessageBox.Show("Xóa thất bại", "Thông báo"); } } else { MessageBox.Show("Giáo viên hiện tại đã chủ nhiệm không thể xóa", "Thông báo"); } } else { MessageBox.Show("Trống rồi sao xóa đây !!!", "Thông báo"); } Reset.ResetFocus(txtMagiaovien, txtNhapthongtincantimkiem); }
public void SaveItem() { string magv = CheckType.chuanHoaMa(dGVGiaovien.CurrentRow.Cells["colMagiaovien"].Value.ToString()); string tengv = CheckType.chuanHoaTen(dGVGiaovien.CurrentRow.Cells["colTengiaovien"].Value.ToString()); string sdt = dGVGiaovien.CurrentRow.Cells["colDienthoai"].Value.ToString(); string diachi = dGVGiaovien.CurrentRow.Cells["colDiachi"].Value.ToString(); string mamh = GiaoVienDAO.Instance.ChangeTenMontoMaMH(dGVGiaovien.CurrentRow.Cells["colTenmonhoc"].Value.ToString()); if (CheckType.Instance.CheckMaGV(magv) == false) { MessageBox.Show("Sai r"); return; } if (!CheckType.Instance.CheckIsPhone(sdt)) { MessageBox.Show("Sai định dạng số điện thoại rồi !!!", "Thông báo"); return; } if (magv != null && tengv != null && sdt != null && diachi != null && mamh != null) { if (!GiaoVienDAO.Instance.CheckGiaoVienExist(magv)) { if (GiaoVienDAO.Instance.ThemGiaoVien(magv, tengv, sdt, diachi, mamh)) { MessageBox.Show("Thêm thành công!!", "Thông báo"); LoadGiaoVien(); } else { MessageBox.Show("Thêm thất bại!!", "Thông bóa"); } } else { if (GiaoVienDAO.Instance.SuaGiaoVien(magv, tengv, sdt, diachi, mamh)) { MessageBox.Show("Sửa thành công!!", "Thông báo"); LoadGiaoVien(); } else { MessageBox.Show("Sửa thất bại!!", "Thông bóa"); } } } else { MessageBox.Show("Trống thông tin rồi kìa hoặc thông tin sai định dạng nè !!", "Thông báo"); } Reset.ResetFocus(txtMagiaovien, txtNhapthongtincantimkiem); }
private void btnSave_Click(object sender, EventArgs e) { try { string mahs = CheckType.chuanHoaMa(picMHSFalse.CurrentRow.Cells["MaHS"].Value.ToString()); string hoten = CheckType.chuanHoaTen(picMHSFalse.CurrentRow.Cells["HoTen"].Value.ToString()); string gioitinh = picMHSFalse.CurrentRow.Cells["GioiTinh"].Value.ToString(); DateTime ngaysinh = (DateTime)picMHSFalse.CurrentRow.Cells["NgSinh"].Value; string noisinh = picMHSFalse.CurrentRow.Cells["NoiSinh"].Value.ToString(); string dienthoai = picMHSFalse.CurrentRow.Cells["DienThoai"].Value.ToString(); string email = picMHSFalse.CurrentRow.Cells["Email"].Value.ToString(); string diachi = picMHSFalse.CurrentRow.Cells["DiaChi"].Value.ToString(); if (!CheckType.Instance.CheckMaHS(mahs)) { MessageBox.Show("Mã học sinh dạng HSXXXX (XXXX là số thứ tự) !!!", "Thông báo", MessageBoxButtons.OK); return; } if (!CheckType.Instance.CheckIsMail(email)) { MessageBox.Show("Email dạng email rồi !!!", "Thông báo", MessageBoxButtons.OK); return; } if (!CheckType.Instance.CheckIsPhone(dienthoai)) { MessageBox.Show("Số điện thoại định dạng sai rồi !!!", "Thông báo", MessageBoxButtons.OK); return; } if (HocSinhDAO.Instance.updateHocSinh(mahs, hoten, gioitinh, ngaysinh, noisinh, dienthoai, email, diachi)) { MessageBox.Show("Đã thay đổi học sinh có mã " + mahs + " thành công !", "Thông báo", MessageBoxButtons.OK); loadStu(); Reset.ResetFocus(txtMahocsinh, txtNhapthongtincantimkiem); } toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 110; toolStripProgressBar1.Value = 0; toolStripProgressBar1.Step = 10; timer1.Start(); } catch { MessageBox.Show("Tuổi phải từ " + QuidinhtuoiDAO.Instance.GetAgeMinByMaTruong() + " đến " + QuidinhtuoiDAO.Instance.GetAgeMaxByMaTruong() + " tuổi !", "Thông báo", MessageBoxButtons.OK); } }
private void btnSave_Click(object sender, EventArgs e) { string ml = CheckType.chuanHoaMa(dGVLop.CurrentRow.Cells["MaLop"].Value.ToString()); string tenlop = CheckType.chuanHoaMa(dGVLop.CurrentRow.Cells["TenLop"].Value.ToString()); string tenkhoi = dGVLop.CurrentRow.Cells["TenKhoiLop"].Value.ToString(); string gvcn = dGVLop.CurrentRow.Cells["TenGV"].Value.ToString(); string namhoc = dGVLop.CurrentRow.Cells["TenNamHoc"].Value.ToString(); if (ClassDAO.Instance.updateClass(ml, tenlop, tenkhoi, gvcn, namhoc)) { //MessageBox.Show("Đã thay đổi thông tin của lớp có mã lớp là " + ml); toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 110; toolStripProgressBar1.Value = 0; toolStripProgressBar1.Step = 10; timer1.Start(); loadClass(); Reset.ResetAllControls(navigationPaneAddClass); Reset.ResetAllControls(navigationPage2); Reset.ResetFocus(txtMalop, txtNhapthongtincantimkiem); } }
private void btnDelete_Click(object sender, EventArgs e) { try { string ml = dGVLop.CurrentRow.Cells["MaLop"].Value.ToString(); if (ClassDAO.Instance.deleteClass(ml)) { //MessageBox.Show("Đã xóa lớp có mã " + ml); toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = 110; toolStripProgressBar1.Value = 0; toolStripProgressBar1.Step = 10; timer1.Start(); loadClass(); Reset.ResetAllControls(navigationPaneAddClass); Reset.ResetAllControls(navigationPage2); Reset.ResetFocus(txtMalop, txtNhapthongtincantimkiem); } } catch { MessageBox.Show("Không thể xóa lớp đã có học sinh !", "Thông báo !!", MessageBoxButtons.OK); } }
private void navigationPane1_Click(object sender, EventArgs e) { loadClass(); Reset.ResetFocus(txtMalop, txtNhapthongtincantimkiem); Reset.ResetAllControls(navigationPage2); }
private void navigationPane1_Click(object sender, EventArgs e) { loadStu(); Reset.ResetAllControls(navigationPageAddHocSinh); Reset.ResetFocus(txtMahocsinh, txtNhapthongtincantimkiem); }
private void navigationPaneAddGV_Click(object sender, EventArgs e) { LoadGiaoVien(); Reset.ResetAllControls(navigationPage2); Reset.ResetFocus(txtMagiaovien, txtNhapthongtincantimkiem); }