public void Seed(DPOContext context) { this.context = context; // Test SeedTestDataUserGroupings(); SeedTestDataProjects(); }
public Repository(DPOContext context) { if (context == null) { context = new DPOContext(); } this.Context = context; }
public void CreateTestAddress(DPOContext context, Address address, string name) { address.AddressLine1 = string.Format("{0} Line1", name); address.AddressLine2 = string.Format("{0} Line2", name); address.AddressLine3 = string.Format("{0} Line3", name); address.PostalCode = "SM7 2PG"; address.RegionId = context.Regions.FirstOrDefault().RegionId; address.Location = "Banstead"; }
public static string GenerateConnectionString(DomainEnum domain) { string sDomain = domain.ToString().ToLower(); string connection = null; connection = ConfigurationManager.ConnectionStrings[sDomain].ConnectionString; if (connection == null) { throw new ConfigurationErrorsException(string.Format(DPO.Resources.SystemMessages.SM001, sDomain)); } var efProvider = new EntityConnectionStringBuilder(connection); var sqlProvider = new SqlConnectionStringBuilder(efProvider.ProviderConnectionString); if (String.IsNullOrEmpty(sqlProvider.UserID) || sqlProvider.UserID == ".") { sqlProvider.IntegratedSecurity = true; } sqlProvider.PersistSecurityInfo = false; sqlProvider.MultipleActiveResultSets = true; //sqlProvider.ConnectTimeout = 5; //sqlProvider.ConnectTimeout = 200; if (domain != DomainEnum.Local) { sqlProvider.IntegratedSecurity = false; sqlProvider.UserID = "DaikinAdmin"; sqlProvider.Password = "******"; } efProvider.ProviderConnectionString = sqlProvider.ToString(); var efConnection = efProvider.ToString(); if (domain == DomainEnum.Local) { using (var db = new DPOContext(efConnection)) { // Recreate schema if no test db or test db is older than schema db.Database.Initialize(true); } } return(efConnection); }
public Business CreateTestBusiness(DPOContext context, BusinessTypeEnum type, string name) { this.context = context; var bus = context.Businesses.Where(u => u.BusinessName == name).FirstOrDefault(); if (bus == null) { bus = Db.BusinessCreate(type); bus.AccountId = name; bus.BusinessName = name; bus.Enabled = true; CreateTestAddress(context, bus.Address, name); CreateTestContact(context, bus.Contact, name); } ; return(bus); }
public Repository() { this.Context = new DPOContext(); this.Log = _log; }
public void CreateTestContact(DPOContext context, Contact contact, string name) { contact.ContactEmail = string.Format("{0}@somewhere.com", name); contact.Mobile = "+44 (0) 780 36545"; contact.Phone = "+44 (0) 208 456 7895"; }