public void CreateManyAccounts(int count) { ManagedSecurityContext sec = ManagedAccount.GetAdminSecurityContext(Session); TransitCountry tc = new TransitCountry(); tc.Name = Guid.NewGuid().ToString(); TransitState ts = new TransitState(); ts.Name = Guid.NewGuid().ToString(); ts.Country = tc.Name; ManagedCountry c = new ManagedCountry(Session); c.CreateOrUpdate(tc, sec); ManagedState s = new ManagedState(Session); s.CreateOrUpdate(ts, sec); TransitAccountAddress ta = new TransitAccountAddress(); ta.Apt = "123"; ta.City = "New York"; ta.Country = tc.Name; ta.Name = "My Address"; ta.State = ts.Name; ta.Street = "Houston St."; ta.Zip = "10001"; for (int i = 0; i < count; i++) { ManagedAccount a = new ManagedAccount(Session); string name = Guid.NewGuid().ToString(); a.Create( name, "password", string.Format("{0}@localhost.com", name), DateTime.UtcNow, sec); ManagedAccountAddress ma = new ManagedAccountAddress(Session); ma.CreateOrUpdate(ta, a.GetSecurityContext()); } }
public void CreateManyAccounts(int count) { ManagedSecurityContext sec = ManagedAccount.GetAdminSecurityContext(Session); TransitCountry tc = new TransitCountry(); tc.Name = Guid.NewGuid().ToString(); TransitState ts = new TransitState(); ts.Name = Guid.NewGuid().ToString(); ts.Country = tc.Name; ManagedCountry c = new ManagedCountry(Session); c.CreateOrUpdate(tc, sec); ManagedState s = new ManagedState(Session); s.CreateOrUpdate(ts, sec); TransitAccountAddress ta = new TransitAccountAddress(); ta.Apt = "123"; ta.City = "New York"; ta.Country = tc.Name; ta.Name = "My Address"; ta.State = ts.Name; ta.Street = "Houston St."; ta.Zip = "10001"; for (int i = 0; i < count; i++) { ManagedAccount a = new ManagedAccount(Session); string name = Guid.NewGuid().ToString(); a.Create( name, "password", string.Format("{0}@localhost.com", name), DateTime.UtcNow, sec); ManagedAccountAddress ma = new ManagedAccountAddress(Session); ma.CreateOrUpdate(ta, a.GetSecurityContext()); } }
public void CreateAccountAddress() { ManagedAccount a = new ManagedAccount(Session); ManagedCountry c = new ManagedCountry(Session); ManagedState s = new ManagedState(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); TransitCountry tc = new TransitCountry(); tc.Name = GetNewString(); TransitState ts = new TransitState(); ts.Name = GetNewString(); ts.Country = tc.Name; c.CreateOrUpdate(tc, AdminSecurityContext); s.CreateOrUpdate(ts, AdminSecurityContext); TransitAccountAddress ta = new TransitAccountAddress(); ta.Apt = "123"; ta.City = "New York"; ta.Country = tc.Name; ta.Name = "My Address"; ta.State = ts.Name; ta.Street = "Houston St."; ta.Zip = "10001"; ManagedAccountAddress m_a = new ManagedAccountAddress(Session); m_a.CreateOrUpdate(ta, new ManagedSecurityContext(a.Instance)); } finally { a.Delete(AdminSecurityContext); s.Delete(AdminSecurityContext); c.Delete(AdminSecurityContext); Session.Flush(); } }
public void CreateAccountAddress() { ManagedAccount a = new ManagedAccount(Session); ManagedCountry c = new ManagedCountry(Session); ManagedState s = new ManagedState(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); TransitCountry tc = new TransitCountry(); tc.Name = GetNewString(); TransitState ts = new TransitState(); ts.Name = GetNewString(); ts.Country = tc.Name; c.CreateOrUpdate(tc, AdminSecurityContext); s.CreateOrUpdate(ts, AdminSecurityContext); TransitAccountAddress ta = new TransitAccountAddress(); ta.Apt = "123"; ta.City = "New York"; ta.Country = tc.Name; ta.Name = "My Address"; ta.State = ts.Name; ta.Street = "Houston St."; ta.Zip = "10001"; ManagedAccountAddress m_a = new ManagedAccountAddress(Session); m_a.CreateOrUpdate(ta, new ManagedSecurityContext(a.Instance)); } finally { a.Delete(AdminSecurityContext); s.Delete(AdminSecurityContext); c.Delete(AdminSecurityContext); Session.Flush(); } }