/// <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)); }
public OperationReturnModel <string> DeleteList(ListType type, long listId) { OperationReturnModel <string> ret = new OperationReturnModel <string>(); try { var list = _listService.ReadList(AuthenticatedUser, SelectedUserContext, type, listId); _listService.DeleteList(AuthenticatedUser, SelectedUserContext, type, list); _auditLogRepo.WriteToAuditLog(Common.Core.Enumerations.AuditType.ListDelete, AuthenticatedUser.Name, String.Format("List {0} ({1}) deleted for customer {2} - {3}", list.Name, listId, this.SelectedUserContext.CustomerId, this.SelectedUserContext.BranchId)); _cacheListLogic.RemoveSpecificCachedList(list); _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true)); ret.SuccessResponse = null; ret.IsSuccess = true; } catch (Exception ex) { ret.IsSuccess = false; ret.ErrorMessage = ex.Message; _elRepo.WriteErrorLog("DeleteList", ex); } return(ret); }
public bool LogHit(UserProfile user, UserSelectedContext context, ContentItemClickedModel clicked) { _audit.WriteToAuditLog( Common.Core.Enumerations.AuditType.MarketingCampaignClicked, user.EmailAddress, string.Format("customer {0}, campaign {1}", JsonConvert.SerializeObject(context), JsonConvert.SerializeObject(clicked)) ); return(true); }
/// <summary> /// create an account in Commerce Server /// </summary> /// <param name="name">Account Name</param> /// <remarks> /// jwames - 10/3/2014 - documented /// </remarks> public Guid CreateAccount(string createdBy, string name) { KeithLink.Svc.Core.Models.Generated.SiteTerm orgTypes = GetOrganizationTypes(); string accountOrgTypeId = orgTypes.Elements.Where(o => o.DisplayName == "Account").FirstOrDefault().Id; var createOrg = new CommerceServer.Foundation.CommerceCreate <KeithLink.Svc.Core.Models.Generated.Organization>("Organization"); createOrg.Model.Name = name; createOrg.Model.OrganizationType = accountOrgTypeId; createOrg.CreateOptions.ReturnModel = new Core.Models.Generated.Organization(); CommerceCreateOperationResponse res = Svc.Impl.Helpers.FoundationService.ExecuteRequest(createOrg.ToRequest()).OperationResponses[0] as CommerceCreateOperationResponse; _auditLog.WriteToAuditLog(Common.Core.Enumerations.AuditType.CustomerGroupCreated, createdBy, name); return(new Guid(res.CommerceEntity.Id)); }
public void AddUserToCustomer(string addedBy, Guid customerId, Guid userId) { base.AddUserToOrg(customerId, userId); _customerCacheRepository.RemoveItem(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCacheKey(string.Format("user_{0}", userId.ToString()))); _auditLogRepository.WriteToAuditLog(Common.Core.Enumerations.AuditType.UserAssignedToCustomer, addedBy, string.Format("Customer: {0}, User: {1}", customerId, userId)); }