Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };

            this.Title = "Refine";

            /*
             * this.NavigationItem.SetLeftBarButtonItem(
             * new UIBarButtonItem("Reset"
             *                                      , UIBarButtonItemStyle.Done
             * , (sender, args) =>
             * {
             *      //Apply button was clicked
             *      //var sfViewController = new SFSafariViewController(new NSUrl(this.aJobDetail.ApplyUri));
             *      //PresentViewControllerAsync(sfViewController, true);
             *      var alert = UIAlertController.Create("Adecco Nederland", "Are you sure ? You want to remove all the filter.", UIAlertControllerStyle.Alert);
             *
             *      alert.AddAction(UIAlertAction.Create("No Thanks", UIAlertActionStyle.Default, null));
             *      alert.AddAction(UIAlertAction.Create("YES", UIAlertActionStyle.Default, action => resetFilterHandler()));
             *
             *      PresentViewController(alert, animated: true, completionHandler: null);
             *
             *
             * })
             * , true);
             */

            this.NavigationItem.SetRightBarButtonItem(
                new UIBarButtonItem("RESET"
                                    , UIBarButtonItemStyle.Done
                                    , (sender, args) =>
            {
                //Reset button was clicked
                var alert = UIAlertController.Create("Adecco Nederland", "Are you sure ? You want to remove all the filter.", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("No Thanks", UIAlertActionStyle.Default, null));
                alert.AddAction(UIAlertAction.Create("YES", UIAlertActionStyle.Default, action => resetFilterHandler()));
                PresentViewController(alert, animated: true, completionHandler: null);
            })
                , true);

            //#EEEEEE   light Grey color
            //View.BackgroundColor = UIColor.Clear.FromHexString("##EEEEEE", 1.0f);

            btnApply.BackgroundColor = UIColor.Red;             //UIColor.Clear.FromHexString("#ef2e24", 1.0f);


            //#FFFFFF  white color
            //Table.BackgroundColor = UIColor.Clear.FromHexString("##FFFFFF", 1.0f);
            //Table.Layer.BorderColor = UIColor.LightGray.CGColor;
            //Table.Layer.BorderWidth = 0.5f;
            //Table.Layer.CornerRadius = 2.0f;
            //Table.Layer.MasksToBounds = true;
            //Table.ClipsToBounds = true;


            Table.Source = new ExpandableTableSource(this.presentationFacetResultList, Table, this);

            this.appliedFilterList();


            // show radius slider if location exist only
            if (jobRequest.FilterURL.Contains("&xy"))
            {
                footerView.Hidden = false;
            }

            else
            {
                footerView.Hidden = true;
            }



            //Constants.selectedRadius = "&r=" + selectedRadius;


            string[] tokens = Constants.selectedRadius.Split(new[] { "=" }, StringSplitOptions.None);

            float radius = float.Parse(tokens[1], CultureInfo.InvariantCulture.NumberFormat);

            radiusSlider.SetValue(radius, true);

            lblRadius.Text = string.Format("Distance {0} Kilometers", tokens[1]);

            radiusSlider.Continuous = false;

            radiusSlider.TouchUpInside += (o, e) =>
            {
                int    kSliderInterval = 5;
                double sliderValue     = kSliderInterval * Math.Floor((radiusSlider.Value / kSliderInterval) + 0.5);
                var    selectedRadius  = Convert.ToInt32(sliderValue);
                radiusSlider.SetValue((float)sliderValue, true);
                Constants.isFileterApplied = true;
                //var selectedRadius = Convert.ToInt32(radiusSlider.Value);
                lblRadius.Text = string.Format("Distance {0} Kilometers", selectedRadius);
                // &r=25"

                this.radiusValueChanged(selectedRadius.ToString());
            };

            radiusSlider.ValueChanged += (o, e) =>
            {
                var selectedRadius = Convert.ToInt32(radiusSlider.Value);
                lblRadius.Text = string.Format("Beam {0} mileage", selectedRadius);
            };


            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            appDelegate.SidebarController.Disabled = true;

            Gai.SharedInstance.DefaultTracker.Set(GaiConstants.ScreenName, "Refine");
            Gai.SharedInstance.DefaultTracker.Send(DictionaryBuilder.CreateScreenView().Build());
        }
        #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);
        }
        public void UpdateCell(JobCMS aJob)
        {
            this.titleLabel.Text    = aJob.JobTitle;
            this.LocationLabel.Text = aJob.JobLocation;
            //this.datePostedLabel.Hidden = true;

            if (!string.IsNullOrEmpty(aJob.Salary) && !(aJob.Salary.Equals("NoContent")))
            {
                this.ContractType.Text         = aJob.Salary;
                this.ContractTypeImgView.Image = UIImage.FromBundle("eurosymbol.png");
                //
            }
            else if (!string.IsNullOrEmpty(aJob.ContractTypeTitle) && !(aJob.ContractTypeTitle.Equals("NoContent")))
            {
                this.ContractType.Text         = aJob.ContractTypeTitle;
                this.ContractTypeImgView.Image = UIImage.FromBundle("calender-icon.png");
            }
            else
            {
                this.ContractType.Text         = "N/A";
                this.ContractTypeImgView.Image = UIImage.FromBundle("calender-icon.png");
                //this.expLable.Hidden = true;
                //this.expImgView.Hidden = tr
            }
            if (!string.IsNullOrEmpty(aJob.JobCategoryTitle) && !(aJob.JobCategoryTitle.Equals("NoContent")))
            {
                this.CategoryLabel.Text      = aJob.JobCategoryTitle;
                this.CategoryImageView.Image = UIImage.FromBundle("Truck.png");
            }
            else
            {
                this.CategoryLabel.Text      = "N/A";
                this.CategoryImageView.Image = UIImage.FromBundle("Truck.png");
                //this.expLable.Hidden = true;
                //this.expImgView.Hidden = tr
            }
            if (!string.IsNullOrEmpty(aJob.isExpiredorNew))
            {
                this.lblNew.Hidden             = false;
                this.lblNew.Layer.CornerRadius = 5.0f;
            }
            else
            {
                this.lblNew.Hidden = true;
            }

            //btnFavJob.Hidden = true;

            // iPhone 5 customization
            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            if (appDelegate.Window.Frame.Size.Width == 320 && appDelegate.Window.Frame.Size.Height == 568)
            {
                this.titleLabel.Frame      = new CGRect(5, 5, 270, 25);
                this.btnFavJob.Frame       = new CGRect(275, 5, 40, 40);
                this.datePostedLabel.Frame = new CGRect(220, 60, 95, 20);
            }
            else if (appDelegate.Window.Frame.Size.Width == 414)
            {                   // iPhone 6+
                this.titleLabel.Frame      = new CGRect(5, 5, 350, 25);
                this.btnFavJob.Frame       = new CGRect(360, 5, 40, 40);
                this.datePostedLabel.Frame = new CGRect(300, 60, 95, 20);
            }

            string endDate = "";

            if (!string.IsNullOrEmpty(aJob.PostedDate))
            {
                string[] tokens = aJob.PostedDate.Split(new[] { " " }, StringSplitOptions.None);
                endDate = tokens[0];
            }
            else if (!string.IsNullOrEmpty(aJob.PostingEndDate))
            {
                string[] tokens = aJob.PostingEndDate.Split(new[] { " " }, StringSplitOptions.None);
                endDate = tokens[0];
            }



            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "MM/dd/yyyy";
            NSDate date = dateFormat.Parse(endDate);

            DateTime dt = ConvertNsDateToDateTime(date);

            endDate = calculateJobPostedDate(dt);


            if (!string.IsNullOrEmpty(endDate) && !(endDate.Equals("NoContent")))
            {
                this.datePostedLabel.Text = endDate;
            }
            else
            {
                this.datePostedLabel.Hidden = true;
            }

            if (Constants.JobDetailSiteName.Equals("adecco.fr"))
            {
                this.datePostedLabel.Frame    = new CGRect(273, 60, 85, 20);
                this.CategoryLabel.Hidden     = true;
                this.CategoryImageView.Hidden = true;
            }
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            if (jobList != null)
            {
                tblView.ReloadData();
            }

            View.EndEditing(true);
            this.FavoriteButtonWithCount(NavigationItem);
            tblView.AllowsSelection = true;

            AutoCompleteTextFieldManager.RemoveTable();
            AutoCompleteTextFieldManager.RemoveAll();


            // clear filetr url used for refine
            Constants.FilterURL         = "";
            Constants.jobSearchResponse = new Dictionary <string, dynamic>();

            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            appDelegate.SidebarController.Disabled = false;


            // Now Get latest jobs if config file changed
            if (Constants.isConigurationChanged)
            {
                this.txtKeyword.Text  = "";
                this.txtLocation.Text = "";

                btnJobSearch.SetTitle(Translations.job_search, UIControlState.Normal);
                btnJobSearch.SetTitle(Translations.job_search, UIControlState.Highlighted);

                segmentCtrl.RemoveAllSegments();
                segmentCtrl.InsertSegment(Translations.latest_job, 0, false);
                segmentCtrl.InsertSegment(Translations.recent_search, 1, false);
                segmentCtrl.SelectedSegment = 0;

                this.txtKeyword.AttributedPlaceholder = new NSAttributedString(
                    Translations.keyword_title,
                    font: UIFont.SystemFontOfSize(15),
                    foregroundColor: UIColor.White,
                    strokeWidth: 0
                    );

                this.txtLocation.AttributedPlaceholder = new NSAttributedString(
                    Translations.location_title,
                    font: UIFont.SystemFontOfSize(15),
                    foregroundColor: UIColor.White,
                    strokeWidth: 0
                    );

                DbHelper.ResetDatabase();
                DbHelper.CreateDatabaseAndTables();

                _recentSearchs = DbHelper.GetRecentSearches();

                this.FavoriteButtonWithCount(NavigationItem);

                GetJobSearchData("", "");

                Constants.isConigurationChanged = false;
            }
        }
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                if (isRecentSearch)
                {
                    int index = _recentSearchs.Count - 1 - indexPath.Row;

                    RecentSearch aRecentSearch = _recentSearchs[index];

                    string keyword  = aRecentSearch.Keyword;
                    string location = aRecentSearch.Location;

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

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

                    if (!string.IsNullOrEmpty(aRecentSearch.LocationLatLong))
                    {
                        Constants.LocationLatLong = aRecentSearch.LocationLatLong;
                    }


                    _introViewCtrl.searchJobButtonPressed = true;
                    _introViewCtrl.txtKeyword.Text        = keyword;
                    _introViewCtrl.txtLocation.Text       = location;
                    _introViewCtrl.GetJobSearchData(keyword, location);
                }

                else
                {
                    string keyword  = _introViewCtrl.txtKeyword.Text.Trim();
                    string location = _introViewCtrl.txtLocation.Text.Trim();

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

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

                    Constants.JobKeyword  = keyword;
                    Constants.JobLocation = location;



                    JobCMS aJob = jobList[indexPath.Row];

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

                    var jobDetailVC = (JobDetailVC)storyboard.InstantiateViewController("JobDetailVC");
                    jobDetailVC.JobId       = aJob.JobId;
                    jobDetailVC.jobTitle    = aJob.JobTitle;
                    jobDetailVC.postingDate = aJob.PostedDate;
                    jobDetailVC.salary      = aJob.Salary;
                    jobDetailVC.jobCategory = aJob.JobCategoryTitle;
                    jobDetailVC.aJob        = aJob;
                    jobDetailVC.loaction    = aJob.JobLocation;
                    jobDetailVC.isNew       = aJob.isExpiredorNew;

                    _introViewCtrl.NavController.PushViewController(jobDetailVC, true);
                }

                tableView.DeselectRow(indexPath, true);
            }
