private bool pmValidVatSeq()
        {
            string strErrorMsg = "";
            string strRefNo    = "";
            bool   bllResult   = true;

            if (this.mstrVatSeq.TrimEnd() != string.Empty)
            {
                if (this.mFormEditMode == UIHelper.AppFormState.Insert || this.mstrOldVatSeq != this.mstrVatSeq)
                {
                    string strMthYr = BizRule.GetVatSeqPrefix(mdttVatDue);

                    WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);
                    object[] pAPara = new object[] { App.ActiveCorp.RowID, this.mstrBranchID, this.mstrVatType, this.mstrVatSeq };

                    if (BizRule.ChkDupVatSeq(pobjSQLUtil, pAPara, ref strRefNo))
                    {
                        strErrorMsg = "";
                        pAPara      = new object[] { App.ActiveCorp.RowID, this.mstrBranchID, this.mstrVatType };
                        string strNewVatSeq = BizRule.RunVatSeq(pobjSQLUtil, pAPara, strMthYr, ref strErrorMsg);

                        strErrorMsg  = "ÅӴѺ·Õè [" + this.mstrVatSeq + "] à¾×èÍÍÍ¡ÃÒ§ҹÀÒÉÕ«×éÍ\n";
                        strErrorMsg += "«éӡѺ¢Í§àÍ¡ÊÒÃãºÍ×è¹\n";
                        strErrorMsg += "à»ÅÕè¹à»ç¹ÅӴѺ·Õè [" + strNewVatSeq.Substring(strMthYr.Length, 5) + "]";
                        MessageBox.Show(strErrorMsg, "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        this.mstrVatSeq = strNewVatSeq;
                        bllResult       = false;
                    }
                }
            }
            return(bllResult);
        }
        private bool pmChkVatSeq(ref string ioErrorMsg)
        {
            bool   bllResult = true;
            string strRefNo  = "";
            string strMthYr  = BizRule.GetVatSeqPrefix(this.txtVatDue.DateTime);
            string strVatSeq = strMthYr + this.txtVatSeq.Text.TrimEnd();

            if (this.mFormEditMode == UIHelper.AppFormState.Insert || this.mstrOldVatSeq != strVatSeq)
            {
                WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);
                object[] pAPara = new object[] { App.ActiveCorp.RowID, this.mstrBranchID, this.mstrVatType, strVatSeq };

                if (BizRule.ChkDupVatSeq(pobjSQLUtil, pAPara, ref strRefNo))
                {
                    ioErrorMsg  = "ÅӴѺ·Õè [" + this.txtVatSeq.Text.TrimEnd() + "] à¾×èÍÍÍ¡ÃÒ§ҹÀÒÉÕ«×éÍ\n";
                    ioErrorMsg += "«éӡѺ¢Í§àÍ¡ÊÒÃàÅ¢·Õè " + strRefNo + "\n";
                    //MessageBox.Show(strErrorMsg, "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    bllResult = false;
                }
            }
            else
            {
                bllResult       = true;
                this.mstrVatSeq = strMthYr + this.txtVatSeq.Text.TrimEnd();
            }
            return(bllResult);
        }
 private void txtVatDue_Validating(object sender, CancelEventArgs e)
 {
     if (this.mdttLastVatDue.CompareTo(this.txtVatDue.DateTime) != 0)
     {
         this.mdttLastVatDue = this.txtVatDue.DateTime;
         string   strVatSeq = this.mstrVatSeq;
         DateTime dttDate   = this.mdttVatDue;
         this.mstrVatSeq = BizRule.GetVatSeqPrefix(this.txtVatDue.DateTime) + this.txtVatSeq.Text;
         this.pmValidVatSeq();
         this.txtVatSeq.Text = this.mstrVatSeq.Substring(6, 5);
         this.mstrVatSeq     = strVatSeq;
         this.mdttVatDue     = dttDate;
     }
 }