Ejemplo n.º 1
0
        public static IDictionary <int, string> ToReverseDictionary(this UserStatusType statusType, bool revesrse = true)
        {
            var arrStatus = Enum.GetValues(typeof(UserStatusType));

            IDictionary <int, string> statusDict = arrStatus
                                                   .Cast <UserStatusType>()
                                                   .ToDictionary(t => (int)t, t =>
            {
                switch (t)
                {
                case UserStatusType.InActive:
                    return("ระงับการใช้งาน");

                case UserStatusType.Active:
                    return("ใช้งานได้");

                case UserStatusType.BlockAward:
                    return("ไม่สามารถสะสมคะแนนได้");

                case UserStatusType.BlockReward:
                    return("ไม่สามารถแลกของรางวัลได้");

                default:
                    return("");
                }
            });

            return(statusDict);
        }
Ejemplo n.º 2
0
        public static string toStatusNameEn(this UserStatusType userStatusType)
        {
            string status = "";

            switch (userStatusType)
            {
            case UserStatusType.InActive:
                status = "InActive";
                break;

            case UserStatusType.Active:
                status = "Active";
                break;

            case UserStatusType.BlockAward:
                return("BlockAward");

            case UserStatusType.BlockReward:
                return("BlockAward");

            default:
                break;
            }
            return(status);
        }
Ejemplo n.º 3
0
        public static string toStatusName(this UserStatusType userStatusType)
        {
            string status = "";

            switch (userStatusType)
            {
            case UserStatusType.InActive:
                status = "ถูกระงับ";
                break;

            case UserStatusType.Active:
                status = "ใช้งานได้";
                break;

            case UserStatusType.BlockAward:
                return("ไม่สามารถสะสมคะแนนได้");

            case UserStatusType.BlockReward:
                return("ไม่สามารถแลกของรางวัลได้");

            default:
                break;
            }
            return(status);
        }
Ejemplo n.º 4
0
        private static bool CanUpdateStatus(UserStatusType currentStatus, UserStatusType toSet)
        {
            switch (toSet)
            {
            case UserStatusType.Invite:
                return(UserStatusType.None.Equals(currentStatus) ||
                       UserStatusType.Invite.Equals(currentStatus));

            case UserStatusType.AcceptInvite:
                return(UserStatusType.Invite.Equals(currentStatus));

            case UserStatusType.Locked:
                return(UserStatusType.System.Equals(currentStatus));

            case UserStatusType.MarkDeleted:
                return(UserStatusType.System.Equals(currentStatus) ||
                       UserStatusType.Locked.Equals(currentStatus));

            case UserStatusType.System:
                return(UserStatusType.System.Equals(currentStatus) ||
                       UserStatusType.None.Equals(currentStatus) ||
                       UserStatusType.AcceptInvite.Equals(currentStatus));

            default:
                return(false);
            }
        }
Ejemplo n.º 5
0
        public async Task ChangeStatusUserAsync(int userId, UserStatusType status)
        {
            var userStatus    = _mapper.Map <UserStatusTypeEntity>(status);
            var userForUpdate = await databaseContext.Set <UserEntity>().Where(x => x.Id == userId).SingleOrDefaultAsync();

            userForUpdate.Status = userStatus;
            await databaseContext.SaveChangesAsync();
        }
Ejemplo n.º 6
0
 private static bool CanRemoveStatus(UserStatusType currentStatus, UserStatusType toRemove)
 {
     if (IsRemoveable(currentStatus))
     {
         return(currentStatus.Equals(toRemove));
     }
     return(false);
 }
