// ReSharper restore InconsistentNaming

        public override void SetUpUser()
        {
            User01 = ResolveUser("LON",	"Jahangez Chaudhery",		"ChaudheJ",		"JVC");
            User02 = ResolveUser("LON",	"Gareth Meech",			"meechg",		"GZM");
            User03 = ResolveUser("LON",	"Angus Stewart",		"StewarAn",		"");
            User04 = ResolveUser("LON",	"William Waddell-Dudley",	"WaddellDW",		"WZD");
            User05 = ResolveUser( "SNG",	"Simon Wilmot-Smith",		"wilmots",		"SWS");
            User06 = ResolveUser("LON", "Susan House", "houses", "SBH");
            User07 = ResolveUser("LON", "Fraser Waters", "WatersF", "FZW");
        }
        // ReSharper restore InconsistentNaming



        public override void SetUpUser()
        {
            User01 = ResolveUser("LON", "Alan Norris", "NorrisA", "AXN");
            User02 = ResolveUser("LON", "Ian Ritchie", "RitchieI", "WZD");
            User03 = ResolveUser("LON", "Gareth Meech", "meechg", "GZM");
            User04 = ResolveUser("LON", "Angus Stewart", "StewarAn", "   ");
            User05 = ResolveUser("SNG", "Simon Wilmot-Smith", "wilmots", "SWS");
            User06 = ResolveUser("LON", "Susan House", "houses", "SBH");
          
        }
        public User EnsureCurrentUser()
        {
            if (_currentHttpContext == null)
                throw new Exception("_currentHttpContext is null");

            var u = (_currentHttpContext.Context.Session != null)
                        ? _currentHttpContext.Context.Session["User"] as User
                        : null;

            if (u == null)
            {
                if (_repository.Query<User>().Any(w => (w.DomainLogon.ToLower() == _currentHttpContext.CurrentUser.Identity.Name.ToLower())))
                {
                    u = _repository.Query<User>(
                                            us => us.FilterCOBs,
                                            us => us.FilterOffices,
                                            us => us.FilterMembers,
                                            us => us.AdditionalCOBs,
                                            us => us.AdditionalOffices,
                                            us => us.AdditionalUsers,
                                            us => us.OpenTabs,
                                            us => us.TeamMemberships.Select(tm => tm.Team.RelatedRisks),
                                            us => us.TeamMemberships.Select(tm => tm.Team.Links),
                                            us => us.TeamMemberships.Select(tm => tm.Team),
                                            us => us.DefaultOrigOffice,
                                            us => us.PrimaryOffice,
                                            us => us.DefaultUW,
                                            us => us.Underwriter,
                                            us => us.DefaultUW.Underwriter
                                    ).SingleOrDefault(w => (w.DomainLogon == _currentHttpContext.CurrentUser.Identity.Name));

                    if (u.TeamMemberships != null)
                        u.TeamMemberships = u.TeamMemberships.Where(tm => tm.IsCurrent).OrderBy(tm => tm.ItemOrder).ToList();
                }

                if (u == null)
                {
                    u = new User { DomainLogon = _currentHttpContext.CurrentUser.Identity.Name };
                    u = _repository.Add(u);
                    _repository.SaveChanges();
                }

                if (_currentHttpContext.Context.Session != null)
                    _currentHttpContext.Context.Session["User"] = u;
            }

            return u;
        }
