コード例 #1
0
        public OAuthController()
        {
            siteSettingsHelper = new SiteSettingsHelper();


            client = new InstagramOAuthClient
            {
                ClientId     = siteSettingsHelper.GetCurrentSiteInstagramClientIdToken(),
                ClientSecret = siteSettingsHelper.GetCurrentSiteInstagramClientSecret(),
                RedirectUri  = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + redirectUrl
            };
        }
コード例 #2
0
        public static bool DeleteFromAmazonS3(string providerName, JobApplicationAttachmentType attachmentType, string itemTitle)
        {
            SiteSettingsHelper siteSettingsHelper = new SiteSettingsHelper();

            S3FilemanagerService fileManagerService = new S3FilemanagerService(_siteSettingsHelper.GetAmazonS3RegionEndpoint(), _siteSettingsHelper.GetAmazonS3AccessKeyId(), _siteSettingsHelper.GetAmazonS3SecretKey());
            var response = fileManagerService.DeleteObjectFromProvider <S3FileManagerResponse, S3FileManagerRequest>(
                new S3FileManagerRequest
            {
                FileName     = itemTitle,
                Directory    = _siteSettingsHelper.GetAmazonS3UrlName() + "/" + JobApplicationAttachmentSettings.PROFILE_RESUME_UPLOAD_LIBRARY,
                S3BucketName = _siteSettingsHelper.GetAmazonS3BucketName()
            });

            return(response != null ? response.Success : false);
        }
コード例 #3
0
        public static Stream GetFileStreamFromAmazonS3(string srcLibName, int attachmentType, string fileTitle)
        {
            SiteSettingsHelper siteSettingsHelper = new SiteSettingsHelper();

            fileTitle = fileTitle.Split('_').First() + "_" + fileTitle;

            S3FilemanagerService fileManagerService = new S3FilemanagerService(siteSettingsHelper.GetAmazonS3RegionEndpoint(), siteSettingsHelper.GetAmazonS3AccessKeyId(), siteSettingsHelper.GetAmazonS3SecretKey());
            var response = fileManagerService.GetObjectFromProvider <S3FileManagerResponse, S3FileManagerRequest>(
                new S3FileManagerRequest
            {
                FileName     = fileTitle,
                Directory    = siteSettingsHelper.GetAmazonS3UrlName() + "/" + JobApplicationAttachmentSettings.PROFILE_RESUME_UPLOAD_LIBRARY,
                S3BucketName = siteSettingsHelper.GetAmazonS3BucketName()
            });

            return(response.FileStream);
        }
コード例 #4
0
        public static S3FileManagerResponse UploadToAmazonS3(Guid masterDocumentId, string providerName, string libName, string fileName, Stream fileStream)
        {
            try
            {
                SiteSettingsHelper siteSettingsHelper = new SiteSettingsHelper();

                S3FilemanagerService fileManagerService = new S3FilemanagerService(_siteSettingsHelper.GetAmazonS3RegionEndpoint(), _siteSettingsHelper.GetAmazonS3AccessKeyId(), _siteSettingsHelper.GetAmazonS3SecretKey());
                var response = fileManagerService.PostObjectToProvider <S3FileManagerResponse, S3FileManagerRequest>(
                    new S3FileManagerRequest
                {
                    FileName     = masterDocumentId.ToString() + "_" + fileName,
                    Directory    = _siteSettingsHelper.GetAmazonS3UrlName() + "/" + libName,
                    FileStream   = fileStream,
                    S3BucketName = _siteSettingsHelper.GetAmazonS3BucketName(),
                    ContentType  = AmazonS3Constants.DocumentContentType
                });
                return(response);
            }
            catch (Exception)
            {
                return(null);
            }
        }
