Esempio n. 1
0
        public override bool IsValid()
        {
            if (string.IsNullOrEmpty(Email) && string.IsNullOrEmpty(Phone))
            {
                StatusCode = SharedCommonsGlobals.FAILURE_STATUS_CODE;
                StatusDesc = "Please Supply an Email or Phone Number";
                return(false);
            }

            string propertiesThatCanBeNull = $"{nameof(Id)}|{nameof(Email)}|{nameof(Phone)}";
            string nullCheckResult         = SharedCommons.CheckForNulls(this, propertiesThatCanBeNull);

            if (nullCheckResult != SharedCommonsGlobals.SUCCESS_STATUS_TEXT)
            {
                StatusCode = SharedCommonsGlobals.FAILURE_STATUS_CODE;
                StatusDesc = nullCheckResult;
                return(false);
            }

            if (!string.IsNullOrEmpty(Email) && !SharedCommons.IsValidEmail(Email))
            {
                StatusCode = SharedCommonsGlobals.FAILURE_STATUS_CODE;
                StatusDesc = "Please Supply an valid Email Address";
                return(false);
            }

            if (!string.IsNullOrEmpty(Phone) && !SharedCommons.IsValidUgPhoneNumber(Phone))
            {
                StatusCode = SharedCommonsGlobals.FAILURE_STATUS_CODE;
                StatusDesc = "Please Supply an valid Phone";
                return(false);
            }

            return(base.IsValid());
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            string       QueuePath = @".\private$\TestQueue";;
            CommonResult result    = new CommonResult();

            result.StatusCode = SharedCommonsGlobals.SUCCESS_STATUS_CODE;
            result.StatusDesc = SharedCommonsGlobals.SUCCESS_STATUS_TEXT;
            CommonResult insertResult = SharedCommons.InsertIntoMSMQ(QueuePath, result);
            Message      message      = SharedCommons.PeekCopyOfTopItemFromMSMQ(QueuePath, typeof(CommonResult));

            result = message.Body as CommonResult;
            bool isValid = SharedCommons.IsValidUgPhoneNumber("0785975800");
        }