Exemplo n.º 1
0
        private bool CheckData()
        {
            if (txtAgencyName.Text.Trim() == "")
            {
                XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtAgencyName.Focus();
                return(false);
            }
            Agency agency = _agencyRepository.FirstOrDefault(_ => _.AgencyName.Equals(txtAgencyName.Text.Trim()));

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