private IProfileInfo CheckProfile()
        {
            switch (_profileType)
            {
            case ProfileType.Administrator:
                return(AdministratorProfile.CreateProfile());

            case ProfileType.Consultant:
                return(ConsultantProfile.CreateProfile());

            case ProfileType.ExternalCustomer:
                return(ExternalCustomerProfile.CreateProfile());

            case ProfileType.InternalCustomer:
                return(InternalCustomerProfile.CreateProfile());

            case ProfileType.Producer:
                return(ProducerProfile.CreateProfile());

            case ProfileType.Carrier:
                return(CarrierProfile.CreateProfile());

            default:
                return(AnonimousProfile.CreateProfile());
            }
        }
        // private methods
        private void CheckProfile()
        {
            switch (profileInfo)
            {
            case ProfileInfoEnum.Administrator:
                Profile = AdministratorProfile.CreateProfile();
                break;

            case ProfileInfoEnum.Consultant:
                Profile = ConsultantProfile.CreateProfile();
                break;

            case ProfileInfoEnum.ExternalCustomer:
                Profile = ExternalCustomerProfile.CreateProfile();
                break;

            case ProfileInfoEnum.InternalCustomer:
                Profile = InternalCustomerProfile.CreateProfile();
                break;

            case ProfileInfoEnum.Producer:
                Profile = ProducerProfile.CreateProfile();
                break;

            case ProfileInfoEnum.Carrier:
                Profile = CarrierProfile.CreateProfile();
                break;
            }
        }
Example #3
0
        public void ConsultantProfileTest()
        {
            var password = string.Format("P{0}", TestHelper.GetRndNumber(10000, 90000));
            var passport = SignUp(password);
            var profile  = passport.Profile;

            Assert.IsNotNull(profile);
            Assert.IsTrue(profile is UserProfile);

            TestHelper.FillRndProperties(passport.Profile, "Passport,PassportId,PersistentState,CreatedTime".Split(','));
            Assert.IsTrue(profile.Save());

            var consultantProfile = new ConsultantProfile();

            TestHelper.FillRndProperties(consultantProfile, "Passport,PassportId,PersistentState,CreatedTime".Split(','));
            var opened = MemberShip.OpenCareerService(passport, consultantProfile);

            Assert.IsTrue(opened);

            Assert.AreNotEqual(profile.Gender, consultantProfile.Gender);
            Assert.AreNotEqual(profile.Birthday, consultantProfile.Birthday);
            Assert.AreNotEqual(profile.RealName, consultantProfile.RealName);

            var newPassport = UserPassport.FindById(passport.PassportId);

            Assert.IsNotNull(newPassport);

            var newPofile = newPassport.Profile;

            Assert.IsNotNull(newPofile);
            Assert.IsTrue(newPofile is ConsultantProfile);

            Assert.AreEqual(profile.Gender, newPofile.Gender);
            Assert.AreEqual(profile.Birthday, newPofile.Birthday);
            Assert.AreEqual(consultantProfile.RealName, newPofile.RealName);
            Assert.AreNotEqual(profile.RealName, newPofile.RealName);
        }
