#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void geoCodeLocation(string location)
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void

        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }

            BTProgressHUD.Show("Loading...", -1, ProgressHUD.MaskType.Black);

            //AsyncGeocodeLocation
            ServiceManager jobService = new ServiceManager();

            string latLong = await jobService.AsyncGeocodeLocation(location);

            Console.WriteLine(latLong);

            if (!string.IsNullOrEmpty(latLong))
            {
                Gai.SharedInstance.DefaultTracker.Send(DictionaryBuilder.CreateEvent("Job Search", "JobSearch_button_press", "AppEvent", null).Build());
                Gai.SharedInstance.Dispatch();                 // Manually dispatch the event immediately // just for demonstration // not much recommended


                // Add recent search in local DB.
                this.AddRecentSearchData();

                // Get job search result based on input keyword and location
                GetJobSearchData(this.txtKeyword.Text.Trim(), this.txtLocation.Text.Trim());
            }
            else
            {
                BTProgressHUD.Dismiss();
            }
        }
        async void JobSearchButtonPressed(object sender, EventArgs ea)
        {
            //ServiceManager jobService = new ServiceManager();
            //List<string> settings = await jobService.GetSettingsDetails("adecco.fr", "fr-Fr");
            //Console.WriteLine(" settings response = > {0}",settings);

            //return;

            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }

            View.EndEditing(true);

            string location = this.txtLocation.Text.Trim();

            searchJobButtonPressed = true;

            if (!string.IsNullOrEmpty(location))
            {
                Constants.shouldGeoCodeLocation = true;

                // geocode location first then search job listing
                this.geoCodeLocation(this.txtLocation.Text.Trim());
            }
            else
            {
                // Add recent search in local DB.
                this.AddRecentSearchData();

                // Get job search result based on input keyword and location
                GetJobSearchData(this.txtKeyword.Text.Trim(), this.txtLocation.Text.Trim());
            }
        }
