public override bool ValidarGrabar(BancosMandatos model)
        {
            //validar bancos
            if (string.IsNullOrEmpty(model.fkcuentas))
            {
                throw new ValidationException(General.ErrorCuentaObligatoria);
            }
            if (string.IsNullOrEmpty(model.descripcion))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancosMandatos.Descripcion));
            }
            if (string.IsNullOrEmpty(model.fkpaises))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancosMandatos.Fkpaises));
            }
            if (string.IsNullOrEmpty(model.iban))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancosMandatos.Iban));
            }
            if (string.IsNullOrEmpty(model.bic))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancosMandatos.Bic));
            }
            if (!ModeloNegocioFunciones.ValidateIban(model.iban))
            {
                throw new ValidationException(string.Format(General.ErrorFormatoCampo, RBancosMandatos.Iban));
            }

            if (!ModeloNegocioFunciones.ValidateBic(model.bic))
            {
                throw new ValidationException(string.Format(General.ErrorFormatoCampo, RBancosMandatos.Bic));
            }

            if (!string.IsNullOrEmpty(model.idacreedor) && !ModeloNegocioFunciones.ValidateIdAcreedor(model.idacreedor))
            {
                throw new ValidationException(string.Format(General.ErrorIdAcreedor, model.idacreedor));
            }

            //validar mandatos
            return(base.ValidarGrabar(model));
        }
Esempio n. 2
0
        public override bool ValidarGrabar(Bancos model)
        {
            if (string.IsNullOrEmpty(model.id))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancos.Id));
            }

            if (string.IsNullOrEmpty(model.nombre))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancos.Nombre));
            }

            if (string.IsNullOrEmpty(model.bic))
            {
                throw new ValidationException(string.Format(General.ErrorCampoObligatorio, RBancos.Bic));
            }

            if (!ModeloNegocioFunciones.ValidateBic(model.bic))
            {
                throw new ValidationException(string.Format(General.ErrorFormatoCampo, RBancos.Bic));
            }

            return(base.ValidarGrabar(model));
        }