Ejemplo n.º 7
0
 public AuthUser(string userName, string userProrName, string password, string userType, short userStatus)
 {
     this._userId          = userName;
     this._password        = password;
     this._userType        = userType;
     this._userProfileName = userProrName;
     this._userStatus      = (UserStatusType)userStatus;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Проверяет возможно ли полностью удалить пользователя  <paramref name="user"/> из системы.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool CanBeRemovedFromDB(User user)
        {
            UserStatusType current = user.UserStatuses.Status;

            return(UserStatusType.Invite.Equals(current) ||
                   UserStatusType.AcceptInvite.Equals(current) ||
                   UserStatusType.MarkDeleted.Equals(current));
        }
 public ChangePendingUserStatusModel(List <string> tags,
                                     UserStatusType status,
                                     int userId,
                                     int roleId)
 {
     Tags   = tags;
     Status = status;
     UserId = userId;
     RoleId = roleId;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Проверяет возможно ли изменение статуса <paramref name="user"/> на <paramref name="changeTo"/>,
        /// если да, то меняет его.
        /// </summary>
        /// <param name="changeTo">Статус на который необходимо сменить</param>
        /// <param name="user">пользователь, статус которого проверяем</param>
        /// <param name="undo">Означает что необходимо снять статус <paramref name="changeTo"/></param>
        /// <returns></returns>
        public static bool CanChangeStatus(User user, UserStatusType changeTo, bool undo = false)
        {
            UserStatusType currentStatus = user.UserStatuses == null ? UserStatusType.None : user.UserStatuses.Status;

            if (undo)
            {
                return(CanRemoveStatus(currentStatus, changeTo));
            }
            else
            {
                return(CanUpdateStatus(currentStatus, changeTo));
            }
        }
Ejemplo n.º 11
0
        /// <see cref="IAuthRepository.FindAllByPhone(string, string, UserStatusType)"/>
        public IList <User> FindAllByPhone(string Phone, string PasswordHash, UserStatusType Status)
        {
            IQueryable <User> query = db.Users
                                      .Include("AccessRoles")
                                      .Where(u => (u.Password.Equals(PasswordHash) &&
                                                   u.UserStatuses.Status == Status &&
                                                   u.UserPhone.Equals(Phone)))
                                      .Include(o => o.UserInfo)
                                      .Include(o => o.UserStatuses)
                                      .Include(o => o.AccessRoles);

            return(GetAll(query));
        }
Ejemplo n.º 12
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            UserStatusType result = UserStatusType.Active;

            if (value is int intValue)
            {
                result = (UserStatusType)((byte)intValue);
            }
            else if (value is UserStatusType typeValue)
            {
                result = typeValue;
            }

            return(result);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Изменяет <see cref="UserStatus"/> пользователя <paramref name="User"/> на <see cref="UserStatus"/> <paramref name="Status"/>.
        /// Если не указан <paramref name="Name"/>, то задает его как <c>Status.ToString()</c>
        /// </summary>
        /// <param name="Status"></param>
        /// <param name="User"></param>
        /// <param name="Description"></param>
        /// <param name="Name"></param>
        public static void ChangeStatus(User User, UserStatusType Status, string Name = null, string Description = "")
        {
            UserStatuses toChange = User.UserStatuses != null ? User.UserStatuses : new UserStatuses();

            if (Name == null)
            {
                Name = Status.ToString();
            }

            toChange.Name        = Name;
            toChange.Description = Description;
            toChange.Status      = Status;
            toChange.UpdateTime  = DateTime.Now;

            User.UserStatuses = toChange;
        }
Ejemplo n.º 14
0
        public async Task UpdateStatus()
        {
            if (Account.Id == -1)
            {
                return;
            }

            var result = await UserApi.GetProfileById(Account.Id)
                         .ConfigureAwait(true);

            if (result.IsError || result.Data == null)
            {
                return;
            }

            UserStatus = (UserStatusType)((byte)result.Data.Status);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Проверяет аутентификацию пользователя по
        /// <paramref name="UserName" />, <paramref name="Phone" />, <paramref name="Password" />,
        /// в случае успеха возвращает сущность пользователя;
        /// При проверке <paramref name="Phone" /> преобразуется в формат <see cref="PhoneService.PhoneConvert(string)" />,
        /// <paramref name="UserName" /> приводится в нижний регистр
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="Phone"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public User Authenticate(string UserName, string Phone, string Password)
        {
            Password = PasswordService.GeneratePasswordHash(Password);
            Phone    = PhoneService.IsPhoneValid(Phone) ? PhoneService.PhoneConvert(Phone) : null;
            UserName = !string.IsNullOrEmpty(UserName) ? UserName.ToLower() : null;
            UserStatusType AvailableStatus = UserStatusType.System;

            if (UserName == null && Phone == null)
            {
                return(null);
            }

            IList <User> users = null;

            if (UserName != null && Phone != null)
            {
                users = AuthRep.FindAllByNamePhone(UserName, Phone, Password, AvailableStatus);
            }
            else if (UserName != null)
            {
                users = AuthRep.FindAllByName(UserName, Password, AvailableStatus);
            }
            else
            {
                users = AuthRep.FindAllByPhone(Phone, Password, AvailableStatus);
            }

            if (users == null || users.Count == 0)
            {
                return(null);
            }
            else if (users.Count == 1)
            {
                //TODO это зачем?
                User toReturn = null;
                foreach (User u in users)
                {
                    toReturn = u;
                }
                return(toReturn);
            }
            else
            {
                throw new Exception("CredentailsService: found more than 1 user with specified credentails");
            }
        }
Ejemplo n.º 16
0
        public static string ToOutString(this UserStatusType type)
        {
            switch (type)
            {
            case UserStatusType.Offline:
            case UserStatusType.Online:
                return(type.ToString().ToLowerInvariant());

            case UserStatusType.OnlineInGame:
                return("online-ingame");

            case UserStatusType.Unknown:
                throw new ArgumentException("PlatformType.Unknown cannot be converted.");

            default:
                return(string.Empty);
            }
        }
Ejemplo n.º 17
0
        public static UserStatusType toUserStatus(this string text)
        {
            UserStatusType status = UserStatusType.Active;

            switch (text)
            {
            case "InActive":
                status = UserStatusType.InActive;
                break;

            case "Active":
                status = UserStatusType.Active;
                break;

            case "BlockAward":
                status = UserStatusType.BlockAward;
                break;

            case "BlockReward":
                status = UserStatusType.BlockReward;
                break;

            case "ระงับการใช้งาน":
                status = UserStatusType.InActive;
                break;

            case "ใช้งานได้":
                status = UserStatusType.Active;
                break;

            case "ไม่สามารถสะสมคะแนนได้":
                status = UserStatusType.BlockAward;
                break;

            case "ไม่สามารถแลกของรางวัลได้":
                status = UserStatusType.BlockReward;
                break;

            default:
                break;
            }
            return(status);
        }
Ejemplo n.º 18
0
        public async Task UpdateAccount()
        {
            if (Account.Id == -1)
            {
                return;
            }

            var result = await UserApi.GetProfileById(Account.Id)
                         .ConfigureAwait(true);

            if (result.IsError || result.Data == null)
            {
                return;
            }

            UserName         = result.Data.Nickname;
            UserAvatarSource = result.Data.PhotoUrl;
            UserStatus       = (UserStatusType)((byte)result.Data.Status);
        }
Ejemplo n.º 19
0
        public async Task <User> ApproveUserAndSetTagsAsync(PendingUser pendingUser, UserStatusType userStatusType, List <string> tags, int currentUserId)
        {
            var userToRegistration = _mapper.Map <User>(pendingUser);

            userToRegistration.Status       = userStatusType;
            userToRegistration.ModifiedById = currentUserId;
            var user = await _userRepository.RegisterByPasswordHashAsync(userToRegistration, pendingUser.PasswordHash);

            await DeleteAsync(user);

            if (tags != null)
            {
                foreach (var tagName in tags)
                {
                    var tagEntity = await databaseContext.Set <TagEntity>().FirstOrDefaultAsync(x => x.Name == tagName) ?? new TagEntity
                    {
                        Name       = tagName.ToUpper(),
                        UserTags   = new List <UserTagEntity>(),
                        ModifiedAt = DateTimeOffset.Now
                    };

                    if (!tagEntity.UserTags.Exists(s => s.UserId == user.Id))
                    {
                        tagEntity.UserTags.Add(new UserTagEntity()
                        {
                            UserId = user.Id
                        });
                    }
                    if (tagEntity.Id == 0)
                    {
                        databaseContext.Set <TagEntity>().Add(tagEntity);
                    }

                    await databaseContext.SaveChangesAsync();
                }
            }
            return(user);
        }
Ejemplo n.º 20
0
        public async Task UserIsConfirmed_ReturnsFalse_ForAllOtherStates(UserStatusType userStatus)
        {
            var user = new AwsCognitoUser
            {
                UserName = "******",
                Password = "******"
            };

            _awsCognitoClient.ListUsersAsync(Arg.Any <ListUsersRequest>()).Returns(new ListUsersResponse {
                Users = new List <UserType>
                {
                    new UserType
                    {
                        Username   = user.UserName,
                        UserStatus = userStatus
                    }
                }
            });

            var userIsConfirmed = await _cognitoAdapterHelper.UserIsConfirmed(user);

            Assert.IsFalse(userIsConfirmed);
        }
Ejemplo n.º 21
0
 public UserStatus(string message, UserStatusType userStatusType)
 {
     Message        = message;
     UserStatusType = userStatusType;
 }
Ejemplo n.º 22
0
 public UserStatus(UserStatusType userStatusType)
 {
     UserStatusType = userStatusType;
 }
Ejemplo n.º 23
0
 private static bool IsRemoveable(UserStatusType status)
 {
     return(status.Equals(UserStatusType.Locked) ||
            status.Equals(UserStatusType.MarkDeleted));
 }
Ejemplo n.º 24
0
 public ChangeUserStatusModel(UserStatusType status,
                              int userId)
 {
     Status = status;
     UserId = userId;
 }
Ejemplo n.º 25
0
        public static void Initialize(IApplicationContext context)
        {
            if (!context.EnsureCreated())
            {
                return; //db was already created or error occurred
            }
            var confirmed = new UserStatusType
            {
                Name        = "Confirmed",
                Description = "The user has confirmed their email is active and is ready for opportunities.",
                CanApply    = true
            };
            var userStatusTypes = new List <UserStatusType>
            {
                new UserStatusType
                {
                    Name        = "Submitted",
                    Description = "The user has signed up and needs to confirm their email is active and receiving messages from the system."
                },
                confirmed,
                new UserStatusType
                {
                    Name        = "Banned",
                    Description = "The user has been banned from any opportunities."
                }
            };

            context.UserStatusTypes.AddRange(userStatusTypes);
            context.SaveChanges();

            //add user
            var robsmitha = new User
            {
                GitHubLogin      = "******",
                UserStatusTypeID = confirmed.ID
            };

            context.Users.Add(robsmitha);
            context.SaveChanges();

            //add company
            var gitCandidates = new Company
            {
                GitHubLogin = "******"
            };

            context.Companies.Add(gitCandidates);
            context.SaveChanges();

            #region Response types
            var textResponse = new ResponseType
            {
                Name        = "TextResponse",
                Description = "A write in response question that renders a text input field.",
                Input       = "text"
            };
            var numberResponse = new ResponseType
            {
                Name        = "NumberResponse",
                Description = "A write in response question that renders a number input field.",
                Input       = "number"
            };
            var yesNo = new ResponseType
            {
                Name        = "YesNo",
                Description = "A yes/no question that renders two yes/mp radio buttons.",
                Input       = "radio"
            };
            context.ResponseTypes.Add(yesNo);
            context.ResponseTypes.Add(numberResponse);
            context.ResponseTypes.Add(textResponse);
            context.SaveChanges();
            #endregion

            #region Validation rules
            var isRequired = new ValidationRule
            {
                Name        = "Is Required",
                Description = "The field in requierd",
                Key         = "isRequired"
            };
            var minLength = new ValidationRule
            {
                Name        = "Minimum Length",
                Description = "The field has a minimum length",
                Key         = "minLength"
            };
            var maxLength = new ValidationRule
            {
                Name        = "Maximum Length",
                Description = "The field has a maximum length",
                Key         = "maxLength"
            };
            context.ValidationRules.Add(isRequired);
            context.ValidationRules.Add(minLength);
            context.ValidationRules.Add(maxLength);
            context.SaveChanges();
            #endregion

            #region Yes/No test question
            var yesNoQ = new Question
            {
                Label          = "Are you authorized to work in the U.S.?",
                CompanyID      = gitCandidates.ID,
                ResponseTypeID = yesNo.ID
            };
            context.Questions.Add(yesNoQ);
            context.SaveChanges();
            var yesNoQYes = new QuestionResponse
            {
                Answer       = "Yes",
                QuestionID   = yesNoQ.ID,
                DisplayOrder = 1
            };
            var yesNoQNo = new QuestionResponse
            {
                Answer       = "No",
                QuestionID   = yesNoQ.ID,
                DisplayOrder = 2
            };
            context.QuestionResponses.Add(yesNoQYes);
            context.QuestionResponses.Add(yesNoQNo);
            context.SaveChanges();

            var yesNoQValidationIsRequired = new QuestionValidation
            {
                QuestionID       = yesNoQ.ID,
                ValidationRuleID = isRequired.ID,
            };
            context.QuestionValidations.Add(yesNoQValidationIsRequired);
            context.SaveChanges();
            #endregion

            #region Write in test question
            var numberResponseQ = new Question
            {
                Label          = "How many years have you professionaly developed software?",
                CompanyID      = gitCandidates.ID,
                ResponseTypeID = numberResponse.ID,
                Placeholder    = "Years of experience",
                Minimum        = 0,
                Maximum        = 99
            };
            context.Questions.Add(numberResponseQ);
            context.SaveChanges();

            var numberResponseQValidationIsRequired = new QuestionValidation
            {
                QuestionID          = numberResponseQ.ID,
                ValidationRuleID    = isRequired.ID,
                ValidationRuleValue = "true"
            };
            var numberResponseQValidationMaxLength = new QuestionValidation
            {
                QuestionID          = numberResponseQ.ID,
                ValidationRuleID    = maxLength.ID,
                ValidationRuleValue = "2"
            };
            context.QuestionValidations.Add(numberResponseQValidationIsRequired);
            context.QuestionValidations.Add(numberResponseQValidationMaxLength);
            context.SaveChanges();

            #endregion

            #region Add jobs
            var jobApplicationStatusTypes = new List <JobApplicationStatusType>
            {
                new JobApplicationStatusType
                {
                    Name                = "Submitted",
                    Description         = "The application has been submitted.",
                    IsActiveApplication = true
                },
                new JobApplicationStatusType
                {
                    Name                = "Under Review",
                    Description         = "The application is under review.",
                    IsActiveApplication = true
                },
                new JobApplicationStatusType
                {
                    Name                = "Under Consideration",
                    Description         = "The application is under review by the company.",
                    IsActiveApplication = true
                },
                new JobApplicationStatusType
                {
                    Name                = "Scheduling Interview",
                    Description         = "The an interview is being schedules.",
                    IsActiveApplication = true
                },
                new JobApplicationStatusType
                {
                    Name        = "No Longer Under Consideration",
                    Description = "The application is no longer being reviewed."
                },
                new JobApplicationStatusType
                {
                    Name        = "Withdrawn",
                    Description = "The application has been withdrawn by the user."
                }
            };
            context.JobApplicationStatusTypes.AddRange(jobApplicationStatusTypes);
            context.SaveChanges();

            var intern = new SeniorityLevel
            {
                Name        = "Intern",
                Description = "Internship level"
            };
            var entry = new SeniorityLevel
            {
                Name        = "Entry",
                Description = "Entry level"
            };
            var midLvl = new SeniorityLevel
            {
                Name        = "Mid-level",
                Description = "Middle level"
            };
            var seniorLvl = new SeniorityLevel
            {
                Name        = "Senior",
                Description = "Senior level"
            };
            var lead = new SeniorityLevel
            {
                Name        = "Lead",
                Description = "Senior level"
            };
            var architect = new SeniorityLevel
            {
                Name        = "Architect",
                Description = "Architect level"
            };
            context.SeniorityLevels.AddRange(new [] { intern, entry, midLvl, seniorLvl, lead, architect });
            var fullTime = new JobType
            {
                Name        = "Full-time",
                Description = "Full-time"
            };
            var partTime = new JobType
            {
                Name        = "Part-time",
                Description = "Part-time"
            };
            var contract = new JobType
            {
                Name        = "Contract",
                Description = "Contract"
            };
            context.JobTypes.AddRange(new[] { fullTime, partTime, contract });
            context.SaveChanges();

            var postHTML  = "<h4 id=&quot;summary&quot;>Job Summary</h4> <p>We develop a .NET software application implements a Domain Driven Design (DDD) pattern to help solve enterprise level problems.</p><p>We're looking for talented engineers to join our team.</p><strong>If this job sounds like you apply today!</strong>";
            var fullstack = new Job
            {
                Name             = "Full Stack Engineer",
                Description      = "A .NET MVC frontend and MSSQL backend",
                CompanyID        = gitCandidates.ID,
                UserID           = robsmitha.ID,
                PostAt           = DateTime.Now.AddMinutes(5),
                PostHTML         = postHTML,
                AllowRemote      = false,
                TeamSize         = "10-50 People",
                MinSalary        = 90000,
                MaxSalary        = 120000,
                Travel           = "No",
                SeniorityLevelID = midLvl.ID,
                JobTypeID        = fullTime.ID,
            };
            var frontend = new Job
            {
                Name             = "Front End Engineer",
                Description      = "A frontend in ReactJS with Bootstrap4.",
                CompanyID        = gitCandidates.ID,
                PostAt           = DateTime.Now.AddDays(-2),
                UserID           = robsmitha.ID,
                PostHTML         = postHTML,
                AllowRemote      = true,
                TeamSize         = "1-10 People",
                MinSalary        = 70000,
                MaxSalary        = 86000,
                Travel           = "No",
                SeniorityLevelID = entry.ID,
                JobTypeID        = partTime.ID,
            };
            var senior = new Job
            {
                Name             = "Senior Software Architect",
                Description      = "Senior Architect Angular frontend and CockroachDB backend",
                CompanyID        = gitCandidates.ID,
                PostAt           = DateTime.Now.AddDays(-4),
                UserID           = robsmitha.ID,
                PostHTML         = postHTML,
                AllowRemote      = false,
                TeamSize         = "50-100 People",
                MinSalary        = 75000,
                MaxSalary        = 96000,
                Travel           = "No",
                SeniorityLevelID = seniorLvl.ID,
                JobTypeID        = fullTime.ID,
            };
            var cloud = new Job
            {
                Name             = "Cloud Engineer",
                Description      = "Create and manage CI/CD pipelines and infrastructure.",
                CompanyID        = gitCandidates.ID,
                PostAt           = DateTime.Now.AddDays(-8),
                UserID           = robsmitha.ID,
                PostHTML         = postHTML,
                AllowRemote      = false,
                TeamSize         = "50-100 People",
                MinSalary        = 65000,
                MaxSalary        = 86000,
                Travel           = "No",
                SeniorityLevelID = lead.ID,
                JobTypeID        = fullTime.ID,
            };
            var jobs = new List <Job>
            {
                fullstack, frontend, senior, cloud
            };
            context.Jobs.AddRange(jobs);
            context.SaveChanges();


            var frontendLocations = new List <JobLocation>
            {
                new JobLocation
                {
                    City = "Tampa",
                    StateAbbreviation = "FL",
                    Latitude          = 27.950575,
                    Longitude         = -82.457176,
                    JobID             = frontend.ID
                },
                new JobLocation
                {
                    City = "Tallahassee",
                    StateAbbreviation = "FL",
                    Latitude          = 30.455000,
                    Longitude         = -84.253334,
                    JobID             = frontend.ID
                },
            };

            var cloudLocations = new List <JobLocation>
            {
                new JobLocation
                {
                    City = "Tallahassee",
                    StateAbbreviation = "FL",
                    Latitude          = 30.455000,
                    Longitude         = -84.253334,
                    JobID             = cloud.ID
                },
                new JobLocation
                {
                    City = "New York",
                    StateAbbreviation = "NY",
                    Latitude          = 40.712776,
                    Longitude         = -74.005974,
                    JobID             = cloud.ID
                },
            };

            var jobLocations = new List <JobLocation>
            {
                new JobLocation
                {
                    City = "Beverly Hills",
                    StateAbbreviation = "CA",
                    Latitude          = 34.077200,
                    Longitude         = -118.422450,
                    JobID             = fullstack.ID
                },
                new JobLocation
                {
                    City = "Redmond",
                    StateAbbreviation = "WA",
                    Latitude          = 47.751076,
                    Longitude         = -120.740135,
                    JobID             = senior.ID
                }
            };

            jobLocations.AddRange(frontendLocations);
            jobLocations.AddRange(cloudLocations);
            context.JobLocations.AddRange(jobLocations);
            foreach (var job in jobs)
            {
                context.JobApplicationQuestions.AddRange(new[] {
                    new JobApplicationQuestion
                    {
                        JobID        = job.ID,
                        QuestionID   = yesNoQ.ID,
                        DisplayOrder = 1,
                    },
                    new JobApplicationQuestion
                    {
                        JobID        = job.ID,
                        QuestionID   = numberResponseQ.ID,
                        DisplayOrder = 2
                    }
                });
                context.JobBenefits.AddRange(new[] {
                    new JobBenefit
                    {
                        JobID       = job.ID,
                        Name        = "Exciting open source projects",
                        Description = "We don’t work on dull and boring projects. Ever."
                    },
                    new JobBenefit
                    {
                        JobID       = job.ID,
                        Name        = "Flexible working hours",
                        Description = "Possibility for remote work, home office, and flexible hours during the day."
                    },
                    new JobBenefit
                    {
                        JobID       = job.ID,
                        Name        = "Learning and development",
                        Description = "Subsidized conferences, classes, and events."
                    },
                    new JobBenefit
                    {
                        JobID       = job.ID,
                        Name        = "Health & vision insurance",
                        Description = "Health and vision insurance."
                    }
                });
                context.JobRequirements.AddRange(new[] {
                    new JobRequirement
                    {
                        JobID       = job.ID,
                        Name        = "Programming experience",
                        Description = "We are looking for people who are familiar with or want to learn .NET quickly'",
                    },
                    new JobRequirement
                    {
                        JobID       = job.ID,
                        Name        = "Flexibility",
                        Description = "A quick learner who can and wants to switch between programming languages depending on project requirements."
                    },
                    new JobRequirement
                    {
                        JobID       = job.ID,
                        Name        = "Problem solver",
                        Description = "We appreciate people who work smart – and hard."
                    }
                });
                context.JobResponsibilities.AddRange(new[] {
                    new JobResponsibility
                    {
                        JobID       = job.ID,
                        Name        = "Design and build",
                        Description = "Design and implement new features and enhance existing functionalities according to business specifications.",
                    },
                    new JobResponsibility
                    {
                        JobID       = job.ID,
                        Name        = "Ownership",
                        Description = "Participate in the whole sprint process for product development."
                    },
                    new JobResponsibility
                    {
                        JobID       = job.ID,
                        Name        = "Coding standards",
                        Description = "Ensure that your code meets software development and quality standards and fits into the continuous release process."
                    }
                });
                context.JobMethods.AddRange(new[] {
                    new JobMethod
                    {
                        JobID       = job.ID,
                        Name        = "Agile software development",
                        Description = "We are agile software developers.",
                    },
                    new JobMethod
                    {
                        JobID       = job.ID,
                        Name        = "SCRUM lifecycles",
                        Description = "We iterate SCRUM lifecycles to develop our software."
                    },
                    new JobMethod
                    {
                        JobID       = job.ID,
                        Name        = "CI/CD",
                        Description = "Continuous integration and deployment."
                    }
                });
            }

            var cSharp = new Skill
            {
                Name        = "C#",
                Description = "C# progamming language"
            };
            var javaScript = new Skill
            {
                Name        = "JavaScript",
                Description = "JavaScript progamming language"
            };
            var sfrontend = new Skill
            {
                Name        = "Frontend",
                Description = "Frontend development"
            };
            var sbackend = new Skill
            {
                Name        = "Backend",
                Description = "Backend development"
            };
            var html = new Skill
            {
                Name        = "HTML",
                Description = "HTML"
            };
            var css = new Skill
            {
                Name        = "CSS",
                Description = "CSS"
            };
            context.Skills.AddRange(new List <Skill>
            {
                cSharp,
                javaScript,
                sfrontend,
                sbackend,
                html,
                css,
            });
            context.SaveChanges();

            context.JobSkills.AddRange(new []
            {
                //frontend
                new JobSkill
                {
                    JobID   = frontend.ID,
                    SkillID = html.ID
                },
                new JobSkill
                {
                    JobID   = frontend.ID,
                    SkillID = css.ID
                },
                new JobSkill
                {
                    JobID   = frontend.ID,
                    SkillID = sfrontend.ID
                },
                //sr developer
                new JobSkill
                {
                    JobID   = senior.ID,
                    SkillID = sbackend.ID
                },
                new JobSkill
                {
                    JobID   = senior.ID,
                    SkillID = cSharp.ID
                },
                new JobSkill
                {
                    JobID   = senior.ID,
                    SkillID = javaScript.ID
                },
                //cloud
                new JobSkill
                {
                    JobID   = cloud.ID,
                    SkillID = sbackend.ID
                },
                new JobSkill
                {
                    JobID   = cloud.ID,
                    SkillID = cSharp.ID
                },
                //full stack
                new JobSkill
                {
                    JobID   = fullstack.ID,
                    SkillID = html.ID
                },
                new JobSkill
                {
                    JobID   = fullstack.ID,
                    SkillID = css.ID
                },
                new JobSkill
                {
                    JobID   = fullstack.ID,
                    SkillID = sfrontend.ID
                },
                new JobSkill
                {
                    JobID   = fullstack.ID,
                    SkillID = sbackend.ID
                },
                new JobSkill
                {
                    JobID   = fullstack.ID,
                    SkillID = cSharp.ID
                },
                new JobSkill
                {
                    JobID   = fullstack.ID,
                    SkillID = javaScript.ID
                },
            });



            context.SaveChanges();
            #endregion
        }