コード例 #1
0
ファイル: frmDocType.cs プロジェクト: ScoreSolutions/DLT-SCAN
        private bool ValidateData()
        {
            bool ret = true;

            if (txtDocTypeCode.Text.Trim() == "") {
                ret = false;
                MessageBox.Show("กรุณาระบุรหัสเอกสาร");
                txtDocTypeCode.Focus();
            }else if(txtDocTypeCode.Text.Length != Func.Utilities.Config.DocTypeCodeLength){
                ret = false;
                MessageBox.Show("จำนวนหลักของรหัสเอกสารไม่ถูกต้อง");
                txtDocTypeCode.Focus();
                txtDocTypeCode.SelectAll();
            }
            else if (txtDoctypeName.Text.Trim() == "")
            {
                ret = false;
                MessageBox.Show("กรุณาระบุชื่อเอกสาร");
                txtDoctypeName.Focus();
            }
            else{
                DocTypePara para = new DocTypePara();
                para.ID = Convert.ToInt64(txtID.Text);
                para.DOCTYPE_CODE = txtDocTypeCode.Text.Trim();
                para.DOCTYPE_NAME = txtDoctypeName.Text.Trim();

                DocTypeFunc fnc = new DocTypeFunc();
                if (fnc.ChkDupData(para) == true) {
                    ret = false;
                    MessageBox.Show(fnc.InfoMessage);
                    txtDocTypeCode.Focus();
                    txtDocTypeCode.SelectAll();
                }
            }

            return ret;
        }