Пример #4
0
        protected User ResolveUser(string officeId,string fullname, string domainName, string underwriterCode)
        {
            var user = _consoleRepository.Query<User>(u => u.DomainLogon == DomainPrefix + @"\" + domainName).SingleOrDefault();
            if (user == null)
            {
                user = new User
                {
                    DomainLogon = DomainPrefix + @"\" + domainName, //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == officeId).Single(),
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };

                if (!string.IsNullOrEmpty(underwriterCode))
                {
                    user.UnderwriterCode = underwriterCode; //<??>
                    user.Underwriter =
                        _consoleRepository.Query<Underwriter>(uw => uw.Code == underwriterCode).SingleOrDefault() ??
                        new Underwriter
                            {
                                Name = fullname,
                                Code = underwriterCode,
                                CreatedBy = "InitialSetup",
                                CreatedOn = DateTime.Now,
                                ModifiedBy = "InitialSetup",
                                ModifiedOn = DateTime.Now
                            };
                }
                _consoleRepository.Add(user);
            }  
            return user;
        }
        public ActionResult DeleteUser(User user)
        {
            try
            {
                var result = AdminModuleManager.DeleteUser(user);

                return new JsonNetResult
                {
                    Data = result
                };
            }
			catch (Exception ex) // TODO: Remove
            {
                LogHandler.WriteLog(ex.ToString(), LogSeverity.Error, LogCategory.BusinessComponent);
                throw new HttpException(500, "Server Error");
            }

        }
        //public int EditUser(UserDto userDto)
        //{
        //    using (ConsoleRepository)
        //    {
        //        var user =
        //            ConsoleRepository.Query<User>();

        //        if (user == null)
        //            throw new ApplicationException("User to edit not found");
        //        // TODO: Throw new NullReferenceException(user)

        //        if (string.IsNullOrEmpty(userDto.UnderwriterId))
        //            throw new ApplicationException("Underwriter required");

                

        //        ConsoleRepository.Attach<User>(user);

                
             

        //        ConsoleRepository.SaveChanges();

        //        if (CurrentHttpContext.CurrentUser.Identity.Name.ToUpper() == user.DomainLogon.ToUpper())
        //            CurrentHttpContext.Context.Session["User"] = null;

        //        return user.Id;
        //    }
        //}

        public string DeleteUser(User user)
        {
            using (ConsoleRepository)
            {
                ConsoleRepository.Attach<User>(user);
                ConsoleRepository.Delete<User>(user);
                ConsoleRepository.SaveChanges();
                return "Successfully Deleted User";
            }
        }
        public int CreateUser(UserDto userDto)
        {
            using (ConsoleRepository)
            {
                var existingUser =
                    ConsoleRepository.Query<User>().FirstOrDefault(u => u.DomainLogon == userDto.DomainLogon);

                if (existingUser != null)
                    throw new ApplicationException("User already exists");

                var user = new User();
                user.DomainLogon = userDto.DomainLogon;
                user.IsActive = userDto.IsActive;
                

                if (userDto.TeamMemberships != null)
                {
                    var teamMembershipList = new List<TeamMembership>();
                    foreach (var newTeamM in userDto.TeamMemberships)
                    {
                        var team = ConsoleRepository.Query<Team>().FirstOrDefault(t => t.Id == newTeamM.Team.Id);
                        teamMembershipList.Add(new TeamMembership
                            {
                                User = user,
                                Team = team,
                                StartDate = DateTime.Now,
                                EndDate = null,
                                PrimaryTeamMembership = newTeamM.PrimaryTeamMembership
                            });
                    }
                    user.TeamMemberships = teamMembershipList;
                }

               

               

                ConsoleRepository.Add<User>(user);
                ConsoleRepository.SaveChanges();
                return user.Id;
            }
        }
        public static void SeedData(IConsoleRepository context)
        {
            var domainPrefix = global::Validus.Console.Properties.Settings.Default.DomainPrefix;

            
            
               


           
            var addUser1 = new User
                {
                    DomainLogon = domainPrefix + @"\DaviesA",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            ////developers


            var globalTim = new User
                {
                    DomainLogon = domainPrefix + @"\tim",
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            context.AddOrUpdate<User>(globalTim);

            var u2 = new User
                {
                    DomainLogon = domainPrefix + @"\baillief",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            context.AddOrUpdate<User>(u2);

            var u2b = new User
                {
                    DomainLogon = @"globaldev\baillief",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            context.AddOrUpdate<User>(u2b);


            var u6 = new User
                {
                    DomainLogon = @"TALBOTDEV\svcUKDEVTFSBuild",
                    
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
           
            context.AddOrUpdate<User>(u6);
            var u5 = new User
                {
                    DomainLogon = @"GLOBALDEV\anandarr",
                    
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
           
            context.AddOrUpdate<User>(u5);

            var u4 = new User
                {
                    DomainLogon = domainPrefix + @"\SheppaA",
                    
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            
            context.AddOrUpdate<User>(u4);

            var u3 = new User
                {
                    DomainLogon = domainPrefix + @"\MurrayE",
                   
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };

            var u = new User
                {
                    DomainLogon = domainPrefix + @"\seigelj",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            context.AddOrUpdate<User>(u);
            

            // Energy
            var energyUser1 = new User
                {
                    DomainLogon = domainPrefix + @"\McDonaldJ",
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; 
            var energyUser2 = new User
                {
                    DomainLogon = domainPrefix + @"\sarjeat",
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser3 = new User
                {
                    DomainLogon = domainPrefix + @"\MassieZ",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser4 = new User
                {
                    DomainLogon = domainPrefix + @"\CantwellJ",
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser5 = new User
                {
                    DomainLogon = domainPrefix + @"\GreenM",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser6 = new User
                {
                    DomainLogon = domainPrefix + @"\EwingtonJ",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser7 = new User
                {
                    DomainLogon = domainPrefix + @"\ShilingS",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser8 = new User
                {
                    DomainLogon = domainPrefix + @"\GarrettJ",
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser9 = new User
                {
                    DomainLogon = domainPrefix + @"\StoopE",
                    IsActive = true,
                    
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser10 = new User
                {
                    DomainLogon = domainPrefix + @"\KeoganA",
                   
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser11 = new User
                {
                    DomainLogon = domainPrefix + @"\ShawI",
                   
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser12 = new User
                {
                    DomainLogon = domainPrefix + @"\IsmailR",
                   
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser13 = new User
                {
                    DomainLogon = domainPrefix + @"\SibleyA",
                   
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser14 = new User
                {
                    DomainLogon = domainPrefix + @"\DaviesK",
                   
                    IsActive = true,
                   
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser15 = new User
                {
                    DomainLogon = domainPrefix + @"\orsoc",
                   
                    IsActive = true,
                  
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };
            var energyUser16 = new User
                {
                    DomainLogon = domainPrefix + @"\dempsef",
                  
                    IsActive = true,
                 
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                }; //, FilterCOBs = energyCobs };


            var energyTeamUsersList = new List<User>
                {
                    energyUser1,
                    energyUser2,
                    energyUser3,
                    energyUser4,
                    energyUser5,
                    energyUser6,
                    energyUser7,
                    energyUser8,
                    energyUser9,
                    energyUser10,
                    energyUser11,
                    energyUser12,
                    energyUser13,
                    energyUser14,
                    energyUser15,
                    energyUser16
                };

            // TeamList and Link List
            var linkList = CreateLinksList();

            var teamList = CreateTeamList();

            teamList[0].Links = new List<Link>();
            foreach (var link in linkList.GetRange(0, 3))
            {
                teamList[0].Links.Add(link);
            }

            teamList[1].Links = new List<Link>();
            foreach (var link in linkList)
            {
                teamList[1].Links.Add(link);
            }
            
           
            

           

            var energyTeamMemberships =
                energyTeamUsersList.Select(
                    energyTeamUser =>
                    new TeamMembership
                        {
                            PrimaryTeamMembership = true,
                            User = energyTeamUser,
                            Team = teamList[1],
                            IsCurrent = true,
                            StartDate = DateTime.Now,
                            EndDate = null,
                            CreatedBy = "InitialSetup",
                            CreatedOn = DateTime.Now,
                            ModifiedBy = "InitialSetup",
                            ModifiedOn = DateTime.Now
                        }).ToList();
            energyTeamMemberships.Add(new TeamMembership
                {
                    PrimaryTeamMembership = false,
                    Team = teamList[1],
                    User = u5,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                });

            var teamMemberships = new List<TeamMembership>
                {
                    new TeamMembership
                        {
                            User = u3,
                            Team = teamList[0],
                            IsCurrent = true,
                            StartDate = DateTime.Now,
                            EndDate = DateTime.Now.AddYears(4),
                            CreatedBy = "InitialSetup",
                            CreatedOn = DateTime.Now,
                            ModifiedBy = "InitialSetup",
                            ModifiedOn = DateTime.Now
                        },
                };

            var memb1 = new TeamMembership
                {
                    PrimaryTeamMembership = true,
                    Team = teamList[0],
                    User = u,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            var memb3 = new TeamMembership
                {
                    PrimaryTeamMembership = true,
                    Team = teamList[0],
                    User = u4,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            var memb2 = new TeamMembership
                {
                    PrimaryTeamMembership = true,
                    Team = teamList[0],
                    User = u2,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            var memb5 = new TeamMembership
                {
                    PrimaryTeamMembership = true,
                    Team = teamList[0],
                    User = u5,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            var memb6 = new TeamMembership
                {
                    PrimaryTeamMembership = true,
                    Team = teamList[0],
                    User = u6,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
            var memb4 = new TeamMembership
                {
                    PrimaryTeamMembership = true,
                    Team = teamList[0],
                    User = globalTim,
                    StartDate = DateTime.Now,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };

           

            teamList[0].Memberships = new List<TeamMembership> {memb1, memb2, memb4, memb3, memb5, memb6};

            foreach (var teamM in teamMemberships)
            {
                teamList[0].Memberships.Add(teamM);
            }

            teamList[1].Memberships = new List<TeamMembership>();
            foreach (var energyTeamMembership in energyTeamMemberships)
            {
                teamList[1].Memberships.Add(energyTeamMembership);
            }

            foreach (var team in teamList)
            {
                context.AddOrUpdate<Team>(team);
            }

            var templates = CreateTemplates();
            foreach (var template in templates)
            {
                context.Add<Template>(template);
            }

            var templatedPages = CreateTemplatedPages();
            foreach (var siteSection in templatedPages)
            {
                context.Add<TemplatedPage>(siteSection);
            }

            var pageTemplates = CreatePageTemplates(teamList, templates, templatedPages);
            foreach (var pageTemplate in pageTemplates)
            {
                context.Add<PageTemplate>(pageTemplate);
            }

        }
        public int CreateUser(UserDto userDto)
        {
            using (ConsoleRepository)
            {
                var existingUser =
                    ConsoleRepository.Query<User>().FirstOrDefault(u => u.DomainLogon == userDto.DomainLogon);

                if (existingUser != null)
                    throw new ApplicationException("User already exists");

                var user = new User();
                user.DomainLogon = userDto.DomainLogon;
                user.IsActive = userDto.IsActive;
                user.UnderwriterCode = userDto.UnderwriterId;
                user.NonLondonBroker = userDto.NonLondonBroker;
                user.PrimaryOffice =
                    ConsoleRepository.Query<Office>().FirstOrDefault(o => o.Id == userDto.PrimaryOffice.Id);
                user.DefaultOrigOffice =
                    ConsoleRepository.Query<Office>().FirstOrDefault(o => o.Id == userDto.DefaultOrigOffice.Id);
                user.DefaultUW = ConsoleRepository.Query<User>().FirstOrDefault(d => d.Id == userDto.DefaultUW.Id);

                if (userDto.TeamMemberships != null)
                {
                    var teamMembershipList = new List<TeamMembership>();
                    foreach (var newTeamM in userDto.TeamMemberships)
                    {
                        var team = ConsoleRepository.Query<Team>().FirstOrDefault(t => t.Id == newTeamM.Team.Id);
                        teamMembershipList.Add(new TeamMembership
                            {
                                User = user,
                                Team = team,
                                StartDate = DateTime.Now,
                                EndDate = null,
                                PrimaryTeamMembership = newTeamM.PrimaryTeamMembership
                            });
                    }
                    user.TeamMemberships = teamMembershipList;
                }

                if (userDto.FilterCOBs != null)
                {
                    var filterCobList = new List<COB>();
                    foreach (var newFilterC in userDto.FilterCOBs)
                    {
                        var cob = ConsoleRepository.Query<COB>().FirstOrDefault(c => c.Id == newFilterC.Id);
                        filterCobList.Add(cob);
                    }
                    user.FilterCOBs = filterCobList;
                }

                if (userDto.FilterOffices != null)
                {
                    var filterOfficeList = new List<Office>();
                    foreach (var newFilterO in userDto.FilterOffices)
                    {
                        var office = ConsoleRepository.Query<Office>().FirstOrDefault(c => c.Id == newFilterO.Id);
                        filterOfficeList.Add(office);
                    }
                    user.FilterOffices = filterOfficeList;
                }

                if (userDto.FilterMembers != null)
                {
                    var filterMembersList = new List<User>();
                    foreach (var newFilterM in userDto.FilterMembers)
                    {
                        var member = ConsoleRepository.Query<User>().FirstOrDefault(c => c.Id == newFilterM.Id);
                        filterMembersList.Add(member);
                    }
                    user.FilterMembers = filterMembersList;
                }

                if (userDto.AdditionalCOBs != null)
                {
                    var additionalCobList = new List<COB>();
                    foreach (var newAdditionalC in userDto.AdditionalCOBs)
                    {
                        var cob = ConsoleRepository.Query<COB>().FirstOrDefault(c => c.Id == newAdditionalC.Id);
                        additionalCobList.Add(cob);
                    }
                    user.AdditionalCOBs = additionalCobList;
                }

                if (userDto.AdditionalOffices != null)
                {
                    var additionalOffices = new List<Office>();
                    foreach (var newAdditionalO in userDto.AdditionalOffices)
                    {
                        var office = ConsoleRepository.Query<Office>().FirstOrDefault(c => c.Id == newAdditionalO.Id);
                        additionalOffices.Add(office);
                    }
                    user.AdditionalOffices = additionalOffices;
                }

                if (userDto.AdditionalUsers != null)
                {
                    var additionalUserList = new List<User>();
                    foreach (var newAdditionalU in userDto.AdditionalUsers)
                    {
                        var additionalUser =
                            ConsoleRepository.Query<User>().FirstOrDefault(c => c.Id == newAdditionalU.Id);
                        additionalUserList.Add(additionalUser);
                    }
                    user.AdditionalUsers = additionalUserList;
                }

                // Add Team FilterCOBs and FilterOffices
                if (userDto.TeamMemberships != null)
                    AddTeamFilters(userDto.TeamMemberships.Select(tm => tm.Team.Id), user, null);

                ConsoleRepository.Add<User>(user);
                ConsoleRepository.SaveChanges();
                return user.Id;
            }
        }
        private static void SetUserDto(UserDto userDto, User user, IConsoleRepository _consoleRepository)
        {
            userDto.Id = user.Id;
            userDto.DomainLogon = user.DomainLogon;
            userDto.IsActive = user.IsActive;

            // Currently Selected Values
            userDto.DefaultOrigOffice = (user.DefaultOrigOffice != null)
                                            ? new OfficeDto
                                                {
                                                    Id = user.DefaultOrigOffice.Id,
                                                    Title = user.DefaultOrigOffice.Name
                                                }
                                            : null;
            userDto.PrimaryOffice = (user.PrimaryOffice != null)
                                        ? new OfficeDto { Id = user.PrimaryOffice.Id, Title = user.PrimaryOffice.Name }
                                        : null;
            userDto.DefaultUW = (user.DefaultUW != null)
                                    ? new UserDto { Id = user.DefaultUW.Id, DomainLogon = user.DefaultUW.DomainLogon }
                                    : null;
            userDto.UnderwriterId = user.UnderwriterCode;
            userDto.NonLondonBroker = user.NonLondonBroker; 

            OfficeDto officeDto = null;
            var officeList = _consoleRepository.Query<Office>().ToList();
            if (user.DefaultOrigOffice != null)
            {
                var defaultOrigOfficeList = new List<OfficeDto>();
                defaultOrigOfficeList.Add(userDto.DefaultOrigOffice);

                defaultOrigOfficeList.AddRange(
                    officeList.Where(o => o.Id != userDto.DefaultOrigOffice.Id)
                    .Select(o => new OfficeDto {Title = o.Name, Id = o.Id}
                    ));
                userDto.DefaultOrigOfficeList = defaultOrigOfficeList.OrderBy(o=>o.Title).ToList();
            }

            if (user.PrimaryOffice != null)
            {
                var primaryOfficeList = new List<OfficeDto>();
                primaryOfficeList.Add(userDto.PrimaryOffice);

                primaryOfficeList.AddRange(
                    officeList.Where(o => o.Id != userDto.PrimaryOffice.Id)
                              .Select(o => new OfficeDto() { Id = o.Id, Title = o.Name }));

                userDto.PrimaryOfficeList = primaryOfficeList.OrderBy(o => o.Title).ToList();
            }

            if (userDto.DefaultOrigOfficeList == null || userDto.PrimaryOfficeList == null)
            {
                var officeDtoList = officeList.ToList().Select(o =>
                    {
                        return new OfficeDto { Id = o.Id, Title = o.Name };
                    }).OrderBy(o => o.Title).ToList();

                if (userDto.DefaultOrigOfficeList == null)
                    userDto.DefaultOrigOfficeList = officeDtoList;

                if (userDto.PrimaryOfficeList == null)
                    userDto.PrimaryOfficeList = officeDtoList;
            }

            if (userDto.DefaultUW != null)
            {
                var defaultUWDtoList = new List<UserDto>();
                defaultUWDtoList.Add(userDto.DefaultUW);

                UserDto defaultUW = null;
                defaultUWDtoList.AddRange(_consoleRepository.Query<User>().OrderBy(u=>u.DomainLogon).ToList().Select(u =>
                    {
                        if (u.Id != userDto.DefaultUW.Id)
                            defaultUW = new UserDto { Id = u.Id, DomainLogon = u.DomainLogon };
                        return defaultUW;
                    }).ToList());

                userDto.DefaultUWList = defaultUWDtoList;
            }

            if (userDto.DefaultUW == null)
            {
                var defaultUWDtoList = _consoleRepository.Query<User>().OrderBy(u => u.DomainLogon).ToList().Select(u =>
                    {
                        return new UserDto { Id = u.Id, DomainLogon = u.DomainLogon };
                    }).ToList();
                userDto.DefaultUWList = defaultUWDtoList;
            }


            userDto.TeamMemberships = (user.TeamMemberships != null && user.TeamMemberships.Any())
                                          ? user.TeamMemberships.Where(m => m.IsCurrent).OrderBy(tm=>tm.Team.Title).ToList().ConvertAll(tm =>
                new TeamMembershipDto
                {
                    TeamId = tm.TeamId,
                    EndDate = tm.EndDate,
                    Id = tm.Id,
                    PrimaryTeamMembership = tm.PrimaryTeamMembership,
                    IsCurrent = tm.IsCurrent,
                    StartDate = tm.StartDate,
                    Team = new TeamDto
                    {
                        Id = tm.Team.Id,
                        Title = tm.Team.Title,
                        DefaultDomicile = tm.Team.DefaultDomicile,
                        DefaultMOA = tm.Team.DefaultMOA,
                        PricingActuary = tm.Team.PricingActuary,
                        QuoteExpiryDaysDefault = tm.Team.QuoteExpiryDaysDefault,
                        DefaultPolicyType = tm.Team.DefaultPolicyType
                    }
                }) : null;

            userDto.AdditionalUsers = (user.AdditionalUsers != null && user.AdditionalUsers.Any())
                                          ? user.AdditionalUsers.OrderBy(u=>u.DomainLogon).ToList()
                                                .ConvertAll(ad => new UserDto { Id = ad.Id, DomainLogon = ad.DomainLogon })
                                          : null;
            userDto.AdditionalCOBs = (user.AdditionalCOBs != null && user.AdditionalCOBs.Any())
                                         ? user.AdditionalCOBs.OrderBy(cob => cob.Narrative).ToList()
                                               .ConvertAll(cob => new COBDto { Id = cob.Id, Narrative = cob.Narrative })
                                         : null;
            userDto.FilterCOBs = (user.FilterCOBs != null && user.FilterCOBs.Any())
                                     ? user.FilterCOBs.OrderBy(cob => cob.Narrative).ToList()
                                           .ConvertAll(cob => new COBDto { Id = cob.Id, Narrative = cob.Narrative })
                                     : null;
            userDto.AdditionalOffices = (user.AdditionalOffices != null && user.AdditionalOffices.Any())
                                            ? user.AdditionalOffices.OrderBy(o => o.Name).ToList()
                                                  .ConvertAll(o => new OfficeDto { Id = o.Id, Title = o.Name })
                                            : null;
            userDto.FilterMembers = (user.FilterMembers != null && user.FilterMembers.Any())
                                        ? user.FilterMembers.OrderBy(u => u.DomainLogon).ToList()
                                              .ConvertAll(fm => new UserDto { Id = fm.Id, DomainLogon = fm.DomainLogon })
                                        : null;
            userDto.FilterOffices = (user.FilterOffices != null && user.FilterOffices.Any())
                                        ? user.FilterOffices.OrderBy(o => o.Name).ToList()
                                              .ConvertAll(fo => new OfficeDto { Id = fo.Id, Title = fo.Name })
                                        : null;

            var requiredData = GetRequiredDataEditUser(user.DomainLogon, _consoleRepository);

            userDto.AllAdditionalUsers = requiredData.AllAdditionalUsers;
            userDto.AllAdditionalCOBs = requiredData.AllAdditionalCOBs;
            userDto.AllAdditionalOffices = requiredData.AllAdditionalOffices;
            userDto.AllFilterCOBs = requiredData.AllFilterCOBs;
            userDto.AllFilterMembers = requiredData.AllFilterMembers;
            userDto.AllFilterOffices = requiredData.AllFilterOffices;
            userDto.AllTeamMemberships = requiredData.AllTeamMemberships;
        }
 // ReSharper restore InconsistentNaming
 public override void SetUpUser()
 {
     
     User02 = ResolveUser("LON", "George Goodliffe", "goodlig", "GFG");
     User03 = ResolveUser("LON", "James Bamford", "bamfordj", "JRB");
     
     User05 = ResolveUser("LON", "Andrew Bickmore", "BickmoA", "ARB");
     User06 = ResolveUser("LON", "Olivia Wright", "WrightO", "OJW");
     User07 = ResolveUser("SNG", "David Morris", "MorrisD", "DM");
     User08 = ResolveUser("DUB", "Matthew Goad", "Matthew", "MWG");
     User09 = ResolveUser("LON", "Patrick Sheriff", "SheriffP", "");
   
 }
Пример #12
0
 // ReSharper restore InconsistentNaming
 public override void SetUpUser()
 {
     User01 = ResolveUser("LON", "Ian Peterson", "petersi", "IRP");
     User02 = ResolveUser("LON", "Holly Kadwill", "KadwillH", "");
     User03 = ResolveUser("LON", "Alex MacLennan", "MacLenna", "AWM");
     User04 = ResolveUser("LON", "Jeannie Schreiner", "SchreiJ", "");
     User05 = ResolveUser("NYC", "Ella Stoop", "stoope", "ERS");
     User06 = ResolveUser("NYC", "Michelle Gatti", "GattiMi", "");
     User07 = ResolveUser("SNG", "John Ewington", "EwingJ", "JDE");
     User08 = ResolveUser("SNG", "Simon Wilmot-Smith", "wilmots", "SWS");
     User09 = ResolveUser("SNG", "Janita Leu", "LeuJa", "JTL");
     User10 = ResolveUser("SNG", "David Morris", "MorrisD", "DM ");
     User11 = ResolveUser("SNG", "Li Lin Kea", "keall", "");
     User12 = ResolveUser("SNG", "Shiling Su", "SuS", "");
     User13 = ResolveUser("DUB", "James Garratt", "GarrattJ", "JCG");
     User14 = ResolveUser("DUB", "Samuel Raj", "rajsamu", "SQR");
     User15 = ResolveUser("DUB", "Raghd Coussa", "CoussaR", "");
     User16 = ResolveUser("MIA", "Luis Sonville", "sonvill", "LAS");
     User17 = ResolveUser("MIA", "Diego I. San Martin", "SanmarD", "");
 } 
Пример #13
0
 // ReSharper restore InconsistentNaming
 public override void SetUpUser()
 {
     //London	David Silk  DZS
     User01 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\SilkD").SingleOrDefault();
     if (User01 == null)
     {
         User01 = new User
         {
             DomainLogon = DomainPrefix + @"\SilkD", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "DZS",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw=>uw.Code=="DZS").SingleOrDefault()?? new Underwriter
             {
                 Name = "David Silk",
                 Code = "DZS",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User01);
     }
     //London	Emma Thornton-Jones ETJ
     User02 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\ThornE").SingleOrDefault();
     if (User02 == null)
     {
         User02 = new User
         {
             DomainLogon = DomainPrefix + @"\ThornE", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "ETJ",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "ETJ").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Emma Thornton-Jones",
                 Code = "ETJ",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User02);
     }
     //London	Alfie Hibbard   
     User03 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\HibbarA").SingleOrDefault();
     if (User03 == null)
     {
         User03 = new User
         {
             DomainLogon = DomainPrefix + @"\HibbarA", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User03);
     }
     //London	Brian James BZJ
     User04 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\JamesBr").SingleOrDefault();
     if (User04 == null)
     {
         User04 = new User
         {
             DomainLogon = DomainPrefix + @"\JamesBr", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "BZJ",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "BZJ").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Brian James",
                 Code = "BZJ",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User04);
     }
     //London	Joanne Fennell JZF
     User05 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\FennellJ").SingleOrDefault();
     if (User05 == null)
     {
         User05 = new User
         {
             DomainLogon = DomainPrefix + @"\FennellJ", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "AYD",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "JZF").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Joanne Fennell",
                 Code = "JZF",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User05);
     }
     //London	Ed Colclough    EWC
     User06 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\ColclouC").SingleOrDefault();
     if (User06 == null)
     {
         User06 = new User
         {
             DomainLogon = DomainPrefix + @"\ColclouC", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "AYD",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "EWC").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Ed Colclough",
                 Code = "EWC",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User06);
     }
     //London	Graham McManus  GTM
     User07 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\McManuG").SingleOrDefault();
     if (User07 == null)
     {
         User07 = new User
         {
             DomainLogon = DomainPrefix + @"\McManuG", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "AYD",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "GTM").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Graham McManus",
                 Code = "GTM",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User07);
     }
     //Singapore	Janita Leu  JTL
     User08 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\LeuJa").SingleOrDefault();
     if (User08 == null)
     {
         User08 = new User
         {
             DomainLogon = DomainPrefix + @"\LeuJa", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "JTL",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "SNG").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "JTL").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Janita Leu",
                 Code = "JTL",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User08);
     }
     //Singapore	Li Lin Kea
     User09 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\keall").SingleOrDefault();
     if (User09 == null)
     {
         User09 = new User
         {
             DomainLogon = DomainPrefix + @"\keall", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "SNG").Single(),
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User09);
     }
     //Singapore	Sharon Seah SHS
     User10 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\SeahS").SingleOrDefault();
     if (User10 == null)
     {
         User10 = new User
         {
             DomainLogon = DomainPrefix + @"\SeahS", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "SHS",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "SNG").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "SHS").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Sharon Seah",
                 Code = "SHS",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User10);
     }
     //Singapore	Simon Wilmot-Smith  SWS
     User11 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\wilmots").SingleOrDefault();
     if (User11 == null)
     {
         User11 = new User
         {
             DomainLogon = DomainPrefix + @"\wilmots", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "SWS",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "SNG").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "SWS").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Simon Wilmot-Smith",
                 Code = "SWS",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User11);
     }
     //New York	Ella Stoop  ERS
     User12 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\stoope").SingleOrDefault();
     if (User12 == null)
     {
         User12 = new User
         {
             DomainLogon = DomainPrefix + @"\stoope", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "ERS",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "NYC").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "ERS").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Ella Stoop",
                 Code = "ERS",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User12);
     }
     //Miami	Luis Sonville   LAS
     User13 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\sonvill").SingleOrDefault();
     if (User13 == null)
     {
         User13 = new User
         {
             DomainLogon = DomainPrefix + @"\sonvill", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             UnderwriterCode = "LAS",//<??>
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "MIA").Single(),
             Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "LAS").SingleOrDefault() ?? new Underwriter
             {
                 Name = "Luis Sonville",
                 Code = "LAS",
                 CreatedBy = "InitialSetup",
                 CreatedOn = DateTime.Now,
                 ModifiedBy = "InitialSetup",
                 ModifiedOn = DateTime.Now
             },
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User13);
     }
     //New York 	Michelle Gatti
     User14 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\GattiMi").SingleOrDefault();
     if (User14 == null)
     {
         User14 = new User
         {
             DomainLogon = DomainPrefix + @"\GattiMi", //<??>
             AdditionalOffices = new List<Office> { },
             AdditionalUsers = new List<User> { },
             IsActive = true,
             OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
             DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
             CreatedBy = "InitialSetup",
             CreatedOn = DateTime.Now,
             ModifiedBy = "InitialSetup",
             ModifiedOn = DateTime.Now
         };
         _consoleRepository.Add(User14);
     }
 } 
Пример #14
0
        // ReSharper restore InconsistentNaming
        public override void SetUpUser()
        {
            User01 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\DaviAnn").SingleOrDefault();
            if (User01 == null)
            {
                User01 = new User
                {
                    DomainLogon = DomainPrefix + @"\DaviAnn", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    UnderwriterCode = "AYD",//<??>
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
                    Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "AYD").SingleOrDefault() ?? new Underwriter
                    {
                        Name = "Alex Colquhoun",
                        Code = "AYD",
                        CreatedBy = "InitialSetup",
                        CreatedOn = DateTime.Now,
                        ModifiedBy = "InitialSetup",
                        ModifiedOn = DateTime.Now
                    },
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User01);
            }

            User02 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\maccolm").SingleOrDefault();
            if (User02 == null)
            {
                User02 = new User
                {
                    DomainLogon = DomainPrefix + @"\maccolm", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    UnderwriterCode = "MDM",//<??>
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
                    Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "MDM").SingleOrDefault() ?? new Underwriter
                    {
                        Name = "Mike MacColl",
                        Code = "MDM",
                        CreatedBy = "InitialSetup",
                        CreatedOn = DateTime.Now,
                        ModifiedBy = "InitialSetup",
                        ModifiedOn = DateTime.Now
                    },
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User02);
            }

            User03 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\carpene").SingleOrDefault();
            if (User03 == null)
            {
                User03 = new User
                {
                    DomainLogon = DomainPrefix + @"\carpene", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    UnderwriterCode = "EJC",//<??>
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
                    Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "EJC").SingleOrDefault() ?? new Underwriter
                    {
                        Name = "Edward Carpenter",
                        Code = "EJC",
                        CreatedBy = "InitialSetup",
                        CreatedOn = DateTime.Now,
                        ModifiedBy = "InitialSetup",
                        ModifiedOn = DateTime.Now
                    },
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User03);
            }

            User04 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\ewenb").SingleOrDefault();
            if (User04 == null)
            {
                User04 = new User
                {
                    DomainLogon = DomainPrefix + @"\ewenb", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User04);
            }

            /* This user is not showong in ADS*/
            User05 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\PalmerEl").SingleOrDefault();
            if (User05 == null)
            {
                User05 = new User
                {
                    DomainLogon = DomainPrefix + @"\PalmerEl", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "LON").Single(),
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User05);
            }

            User06 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\stoope").SingleOrDefault();
            if (User06 == null)
            {
                User06 = new User
                {
                    DomainLogon = DomainPrefix + @"\stoope", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    UnderwriterCode = "ERS",//<??>
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "NYC").Single(),
                    Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "ERS").SingleOrDefault() ?? new Underwriter
                    {
                        Name = "Ella Stoop",
                        Code = "ERS",
                        CreatedBy = "InitialSetup",
                        CreatedOn = DateTime.Now,
                        ModifiedBy = "InitialSetup",
                        ModifiedOn = DateTime.Now
                    },
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User06);
            }

            User07 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\wilmots").SingleOrDefault();
            if (User07 == null)
            {
                User07 = new User
                {
                    DomainLogon = DomainPrefix + @"\wilmots", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    UnderwriterCode = "SWS",//<??>
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "SNG").Single(),
                    Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "SWS").SingleOrDefault() ?? new Underwriter
                    {
                        Name = "Simon Wilmot-Smith",
                        Code = "SWS",
                        CreatedBy = "InitialSetup",
                        CreatedOn = DateTime.Now,
                        ModifiedBy = "InitialSetup",
                        ModifiedOn = DateTime.Now
                    },
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User07);
            }

            User08 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\GarrattJ").SingleOrDefault();
            if (User08 == null)
            {
                User08 = new User
                {
                    DomainLogon = DomainPrefix + @"\GarrattJ", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    UnderwriterCode = "JCG",//<??>
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "DUB").Single(),
                    Underwriter = _consoleRepository.Query<Underwriter>(uw => uw.Code == "JCG").SingleOrDefault() ?? new Underwriter
                    {
                        Name = "James Garratt",
                        Code = "JCG",
                        CreatedBy = "InitialSetup",
                        CreatedOn = DateTime.Now,
                        ModifiedBy = "InitialSetup",
                        ModifiedOn = DateTime.Now
                    },
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User08);
            }

            User09 = _consoleRepository.Query<User>(user => user.DomainLogon == DomainPrefix + @"\GattiMi").SingleOrDefault();
            if (User09 == null)
            {
                User09 = new User
                {
                    DomainLogon = DomainPrefix + @"\GattiMi", //<??>
                    AdditionalOffices = new List<Office> { },
                    AdditionalUsers = new List<User> { },
                    IsActive = true,
                    OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                    DefaultOrigOffice = _consoleRepository.Query<Office>(off => off.Id == "NYC").Single(),
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                };
                _consoleRepository.Add(User09);
            }

        } 
Пример #15
0
        public static void SeedData(IConsoleRepository context)
        {
            var domainPrefix = global::Validus.Console.Properties.Settings.Default.DomainPrefix;

            var AG = new COB { Id = "AG", Narrative = "Direct - Property - Construction", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            context.AddOrUpdate<COB>(AG);
            var AR = new COB { Id = "AR", Narrative = "Direct - Property - Rig", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            context.AddOrUpdate<COB>(AR);
            var AT = new COB { Id = "AT", Narrative = "Direct - Property - Hull", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            context.AddOrUpdate<COB>(AT);
            var CC = new COB { Id = "CC", Narrative = "Direct - Casualty - Construction", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            context.AddOrUpdate<COB>(CC);


            var c = new COB { Id = "CA", Narrative = "Cargo", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            context.AddOrUpdate<COB>(c);

            var c1 = new COB { Id = "AD", Narrative = "Direct - Property - Contingency", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            context.AddOrUpdate<COB>(c1);

            var userWriter1 = new Underwriter
            {
                Name = "Alex Colquhoun",
                Code = "JAC",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            context.AddOrUpdate<Underwriter>(userWriter1);

            var userWriter2 = new Underwriter
            {
                Name = "Alexandra Davies",
                Code = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            context.AddOrUpdate<Underwriter>(userWriter2);

            var underWriter = new User
            {
                DomainLogon = domainPrefix + @"\defaultunderwriter",
                IsActive = true,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now,
                UnderwriterCode = "AED"
            };
            context.AddOrUpdate<User>(underWriter);

            var quoteSheetPerson = new User
            {
                DomainLogon = domainPrefix + @"\quoteSheetPerson",
                IsActive = true,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now,
                UnderwriterCode = "AED"
            };
            context.AddOrUpdate<User>(quoteSheetPerson);

            // Note - SubmissionStatus - SUBMITTED, QUOTED, FIRM ORDER, DECLINED, WITHDRAWN, ADDL INFO REQST, FIRM ORDER REQST, OTHER OFFICE
            var masterQuote = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "ADC118440A110006", //"AJH105451C12", // Policy Ref
                SubmissionStatus = "SUBMITTED",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 25000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = true,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                //OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var q = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "ADC118440A110006",
                SubmissionStatus = "QUOTED",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 60000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = false,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                //OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var q3 = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "AJE125510B12",
                SubmissionStatus = "DECLINED",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 360000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = false,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                //OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var q4master = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "AJE125510B12",
                SubmissionStatus = "SUBMITTED",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 100000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = true,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                //OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var q5 = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "AJE125510B12",
                SubmissionStatus = "SUBMITTED",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 1000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = false,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                // OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var q6master = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "AJY087986D12",
                SubmissionStatus = "SUBMITTED",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 890000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = true,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                //OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var q7master = new Quote
            {
                AccountYear = 2013,
                COB = c,
                COBId = c.Id,
                Currency = "USD",
                //<??>
                //QuoteCreated = DateTime.Now,
                //QuoteLastModified = DateTime.Now,
                //QuoteLastModifiedBy = underWriter,
                //QuoteCreatedBy = underWriter,
                SubscribeReference = "AJJ144268A12",
                SubmissionStatus = "ADDL INFO REQST",
                EntryStatus = "PARTIAL",
                PolicyType = "NONMARINE",
                TechnicalPricingMethod = "MODEL",
                QuotedPremium = 39000,
                FacilityRef = "ADC118440A11",
                IsSubscribeMaster = true,
                InceptionDate = DateTime.Now,
                ExpiryDate = DateTime.Now.AddYears(1),
                QuoteExpiryDate = DateTime.Now.AddDays(30),
                //OriginatingOfficeId = "LON",
                MOA = "FA",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };


            var quoteSheet1 = new QuoteSheet { Title = "QS_1", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-1), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet2 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-2), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet3 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-3), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet4 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-4), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet5 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-5), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet6 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-6), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet7 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-7), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var quoteSheet8 = new QuoteSheet { Title = "QS_2", Guid = Guid.NewGuid(), IssuedBy = quoteSheetPerson, IssuedDate = DateTime.Now.AddDays(-8), ObjectStore = "Underwriting", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };

            var ov = new OptionVersion
            {
                Title = "Version 1",
                VersionNumber = 1,
                Quotes = new List<Quote> { q, masterQuote },
                QuoteSheets =
                    new List<QuoteSheet>
                                {
                                    quoteSheet1,
                                    quoteSheet2,
                                    quoteSheet3,
                                    quoteSheet4,
                                    quoteSheet5,
                                    quoteSheet6
                                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var ov2 = new OptionVersion
            {
                Title = "Version 2",
                VersionNumber = 2,
                Quotes = new List<Quote> { q3, q4master, q5 },
                QuoteSheets = new List<QuoteSheet> { quoteSheet7, quoteSheet8 },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };


            var ov3 = new OptionVersion
            {
                Title = "Version 3",
                VersionNumber = 1,
                Quotes = new List<Quote> { q6master },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };


            var ov4 = new OptionVersion
            {
                Title = "Version 4",
                VersionNumber = 1,
                Quotes = new List<Quote> { q7master },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var o1 = new Option
            {
                Title = "Option 1",
                Comments =
                    "There is a known issue with this technique where creating databases is not supported on SqlClient provider. Other providers may or may not support this functionality depending on implementation. In general, because of that it is recommended to use unwrapped connections when using DDL APIs (CreateDatabase, DeleteDatabase, DatabaseExists()) as demonstrated in the sample.",
                OptionVersions = new List<OptionVersion> { ov, ov2 },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var o2 = new Option
            {
                Title = "Option 2",
                Comments =
                    "In order to efficiently manage tracing for the application we need to create a central factory class which will create ObjectContext instances for us. This is the place where we will create tracing provider connection and use it to instantiate ObjectContext. Assuming our Object Context class is called MyContainer, the factory class will be called MyContainerFactory and will have a method called CreateContext, so the usage becomes:",
                OptionVersions = new List<OptionVersion> { ov3 },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var o3 = new Option
            {
                Title = "Option 3",
                Comments =
                    "Entity Framework/Code First feature released as part of Feature CTP 3 can work with any EF-enabled data provider. In addition to regular providers which target databases, it is possible to use wrapping providers which can add interesting functionality, such as caching and tracing. In this post I’m going to explain how to use EFTracingProvider to produce diagnostic trace of all SQL commands executed by EF in Code First.",
                OptionVersions = new List<OptionVersion> { ov4 },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var lon = new Office
            {
                Id = "LON",
                Name = "London",
                Title = "Talbot Underwriting Ltd",
                Footer = "Talbot Underwriting Ltd is Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority.",
                Address = new Address
                {
                    AddressLine1 = "60 Threadneedle Street",
                    AddressLine2 = "",
                    City = "London",
                    ZipPostalCode = "EC2R 8HP",
                    Country = "England",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var mia = new Office
            {
                Id = "MIA",
                Name = "Miami",
                Title = "Validus Reaseguros, Inc.",
                Address = new Address
                {
                    AddressLine1 = "2601 South Bayshore Drive",
                    AddressLine2 = "Suite 1850, Coconut Grove",
                    City = "Miami",
                    StateProvinceRegion = "Florida",
                    ZipPostalCode = "33133",
                    Country = "U.S.A.",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            var lab = new Office
            {
                Id = "LAB",
                Name = "Labuan",
                Title = "Talbot Risk Services (Labuan) Pte Ltd",
                Address = new Address
                {
                    AddressLine1 = "Brighton Place, Ground Floor,",
                    AddressLine2 = "No. U0215, Jalan Bahasa,",
                    City = "Labuan FT",
                    Country = "Malaysia",
                    ZipPostalCode = "87000",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            var nyc = new Office
            {
                Id = "NYC",
                Name = "New York",
                Title = "Talbot Underwriting (US) Ltd. ",
                Address = new Address
                {
                    AddressLine1 = "48 Wall Street 17th Floor",
                    AddressLine2 = "",
                    Country = "USA",
                    StateProvinceRegion = "NY",
                    City = "New York",
                    ZipPostalCode = "10005",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            var sng = new Office
            {
                Id = "SNG",
                Name = "Singapore",
                Title = "Talbot Risk Services Pte Ltd",
                Address = new Address
                {
                    AddressLine1 = "8 Marina View #14-01",
                    AddressLine2 = "Asia Square Tower 1",
                    City = "Singapore",
                    ZipPostalCode = "018960",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            var dubai = new Office
            {
                Id = "DUB",
                Name = "Dubai",
                Title = "Talbot Underwriting (MENA) Ltd",
                Footer = "Underwriting Risk Services (Middle East) Ltd ('URSME') is authorised and regulated by the Dubai Financial Services Authority.",
                Address = new Address
                {
                    AddressLine1 = "Dubai International Financial Centre",
                    AddressLine2 = "Gate Village Building 10, Level 5",
                    City = "Dubai",
                    Country = "UAE",
                    ZipPostalCode = "PO Box 506809",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            var usrl = new Office
            {
                Id = "URS",
                Name = "URSL",
                Title = "Talbot Underwriting Risk Services Ltd",
                Footer = "Talbot Underwriting Risk Services Ltd is an appointed representative of Talbot Underwriting Ltd which is Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority.",
                Address = new Address
                {
                    AddressLine1 = "60 Threadneedle Street",
                    AddressLine2 = "",
                    City = "London",
                    Country = "England",
                    ZipPostalCode = "EC2R 8HP",
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now
                },
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            context.AddOrUpdate<Office>(lon);
            context.AddOrUpdate<Office>(mia);
            context.AddOrUpdate<Office>(lab);
            context.AddOrUpdate<Office>(nyc);
            context.AddOrUpdate<Office>(sng);
            context.AddOrUpdate<Office>(dubai);
            context.AddOrUpdate<Office>(usrl);

            //var userWriter1 = new Underwriter
            //{
            //    Name = "Alex Colquhoun",
            //    Code = "JAC",
            //    CreatedBy = "InitialSetup",
            //    CreatedOn = DateTime.Now,
            //    ModifiedBy = "InitialSetup",
            //    ModifiedOn = DateTime.Now
            //};
            //context.AddOrUpdate<Underwriter>(userWriter1);

            //userWriter2 = new Underwriter
            //{
            //    Name = "Alexandra Davies",
            //    Code = "AED",
            //    CreatedBy = "InitialSetup",
            //    CreatedOn = DateTime.Now,
            //    ModifiedBy = "InitialSetup",
            //    ModifiedOn = DateTime.Now
            //};
            //context.AddOrUpdate<Underwriter>(userWriter2);


            var submissionTypes = new List<SubmissionType>
                {
                    new SubmissionType { Id = "EN", Title = "EN Submission" },
                    new SubmissionType { Id = "PV", Title = "PV Submission" },
                    new SubmissionType { Id = "FI", Title = "FI Submission" },
                    new SubmissionType { Id = "CA", Title = "CA Submission" },
                    new SubmissionType { Id = "HM", Title = "HM Submission" },
                    new SubmissionType { Id = "ME", Title = "ME Submission" },
                };

            foreach (var submissionType in submissionTypes)
            {
                context.AddOrUpdate<SubmissionType>(submissionType);
            }


            var submission = new Submission
            {
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now,
                InsuredName = "- N/A",
                BrokerCode = "1111",
                BrokerPseudonym = "AAA",
                BrokerSequenceId = 822,
                InsuredId = 182396,
                Brokerage = 1,
                BrokerContact = "ALLAN MURRAY",
                UnderwriterCode = "AED",
                UnderwriterContactCode = "JAC",
                QuotingOfficeId = "LON",
                Leader = "AG",
                Domicile = "AD",
                Title = "Seed Submission",
                SubmissionTypeId = submissionTypes[0].Id,

                Options = new List<Option>{
                        new Option { 
                            CreatedOn = DateTime.Now,
                            ModifiedBy = "InitialSetup",
                            ModifiedOn = DateTime.Now,
                            Id = 1, 
                            Title = "Seed Submission",
                            OptionVersions = new List<OptionVersion>{
                                new OptionVersion { 
                                    OptionId = 0, 
                                    VersionNumber = 0, 
                                    Comments = "OptionVersion Comments", 
                                    Title = "Unit Test Submission", 
                                    CreatedBy = "InitialSetup",

                                    CreatedOn = DateTime.Now,
                                    ModifiedBy = "InitialSetup",
                                    ModifiedOn = DateTime.Now,
                                    Quotes = new List<Quote>
                                        {
                                            new Quote
                                            { 
                                            COBId = "AD", 
                                            MOA = "FA", 
                                            InceptionDate = DateTime.Now, 
                                            ExpiryDate = DateTime.Now.AddMonths(12), 
                                            QuoteExpiryDate = DateTime.Now, 
                                            AccountYear = 2013, 
                                            Currency = "USD", 
                                            LimitCCY = "USD", 
                                            ExcessCCY = "USD", 
                                            CorrelationToken = Guid.NewGuid(), 
                                            IsSubscribeMaster = true, 
                                            PolicyType = "NONMARINE", 
                                            EntryStatus = "PARTIAL", 
                                            SubmissionStatus = "SUBMITTED", 
                                            TechnicalPricingBindStatus = "PRE", 
                                            TechnicalPricingPremiumPctgAmt = "AMT", 
                                            TechnicalPricingMethod = "UW" ,
                                            OriginatingOfficeId = "LON",
                                            //Energy_QuoteExtraProperty1 = "Seed Val...",

                                            CreatedBy = "InitialSetup",
                                            CreatedOn = DateTime.Now,
                                            ModifiedBy = "InitialSetup",
                                            ModifiedOn = DateTime.Now
                                            }
                                        }
                                }}
                        }}
            };
            context.AddOrUpdate<Submission>(submission);

            var addUser1 = new User { DomainLogon = domainPrefix + @"\DaviesA", IsActive = true, UnderwriterCode = "AED", PrimaryOffice = lon, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };//, FilterCOBs = energyCobs };
            ////developers


            var globalTim = new User
            {
                DomainLogon = domainPrefix + @"\tim",
                IsActive = true,
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                AdditionalUsers = new List<User> { addUser1 },
                OpenTabs =
                    new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                UnderwriterCode = "AED",
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            context.AddOrUpdate<User>(globalTim);

            var u2 = new User
            {
                DomainLogon = domainPrefix + @"\baillief",
                IsActive = true,
                FilterCOBs = new List<COB> { c, c1 },
                FilterOffices = new List<Office> { lon },
                UnderwriterCode = "AED",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                AdditionalUsers = new List<User> { addUser1 },
                OpenTabs =
                    new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            context.AddOrUpdate<User>(u2);


            var u6 = new User
            {
                DomainLogon = @"TALBOTDEV\svcUKDEVTFSBuild",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                AdditionalUsers = new List<User> { addUser1 },
                UnderwriterCode = "AED",
                IsActive = true,
                OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            u6.FilterMembers = new List<User> { u6 };
            context.AddOrUpdate<User>(u6);
            var u5 = new User
            {
                DomainLogon = @"GLOBALDEV\anandarr",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                AdditionalUsers = new List<User> { addUser1 },
                IsActive = true,
                UnderwriterCode = "AED",
                OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            u5.FilterMembers = new List<User> { u5 };
            context.AddOrUpdate<User>(u5);

            var u4 = new User
            {
                DomainLogon = domainPrefix + @"\SheppaA",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                AdditionalUsers = new List<User> { addUser1 },
                IsActive = true,
                OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                UnderwriterCode = "AED",
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            u4.FilterMembers = new List<User> { u4 };
            context.AddOrUpdate<User>(u4);

            var u3 = new User
            {
                DomainLogon = domainPrefix + @"\MurrayE",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                AdditionalUsers = new List<User> { addUser1 },
                IsActive = true,
                OpenTabs = new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                UnderwriterCode = "AED",
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };

            var u = new User
            {
                DomainLogon = domainPrefix + @"\seigelj",
                IsActive = true,
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                FilterMembers = new List<User> { u2, u4, u3, u5, u6, globalTim },
                OpenTabs =
                    new List<Tab> { new Tab { Url = "/Submission/CreateSubmission", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }, new Tab { Url = "/Submission/_Edit/1", CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now } },
                UnderwriterCode = "AED",
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };
            context.AddOrUpdate<User>(u);
            u2.AdditionalUsers = new List<User> { u };

            // Energy
            var energyUser1 = new User
            {
                DomainLogon = domainPrefix + @"\McDonaldJ",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            }; //, FilterCOBs = energyCobs };
            var energyUser2 = new User
            {
                DomainLogon = domainPrefix + @"\sarjeat",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser3 = new User
            {
                DomainLogon = domainPrefix + @"\MassieZ",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser4 = new User
            {
                DomainLogon = domainPrefix + @"\CantwellJ",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser5 = new User
            {
                DomainLogon = domainPrefix + @"\GreenM",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser6 = new User
            {
                DomainLogon = domainPrefix + @"\EwingtonJ",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser7 = new User
            {
                DomainLogon = domainPrefix + @"\ShilingS",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser8 = new User
            {
                DomainLogon = domainPrefix + @"\GarrettJ",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser9 = new User
            {
                DomainLogon = domainPrefix + @"\StoopE",
                IsActive = true,
                UnderwriterCode = "AED",
                FilterCOBs = new List<COB> { AR, AG, CC, AT },
                FilterOffices = new List<Office> { lon, mia, sng, lab, nyc },
                PrimaryOffice = lon,
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser10 = new User
            {
                DomainLogon = domainPrefix + @"\KeoganA",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser11 = new User
            {
                DomainLogon = domainPrefix + @"\ShawI",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser12 = new User
            {
                DomainLogon = domainPrefix + @"\IsmailR",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser13 = new User
            {
                DomainLogon = domainPrefix + @"\SibleyA",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser14 = new User
            {
                DomainLogon = domainPrefix + @"\DaviesK",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser15 = new User
            {
                DomainLogon = domainPrefix + @"\orsoc",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };
            var energyUser16 = new User
            {
                DomainLogon = domainPrefix + @"\dempsef",
                AdditionalOffices = new List<Office> { lon, mia, sng, lab, nyc },
                IsActive = true,
                PrimaryOffice = lon,
                UnderwriterCode = "AED",
                CreatedBy = "InitialSetup",
                CreatedOn = DateTime.Now,
                ModifiedBy = "InitialSetup",
                ModifiedOn = DateTime.Now
            };//, FilterCOBs = energyCobs };


            var energyTeamUsersList = new List<User>
                    {
                        energyUser1,
                        energyUser2,
                        energyUser3,
                        energyUser4,
                        energyUser5,
                        energyUser6,
                        energyUser7,
                        energyUser8,
                        energyUser9,
                        energyUser10,
                        energyUser11,
                        energyUser12,
                        energyUser13,
                        energyUser14,
                        energyUser15,
                        energyUser16
                    };

            // TeamList and Link List
            var linkList = CreateLinksList();

            var teamList = CreateTeamList(submissionTypes);

            teamList[0].Links = new List<Link>();
            foreach (var link in linkList.GetRange(0, 3))
            {
                teamList[0].Links.Add(link);
            }

            teamList[1].Links = new List<Link>();
            foreach (var link in linkList)
            {
                teamList[1].Links.Add(link);
            }
            var appAccelerators = CreateAppAcceleratorsList();
            teamList[0].AppAccelerators = new List<AppAccelerator>();
            foreach (var appAccelerator in appAccelerators)
            {
                teamList[0].AppAccelerators.Add(appAccelerator);
            }

            teamList[1].AppAccelerators = new List<AppAccelerator>();
            foreach (var appAccelerator in appAccelerators)
            {
                teamList[1].AppAccelerators.Add(appAccelerator);
            }

            teamList[0].RelatedOffices = new List<Office> { lon };
            teamList[1].RelatedOffices = new List<Office> { dubai };
            teamList[0].TeamOfficeSettings = new List<TeamOfficeSetting> { new TeamOfficeSetting { Office = lon, MarketWordingSettings = new List<MarketWordingSetting>(), TermsNConditionWordingSettings = new List<TermsNConditionWordingSetting>(), SubjectToClauseWordingSettings = new List<SubjectToClauseWordingSetting>() } };
            teamList[1].TeamOfficeSettings = new List<TeamOfficeSetting> { new TeamOfficeSetting { Office = dubai, MarketWordingSettings = new List<MarketWordingSetting>(), TermsNConditionWordingSettings = new List<TermsNConditionWordingSetting>(), SubjectToClauseWordingSettings = new List<SubjectToClauseWordingSetting>() } };

            var marketWordings = CreateMarketWordingsList();
            foreach (var marketWording in marketWordings.Take(10))
            {
                teamList[0].TeamOfficeSettings.First().MarketWordingSettings.Add(new MarketWordingSetting { MarketWording = marketWording });
            }

            foreach (var marketWording in marketWordings.Skip(10).Take(10))
            {
                teamList[1].TeamOfficeSettings.First().MarketWordingSettings.Add(new MarketWordingSetting { MarketWording = marketWording });
            }

            foreach (var marketWording in marketWordings.Skip(20))
            {
                context.AddOrUpdate(marketWording);
            }

            var termsNConditionWordings = CreateTermsNConditionWordingsList();
            foreach (var termsNConditionWording in termsNConditionWordings.Take(5))
            {
                teamList[0].TeamOfficeSettings.First().TermsNConditionWordingSettings.Add(new TermsNConditionWordingSetting { TermsNConditionWording = termsNConditionWording });
            }

            foreach (var termsNConditionWording in termsNConditionWordings.Take(5))
            {
                teamList[1].TeamOfficeSettings.First().TermsNConditionWordingSettings.Add(new TermsNConditionWordingSetting { TermsNConditionWording = termsNConditionWording });
            }

            foreach (var termsNConditionWording in termsNConditionWordings.Take(5))
            {
                context.AddOrUpdate(termsNConditionWording);
            }


            var subjectToClauseWordings = CreateSubjectToClauseWordingsList();
            foreach (var subjectToClauseWording in subjectToClauseWordings.Take(5))
            {
                teamList[0].TeamOfficeSettings.First().SubjectToClauseWordingSettings.Add(new SubjectToClauseWordingSetting { SubjectToClauseWording = subjectToClauseWording });
            }

            foreach (var subjectToClauseWording in subjectToClauseWordings.Take(5))
            {
                teamList[1].TeamOfficeSettings.First().SubjectToClauseWordingSettings.Add(new SubjectToClauseWordingSetting { SubjectToClauseWording = subjectToClauseWording });
            }

            foreach (var subjectToClauseWording in subjectToClauseWordings.Take(5))
            {
                context.AddOrUpdate(subjectToClauseWording);
            }

            var energyTeamMemberships = energyTeamUsersList.Select(energyTeamUser => new TeamMembership { PrimaryTeamMembership = true, User = energyTeamUser, Team = teamList[1], IsCurrent = true, StartDate = DateTime.Now, EndDate = null, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now }).ToList();
            energyTeamMemberships.Add(new TeamMembership { PrimaryTeamMembership = false, Team = teamList[1], User = u5, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now });

            var teamMemberships = new List<TeamMembership> 
                { 
                    new TeamMembership { User = u3, Team = teamList[0], IsCurrent = true, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(4), CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now  },
                };

            var memb1 = new TeamMembership { PrimaryTeamMembership = true, Team = teamList[0], User = u, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var memb3 = new TeamMembership { PrimaryTeamMembership = true, Team = teamList[0], User = u4, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var memb2 = new TeamMembership { PrimaryTeamMembership = true, Team = teamList[0], User = u2, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var memb5 = new TeamMembership { PrimaryTeamMembership = true, Team = teamList[0], User = u5, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var memb6 = new TeamMembership { PrimaryTeamMembership = true, Team = teamList[0], User = u6, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };
            var memb4 = new TeamMembership { PrimaryTeamMembership = true, Team = teamList[0], User = globalTim, StartDate = DateTime.Now, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now };

            teamList[0].RelatedCOBs = new List<COB> { AR, AG, CC, AT };
            teamList[1].RelatedCOBs = new List<COB> { AR, AG, CC, AT };

            teamList[0].Memberships = new List<TeamMembership> { memb1, memb2, memb4, memb3, memb5, memb6 };

            foreach (var teamM in teamMemberships)
            {
                teamList[0].Memberships.Add(teamM);
            }

            teamList[1].Memberships = new List<TeamMembership>();
            foreach (var energyTeamMembership in energyTeamMemberships)
            {
                teamList[1].Memberships.Add(energyTeamMembership);
            }

            foreach (var team in teamList)
            {
                context.AddOrUpdate<Team>(team);
            }

        }
        public void AddTeamFilters(IEnumerable<int> teamIds, User user, Team team)
        {
            if (teamIds == null) return;

            bool teamPassedIn = team != null;

            foreach (var teamId in teamIds)
            {

                if (!teamPassedIn) // Has a new team been passed in?

                    team = ConsoleRepository.Query<Team>(t => t.RelatedCOBs, t => t.RelatedOffices)
                                            .FirstOrDefault(t => t.Id == teamId);

                if (team == null) continue; // Cannot find team in DB

                var relatedCOBs = team.RelatedCOBs;
                if (relatedCOBs != null && relatedCOBs.Count > 0)
                {
                    var cobsToAdd = (user.FilterCOBs != null && user.FilterCOBs.Count > 0)
                                        ? relatedCOBs.Except(user.FilterCOBs)
                                        : relatedCOBs;

                    if (user.FilterCOBs == null)
                        user.FilterCOBs = new Collection<COB>();
                    foreach (var cob in cobsToAdd)
                    {
                        user.FilterCOBs.Add(cob);
                    }
                }

                var relatedOffices = team.RelatedOffices;
                if (relatedOffices == null || relatedOffices.Count <= 0) continue;

                var officesToAdd = (user.FilterOffices != null && user.FilterOffices.Count > 0)
                                       ? relatedOffices.Except(user.FilterOffices)
                                       : relatedOffices;

                if (user.FilterOffices == null)
                    user.FilterOffices = new Collection<Office>();
                foreach (var office in officesToAdd)
                {
                    user.FilterOffices.Add(office);
                }


            }
        }
 // ReSharper restore InconsistentNaming
 public override void SetUpUser()
 {
     User01 = ResolveUser("LON", "Patrick Bravery", "BraverP", "PB");
     User02 = ResolveUser("LON", "Tom De'ath", "deathth", "");
     User03 = ResolveUser("LON", "Simon Wilcock", "WilcockS", "SCW");
     User04 = ResolveUser("LON", "David Turner", "TurnerD", "DGT");
     User05 = ResolveUser("NYC", "Rupert Allhusen", "allhusr", "RA");
     User06 = ResolveUser("SNG", "Joe Wee", "WeeJ", "JSW");
     User07 = ResolveUser("MIA", "Luis Sonville", "Luis.Sonville", "LAS"); //SonvilL	
     User08 = ResolveUser("MIA", "Diego San Martin", "SanmarD", "");
     User09 = ResolveUser("DUB", "Samuel Raj", "rajsamu", "SQR");
     User10 = ResolveUser("NYC", "Chris Sonneman", "chris.sonneman", "");
 }
 // ReSharper restore InconsistentNaming
 public override void SetUpUser()
 {
     User01 = ResolveUser("LON", "Jon Atkinson", "AtkinsJ", "JZA");
     User04 = ResolveUser("LON", "Neil Evans", "EvansN", "NZE");
     User09 = ResolveUser("LON", "Thomas Howard", "HowardT", "");
 }