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

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