Beispiel #3
0
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void CreateJobAlert(string keyword, string location)
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }

            location = System.Net.WebUtility.UrlEncode(location);
            keyword  = System.Net.WebUtility.UrlEncode(keyword);


            BTProgressHUD.Show("Loading...", -1, ProgressHUD.MaskType.Black);


            JobRequest jobRequest = new JobRequest();

            jobRequest.Keyword             = "";
            jobRequest.Location            = "";
            jobRequest.CurrentLanguage     = "nl-NL";
            jobRequest.SitenameForRegister = Constants.JobDetailSiteName;

            jobRequest.FilterURL = Constants.JobSearchFilterURL + "pageNum=" + Constants.CurrentpageNum + "&display=" + Constants.displayCount + "&k=" + keyword + "&l=" + location;

            // Refine result if filter appiled.
            if (!string.IsNullOrEmpty(Constants.FilterURL))
            {
                jobRequest.FilterURL = Constants.FilterURL;
            }

            if (!Constants.LocationLatLong.Equals("") && location.Contains("%2C"))
            {
                jobRequest.FilterURL = jobRequest.FilterURL + "&xy=" + Constants.LocationLatLong;
            }


            jobRequest.FacetSettingId = Constants.JobSearchFacetSettingID;
            jobRequest.BaseAddress    = Constants.JobBaseAddress;

            jobRequest.AlertData.Add("AlertName", _jobAlerts[0].inputValue);
            jobRequest.AlertData.Add("JobAlertFrequencyId", _jobAlerts[1].inputValue);
            jobRequest.AlertData.Add("FirstName", _jobAlerts[2].inputValue);
            jobRequest.AlertData.Add("LastName", _jobAlerts[3].inputValue);
            jobRequest.AlertData.Add("EmailAddress", _jobAlerts[4].inputValue);


            ServiceManager jobService = new ServiceManager();

            string JobAlertIdValue = await jobService.AsyncCreateJobAlert(jobRequest);

            if (!string.IsNullOrEmpty(JobAlertIdValue))
            {
                var alert = UIAlertController.Create("Adecco Nederland", "Your new Job Alert is created successfully.", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Thanks", UIAlertActionStyle.Default, action => JobAlertCreated()));
                PresentViewController(alert, animated: true, completionHandler: null);
            }

            BTProgressHUD.Dismiss();
        }
        #pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void getBranchList()
        #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }

            //BTProgressHUD.Show("Searching Branches...", -1, ProgressHUD.MaskType.Black);

            //Console.WriteLine("JobLocations ==> {0}",DbHelper.JobLocations);

            BranchRequest _branchRequest = new BranchRequest();

            _branchRequest.Latitude  = Constants.Latitude;
            _branchRequest.Longitude = Constants.Longitude;
            _branchRequest.Radius    = ConfigManager.BLRadius;

            if (!string.IsNullOrEmpty(Constants.Latitude))
            {
                _branchRequest.Latitude = Constants.Latitude;
            }

            if (!string.IsNullOrEmpty(Constants.Longitude))
            {
                _branchRequest.Longitude = Constants.Longitude;
            }

            if (!string.IsNullOrEmpty(this.txtDistance.Text))
            {
                String[] splitstring = txtDistance.Text.Split(' ');
                _branchRequest.Radius = splitstring[0];
            }


            _branchRequest.RadiusUnits = "KM";
            _branchRequest.Industry    = "ALL";
            _branchRequest.MaxResults  = ConfigManager.BLMaxResultCount;

            ServiceManager jobService = new ServiceManager();

            List <Branch> _branchList = await jobService.AsyncBranchLocator(_branchRequest);

            //Console.WriteLine(_branchList);
            BTProgressHUD.Dismiss();


            Gai.SharedInstance.DefaultTracker.Send(DictionaryBuilder.CreateEvent("Branch Search", "BranchSearch_button_press", "AppEvent", null).Build());
            Gai.SharedInstance.Dispatch();             // Manually dispatch the event immediately // just for demonstration // not much recommended


            AppDelegate  appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
            UIStoryboard storyboard  = UIStoryboard.FromName(appDelegate.storyboard, null);

            var _aBranchListVC = (BranchListVC)storyboard.InstantiateViewController("BranchListVC");

            _aBranchListVC._branchList = _branchList;
            this.NavigationController.PushViewController(_aBranchListVC, true);
        }
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void GetJobSearchData(string keyword, string location)
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }
            //var _JobAlertVC = (JobAlertVC)Storyboard.InstantiateViewController("JobAlertVC");
            //NavController.PushViewController(_JobAlertVC, true);

            //return;

            //location = "nederland";
            //Constants.LocationLatLong = "";

            if (keyword.Equals("N/A"))
            {
                keyword = "";
            }

            if (location.Equals("N/A"))
            {
                location = "";
            }

            Constants.JobKeyword  = keyword.Trim();
            Constants.JobLocation = location.Trim();



            location = System.Net.WebUtility.UrlEncode(location);
            keyword  = System.Net.WebUtility.UrlEncode(keyword);


            BTProgressHUD.Show("Loading...", -1, ProgressHUD.MaskType.Black);


            jobRequest          = new JobRequest();
            jobRequest.Keyword  = "";
            jobRequest.Location = "";

            //jobRequest.CurrentLanguage = "nl-NL";
            //jobRequest.SitenameForRegister = Constants.JobDetailSiteName;

            jobRequest.CurrentLanguage     = Constants.JobDetailCurrentLanguage;
            jobRequest.SitenameForRegister = Constants.JobDetailSiteName;


            jobRequest.FilterURL = Constants.JobSearchFilterURL + "pageNum=" + Constants.CurrentpageNum + "&display=" + Constants.displayCount + "&k=" + keyword + "&l=" + location;

            if (!Constants.LocationLatLong.Equals("") && location.Contains("%2C"))
            {
                jobRequest.FilterURL = jobRequest.FilterURL + "&xy=" + Constants.LocationLatLong;
            }


            jobRequest.FacetSettingId = Constants.JobSearchFacetSettingID;
            jobRequest.BaseAddress    = Constants.JobBaseAddress;


            List <JobCMS> searchResults = new List <JobCMS>();

            ServiceManager jobService = new ServiceManager();

            Dictionary <string, dynamic> serverResponse = await jobService.AsyncJobSearch(jobRequest);

            Constants.jobSearchResponse = serverResponse;

            if (searchJobButtonPressed)
            {
                if (serverResponse.ContainsKey("jobList"))
                {
                    searchResults = serverResponse["jobList"];
                }
            }
            else
            {
                if (serverResponse.ContainsKey("jobList"))
                {
                    jobList = serverResponse["jobList"];
                }
            }


            BTProgressHUD.Dismiss();


            if (jobList == null)
            {
                BTProgressHUD.ShowToast("No record found.", false, 3000);
                return;
            }

            if (searchResults == null)
            {
                BTProgressHUD.ShowToast("No record found.", false, 3000);
                return;
            }

            if (jobList == null)
            {
                jobList = new List <JobCMS>();
            }

            if (searchJobButtonPressed)
            {
                if (searchResults == null)
                {
                    searchResults = new List <JobCMS>();
                }

                var searchResultVC = (SearchResultVC)Storyboard.InstantiateViewController("SearchResultVC");
                searchResultVC.jobList         = searchResults;
                searchResultVC.isFavoriteJob   = false;
                searchResultVC._keyword        = this.txtKeyword.Text.Trim();
                searchResultVC._location       = this.txtLocation.Text.Trim();
                searchResultVC.LocationLatLong = Constants.LocationLatLong;
                searchResultVC.aJobRequest     = jobRequest;
                NavController.PushViewController(searchResultVC, true);
                searchJobButtonPressed = false;
            }
            else
            {
                tblView.Source = new TableSource(jobList, _recentSearchs, isRecentSearch, this);
                //Delegate = new TableViewDelegate(list);
                //tblView.Delegate = new TableViewDelegate(jobList);
                //tblView.WeakDelegate = this;
                tblView.ReloadData();
            }


            tblView.AllowsSelection        = true;
            tblView.UserInteractionEnabled = true;
        }
                #pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void GetJobSearchData(string keyword, string location)
                #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }

            location = System.Net.WebUtility.UrlEncode(location);
            keyword  = System.Net.WebUtility.UrlEncode(keyword);

            // Add table footer view if this is not a fav job screen
            if (!isFavoriteJob)
            {
                this.AddTableFooterView();
            }

            JobRequest jobRequest = new JobRequest();

            jobRequest.Keyword             = "";
            jobRequest.Location            = "";
            jobRequest.CurrentLanguage     = "nl-NL";
            jobRequest.SitenameForRegister = Constants.JobDetailSiteName;

            jobRequest.FilterURL = Constants.JobSearchFilterURL + "pageNum=" + this.CurrentpageNum.ToString() + "&display=" + Constants.displayCount + "&k=" + keyword + "&l=" + location;

            // Refine result if filter appiled.
            if (!string.IsNullOrEmpty(Constants.FilterURL))
            {
                jobRequest.FilterURL = Constants.FilterURL;
            }


            if (!this.isLoadingMoreData)
            {
                BTProgressHUD.Show("Loading...", -1, ProgressHUD.MaskType.Black);
            }


            if (!this.LocationLatLong.Equals("") && location.Contains("%2C"))
            {
                jobRequest.FilterURL = jobRequest.FilterURL + "&xy=" + this.LocationLatLong;
            }
            jobRequest.FacetSettingId = Constants.JobSearchFacetSettingID;
            jobRequest.BaseAddress    = Constants.JobBaseAddress;


            this.aJobRequest = jobRequest;

            ServiceManager jobService = new ServiceManager();
            //List<JobCMS> jobList2 = await jobService.AsyncJobSearch(jobRequest);

            Dictionary <string, dynamic> responseDict = await jobService.AsyncJobSearch(jobRequest);

            Constants.jobSearchResponse = responseDict;

            if (!Constants.jobSearchResponse.ContainsKey("jobList"))
            {
                BTProgressHUD.Dismiss();
                return;
            }
            List <JobCMS> jobList2 = responseDict["jobList"];


            // If we are fetching more data then append into joblist
            if (this.isLoadingMoreData)
            {
                jobList.AddRange(jobList2);
            }
            else
            {
                // else  simple refresh the job list
                jobList = jobList2;
            }

            //jobList = (System.Collections.Generic.List<AdeccoNL.JobCMS>)jobList.Concat(jobList2);

            tblView.Source = new TableSource(jobList, this, this.isFavoriteJob);

            this.appliedFilterList();

            tblView.ReloadData();

            tblView.AllowsSelection        = true;
            tblView.UserInteractionEnabled = true;

            // Remove table footer view
            tblView.TableFooterView = new UIView();

            // Refine result if filter appiled.
            BTProgressHUD.Dismiss();
            this.headerLabel.Text = "  " + Constants.JobCount;
        }