Exemple #6
0
        void LoadFinished(object sender, EventArgs e)
        {
            float contentHeight = (float)webView.ScrollView.ContentSize.Height - 40;

            Console.WriteLine("== LoadFinished == ");


            CGRect webViewframe = this.webView.Frame;

            webViewframe.Size = new CGSize(webViewframe.Size.Width, contentHeight);
            webView.Frame     = webViewframe;

            float descHeight = (float)(webViewframe.Size.Height + webViewframe.Location.Y) + 50;

            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            if (appDelegate.Window.Frame.Size.Width == 320 && appDelegate.Window.Frame.Size.Height == 568)
            {
                // iphone 5
                socialNetworkingBGView.Frame = new CoreGraphics.CGRect(0, descHeight, 320, 50);
            }
            else if (appDelegate.Window.Frame.Size.Width == 414)
            {
                // iphone 6+
                socialNetworkingBGView.Frame = new CoreGraphics.CGRect(0, descHeight, 414, 50);
            }
            else
            {
                // iphone 6
                socialNetworkingBGView.Frame = new CoreGraphics.CGRect(0, descHeight, 375, 50);
            }

            descHeight += 100;

            CGRect descriptionFrame = this.descriptionBGView.Frame;

            descriptionFrame.Size   = new CGSize(descriptionFrame.Size.Width, descHeight);
            descriptionBGView.Frame = descriptionFrame;


            float scrollviewHeight = (float)(descriptionFrame.Size.Height + descriptionFrame.Location.Y);

            if (appDelegate.Window.Frame.Size.Width == 320 && appDelegate.Window.Frame.Size.Height == 568)
            {
                // iphone 5
                this.baseScrollView.ContentSize = new CGSize(320, scrollviewHeight);
            }
            else if (appDelegate.Window.Frame.Size.Width == 414)

            {
                //scrollviewHeight = Math.Max(697, scrollviewHeight);

                // iphone 6
                this.baseScrollView.ContentSize = new CGSize(414, scrollviewHeight);
                //this.baseScrollView.Frame = new CGRect(0,0,414,scrollviewHeight);
            }
            else

            {
                // iphone 6
                this.baseScrollView.ContentSize = new CGSize(375, scrollviewHeight);
            }



            this.baseScrollView.Hidden    = false;
            this.applybuttonBGView.Hidden = false;
            BTProgressHUD.Dismiss();
        }