コード例 #5
0
        // Interface method
        public SocialMediaProcessedResponse ProcessData(string code, string state, string indeedData)
        {
            Log.Write("ProcessData Seek ProcessData : ", ConfigurationPolicy.ErrorLog);
            SocialMediaProcessedResponse processedResponse = null;

            if (!code.IsNullOrEmpty())
            {
                Log.Write("ProcessData Seek Condtion check true : ", ConfigurationPolicy.ErrorLog);
                processedResponse = new SocialMediaProcessedResponse();
                try
                {
                    var siteSettingsHelper = new SiteSettingsHelper();

                    // Fetaching Seek information from site settings
                    var clientId     = siteSettingsHelper.GetCurrentSiteSeekClientId();
                    var clientSecret = siteSettingsHelper.GetCurrentSiteSeekClientSecret();
                    var advertiserId = siteSettingsHelper.GetCurrentSiteSeekClientAdvertiserId();
                    var redirectUri  = siteSettingsHelper.GetCurrentSiteSeekRedirectUri();

                    // Fill the seek request for the API call
                    SeekSocialMediaRequest req = new SeekSocialMediaRequest();
                    req.AuthorisationCode = code;
                    req.ClientId          = clientId;
                    req.ClientSecret      = clientSecret;
                    req.AdvertiserId      = advertiserId;
                    req.RedirectUri       = redirectUri;
                    req.JobTitle          = "developer";
                    req.CountryCode       = "61";
                    req.JobUrl            = "http://localhost:60876/jobs";
                    req.PositionUrl       = "dfdf";
                    req.PostalCode        = "2145";

                    SeekSocialMediaService seekSocialMediaService = new SeekSocialMediaService();
                    if (Int32.TryParse(state, out int jobId))
                    {
                        processedResponse.JobId = jobId;
                    }
                    // Seek API call
                    var seekAPIResponse = seekSocialMediaService.ProcessSocialMediaIntegration <SeekSocialMediaResponse, SeekSocialMediaRequest>(req);

                    #region Downloading the resume
                    // Downloading the resume from seek
                    if (seekAPIResponse.SocialMediaProcessSuccess && seekAPIResponse.SeekApplication.resume != null)
                    {
                        processedResponse.Success     = true;
                        processedResponse.Email       = seekAPIResponse.SeekApplication.applicantInfo.emailAddress;
                        processedResponse.FirstName   = seekAPIResponse.SeekApplication.applicantInfo.firstName;
                        processedResponse.LastName    = seekAPIResponse.SeekApplication.applicantInfo.lastName;
                        processedResponse.PhoneNumber = seekAPIResponse.SeekApplication.applicantInfo.phoneNumber;

                        HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(seekAPIResponse.SeekApplication.resume.link);
                        webReq.ContentType = "application/json";
                        webReq.Accept      = "application/octet-stream";
                        webReq.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + seekAPIResponse.SeekApplication.OAuthToken);

                        WebResponse webResponse = webReq.GetResponse();

                        string[] splits = webResponse.Headers["Content-Disposition"].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                        string   resumeFileNameSplit = splits.Where(c => c.Contains("filename=")).FirstOrDefault();
                        string   resumeFileName      = resumeFileNameSplit.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries).Last();

                        MemoryStream fileStream = new MemoryStream();

                        byte[] fileBytes = GetStreamBytes(webResponse);
                        fileStream = new MemoryStream(fileBytes);
                        processedResponse.FileStream = fileStream;
                        processedResponse.FileName   = resumeFileName;
                    }
                    else
                    {
                        if (!seekAPIResponse.SocialMediaProcessSuccess)
                        {
                            processedResponse.Success = false;
                            processedResponse.Errors  = seekAPIResponse.Errors;
                        }
                        else
                        {
                            processedResponse.Success             = false;
                            processedResponse.ResumeLinkNotExists = true;
                            processedResponse.Errors = new List <string>()
                            {
                                "Seek Resume Link is NULL"
                            };
                        }
                    }
                }
                #endregion

                catch (Exception ex)
                {
                    processedResponse.Success = false;
                    List <string> errors = new List <string>();
                    errors.Add(ex.Message);
                    processedResponse.Errors = errors;
                }
            }

            return(processedResponse);
        }
