private void BuildSections()
        {
            var headerLabel = new UILabel (new RectangleF (0, 0, 370, 30)) {
                Font = UIFont.BoldSystemFontOfSize (18),
                BackgroundColor = ColorHelper.GetGPPurple (),
                TextAlignment = UITextAlignment.Center,
                TextColor = UIColor.White,
                Text = "Post Note"
            };
            var view = new UIViewBordered ();
            view.Frame = new RectangleF (0, 0, 370, 30);
            view.Add (headerLabel);
            var topSection = new Section (view);

            Root.Add (topSection);

            string name = "";
            if (matter != null) {
                name = matter.matterName;
                headerLabel.Text = name;
            }
            //var sec = new Section (name);
            //
            addBusySection ();

            if (tariffList != null && tariffList.Count > 0) {
                btnTar = new StyledStringElement ("Select Activity Code");
                btnTar.TextColor = ColorHelper.GetGPLightPurple ();
                btnTar.Alignment = UITextAlignment.Center;
                btnTar.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                btnTar.Tapped += delegate {
                    if (tariffList == null) {

                    } else {
                        string[] btns = new string[tariffList.Count];
                        for (int i = 0; i < tariffList.Count; i++) {
                            btns [i] = tariffList [i].name;
                        }
                        actionSheet = new UIActionSheet ("Activity Codes", null, "Cancel", null, btns) {
                            Style = UIActionSheetStyle.Automatic
                        };

                        actionSheet.Clicked += delegate (object sender, UIButtonEventArgs args) {
                            if (args.ButtonIndex == tariffList.Count) {
                                //ignored - cancelled
                            } else {
                                narration.Value = tariffList [args.ButtonIndex].narration;
                                selectedTariff = tariffList [args.ButtonIndex];
                                //TODO - think about just updating the affected fields only ... lose the effect?
                                BuildInterface ();
                            }

                        };

                        actionSheet.ShowInView (View);
                    }

                };
                topSection.Add (btnTar);
            }
            //
            narrationSection = new Section ("");

            if (selectedTariff == null) {
                narration = new EntryElement ("Narration", "Narration", null);
            } else {
                narrationSection = new Section (selectedTariff.name);
                narration = new EntryElement ("Narration", "", selectedTariff.narration);
            }
            narration.KeyboardType = UIKeyboardType.Default;
            narrationSection.Add (narration);
            //
            picker = new UIDatePicker ();
            //picker.Frame = new RectangleF (10f, 10f, 320f, 320f);
            picker.Mode = UIDatePickerMode.Date;
            picker.Date = DateTime.Now;

            var pickerSection = new Section (picker);

            //Root.Add (sec);
            Root.Add (narrationSection);
            Root.Add (pickerSection);
            BuildButtons ();
        }
        //
        public void BuildInterface()
        {
            Root = new RootElement ("Reports");
            var headerLabel = new UILabel (new RectangleF (10, 10, 300, 40)) {
                Font = UIFont.BoldSystemFontOfSize (20),
                BackgroundColor = ColorHelper.GetGPPurple (),
                TextAlignment = UITextAlignment.Center,
                TextColor = UIColor.White,
                Text = "Practice Reports"
            };
            var view = new UIViewBordered ();
            view.Frame = new RectangleF (10, 10, 300, 40);
            view.Add (headerLabel);
            var topSection = new Section (view);
            Root.Add (topSection);

            Root.Add (new Section (NSUserDefaults.StandardUserDefaults.StringForKey ("userName")));
            var getReportsSection = new Section ("Request Reports");

            btnFinance =
            new StyledStringElement ("Financial Status Report",
                null,
                UITableViewCellStyle.Subtitle) {
                DetailColor = UIColor.Blue
            };
            btnFinance.Tapped += delegate() {
                CheckIfBusy (FINANCIAL_STATUS);
            };
            btnFinance.AccessoryTapped += delegate() {
                CheckIfBusy (FINANCIAL_STATUS);
            };
            getReportsSection.Add (btnFinance);
            //
            btnFeeTarget =
            new StyledStringElement ("Fee Target Progress Report",
                null,
                UITableViewCellStyle.Subtitle) {
                DetailColor = UIColor.Gray
            };
            btnFeeTarget.Tapped += delegate() {
                CheckIfBusy (FEE_TARGET);
            };
            btnFeeTarget.AccessoryTapped += delegate() {
                CheckIfBusy (FEE_TARGET);
            };
            getReportsSection.Add (btnFeeTarget);
            //
            btnMatterAnalysis = new StyledStringElement ("Matter Analysis Report");
            btnMatterAnalysis =
            new StyledStringElement ("Matter Analysis Report",
                null,
                UITableViewCellStyle.Subtitle) {
                DetailColor = UIColor.Gray
            };
            btnMatterAnalysis.Tapped += delegate() {
                CheckIfBusy (MATTER_ANALYSIS);
            };
            btnMatterAnalysis.AccessoryTapped += delegate() {
                CheckIfBusy (MATTER_ANALYSIS);
            };
            getReportsSection.Add (btnMatterAnalysis);

            Root.Add (getReportsSection);
            Root.Add (new Section ("  "));
        }
        public void BuildInterface()
        {
            if (Root == null) {
                Root = new RootElement ("Matter Details");
            }
            Root.Clear ();
            headerLabel = new UILabel (new RectangleF (10, 10, 300, 40)) {
                Font = UIFont.BoldSystemFontOfSize (20),
                BackgroundColor = ColorHelper.GetGPPurple (),
                TextAlignment = UITextAlignment.Center,
                TextColor = UIColor.White,
                Text = searchResult.matterName
            };
            var view = new UIViewBordered ();
            view.Frame = new RectangleF (10, 10, 300, 40);
            view.Add (headerLabel);
            var topSection = new Section (view);

            Root.Add (topSection);
            //
            var sec = new Section ("");
            //matterName = new TitleElement (searchResult.matterName);
            ownerName = new StringsElement ("Owner", searchResult.currentOwner);
            matterID = new NumberElement (
                Convert.ToInt16 (searchResult.matterID),
                "Matter ID"
            );
            if (searchResult.matterLegacyAccount == null || searchResult.matterLegacyAccount.Trim () == "") {
                //ignore
            } else {
                legacy = new StringsElement (
                    "Legacy Account",
                    searchResult.matterLegacyAccount
                );
            }
            clientName = new StringsElement ("Client", "" + searchResult.clientName);
            //
            var sec2 = new Section ("");
            if (matter == null) {
                busBal = new FinanceElement (S.GetText (S.BUSINESS_BALANCE) + ":", 0.00);
                currBal = new FinanceElement (S.GetText (S.CURRENT_BALANCE) + ":", 0.00);
                trustBal = new FinanceElement (S.GetText (S.TRUST_BALANCE) + ":", 0.00);
                reserveTrust = new FinanceElement (S.GetText (S.RESERVE_TRUST) + ":", 0.00);
                unbilled = new FinanceElement (S.GetText (S.UNBILLED_BALANCE) + ":", 0.00);
                pending = new FinanceElement (S.GetText (S.PENDING_DISBURSEMENTS) + ":", 0.00);
                investTrust = new FinanceElement (S.GetText (S.INVESTMENT_TRUST) + ":", 0.00);
            } else {
                busBal = new FinanceElement (S.GetText (S.BUSINESS_BALANCE) + ":", matter.businessBalance);
                currBal = new FinanceElement (S.GetText (S.CURRENT_BALANCE), matter.currentBalance);
                unbilled = new FinanceElement (S.GetText (S.UNBILLED_BALANCE) + ":", matter.unbilledBalance);
                trustBal = new FinanceElement (S.GetText (S.TRUST_BALANCE), matter.trustBalance);
                reserveTrust = new FinanceElement (S.GetText (S.RESERVE_TRUST), matter.reserveTrust);
                pending = new FinanceElement (
                    S.GetText (S.PENDING_DISBURSEMENTS) + ":",
                    matter.pendingDisbursementBalance
                );
                investTrust = new FinanceElement (
                    S.GetText (S.INVESTMENT_TRUST) + ":",
                    matter.investmentTrustBalance
                );

            }
            //
            //sec.Add (matterName);
            sec.Add (clientName);
            sec.Add (ownerName);
            sec.Add (matterID);
            Root.Add (sec);
            //
            sec2.Add (busBal);
            sec2.Add (trustBal);
            sec2.Add (investTrust);
            sec2.Add (currBal);
            sec2.Add (reserveTrust);
            sec2.Add (unbilled);
            sec2.Add (pending);
            if (legacy != null) {
                sec2.Add (legacy);
            }

            Root.Add (sec2);

            //
            var sec3 = new Section (searchResult.matterName);
            btnPostFee = new StyledStringElement ("Post Fee");
            btnPostUnbillable = new StyledStringElement ("Post Unbillable");
            btnPostNote = new StyledStringElement ("Post Note");
            btnBack = new StyledStringElement (S.GetText (S.MATTER_SEARCH));
            btnAssignTask = new StyledStringElement ("Assign Task");

            btnAssignTask.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new FeeEarnerListController (searchResult);
                    this.NavigationController.PushViewController (c, true);
                }

            };
            btnPostFee.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new PostFeeDialog (matter, false, this);
                    this.NavigationController.PushViewController (c, true);
                }

            };
            btnPostUnbillable.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new PostFeeDialog (matter, true, this);
                    this.NavigationController.PushViewController (c, true);
                }
            };
            btnPostNote.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new PostNoteDialog (matter, this);
                    this.NavigationController.PushViewController (c, true);
                }
            };
            btnBack.Tapped += delegate() {
                if (isBusy) {
                    Busy ();
                } else {
                    this.NavigationController.PopViewControllerAnimated (true);
                }

            };
            btnPostFee.Alignment = UITextAlignment.Center;
            btnPostUnbillable.Alignment = UITextAlignment.Center;
            btnPostNote.Alignment = UITextAlignment.Center;
            btnBack.Alignment = UITextAlignment.Center;
            btnAssignTask.Alignment = UITextAlignment.Center;
            //
            sec3.Add (btnPostFee);
            sec3.Add (btnPostUnbillable);
            sec3.Add (btnPostNote);
            sec3.Add (btnAssignTask);
            sec3.Add (btnBack);
            Root.Add (sec3);
        }