private void CalcularPrecioPiezas(List <TransformacioneslotesLinModel> lineas, double costetotal)
        {
            var unidadesService = FService.Instance.GetService(typeof(UnidadesModel), _context, _db) as UnidadesService;
            var preciolinea     = costetotal / lineas.Sum(f => ModeloNegocioFunciones.CalculaEquivalentePeso(((UnidadesModel)unidadesService.get(f.Fkunidades)).Formula == TipoStockFormulas.Superficie, f.Metros ?? 0, f.Grueso ?? 0));

            foreach (var item in lineas)
            {
                if (item.Precio != preciolinea)
                {
                    item.Precio         = preciolinea * item.Metros ?? 0;
                    item.Flagidentifier = Guid.NewGuid();
                }
            }
        }
        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. 3
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));
        }