Ejemplo n.º 1
0
        public bool UpdateUser(UserAuthenticationRequest request)
        {
            Epi.Web.BLL.User userImplementation = new Epi.Web.BLL.User(_userDao);

            UserBO         UserBO = request.User.ToUserBO();
            OrganizationBO OrgBO  = new OrganizationBO();

            return(userImplementation.UpdateUser(UserBO, OrgBO));
        }
Ejemplo n.º 2
0
        public bool UpdateUserInfo(UserRequest UserInfo)
        {
            Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory();
            Epi.Web.Interfaces.DataInterfaces.IUserDao    IUserDao         = new EF.EntityUserDao();
            Epi.Web.BLL.User Implementation = new Epi.Web.BLL.User(IUserDao);

            var            UserBO = Mapper.ToUserBO(UserInfo.User);
            OrganizationBO OrgBO  = new OrganizationBO();

            OrgBO = Mapper.ToBusinessObject(UserInfo.Organization);
            return(Implementation.UpdateUser(UserBO, OrgBO));
        }
Ejemplo n.º 3
0
        public UserResponse SetUserInfo(UserRequest request)
        {
            try
            {
                UserResponse response = new UserResponse();

                Epi.Web.BLL.Organization organizationImplementation = new Epi.Web.BLL.Organization(_organizationDao);

                Epi.Web.BLL.User userImplementation = new Epi.Web.BLL.User(_userDao);
                UserBO           userBO             = request.User.ToUserBO();
                OrganizationBO   orgBo = request.Organization.ToOrganizationBO();
                if (request.Action.ToUpper() == "UPDATE")
                {
                    OrganizationBO organizationBO = organizationImplementation.GetOrganizationByOrgId(request.CurrentOrg);
                    userBO.Operation = OperationMode.UpdateUserInfo;
                    userImplementation.UpdateUser(userBO, organizationBO);
                }
                else
                {
                    UserBO existingUser = userImplementation.GetUserByEmail(userBO);//Validate if user is in the system.
                    bool   UserExists   = false;
                    if (existingUser != null)
                    {
                        OrganizationBO OrganizationBO = organizationImplementation.GetOrganizationByOrgId(request.CurrentOrg);
                        existingUser.Role     = userBO.Role;
                        existingUser.IsActive = userBO.IsActive;
                        userBO     = existingUser;
                        UserExists = userImplementation.IsUserExistsInOrganizaion(userBO, OrganizationBO); //validate if user is part of the organization already.
                    }

                    if (!UserExists)
                    {
                        //OrgBo.OrganizationId = request.CurrentOrg; // User is added to the current organization
                        OrganizationBO organizationBO = organizationImplementation.GetOrganizationByOrgId(request.CurrentOrg);
                        userImplementation.SetUserInfo(userBO, organizationBO);
                        response.Message = "Success";
                    }
                    else
                    {
                        response.Message = "Exists";
                    }
                }

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <CustomFaultException>(new CustomFaultException(ex));
            }
        }