예제 #1
0
        private bool IsValid()
        {
            bool result = true;

            errorProvider.SetError(txtCode, string.Empty);

            #region Analysis Code 唔可以吉
            if (txtCode.Text.Length == 0)
            {
                errorProvider.SetError(txtCode, "Cannot be blank!");
                errorProvider.SetIconAlignment(txtCode, ErrorIconAlignment.TopLeft);
                result = false;
            }
            #endregion

            #region 新增,要 check Analysis Code 係咪 in use
            if (_CodeId == Guid.Empty)
            {
                if (PosAnalysisCodeEx.IsAnalysisCodeInUse(txtCode.Text.Trim()))
                {
                    errorProvider.SetError(txtCode, "Analysis Code in use");
                    errorProvider.SetIconAlignment(txtCode, ErrorIconAlignment.TopLeft);
                    result = false;
                }
            }
            #endregion

            return(result);
        }
예제 #2
0
        private bool Verify()
        {
            bool result = true;

            if (txtCode.Text.Length == 0)
            {
                errorProvider.SetError(txtCode, "Cannot be blank!");
                result = false;
            }
            else
            {
                errorProvider.SetError(txtCode, string.Empty);
            }

            //string sql = "AnalysisCode = '" + txtCode.Text + "'";
            //PosAnalysisCode oAnalysisCode = PosAnalysisCode.LoadWhere(sql);
            if (PosAnalysisCodeEx.IsAnalysisCodeInUse(txtCode.Text))
            {
                result = false;
                errorProvider.SetError(txtCode, "Duplicated Analysis Code!");
            }
            else
            {
                errorProvider.SetError(txtCode, string.Empty);
            }

            return(result);
        }