Beispiel #1
0
        /// <summary>
        /// Valida una entidad <c>Entity.PaymentMethodDetail</c>.
        /// </summary>
        /// <param name="entity">Entidad.</param>
        /// <returns><c>IResponseValidate</c></returns>
        /// <exception cref="System.ArgumentNullException">entity</exception>
        public IResponseValidate Validate(Entity.PaymentMethodDetail entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            IResponseValidate validate = new ResponseValidate();

            validate.Message = string.Empty;

            if (string.IsNullOrEmpty(entity.Name))
            {
                validate.Message += this._resourceReacher.GetString("PaymentMethodDetailNameEmpty");
            }
            if (entity.PaymentMethodId <= 0)
            {
                validate.Message += _resourceReacher.GetString("PaymentMethodDetailPaymentMethodInvalid");
            }
            if (entity.UserId != this._user.Id)
            {
                validate.Message += _resourceReacher.GetString("PaymentMethodDetailUserInvalid");
            }

            validate.IsValid = string.IsNullOrEmpty(validate.Message);

            return(validate);
        }
Beispiel #2
0
        public IResponseValidate Validate(Entity.Payment entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            IResponseValidate validate = new ResponseValidate();

            validate.Message = string.Empty;

            if (entity.Date == null)
            {
                validate.Message += _resourceReacher.GetString("PaymentDateNull");
            }
            if (string.IsNullOrEmpty(entity.Description))
            {
                validate.Message += _resourceReacher.GetString("PaymentDescriptionEmpty");
            }
            if (entity.PaymentMethodDetail == null)
            {
                validate.Message += _resourceReacher.GetString("PaymentPaymentMethodDetailNull");
            }
            if (entity.PaymentType <= 0)
            {
                validate.Message += _resourceReacher.GetString("PaymentPaymentType");
            }
            if (entity.User == null)
            {
                validate.Message += _resourceReacher.GetString("PaymentUserNull");
            }
            if (entity.Value == 0)
            {
                validate.Message += _resourceReacher.GetString("PaymentValueIsZero");
            }
            if (entity.User.Id != this._user.Id)
            {
                validate.Message += _resourceReacher.GetString("PaymentUserInvalid");
            }

            validate.IsValid = string.IsNullOrEmpty(validate.Message);

            return(validate);
        }
Beispiel #3
0
        public IResponseValidate Validate(Entity.Capture entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            IResponseValidate validate = new ResponseValidate();

            validate.Message = string.Empty;

            if (entity.Image == null)
            {
                validate.Message += _resourceReacher.GetString("CaptureImageNull");
            }
            if (entity.Payment == null)
            {
                validate.Message += _resourceReacher.GetString("CapturePaymentNull");
            }

            validate.IsValid = string.IsNullOrEmpty(validate.Message);

            return(validate);
        }