Beispiel #1
0
        public Result Execute(BeneficiarioSaveCommand command)
        {
            Result result = _beneficiarioServiceBusiness.ValidateSave(command.Beneficiario);

            result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.Beneficiario.Domicilio).GetErrors());

            if (command.Beneficiario.Integrante != null && !command.Beneficiario.Integrante.EsDomicilioBeneficiario)
            {
                result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.Beneficiario.Integrante.Domicilio).GetErrors());
            }

            if (!String.IsNullOrEmpty(existenciaBeneficiario(command)))
            {
                result.AddError("El beneficiario ya se encuentra inscripto en una sala cuna");
            }

            if (result.success)
            {
                BeneficiarioSave(command, ref result);
            }



            return(result);
        }
Beispiel #2
0
        public void Save_domicilio_success()
        {
            var domicilio = new Domicilio()
            {
                Direccion = "cruz roja", Altura = 123
            };

            _domicilioServiceBusiness = new DomicilioServiceBusiness(_mockedVisitorDomicilioSave.Object);
            _result = _domicilioServiceBusiness.ValidateSave(domicilio);

            Assert.AreEqual(true, _result.success);
        }
Beispiel #3
0
        public Result Execute(EntidadSaveCommand command)
        {
            Result result = _entidadServiceBusiness.ValidateSave(command.Entidad);

            result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.Entidad.Sede.Domicilio).GetErrors());

            if (result.success)
            {
                SaveEntidad(command, ref result);
            }

            return(result);
        }
Beispiel #4
0
        public Result Execute(SalaCunaUpdateCommand command)
        {
            Result result = _salaCunaServiceBusiness.ValidateUpdate(command.SalaCuna);

            result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.SalaCuna.Domicilio).GetErrors());

            if (result.success)
            {
                UpdateSalaCuna(command, ref result);
            }

            return(result);
        }
Beispiel #5
0
        public void Save_domicilio_with_has_error_direccion()
        {
            var domicilio = new Domicilio()
            {
                Altura = 123
            };

            _domicilioServiceBusiness = new DomicilioServiceBusiness(_mockedVisitorDomicilioSave.Object);
            _result = _domicilioServiceBusiness.ValidateSave(domicilio);

            Assert.AreEqual(false, _result.success);
            // Assert.AreEqual(MessageError.DOMICILIO_SAVE_ERROR_DIRECCION, _result.GetErrors()[0].ToString());
        }
Beispiel #6
0
        public void Save_domicilio_with_has_error_Altura()
        {
            var domicilio = new Domicilio()
            {
                Direccion = "cruz roja"
            };

            _domicilioServiceBusiness = new DomicilioServiceBusiness(_mockedVisitorDomicilioSave.Object);
            _result = _domicilioServiceBusiness.ValidateSave(domicilio);

            Assert.AreEqual(false, _result.success);
            //Assert.AreEqual(MessageError.DOMICILIO_SAVE_ALTURA, _result.GetErrors()[0].ToString());
        }
Beispiel #7
0
        public Result Execute(PersonalSaveCommand command)
        {
            Result result  = new Result();
            string reqSala = "";
            string fecha   = "01/01/0001";

            result.AddErrorsRange(_personalServiceBusiness.ValidateSave(command.Personal).GetErrors());
            foreach (RequisitoPersonal requisito in command.Personal.requisitos)
            {
                //if (requisito.Estado == true)
                //{
                //    estado = "S";
                //}
                //else {
                //    estado = "N";
                //}

                if (requisito.fechaPresentacion.HasValue || requisito.Baja)
                {
                    string idRQS         = requisito.Baja ? "-1" : requisito.Id.ToString();
                    string idRQSPERSONAL = requisito.IdRequisitoPersonal != null?requisito.IdRequisitoPersonal.ToString() : "-1";

                    fecha = "01/01/0001";


                    if (requisito.fechaPresentacion.HasValue)
                    {
                        fecha = ((DateTime)requisito.fechaPresentacion).ToString("dd/MM/yyyy");
                    }

                    reqSala += idRQSPERSONAL + "," + idRQS + "," + fecha + ";";
                }
            }

            result.AddErrorsRange(_personalServiceBusiness.ValidateSave(command.Personal).GetErrors());

            result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.Personal.Domicilio).GetErrors());

            if (result.success)
            {
                PersonalSave(command, reqSala, ref result);
            }

            return(result);
        }
Beispiel #8
0
        public Result Execute(PersonalEditCommand command)
        {
            Result result  = new Result();
            string reqSala = "";
            string fecha   = "01/01/0001";

            foreach (RequisitoPersonal requisito in command.Personal.requisitos)
            {
                if (requisito.fechaPresentacion.HasValue || requisito.Baja)
                {
                    string idRQS         = requisito.Baja ? "-1" : requisito.Id.ToString();
                    string idRQSPERSONAL = requisito.IdRequisitoPersonal != null?requisito.IdRequisitoPersonal.ToString() : "-1";

                    fecha = "01/01/0001";


                    if (requisito.fechaPresentacion.HasValue)
                    {
                        fecha = ((DateTime)requisito.fechaPresentacion).ToString("dd/MM/yyyy");
                    }

                    reqSala += idRQSPERSONAL + "," + idRQS + "," + fecha + ";";
                }
            }

            // result.AddRange(_personalServiceBusiness.ValidateSave(command.Personal).GetErrors());
            result.AddErrorsRange(_personalServiceBusiness.ValidateUpdate(command.Personal).GetErrors());
            if (!command.Personal.IdCargo.HasValue)
            {
                result.AddError("Debe seleccionar un Cargo");
            }

            result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.Personal.Domicilio).GetErrors());



            if (result.success)
            {
                PersonalEdit(command, reqSala, ref result);
            }

            return(result);
        }
Beispiel #9
0
        public Result Execute(BeneficiarioUpdateCommand command)
        {
            Result result = _beneficiarioServiceBusiness.ValidateUpdate(command.Beneficiario);

            if (command.Beneficiario.Domicilio == null)
            {
                result.AddError("Faltan datos obligatorios en el domicilio del beneficiario");
            }
            else
            {
                result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(command.Beneficiario.Domicilio).GetErrors());
            }

            if (result.success)
            {
                BeneficiarioUpdate(command, ref result);
            }

            return(result);
        }
Beispiel #10
0
        public Result Execute(IntegranteSaveCommand command)
        {
            Result result = new Result();

            result.AddErrorsRange(_integranteServiceBusiness.ValidateSave(command.Beneficiario).GetErrors());

            foreach (var integrante in command.Beneficiario.ListIntegrantes)
            {
                if (!integrante.EsDomicilioBeneficiario)
                {
                    result.AddErrorsRange(_domicilioServiceBusiness.ValidateSave(integrante.Domicilio).GetErrors());
                }
            }

            if (result.success)
            {
                IntegranteSave(command, ref result);
            }

            return(result);
        }
Beispiel #11
0
 public Result Execute(DomicilioSaveCommand command)
 {
     return(_domicilioServiceBusiness.ValidateSave(command.Domicilio));
 }