partial void officeFollowupTouchDown(NSObject sender) { ac = new UIActionSheet("Is office follow-up required for this?", null, "Cancel", null, "Yes", "No"); // WillDismiss ac.Dismissed += delegate(object _sender, UIButtonEventArgs e) { const int i = 2; // ac.CancelButtonIndex; switch (e.ButtonIndex) { case i: { /* officeFollowupTextField.Text = "?";*/ break; } case i - 2: { officeFollowupTextField.Text = "Yes"; pr.OfficeFollowUpRequired = Choices.Yes; Dictionary <int, string> Reasons = MyConstants.GetFollowUpReasonsFromDB(); UIActionSheet act = new UIActionSheet("Please specify a reason"); foreach (int j in Reasons.Keys) { act.AddButton(Reasons[j]); } act.WillDismiss += delegate(object __sender, UIButtonEventArgs ee) { if (ee.ButtonIndex != -1) { // IMPLEMENTED :: saves the followup reason to database string pickedReason = ((UIActionSheet)__sender).ButtonTitle(ee.ButtonIndex); // Reasons[ee.ButtonIndex+1]; int reasonID = Reasons.FindKeyByValue(pickedReason); long jobID = _navWorkflow._tabs._jobRunTable.CurrentJob.JobBookingNumber; if (act.ButtonTitle(ee.ButtonIndex).ToUpper().Contains("OTHER") || act.ButtonTitle(ee.ButtonIndex).ToUpper().Contains("TECHNICAL ISSUES")) { // display an additional dialog to get a description of what happened var getDescription = new UIAlertView("Comment", "Type in a few words about why this needs to be followed up", null, "Cancel", "OK"); getDescription.AlertViewStyle = UIAlertViewStyle.PlainTextInput; getDescription.Dismissed += delegate(object desc_sender, UIButtonEventArgs btn) { if (btn.ButtonIndex != getDescription.CancelButtonIndex) { string desc = getDescription.GetTextField(0).Text; _navWorkflow._tabs._jobService.SaveFollowupToDatabase(jobID, reasonID, desc); } else { pr.OfficeFollowUpRequired = Choices.No; } }; getDescription.Show(); } else { _navWorkflow._tabs._jobService.SaveFollowupToDatabase(jobID, reasonID, ""); } officeFollowupTextField.Text = pickedReason; } else { officeFollowupTextField.Text = "No"; pr.OfficeFollowUpRequired = Choices.No; } }; act.ShowInView(this.View); break; } case i - 1: { officeFollowupTextField.Text = "No"; pr.OfficeFollowUpRequired = Choices.No; break; } } }; ac.ShowInView(this.View); }
public SignPrePlumbingViewController(DetailedTabs tabs) : base(tabs) { this.Title = "Sign pre-plumbing"; using (var image = UIImage.FromBundle("Images/187-pencil")) this.TabBarItem.Image = image; this.NavigationItem.HidesBackButton = true; GoBack = delegate { if (!SigningMode) { Tabs.SelectedViewController = Tabs.ViewControllers[Tabs.LastSelectedTab]; } else { FinishSigning(null, null); hasBeenSigned = false; Tabs.SelectedViewController = Tabs.ViewControllers[Tabs.LastSelectedTab]; } }; GoForward = delegate { if (hasBeenSigned && !SigningMode) { bool ShouldSignService = false; Job main = (Tabs._jobRunTable.CurrentJob.HasParent())? Tabs._jobRunTable.FindParentJob(Tabs._jobRunTable.CurrentJob) : Tabs._jobRunTable.CurrentJob; if (main.Type.Code == "SER") { ShouldSignService = true; } foreach (Job child in main.ChildJobs) { if (child.Type.Code == "SER") { ShouldSignService = true; } } if ((Tabs._prePlumbView.pr.UpgradeOffered == PrePlumbingCheckView.Choices.Option1 || Tabs._prePlumbView.pr.UpgradeOffered == PrePlumbingCheckView.Choices.Option2) && Tabs._prePlumbView.pr.CustomerAcceptedUpgrade == PrePlumbingCheckView.Choices.Yes) { // look for a tubing upgrade job bool foundUpgrade = false; if (main.Type.Code.Contains("TUBING")) { foundUpgrade = true; } if (!foundUpgrade) { foreach (Job child in main.ChildJobs) { if (child.Type.Code.Contains("TUBING")) { foundUpgrade = true; } } } if (!foundUpgrade) { Dictionary <int, string> Reasons = MyConstants.GetFollowUpReasonsFromDB(); string pickedReason = "Unable to do upgrade"; int reasonID = Reasons.FindKeyByValue(pickedReason); Tabs._jobService.SaveFollowupToDatabase(main.JobBookingNumber, reasonID, "Upgrade was authorised and not done?"); } } if (ShouldSignService) { Tabs.SigningNav.PopToRootViewController(false); Tabs.SigningNav.PushViewController(Tabs.SignService, true); } else { Tabs.SigningNav.PushViewController(Tabs.SignInvoice, true); //Tabs.SigningNav.InvoicePushed = true; // Tabs._navWorkflow._finishWorkflow(null, null); } } else { var alert = new UIAlertView("", "Please finish signing the document first", null, "OK"); alert.Show(); } }; ClearSignature = delegate { // Signature.Image = new UIImage(); Signature.Clear(); hasBeenSigned = false; }; StartSigning = delegate { signing = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning); this.SetToolbarItems(new UIBarButtonItem[] { back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), clearSignature, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), forward }, true); // Signature.Image = new UIImage(); Signature.Clear(); hasBeenSigned = false; SigningMode = true; this.NavigationController.SetNavigationBarHidden(false, true); this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature), true); this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning), true); // this.NavigationItem.SetRightBarButtonItems (new UIBarButtonItem[] { // new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning), // new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature) }, true); this.NavigationController.SetToolbarHidden(true, true); }; FinishSigning = delegate { SigningMode = false; signing = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning); this.SetToolbarItems(new UIBarButtonItem[] { back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), forward }, true); this.NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { }, true); this.NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { }, true); this.NavigationController.SetToolbarHidden(false, true); UIImageView iv = new UIImageView(); iv = (UIImageView)Tabs._prePlumbView.GeneratedPDFView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.Signature); iv.ContentMode = UIViewContentMode.ScaleAspectFit; UIImage im = this.Signature.GetDrawingImage(); // this.Signature.Image; iv.Image = im; if (hasBeenSigned) { Tabs._prePlumbView.RedrawPrePlumbingPDF(false, true); CGPoint offset = new CGPoint(0, this.PDFView.ScrollView.ContentSize.Height - this.PDFView.ScrollView.Bounds.Height); PDFView.ScrollView.SetContentOffset(offset, true); Signature.Clear(); // Signature.Image = new UIImage(); } iv.Dispose(); im.Dispose(); im = null; iv = null; }; back = new UIBarButtonItem(UIBarButtonSystemItem.Reply); signing = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning); forward = new UIBarButtonItem(UIBarButtonSystemItem.Action); clearSignature = new UIBarButtonItem("Clear signature", UIBarButtonItemStyle.Bordered, ClearSignature); ToolbarItems = new UIBarButtonItem[] { back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), forward }; back.Clicked += GoBack; forward.Clicked += GoForward; }