private void btnSave_Click(object sender, EventArgs e) { if (txtFullName.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập tên Sinh viên", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtFullName.Focus(); } else if (dteBirthday.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Ngày sinh", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (dteStartYear.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Ngày bắt đầu", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtPhoneNumber.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Số điện thoại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtEmail.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Email", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtIDCard.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Chứng minh nhân dân", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtAddress.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Địa chỉ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!(radNam.Checked) && !(radNu.Checked)) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Giới tính", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!(radAvailable.Checked) && !(radUnavailable.Checked)) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Trạng thái", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (lkeClass.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Lớp học", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (lkeFaculty.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Khoa", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _getData(); if (GarenaViewModel.checkPhoneNumber(_StudentModelNow.StrPhone) == false) { DevExpress.XtraEditors.XtraMessageBox.Show("Số Điện Thoại Phải 10 Số!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (GarenaViewModel.checkIDCard(_StudentModelNow.StrCardID) == false) { DevExpress.XtraEditors.XtraMessageBox.Show("CMND Phải Trên 8 Số!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (GarenaViewModel.checkEmail(_StudentModelNow.StrEmail) == false) { DevExpress.XtraEditors.XtraMessageBox.Show("Email không đúng định dạng !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (CheckBirthday() == false) { DevExpress.XtraEditors.XtraMessageBox.Show("Sinh viên chưa đủ 18 tuổi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (CheckStartDay() == true) { DevExpress.XtraEditors.XtraMessageBox.Show("Kiểm tra dữ liệu Lớp học và Ngày bắt đầu"); DevExpress.XtraEditors.XtraMessageBox.Show("Hai số đầu Mã lớp tương đương với hai số cuối Ngày bắt đầu", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { _getData(); bool bresult = false; if (_IStatusForm == 1) { bresult = _Student.addNewStudent(_StudentModelNow); } else { bresult = _Student.updateCurrentStudent(_StudentModelNow); } if (!bresult) { DevExpress.XtraEditors.XtraMessageBox.Show("Lưu Thất Bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _lstLoadListStudent(); _IStatusForm = 0; _setStatusForm(); DevExpress.XtraEditors.XtraMessageBox.Show("Lưu Thành Công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnSave_Click(object sender, EventArgs e) { if (txtFullName.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập tên Giảng viên", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtIDCard.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Chứng minh nhân dân", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } //else if (_Staff.checkStaffID(txtID.Text) == true) //{ // DevExpress.XtraEditors.XtraMessageBox.Show("Mã số nhân viên bị trùng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //} else if (_Staff.checkCardID(txtID.Text) == true) { DevExpress.XtraEditors.XtraMessageBox.Show("CMND bị trùng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (dteBirthday.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Ngày sinh", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtAddress.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Địa chỉ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtPhoneNumber.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Số điện thoại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtEmail.Text == "") { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Email", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (lkeFaculty.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Khoa", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!(radNam.Checked) && !(radNu.Checked)) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Giới tính", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!(radAvailable.Checked) && !(radUnavailable.Checked)) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa chọn Trạng thái", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _getData(); if (GarenaViewModel.checkPhoneNumber(_LecturerModelNow.StrPhone) == false) { DevExpress.XtraEditors.XtraMessageBox.Show("Số Điện Thoại Phải 10 Số!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (GarenaViewModel.checkIDCard(_LecturerModelNow.StrCardID) == false) { DevExpress.XtraEditors.XtraMessageBox.Show("CMND Phải Trên 8 Số!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (GarenaViewModel.checkEmail(_LecturerModelNow.StrEmail) == false) { DevExpress.XtraEditors.XtraMessageBox.Show("Email không đúng định dạng !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (CheckBirthday() == false) { DevExpress.XtraEditors.XtraMessageBox.Show("Nhân viên phải trên 18 tuổi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { _getData(); bool bresult = false; if (_IStatusForm == 1) { bresult = _Staff.addNewStaff(_LecturerModelNow); } else { bresult = _Staff.updateCurrentStaff(_LecturerModelNow); } if (!bresult) { DevExpress.XtraEditors.XtraMessageBox.Show("Lưu Thất Bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _lstLoadListLecturer(); _IStatusForm = 0; _setStatusForm(); DevExpress.XtraEditors.XtraMessageBox.Show("Lưu Thành Công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }