Exemplo n.º 1
0
        public void AddUserToOrg(Guid orgId, Guid userId)
        {
            CommerceCreate <UserOrganizations> createOrg = new CommerceCreate <UserOrganizations>("UserOrganizations");

            createOrg.Model.Id                  = Guid.NewGuid().ToCommerceServerFormat();
            createOrg.Model.OrganizationId      = orgId.ToCommerceServerFormat();
            createOrg.Model.UserId              = userId.ToCommerceServerFormat();
            createOrg.CreateOptions.ReturnModel = new UserOrganizations();

            createOrg.Model.UserOrganizationKey = GetUserOrgKey(orgId, userId);
            CommerceResponse res = Svc.Impl.Helpers.FoundationService.ExecuteRequest(createOrg.ToRequest());
        }
Exemplo n.º 2
0
        /// <summary>
        ///     create a profile for the user in commerce server
        /// </summary>
        /// <param name="emailAddress">the user's email address</param>
        /// <param name="firstName">user's given name</param>
        /// <param name="lastName">user's surname</param>
        /// <param name="phoneNumber">user's telephone number</param>
        /// <remarks>
        ///     jwames - 10/3/2014 - documented
        /// </remarks>
        public void CreateUserProfile(string createdBy, string emailAddress, string firstName, string lastName, string phoneNumber, string branchId)
        {
            CommerceCreate <Core.Models.Generated.UserProfile> createUser = new CommerceCreate <Core.Models.Generated.UserProfile>("UserProfile");

            createUser.Model.FirstName     = firstName;
            createUser.Model.LastName      = lastName;
            createUser.Model.Email         = emailAddress;
            createUser.Model.Telephone     = phoneNumber;
            createUser.Model.DefaultBranch = branchId;

            FoundationService.ExecuteRequest(createUser.ToRequest());

            _auditLog.WriteToAuditLog(AuditType.UserCreated, createdBy, JsonConvert.SerializeObject(createUser.Model));
        }