コード例 #6
0
        // GET: JobDetails
        public ActionResult Index(int?jobId)
        {
            JobDetailsViewModel viewModel = new JobDetailsViewModel();

            if (jobId.HasValue)
            {
                // Get job source or url referral

                string UrlReferral = string.Empty;
                if (!string.IsNullOrWhiteSpace(Request.QueryString["source"]))
                {
                    UrlReferral = Request.QueryString["source"];
                }
                else
                {
                    UrlReferral = this.GetCookieDomain(Request.Cookies["JobsViewed"], jobId.Value);
                }

                viewModel.UrlReferral = UrlReferral;
                Log.Write($" viewModel.UrlReferral  : " + viewModel.UrlReferral, ConfigurationPolicy.ErrorLog);

                IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest {
                    JobID = jobId.Value
                };
                IGetJobListingResponse jobListingResponse = _BLConnector.GuestGetJob(jobListingRequest);

                if (jobListingResponse.Job != null && !jobListingResponse.Job.IsDeleted)
                {
                    viewModel.JobDetails = jobListingResponse.Job;

                    // Getting Consultant Avatar Image Url from Sitefinity
                    viewModel.ApplicationEmail = jobListingResponse.Job.CustomData["ApplicationMethod.ApplicationEmail"];
                    var user = SitefinityHelper.GetUserByEmail(jobListingResponse.Job.CustomData["ApplicationMethod.ApplicationEmail"]);
                    if (user != null && user.Id != Guid.Empty)
                    {
                        viewModel.ApplicationAvatarImageUrl = SitefinityHelper.GetUserAvatarUrlById(user.Id);
                    }

                    if (this.Model.IsJobApplyAvailable())
                    {
                        viewModel.JobApplyAvailable = true;
                    }

                    // Processing Classifications
                    OrderedDictionary classifOrdDict = new OrderedDictionary();
                    classifOrdDict.Add(jobListingResponse.Job.CustomData["Classifications[0].Filters[0].ExternalReference"], jobListingResponse.Job.CustomData["Classifications[0].Filters[0].Value"]);
                    string parentClassificationsKey = "Classifications[0].Filters[0].SubLevel[0]";
                    JobDetailsViewModel.ProcessCustomData(parentClassificationsKey, jobListingResponse.Job.CustomData, classifOrdDict);
                    OrderedDictionary classifParentIdsOrdDict = new OrderedDictionary();
                    JobDetailsViewModel.AppendParentIds(classifOrdDict, classifParentIdsOrdDict);

                    var bull = jobListingResponse.Job.CustomData["Bulletpoints.BulletPoint1"];

                    // Processing Locations
                    OrderedDictionary locOrdDict = new OrderedDictionary();
                    locOrdDict.Add(jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].ExternalReference"], jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].Value"]);
                    string parentLocKey = "CountryLocationArea[0].Filters[0].SubLevel[0]";
                    JobDetailsViewModel.ProcessCustomData(parentLocKey, jobListingResponse.Job.CustomData, locOrdDict);
                    OrderedDictionary locParentIdsOrdDict = new OrderedDictionary();
                    JobDetailsViewModel.AppendParentIds(locOrdDict, locParentIdsOrdDict);

                    DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.DateCreated), TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time"));
                    DateTime utcTime   = ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.DateCreated);
                    DateTime elocalTime;
                    DateTime eutcTime = new DateTime();
                    TimeSpan offset   = localTime - utcTime;
                    TimeSpan eoffset  = new TimeSpan();


                    if (jobListingResponse.Job.ExpiryDate.HasValue)
                    {
                        elocalTime = TimeZoneInfo.ConvertTimeFromUtc(ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.ExpiryDate.Value), TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time"));
                        eutcTime   = ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.ExpiryDate.Value);
                        eoffset    = elocalTime - eutcTime;
                    }

                    viewModel.Classifications         = classifParentIdsOrdDict;
                    viewModel.Locations               = locParentIdsOrdDict;
                    viewModel.ClassificationsRootName = "Classifications";
                    viewModel.LocationsRootName       = "CountryLocationArea";
                    var siteSettingsHelper = new SiteSettingsHelper();
                    viewModel.JobCurrencySymbol = siteSettingsHelper.GetJobCurrencySymbol();

                    // Getting the SEO route name for classifications
                    List <string> seoString = new List <string>();
                    foreach (var key in classifParentIdsOrdDict.Keys)
                    {
                        string value     = classifParentIdsOrdDict[key].ToString();
                        string SEOString = Regex.Replace(value, @"([^\w]+)", "-");
                        seoString.Add(SEOString);
                    }

                    viewModel.ClassificationsSEORouteName = jobListingResponse.Job.ClassificationURL;

                    ViewBag.CssClass = this.CssClass;
                    ViewBag.JobApplicationPageUrl = SfPageHelper.GetPageUrlById(JobApplicationPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(JobApplicationPageId));
                    ViewBag.JobResultsPageUrl     = SfPageHelper.GetPageUrlById(JobResultsPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(JobResultsPageId));
                    ViewBag.EmailJobPageUrl       = SfPageHelper.GetPageUrlById(EmailJobPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(EmailJobPageId));
                    ViewBag.GoogleForJobs         = ReplaceToken(GoogleForJobsTemplate, JsonConvert.SerializeObject(new
                    {
                        CurrencySymbol        = "$",
                        SalaryLowerBand       = jobListingResponse.Job.CustomData.ContainsKey("Salaries[0].Filters[0].Min") ? jobListingResponse.Job.CustomData["Salaries[0].Filters[0].Min"] : null,
                        SalaryUpperBand       = jobListingResponse.Job.CustomData.ContainsKey("Salaries[0].Filters[0].Max") ? jobListingResponse.Job.CustomData["Salaries[0].Filters[0].Max"] : null,
                        FullDescription       = jobListingResponse.Job.Description,
                        Description           = jobListingResponse.Job.ShortDescription,
                        AdvertiserCompanyName = jobListingResponse.Job.CustomData.ContainsKey("CompanyName") ? jobListingResponse.Job.CustomData["CompanyName"] : null,
                        ProfessionName        = jobListingResponse.Job.CustomData.ContainsKey("Classifications[0].Filters[0].Value") ? jobListingResponse.Job.CustomData["Classifications[0].Filters[0].Value"] : null,
                        LocationName          = jobListingResponse.Job.CustomData.ContainsKey("CountryLocationArea[0].Filters[0].Value") ? jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].Value"] : null,
                        AreaName   = jobListingResponse.Job.CustomData.ContainsKey("CountryLocationArea[0].Filters[0].SubLevel[0].Value") ? jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].SubLevel[0].Value"] : null,
                        JobName    = jobListingResponse.Job.Title,
                        DatePosted = string.Format("|{0}+{1}|", utcTime.ToString("yyyy-MM-ddThh:mm:ss"), offset.Hours.ToString("00") + ":" + offset.Minutes.ToString("00")),
                        ExpiryDate = (jobListingResponse.Job.ExpiryDate.HasValue) ? string.Format("|{0}+{1}|", eutcTime.ToString("yyyy-MM-ddThh:mm:ss"), eoffset.Hours.ToString("00") + ":" + eoffset.Minutes.ToString("00")) : string.Empty,
                        Address    = jobListingResponse.Job.Address
                    }));
                    var fullTemplateName = this.templateNamePrefix + this.TemplateName;
                    // If it is null make sure that pass empty string , because html attrubutes will not work properly.
                    viewModel.JobDetails.Address           = viewModel.JobDetails.Address == null ? "" : viewModel.JobDetails.Address;
                    viewModel.JobDetails.AddressLatitude   = viewModel.JobDetails.AddressLatitude == null ? "" : viewModel.JobDetails.AddressLatitude;
                    viewModel.JobDetails.AddressLongtitude = viewModel.JobDetails.AddressLongtitude == null ? "" : viewModel.JobDetails.AddressLongtitude;

                    #region Check job already applied
                    ViewBag.IsJobApplied = false;
                    JXTNext_MemberAppliedJobResponse response = _BLConnector.MemberAppliedJobsGet() as JXTNext_MemberAppliedJobResponse;
                    if (response.Success)
                    {
                        foreach (var item in response.MemberAppliedJobs)
                        {
                            if (item.JobId == jobId.Value)
                            {
                                ViewBag.IsJobApplied = true;
                                break;
                            }
                        }
                    }
                    #endregion
                    var meta = new System.Web.UI.HtmlControls.HtmlMeta();
                    meta.Attributes.Add("property", "og:title");
                    meta.Content = jobListingResponse.Job.Title;

                    // Get the current page handler in order to access the page header
                    var pageHandler = this.HttpContext.CurrentHandler.GetPageHandler();
                    pageHandler.Header.Controls.Add(meta);
                    return(View(fullTemplateName, viewModel));
                }
                else
                {
                    if (jobListingResponse.Job != null && jobListingResponse.Job.IsDeleted)
                    {
                        return(Content("This Job is no longer available!"));
                    }
                    else
                    {
                        return(Content("No job has been found"));
                    }
                }
            }

            return(Content("No job has been selected"));
        }
コード例 #7
0
 public InstagramController()
 {
     siteSettingsHelper = new SiteSettingsHelper();
 }