コード例 #1
0
        public void Validate_Name_IsInValid()
        {
            String name = "สมชาย%%";

            Assert.IsFalse(StringNameHelper.Validate(name));
        }
コード例 #2
0
        protected void Validate()
        {
            if (APPLICANT_CODE == null || APPLICANT_CODE == 0)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.APPLICANT_CODE_Required);
            }

            //if (ApplicantFileHeader.SourceFrom == RegistrationType.Insurance)
            //{
            //    if (String.IsNullOrEmpty(TESTING_NO))
            //        AddBrokenRule(ApplicantFileDetailBusinessRules.TESTING_NO_Required);
            //    else if (ApplicantFileHeader.ExamLicense.TESTING_NO != TESTING_NO)
            //    {
            //        AddBrokenRule(ApplicantFileDetailBusinessRules.TESTING_NO_Required);
            //    }
            //}


            if (String.IsNullOrEmpty(EXAM_PLACE_CODE))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.EXAM_PLACE_CODE_Required);
            }

            //if (String.IsNullOrEmpty(ACCEPT_OFF_CODE))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.ACCEPT_OFF_CODE_Required);

            if (APPLY_DATE == null || APPLY_DATE == DateTime.MinValue)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.APPLY_DATE_Required);
            }

            if (String.IsNullOrEmpty(ID_CARD_NO))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Required);
            }
            else if (!Utils.IdCard.Verify(ID_CARD_NO))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Required);
            }
            else if (IsRegisted)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Registed);
            }

            else if (IsRegistedToday)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Registed);
            }
            else if (IsRegistedTodayAndTime)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Registed);
            }

            else if (IsRegistedTestingDateAndTimeAndOtherTestingNo)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Registed);
            }
            else if (IsRegistedTodayAndTimeAndExamPlace)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.ID_CARD_NO_Registed);
            }

            if (String.IsNullOrEmpty(PRE_NAME_CODE))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.PRE_NAME_CODE_Required);
            }

            if (String.IsNullOrEmpty(NAMES))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.NAMES_Required);
            }
            else if (NAMES.Length > 30)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.NAMES_TooLong);
            }
            else if (!StringNameHelper.Validate(this.NAMES))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.NAMES_Required);
            }

            if (String.IsNullOrEmpty(LASTNAME))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.LASTNAME_Required);
            }
            else if (LASTNAME.Length > 30)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.LASTNAME_TooLong);
            }
            else if (!StringNameHelper.Validate(this.LASTNAME))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.LASTNAME_Required);
            }

            if (BIRTH_DATE == null || BIRTH_DATE == DateTime.MinValue)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.BIRTH_DATE_Required);
            }
            else if (!(((DateTime)BIRTH_DATE) < DateTime.Now.Date))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.BIRTH_DATE_Required);
            }

            if (String.IsNullOrEmpty(SEX))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.SEX_Required);
            }
            else if (SEX != "F" && SEX != "M")
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.SEX_Required);
            }

            if (String.IsNullOrEmpty(EDUCATION_CODE))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.EDUCATION_CODE_Required);
            }

            if (!String.IsNullOrEmpty(ADDRESS1))
            {
                ADDRESS1 = (ADDRESS1.Length > 60) ? ADDRESS1.Substring(0, 60) : ADDRESS1;
            }

            if (!String.IsNullOrEmpty(ADDRESS2))
            {
                ADDRESS2 = (ADDRESS2.Length > 60) ? ADDRESS2.Substring(0, 60) : ADDRESS2;
            }

            //if (String.IsNullOrEmpty(AREA_CODE))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.AREA_CODE_Required);

            //if (String.IsNullOrEmpty(PROVINCE_CODE))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.PROVINCE_CODE_Required);

            //if (String.IsNullOrEmpty(ZIPCODE))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.ZIPCODE_Required);

            //if (String.IsNullOrEmpty(TELEPHONE))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.TELEPHONE_Required);

            //if (String.IsNullOrEmpty(AMOUNT_TRAN_NO))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.AMOUNT_TRAN_NO_Required);

            //if (String.IsNullOrEmpty(PAYMENT_NO))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.PAYMENT_NO_Required);

            if (ApplicantFileHeader.SourceFrom == RegistrationType.Insurance && String.IsNullOrEmpty(INSUR_COMP_CODE))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.INSUR_COMP_CODE_Required);
            }
            else if (ApplicantFileHeader.SourceFrom == RegistrationType.Association && ActivateLicense())
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.INSUR_COMP_CODE_Required);
            }
            else if (ApplicantFileHeader.SourceFrom == RegistrationType.Insurance && ApplicantFileHeader.CreateBy.CompCode != INSUR_COMP_CODE)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.INSUR_COMP_CODE_Required);
            }

            //if (String.IsNullOrEmpty(ABSENT_EXAM))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.ABSENT_EXAM_Required);

            //if (String.IsNullOrEmpty(RESULT))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.RESULT_Required);

            //if (EXPIRE_DATE == null || EXPIRE_DATE==DateTime.MinValue)
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.EXPIRE_DATE_Required);

            //if (String.IsNullOrEmpty(LICENSE))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.LICENSE_Required);

            //if (String.IsNullOrEmpty(CANCEL_REASON))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.CANCEL_REASON_Required);

            //if (String.IsNullOrEmpty(RECORD_STATUS))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.RECORD_STATUS_Required);

            if (String.IsNullOrEmpty(USER_ID))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.USER_ID_Required);
            }

            if (USER_DATE == null || USER_DATE == DateTime.MinValue)
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.USER_DATE_Required);
            }

            //if (String.IsNullOrEmpty(EXAM_STATUS))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.EXAM_STATUS_Required);

            //if (String.IsNullOrEmpty(REQUEST_NO))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.REQUEST_NO_Required);

            if (String.IsNullOrEmpty(UPLOAD_GROUP_NO))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.UPLOAD_GROUP_NO_Required);
            }

            if (String.IsNullOrEmpty(SEQ_NO))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.SEQ_NO_Required);
            }

            if (String.IsNullOrEmpty(TITLE))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.TITLE_Required);
            }

            //if (String.IsNullOrEmpty(ERROR_MSG))
            //    AddBrokenRule(ApplicantFileDetailBusinessRules.ERROR_MSG_Required);

            if (_brokenRules.Count > 0)
            {
                LOAD_STATUS = "F";
            }
            else
            {
                LOAD_STATUS = "T";
            }

            if (String.IsNullOrEmpty(LOAD_STATUS))
            {
                AddBrokenRule(ApplicantFileDetailBusinessRules.LOAD_STATUS_Required);
            }
        }
コード例 #3
0
        public void Validate_Name_IsValid()
        {
            String name = "สมชาย";

            Assert.IsTrue(StringNameHelper.Validate(name));
        }