Exemplo n.º 1
0
        public static ProfessionalRegistrationModel MapProfessionalRegistrationModelFrom(ProfessionalRegistration professionalRegistrationObj)
        {
            Mapper.CreateMap<ProfessionalRegistration, ProfessionalRegistrationModel>().ForMember(dest => dest.State, source => source.Ignore());

            var professionalRegistration = Mapper.Map<ProfessionalRegistration, ProfessionalRegistrationModel>(professionalRegistrationObj);

            professionalRegistration.State = StateMapper.MapSpecialtyModelFrom(professionalRegistrationObj.State);

            return professionalRegistration;
        }
Exemplo n.º 2
0
        public override void AddprofessionalResgistration(int accountId, short professionalResgistrationType, string professionalResgistrationNumber, short stateId)
        {
            //todo: Implementando

            var account = _accounts.Get<Account>(accountId);
            Assertion.IsTrue(account.ProfessionalRegistrations == null ||
                             account.ProfessionalRegistrations.Count == 0 ||
                             !account.ProfessionalRegistrations.Any(p => p.State.Id == stateId && p.Type == (ProfessionalRegistrationTypeEnum)professionalResgistrationType),
                             "Este estado j&aacute; foi registrado").Validate();

            //((Accounts)FactoryRepository.GetRepository(RepositoryEnum.Accounts)).Approve(account);
            var repository = new Types<State>();
            var state = repository.Get(stateId);
            var professionalRegistration = new ProfessionalRegistration
                                                                    {
                                                                        Number = professionalResgistrationNumber,
                                                                        Type = (ProfessionalRegistrationTypeEnum)professionalResgistrationType,
                                                                        State = state
                                                                    };

            account.AddProfessionalRegistration(professionalRegistration);
            FactoryRepository.GetRepository(RepositoryEnum.Accounts).Save(account);
        }
Exemplo n.º 3
0
        private Account CreateAccount(string firstName, string lastName, GenderEnum gender, ProfessionalRegistrationTypeEnum professionalResgistrationType,
            string professionalResgistrationNumber, string email, string password, DateTime birthday, Hospital hospital)
        {
            var professionalResgistration = new ProfessionalRegistration
                                                {
                                                    Number = professionalResgistrationNumber,
                                                    State = hospital.State,
                                                    Type = professionalResgistrationType
                                                };

            var account = new Account(false);
            account.ToApprove(false);
            account.ToRefuse(false);
            account.AddProfessionalRegistration(professionalResgistration);
            account.ToEnterFirstName(firstName);
            account.ToEnterLastName(lastName);
            account.ToEnterGender(gender);
            account.ToEnterEmail(email);
            account.ToEnterPassword(password);
            account.ToEnterBirthday(birthday);

            account.AddHospital(hospital);

            return account;
        }