public static void AppsDelete(this ContactMechanism @this, DeletableDelete method) { foreach (PartyContactMechanism partyContactMechanism in @this.PartyContactMechanismsWhereContactMechanism) { partyContactMechanism.Delete(); } }
public static void AppsOnPreDerive(this ContactMechanism @this, ObjectOnPreDerive method) { var derivation = method.Derivation; foreach (PartyContactMechanism partyContactMechanism in @this.PartyContactMechanismsWhereContactMechanism) { derivation.AddDependency(partyContactMechanism, @this); } }
public ElectronicAddressEditPage SelectElectronicAddress(ContactMechanism contactMechanism) { this.ContactMechanismPanel.Click(); var row = this.Table.FindRow(contactMechanism); var cell = row.FindCell("contact"); cell.Click(); return(new ElectronicAddressEditPage(this.Driver)); }
public TelecommunicationsNumberEditPage SelectTelecommunicationsNumber(ContactMechanism ContactMechanism) { this.ContactMechanismPanel.Click(); var row = this.Table.FindRow(ContactMechanism); var cell = row.FindCell("contact"); cell.Click(); return(new TelecommunicationsNumberEditPage(this.Driver)); }
public static void BaseOnPreDerive(this ContactMechanism @this, ObjectOnPreDerive method) { var(iteration, changeSet, derivedObjects) = method; if (iteration.IsMarked(@this) || changeSet.IsCreated(@this) || changeSet.HasChangedRoles(@this)) { foreach (PartyContactMechanism partyContactMechanism in @this.PartyContactMechanismsWhereContactMechanism) { iteration.AddDependency(partyContactMechanism, @this); iteration.Mark(partyContactMechanism); } } }
private PartyContactMechanism CreatePartyContactMechanism(ContactMechanismPurpose purpose, ContactMechanism mechanism) => new PartyContactMechanismBuilder(this.Session) .WithContactPurpose(purpose) .WithContactMechanism(mechanism) .WithUseAsDefault(true) .Build();
private PartyContactMechanism CreateShipTo(ContactMechanism mechanism, ContactMechanismPurpose purpose, bool isDefault) => new PartyContactMechanismBuilder(this.Session).WithContactMechanism(mechanism).WithContactPurpose(purpose).WithUseAsDefault(isDefault).Build();
public async Task <ServiceResponse <string> > Register(UserRegisterDto user) { var response = new ServiceResponse <string>(); try { if (await UserExists(user.Username)) { response.Success = false; response.Message = "User already exists."; return(response); } CreatePasswordHash(user.Password, out byte[] passwordHash, out byte[] passwordSalt); //create new party var party = new Party { //create new guid Uuid = Guid.NewGuid().ToString().ToUpper(), CreateDate = DateTime.UtcNow, LastUpdateTimestamp = DateTime.UtcNow }; await context.Party.AddAsync(party); //save to get the party id await context.SaveChangesAsync(); //create person var person = new Person { PersonId = party.PartyId, FullName = user.FullName, PlatformUserName = user.Username, LastUpdateTimestamp = DateTime.UtcNow }; await context.Person.AddAsync(person); //save to get the person id await context.SaveChangesAsync(); //create person as user var actorType = ActorType.Owner; var participantType = await context.PlatformParticipantType .Where(x => x.ParticipantTypeIndicator == actorType.GetDescription()).FirstOrDefaultAsync(); var personAsUser = new PersonAsUser { PersonFk = person.PersonId, Uuid = Guid.NewGuid().ToString().ToUpper(), MobileBusinessFk = null, PasswordBin = passwordHash, PasswordSalt = passwordSalt, PlatformParticipantTypeFk = participantType.PlatformParticipantTypeId, LastUpdateTimestamp = DateTime.UtcNow }; await context.PersonAsUser.AddAsync(personAsUser); //save to get the person as user id await context.SaveChangesAsync(); //save the person id var personId = (int)person.PersonId; //create new contact mechanism uuid var cm = new ContactMechanism() { Uuid = Guid.NewGuid().ToString(), LastUpdateTimestamp = DateTime.UtcNow }; await context.ContactMechanism.AddAsync(cm); //need to save here to get the contact mechanism id!! await context.SaveChangesAsync(); //create Email Address var email = new EmailAddress() { EmailAddressId = cm.ContactMechanismId, Email = user.Username, EmailTypeCode = user.EmailTypeCode ?? "P", LastUpdateTimestamp = DateTime.UtcNow }; await context.EmailAddress.AddAsync(email); await context.SaveChangesAsync(); response.Data = $"User {person.PlatformUserName} created."; } catch (Exception ex) { //create user friendly exception response.Success = false; response.Message = ex.Message; response.Exception = new PlatformScreenException(ex); } return(response); }