protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (!_disposed)
            {
                _settings      = null;
                _logonComplete = null;
                if (_message != null)
                {
                    _message.Dispose();
                }
                _message = null;
                if (_userName != null)
                {
                    _userName.Dispose();
                }
                _userName = null;
                if (_password != null)
                {
                    _password.Dispose();
                }
                _password = null;
                if (_logon != null)
                {
                    _logon.Dispose();
                }
                _logon = null;

                _disposed = true;
            }
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (!_disposed)
            {
                if (_message != null)
                {
                    _message.Dispose();
                }
                _message = null;
                if (_indicator != null)
                {
                    _indicator.Dispose();
                }
                _indicator = null;
                if (_progress != null)
                {
                    _progress.Dispose();
                }
                _progress = null;

                _disposed = true;
            }
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         entry.Dispose();
         entry = null;
     }
 }
Exemple #4
0
 private void ReleaseDesignOutlets()
 {
     if (_textView != null)
     {
         _textView.Dispose();
         _textView = null;
     }
     if (_button != null)
     {
         _button.Dispose();
         _button = null;
     }
 }
        public void GeneratePrePlumbingPDFpreview()
        {
            Customer c = _navWorkflow._tabs._jobRunTable.CurrentCustomer;

            NSArray a = NSBundle.MainBundle.LoadNib("PrePlumbingPDFView", this, null);

            _generatedPdfView = (UIView)ObjCRuntime.Runtime.GetNSObject(a.ValueAt(0));

            UIImageView imgv = (UIImageView)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.PuratapLogo);

            using (var image = UIImage.FromBundle("Images/puratap-logo")) imgv.Image = image;

            UILabel tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.CustomerNumber);

            tl.Text = "Customer Number: " + c.CustomerNumber;
            tl      = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.PuratapEmployeeName);
            tl.Text = MyConstants.EmployeeName;             // "Puratap representative: "
            tl      = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.Date);
            tl.Text = "Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy");
            tl      = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.CustomerName);
            tl.Text = "Customer Name: " + String.Format("{0} {1} {2}", c.Title, c.FirstName, c.LastName);

            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.LeakingBrassFittings);
            switch (pr.LeakingFittings)
            {
            case Choices.YesPuratap: { tl.Text = "Leaking brass fittings (Puratap)"; tl.Enabled = true; break; }

            case Choices.YesNonPuratap: { tl.Text = "Leaking brass fittings (non-Puratap)"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "No leaking brass fittings"; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.LeakingTap);
            switch (pr.LeakingTap)
            {
            case Choices.YesPuratap: { tl.Text = "Leaking tap (Puratap)"; tl.Enabled = true; break; }

            case Choices.YesNonPuratap: { tl.Text = "Leaking tap (non-Puratap)"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "No leaking tap"; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.PotentialLeak);
            switch (pr.PotentialLeak)
            {
            case Choices.YesPuratap: { tl.Text = "Potential leak (discolouration of Puratap ball valve)"; tl.Enabled = true; break; }

            case Choices.YesNonPuratap: { tl.Text = "Potential leak (discolouration of Non-Puratap ball valve)"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "No discolouration of ball valve found"; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.OldTubing);
            switch (pr.OldTubing)
            {
            case Choices.Yes: { tl.Text = "Old \"industry stanard\" thin-walled tubing (needs an upgrade)"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "Tubing not discoloured and not showing visual signs of wear"; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.NonPuratapComponents);
            switch (pr.NonPuratapComponents)
            {
            case Choices.Yes: { tl.Text = "Non-Puratap plumbing components used"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "No non-Puratap components "; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.ExistingDamage);
            switch (pr.ExistingDamage)
            {
            case Choices.Yes: { tl.Text = "Existing property damage (see comments for details)"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "No pre-existing property damage"; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.NotPuratapProblem);
            switch (pr.NotAPuratapProblem)
            {
            case Choices.Yes: { tl.Text = "There is a problem not related to Puratap (see comments for details)"; tl.Enabled = true; break; }

            case Choices.No: { tl.Text = "No other problems (not related to Puratap)"; tl.Enabled = false; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.CustomerAcceptedUpgrade);
            switch (pr.UpgradeOffered)
            {
            case Choices.Option1: {
                if (pr.CustomerAcceptedUpgrade == Choices.Yes)
                {
                    tl.Text = "Customer has accepted an offer of Option 1 upgrade";
                }
                if (pr.CustomerAcceptedUpgrade == Choices.No)
                {
                    tl.Text = "Customer has declined an offer of Option 1 upgrade";
                }
                break;
            }

            case Choices.Option2: {
                if (pr.CustomerAcceptedUpgrade == Choices.Yes)
                {
                    tl.Text = "Customer has accepted an offer of Option 2 upgrade";
                }
                if (pr.CustomerAcceptedUpgrade == Choices.No)
                {
                    tl.Text = "Customer has declined an offer of Option 2 upgrade";
                }
                break;
            }

            case Choices.No: {
                tl.Hidden = true;
                tl        = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.UpgradeOfferText);
                tl.Hidden = true;
                break;
            }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.CustomerSignatureLabel);
            switch (pr.UnwillingToSign)
            {
            case Choices.No: { tl.Text = "Customer signature"; break; }

            case Choices.Yes: { tl.Text = "Customer unable or unwilling to sign off. Signed by service representative"; break; }
            }
            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.OfficeFollowUpRequired);
            switch (pr.OfficeFollowUpRequired)
            {
            case Choices.Yes: { tl.Hidden = false; break; }

            case Choices.No: { tl.Hidden = true; break; }
            }

            UITextView comments = (UITextView)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.Comments);

            comments.Text = this.commentsTextView.Text;

            tl = (UILabel)_generatedPdfView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.TubingUpgradeNotice);
            if (pr.UpgradeOffered != Choices.No)
            {
                if (pr.CustomerAcceptedUpgrade != Choices.No)
                {
                    // upgrade was offered and customer accepted
                    Job main = _navWorkflow._tabs._jobRunTable.CurrentJob;
                    if (main.HasParent())
                    {
                        main = _navWorkflow._tabs._jobRunTable.FindParentJob(_navWorkflow._tabs._jobRunTable.CurrentJob);
                    }
                    bool tuInJobCluster = false;
                    if ((main.Type.Code == "TUBINGUPGR" || main.Type.Code == "TUBING") && (main.Warranty == false))
                    {
                        tuInJobCluster = true;
                    }
                    else
                    {
                        foreach (Job child in main.ChildJobs)
                        {
                            if ((child.Type.Code == "TUBINGUPGR" || child.Type.Code == "TUBING") && (child.Warranty == false))
                            {
                                tuInJobCluster = true; break;
                            }
                        }
                    }

                    if (tuInJobCluster)
                    {
                        tl.Text = "Tubing upgrade was offered, accepted and done on the day";
                    }
                    else
                    {
                        tl.Text = "Tubing upgrade was offered, accepted, but NOT DONE on the day.";                             // todo :: create a followup here?
                    }
                }
                else
                {
                    tl.Hidden = true;
                }
            }
            else
            {
                tl.Hidden = true;
            }

            tl.Dispose(); tl             = null;
            comments.Dispose(); comments = null;
            a.Dispose(); a       = null;
            imgv.Dispose(); imgv = null;
        }