Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pServiceRequest"></param>
        /// <returns></returns>
        public override CreateUserRes Execute(CreateUserReq pServiceRequest)
        {
            CreateUserRes wRes    = new CreateUserRes();
            UserBC        wUserBC = new UserBC(pServiceRequest.ContextInformation.AppId, pServiceRequest.SecurityProviderName);

            wUserBC.Create(pServiceRequest.BusinessData.User);

            //TODO: Ver por que se retorna la entidad completa
            wRes.BusinessData.UserId = pServiceRequest.BusinessData.User.UserId.Value;


            return(wRes);
        }
Ejemplo n.º 2
0
        public override CrearProfesionalRes Execute(CrearProfesionalReq pServiceRequest)
        {
            CrearProfesionalRes wRes = new CrearProfesionalRes();

            pServiceRequest.BusinessData.profesional.LastAccessUserId         = Guid.Parse(pServiceRequest.ContextInformation.UserId);
            pServiceRequest.BusinessData.profesional.Persona.LastAccessUserId = Guid.Parse(pServiceRequest.ContextInformation.UserId);

            bool personaExiste = PersonasDAC.Exist(pServiceRequest.BusinessData.profesional.Persona.NroDocumento);

            //Lo primero es crear el inicio de sesion
            UserBC wUserBC = new UserBC(pServiceRequest.ContextInformation.AppId, pServiceRequest.SecurityProviderName);

            wUserBC.Create(pServiceRequest.BusinessData.User);
            wRes.BusinessData.UserId = Guid.Parse(pServiceRequest.BusinessData.User.ProviderId.ToString());

            if (personaExiste)
            {
                if (ProfesionalesDAC.Persona_EstaAsociada(pServiceRequest.BusinessData.profesional.Persona.NroDocumento))
                {
                    throw new Fwk.Exceptions.FunctionalException(String.Format("El Nro documento {0} ya pertenece a otro profesional registrado",
                                                                               pServiceRequest.BusinessData.profesional.Persona.NroDocumento));
                }

                ProfesionalesDAC.Asociar(pServiceRequest.BusinessData.profesional);
            }
            else
            {
                pServiceRequest.BusinessData.profesional.Persona.UserId = wRes.BusinessData.UserId;
                ProfesionalesDAC.Create(pServiceRequest.BusinessData.profesional);
            }

            wRes.BusinessData.IdProfesional = pServiceRequest.BusinessData.profesional.IdProfesional;
            wRes.BusinessData.UserId        = wRes.BusinessData.UserId;

            return(wRes);
        }