Example #4
0
        public static async Task SeedDevData(IServiceProvider sp, ApplicationDbContext context)
        {
            var userManager = sp.GetService <UserManager <User> >();

            if (await userManager.FindByNameAsync("daniel.aberg@se") == null)
            {
                var managerProfile = new ManagerProfile()
                {
                    FirstName         = "Daniel",
                    LastName          = "Åberg",
                    Headline          = "",
                    Title             = "Consultant Manager",
                    ShortPresentation = "Long experience within the IT field. Tech-savy.",
                    Presentation      = "",
                    Address           = new Address()
                    {
                        Address1   = "Skeppsbron 7",
                        PostalCode = "211 20",
                        City       = "Malmö",
                        Country    = "Sweden"
                    },
                    Email          = "daniel.aberg@se",
                    PhoneNumber    = "0703-790997",
                    ProfileImage   = "/images/daniel-aberg.jpeg",
                    OrganizationId = (await context.Organizations.FindAsync("syd")).Id
                };

                var entry = context.Add(managerProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = managerProfile.Email,
                    UserName  = managerProfile.Email,
                    Name      = $"{managerProfile.FirstName} {managerProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Manager);
            }

            if (await userManager.FindByNameAsync("jorgen.nilsson@se") == null)
            {
                var managerProfile = new ManagerProfile()
                {
                    FirstName      = "Jörgen",
                    LastName       = "Nilsson",
                    Email          = "jorgen.nilsson@se",
                    ProfileImage   = "/images/jorgen-nilsson.jpeg",
                    OrganizationId = (await context.Organizations.FindAsync("syd")).Id
                };

                var entry = context.Add(managerProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = managerProfile.Email,
                    UserName  = managerProfile.Email,
                    Name      = $"{managerProfile.FirstName} {managerProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Manager);
            }

            if (await userManager.FindByNameAsync("mikael.hall@se") == null)
            {
                var managerProfile = new ManagerProfile()
                {
                    FirstName      = "Mikael",
                    LastName       = "Häll",
                    Email          = "mikael.hall@se",
                    ProfileImage   = "/images/mikael-hall.jpeg",
                    OrganizationId = (await context.Organizations.FindAsync("syd")).Id
                };

                var entry = context.Add(managerProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = managerProfile.Email,
                    UserName  = managerProfile.Email,
                    Name      = $"{managerProfile.FirstName} {managerProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Manager);
            }

            if (await userManager.FindByNameAsync("marcus.ekerhult@se") == null)
            {
                var managerProfile = new ManagerProfile()
                {
                    FirstName = "Marcus",
                    LastName  = "Ekerhult",
                    Title     = "Consultant Manager",
                    Address   = new Address()
                    {
                        Address1   = "Alfagatan 7",
                        PostalCode = "431 49",
                        City       = "Mölndal",
                        Country    = "Sweden"
                    },
                    Email          = "marcus.ekerhult@se",
                    PhoneNumber    = "(+46) 702-907879",
                    ProfileImage   = "/images/marcus-ekerhult.jpeg",
                    OrganizationId = (await context.Organizations.FindAsync("vast")).Id
                };

                var entry = context.Add(managerProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = managerProfile.Email,
                    UserName  = managerProfile.Email,
                    Name      = $"{managerProfile.FirstName} {managerProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Manager);
            }

            if (await userManager.FindByNameAsync("sofie.bondeson") == null)
            {
                var consultantProfile = new ConsultantProfile()
                {
                    FirstName        = "Sofie",
                    LastName         = "Bondeson",
                    Email            = "sofie.bondeson@se",
                    PhoneNumber      = "",
                    OrganizationId   = (await context.Organizations.FindAsync("syd")).Id,
                    ManagerId        = (await context.UserProfiles.FirstAsync(x => x.Email == "daniel.aberg@se")).Id,
                    CompetenceAreaId = (await context.CompetenceAreas.FindAsync("project-management")).Id,
                    Headline         = "Project Manager",
                    Presentation     = "",
                    ProfileImage     = "/images/sofie-bondeson.jpeg",
                    ProfileVideo     = "/videos/SampleVideo_720x480_5mb.mp4"
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = "******",
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Consultant);
            }

            if (await userManager.FindByNameAsync("nermin.paratusic") == null)
            {
                var consultantProfile = new ConsultantProfile()
                {
                    FirstName        = "Nermin",
                    LastName         = "Paratusic",
                    Email            = "nermin.paratusic@se",
                    PhoneNumber      = "(+46)73 891 33 21",
                    OrganizationId   = (await context.Organizations.FindAsync("syd")).Id,
                    ManagerId        = (await context.UserProfiles.FirstAsync(x => x.Email == "daniel.aberg@se")).Id,
                    CompetenceAreaId = (await context.CompetenceAreas.FindAsync("software")).Id,
                    Headline         = "Senior .NET Developer",
                    Presentation     = "Nermin is an experienced .NET developer who has been working on both desktop and web applications. he also got experience in SharePoint.",
                    ProfileImage     = "/images/nermin-paratusic.jpeg",
                    ProfileVideo     = "/videos/SampleVideo_720x480_5mb.mp4"
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = "******",
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Consultant);
            }


            if (await userManager.FindByNameAsync("christian.nilsson") == null)
            {
                var consultantProfile = new ConsultantProfile()
                {
                    FirstName        = "Christian",
                    LastName         = "Nilsson",
                    Email            = "christian.nilsson@se",
                    PhoneNumber      = "",
                    OrganizationId   = (await context.Organizations.FindAsync("syd")).Id,
                    ManagerId        = (await context.UserProfiles.FirstAsync(x => x.Email == "daniel.aberg@se")).Id,
                    CompetenceAreaId = (await context.CompetenceAreas.FindAsync("software")).Id,
                    Headline         = "Senior .NET Developer",
                    Presentation     = "",
                    ProfileImage     = "/images/christian-nilsson.jpeg",
                    ProfileVideo     = "/videos/SampleVideo_720x480_5mb.mp4"
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = "******",
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Consultant);
            }

            if (await userManager.FindByNameAsync("niklas.martensson") == null)
            {
                var consultantProfile = new ConsultantProfile()
                {
                    FirstName        = "Niklas",
                    LastName         = "Mårtensson",
                    Email            = "niklas.martensson@se",
                    PhoneNumber      = "",
                    OrganizationId   = (await context.Organizations.FindAsync("syd")).Id,
                    ManagerId        = (await context.UserProfiles.FirstAsync(x => x.Email == "mikael.hall@se")).Id,
                    CompetenceAreaId = (await context.CompetenceAreas.FindAsync("electronics")).Id,
                    Headline         = "Senior Electronics Engineer",
                    Presentation     = "",
                    ProfileImage     = "/images/niklas-martensson.jpeg",
                    ProfileVideo     = "/videos/SampleVideo_720x480_5mb.mp4"
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = "******",
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Consultant);
            }

            if (await userManager.FindByNameAsync("johanna.sjoberg") == null)
            {
                var consultantProfile = new ConsultantProfile()
                {
                    FirstName        = "Johanna",
                    LastName         = "Sjöberg",
                    Email            = "johanna.sjoberg@se",
                    PhoneNumber      = "",
                    OrganizationId   = (await context.Organizations.FindAsync("syd")).Id,
                    ManagerId        = (await context.UserProfiles.FirstAsync(x => x.Email == "mikael.hall@se")).Id,
                    CompetenceAreaId = (await context.CompetenceAreas.FindAsync("mechanics")).Id,
                    Headline         = "Junior Mechanical Engineer",
                    Presentation     = "",
                    ProfileImage     = "/images/johanna-sjoberg.jpeg",
                    ProfileVideo     = "/videos/SampleVideo_720x480_5mb.mp4"
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = "******",
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Consultant);
            }

            if (await userManager.FindByNameAsync("*****@*****.**") == null)
            {
                var consultantProfile = new ClientProfile()
                {
                    FirstName = "Per",
                    LastName  = "Nilsson",
                    Email     = "*****@*****.**",
                    Title     = "Line Manager",
                    Company   = "BorgWarner Sweden AB",
                    Section   = "Rotating Electric Lines",
                    Address   = new Address()
                    {
                        Address1   = "Instrumentgatan 15",
                        PostalCode = "261 51",
                        City       = "Landskrona",
                        State      = "Skåne",
                        Country    = "Sweden"
                    },
                    PhoneNumber    = "070-244 34 22",
                    OrganizationId = (await context.Organizations.FindAsync("syd")).Id,
                    ReferenceId    = (await context.UserProfiles.FirstAsync(x => x.Email == "mikael.hall@se")).Id,
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = consultantProfile.Email,
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Client);
            }

            if (await userManager.FindByNameAsync("*****@*****.**") == null)
            {
                var consultantProfile = new ClientProfile()
                {
                    FirstName  = "Maria",
                    LastName   = "Sjölund",
                    Email      = "*****@*****.**",
                    Title      = "R&D Director",
                    Section    = "Camera Solutions",
                    Department = "New Business",
                    Company    = "Axis Communications AB",
                    Address    = new Address()
                    {
                        Address1   = "Emdalavägen 14",
                        PostalCode = "223 69",
                        City       = "Lund",
                        State      = "Skåne",
                        Country    = "Sweden"
                    },
                    PhoneNumber    = "070-422 72 35",
                    OrganizationId = (await context.Organizations.FindAsync("syd")).Id,
                    ReferenceId    = (await context.UserProfiles.FirstAsync(x => x.Email == "daniel.aberg@se")).Id,
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = consultantProfile.Email,
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Client);
            }

            if (await userManager.FindByNameAsync("*****@*****.**") == null)
            {
                var consultantProfile = new ClientProfile()
                {
                    FirstName      = "Anders",
                    LastName       = "Bengtsson",
                    Email          = "*****@*****.**",
                    Title          = "Line Manager",
                    Section        = "Core System Platform",
                    Department     = "Software",
                    Company        = "Volvo Cars Group AB",
                    PhoneNumber    = "070-44 71 325",
                    OrganizationId = (await context.Organizations.FindAsync("vast")).Id,
                    ReferenceId    = (await context.UserProfiles.FirstAsync(x => x.Email == "marcus.ekerhult@se")).Id,
                };

                var entry = context.Add(consultantProfile);

                await context.SaveChangesAsync();

                var user = new User
                {
                    Email     = consultantProfile.Email,
                    UserName  = consultantProfile.Email,
                    Name      = $"{consultantProfile.FirstName} {consultantProfile.LastName}",
                    ProfileId = entry.Entity.Id
                };

                var results = await userManager.CreateAsync(user, "Abc123!");

                await userManager.AddToRoleAsync(user, RoleConstants.Client);
            }
        }
Example #5
0
 private void OnCardClick(ConsultantProfile consultantProfile)
 {
     NavigationManager.NavigateTo($"/consultants/{consultantProfile.Id}");
 }