Beispiel #7
0
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void GetJobDetails()
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            if (!string.IsNullOrEmpty(this.jobTitle) && !(this.jobTitle.Equals("NoContent")))
            {
                this.titleLabel.Text = this.jobTitle;
            }
            else
            {
                this.titleLabel.Hidden = true;
            }
            if (!string.IsNullOrEmpty(this.isNew))
            {
                this.lblNew.Hidden = false;
            }
            else
            {
                this.lblNew.Hidden        = true;
                this.favorateButton.Frame = new CGRect(315, 20, 30, 30);
            }

            if (aJob.isFavorote)
            {
                favorateButton.SetImage(UIImage.FromFile("heart-icon-selected.png"), UIControlState.Normal);
            }

            else
            {
                favorateButton.SetImage(UIImage.FromFile("fav-icon.png"), UIControlState.Normal);
            }


            if (!string.IsNullOrEmpty(this.loaction) && !(this.loaction.Equals("NoContent")))
            {
                this.locationLabel.Text = this.loaction;
            }
            else
            {
                this.locationLabel.Text = "No Content";
                //this.locationLabel.Hidden = true;
                //this.btnLocation.Hidden = true;
            }

            //if (!string.IsNullOrEmpty(this.salary) && !(this.salary.Equals("NoContent")))
            //{
            //	this.salaryLabel.Text = this.salary;
            //}
            //else
            //{
            //	this.salaryLabel.Hidden = true;
            //	this.btnSalary.Hidden = true;

            //}
            if (!string.IsNullOrEmpty(this.jobCategory) && !(this.jobCategory.Equals("NoContent")))
            {
                this.categoryLabel.Text = this.jobCategory;
            }
            else
            {
                this.categoryLabel.Text = "N/A";
                //this.btnCategory.Hidden = true;
            }

            if (!string.IsNullOrEmpty(aJob.ContractTypeTitle) && !(aJob.ContractTypeTitle.Equals("NoContent")))
            {
                this.ContractTypeLabel.Text = aJob.ContractTypeTitle;
            }
            else
            {
                this.ContractTypeLabel.Hidden = true;
                this.btnContractType.Hidden   = true;
            }

            if (Constants.JobDetailSiteName.Equals("adecco.fr"))
            {
            }



            try
            {
                NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();
                if (remoteHostStatus == NetworkStatus.NotReachable)
                {
                    var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, animated: true, completionHandler: null);

                    return;
                }

                BTProgressHUD.Show("Loading...", -1, ProgressHUD.MaskType.Black);

                aJobDetail = new JobCIS();

                ServiceManager jobService = new ServiceManager();
                this.aJobDetail = await jobService.GetJobDetails(this.JobId);

                loadData(aJobDetail);
            }
            catch (Exception ex)
            {
                string str = ex.Message;
            }
        }