Exemple #1
0
        private IntegratorUser AuthenticateRequest(string userName, string password, IntegratorPermissions permissions)
        {
            if (string.IsNullOrEmpty(userName))
            {
                throw new UserException(NoUserNameError);
            }

            if (string.IsNullOrEmpty(password))
            {
                throw new UserException(NoPasswordError);
            }

            var user = _integrationQuery.GetIntegratorUser(userName);

            if (user == null)
            {
                throw new UserException(string.Format(UnknownUserError, userName));
            }

            var passwordHash = LoginCredentials.HashToString(password);

            if (passwordHash != user.PasswordHash)
            {
                throw new UserException(string.Format(IncorrectPasswordError, userName));
            }

            if (!user.Permissions.IsFlagSet(permissions))
            {
                throw new UserException(string.Format(PermissionDeniedError, user.LoginId));
            }

            return(user);
        }
Exemple #2
0
        public override void ExecuteTask(string[] args)
        {
            var startTime      = DateTime.Parse(args[0]);
            var endTime        = DateTime.Parse(args[1]);
            var integratorName = args[2];

            if (string.IsNullOrEmpty(integratorName))
            {
                throw new ArgumentException("Integrator name required.", "integratorName");
            }

            var startDate      = startTime.Date;
            var endDate        = endTime.Date;
            var integratorUser = _integrationQuery.GetIntegratorUser(integratorName);

            var filePath = Path.Combine(Path.GetTempPath(), integratorName + ".csv");

            using (var writer = File.CreateText(filePath))
            {
                writer.WriteLine("Date, Count");

                for (var date = startDate; date <= endDate; date = date.AddDays(1))
                {
                    var count = _jobAdReportsQuery.GetExternalApplications(integratorUser.Id, new DateTimeRange(date, date.AddDays(1)));
                    writer.WriteLine("\"{0}\", {1}", date.ToShortDateString(), count);
                }
            }
        }
Exemple #3
0
        private Guid GetIntegratorId(string integratorName)
        {
            var integrator = _integrationQuery.GetIntegratorUser(integratorName);

            if (integrator == null)
            {
                throw new ApplicationException("There is no IntegratorUser with username '"
                                               + integratorName + "'.");
            }

            return(integrator.Id);
        }
Exemple #4
0
        string IExternalJobAdsQuery.GetRedirectName(MemberJobAdView jobAd)
        {
            //return the company name for JXT; return the integrator use name otherwise
            if (jobAd.Integration.IntegratorUserId == _jxtIntegratorUserId)
            {
                return(jobAd.ContactDetails.CompanyName);
            }

            return(_integrationQuery.GetIntegrationSystem <Ats>(
                       _integrationQuery.GetIntegratorUser(jobAd.Integration.IntegratorUserId.Value).IntegrationSystemId).
                   Name);
        }
Exemple #5
0
        public override void ExecuteTask()
        {
            if (string.IsNullOrEmpty(IntegratorUserLoginId))
            {
                throw new ApplicationException("The IntegratorUserLoginId is not set.");
            }

            if (string.IsNullOrEmpty(JobPosterLoginId))
            {
                throw new ApplicationException("The JobPosterLoginId is not set.");
            }

            if (string.IsNullOrEmpty(RemoteUrl))
            {
                throw new ApplicationException("The RemoteUrl is not set.");
            }

            var reader = new JobFeedReader(RemoteUrl);
            var mapper = new JobFeedMapper(_industriesQuery, _locationQuery);

            var integratorUser = _integrationQuery.GetIntegratorUser(IntegratorUserLoginId);

            if (integratorUser == null)
            {
                throw new ApplicationException("The integrator user with login id '" + IntegratorUserLoginId + "' cannot be found.");
            }

            var jobPoster = _externalJobAdsQuery.GetJobPoster(integratorUser, JobPosterLoginId);

            if (jobPoster == null)
            {
                throw new ApplicationException("The job poster with login id '" + JobPosterLoginId + "' cannot be found.");
            }

            ProcessJobFeed(reader, mapper, integratorUser, jobPoster);
        }
Exemple #6
0
 public DewrQuery(IIntegrationQuery integrationQuery)
 {
     _integrationQuery = integrationQuery;
     _integratorUser   = _integrationQuery.GetIntegratorUser(IntegratorUserName);
 }
Exemple #7
0
 public HrCareersQuery(IIntegrationQuery integrationQuery)
 {
     _integrationQuery = integrationQuery;
     _integratorUser   = _integrationQuery.GetIntegratorUser(IntegratorUserName);
 }