Esempio n. 1
0
        private bool CheckData()
        {
            if (txtShiftNo.Text.Trim() == "")
            {
                XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtShiftNo.Focus();
                return(false);
            }
            Shift shift = _shiftRepository.FirstOrDefault(_ => _.ShiftNo.Equals(txtShiftNo.Text.Trim()));

            if (shift != null &&
                (
                    String.IsNullOrEmpty(_id) ||
                    (!String.IsNullOrEmpty(_id) && txtShiftNo.Text.Trim() != shift.ShiftNo)
                ))
            {
                XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtShiftNo.Focus();
                return(false);
            }
            return(true);
        }