async void AdPhone1_TouchUpInside(object sender, EventArgs e)
        {
            var ad = DataObject.Ads[0];
            var brokerPhoneNumber = ad.BrokerPhone;
            var url = new NSUrl("tel:" + brokerPhoneNumber);

            if (!UIApplication.SharedApplication.OpenUrl(url))
            {
                var av = new UIAlertView("Not supported",
                                         "Phone calls are not supported on this device",
                                         null,
                                         "OK",
                                         null);
                av.Show();
            }
            else
            {
                //Send Inquiry
                //Clay Martin 1/1/18: Change app name to BuyPlane
                var response = await AdInquiryResponse.AdInquiry(int.Parse(ad.ID), string.Empty, string.Empty, ad.BrokerPhone, string.Empty
                                                                 , ad.BrokerId, AdInquirySource.Call, "Inquiry about " + ad.Name + " from GlobalAir.com BuyPlane Magazine");

                if (response.Status != "Success")
                {
                    HelperMethods.SendBasicAlert("Oops", "There was a problem sending your email to the aircraft broker. Please try again");
                }
            }
        }
Пример #2
0
        void AdMessages_TouchUpInside(object sender, EventArgs e)
        {
            Ad ad = new Ad();

            if (sender == Ad1MessageButton)
            {
                ad = DataObject.Ads[2];
            }

            if (sender == Ad2MessageButton)
            {
                ad = DataObject.Ads[1];
            }

            if (sender == Ad3MessageButton)
            {
                ad = DataObject.Ads[0];
            }

            var brokerPhoneNumber = ad.BrokerCellPhone;
            //var brokerPhoneNumber = "5024171595";

            var smsTo = NSUrl.FromString("sms:" + brokerPhoneNumber);

            if (UIApplication.SharedApplication.CanOpenUrl(smsTo))
            {
                //Clay Martin 1/1/18: Change app name to BuyPlane
                string textMessageBody = "Inquiry about " + ad.Name + " from GlobalAir.com BuyPlane Magazine";

                Action successCallBack = async() =>
                {
                    //Send Inquiry
                    var response = await AdInquiryResponse.AdInquiry(int.Parse(ad.ID), string.Empty, string.Empty, brokerPhoneNumber, string.Empty
                                                                     , ad.BrokerId, AdInquirySource.Text, textMessageBody);

                    if (response.Status != "Success")
                    {
                        HelperMethods.SendBasicAlert("Oops", "There was a problem sending your email to the aircraft broker. Please try again");
                    }
                };

                //try to send text message in the ap
                HelperMethods.ShowAndSendSMS(this, new string[] { brokerPhoneNumber }, textMessageBody, successCallBack);
            }
            else
            {
                var av = new UIAlertView("Not supported",
                                         "Text messaging is not supported on this device",
                                         null,
                                         "OK",
                                         null);
                av.Show();
            }
        }
Пример #3
0
        async partial void submitAction(Foundation.NSObject sender)
        {
            if (!string.IsNullOrEmpty(addressEdt.Text) && !string.IsNullOrEmpty(commentsEdt.Text) && !string.IsNullOrEmpty(nameEdt.Text) && !string.IsNullOrEmpty(phnoEdt.Text))
            {
                addressEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                addressEdt.Layer.BorderWidth = 0f;

                commentsEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                commentsEdt.Layer.BorderWidth = 0f;

                nameEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                nameEdt.Layer.BorderWidth = 0f;


                //this.DismissViewController(true, null);

                ////Send Inquiry
                var response = await AdInquiryResponse.AdInquiry(0, nameEdt.Text, addressEdt.Text, string.Empty, commentsEdt.Text
                                                                 , 0, AdInquirySource.Email, "");

                if (response == null)
                {
                    //var alert = UIAlertController.Create("Oops", "There was a problem sending your email to the aircraft broker. Please try again", UIAlertControllerStyle.Alert);

                    HelperMethods.SendBasicAlert("Oops", "There was a problem sending your email. Please try again");
                }
                else
                {
                    var alert = UIAlertController.Create("Congratulations!", "Email sent successfully.", UIAlertControllerStyle.Alert);

                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                    {
                        if (!isModal)
                        {
                            MainTabBarController controller = this.ParentViewController as MainTabBarController;
                            //Navigate to the main magazine tab
                            controller.SelectedIndex = 0;
                        }
                    }));

                    PresentViewController(alert, animated: true, completionHandler: () =>
                    {
                    });
                }
            }
            else
            {
                //Update UI to reflect invalid username or password

                if (string.IsNullOrEmpty(addressEdt.Text))
                {
                    //UIView.Animate(1, () =>
                    //{
                    //    addressEdt.Layer.BorderColor = UIColor.Red.CGColor;
                    //    addressEdt.Layer.BorderWidth = 4f;
                    //    View.LayoutIfNeeded();
                    //}, () => {

                    //    UIView.Animate(1, () =>
                    //    {
                    //        addressEdt.Layer.BorderColor = UIColor.Red.CGColor;
                    //        addressEdt.Layer.BorderWidth = 2f;
                    //        View.LayoutIfNeeded();
                    //    });
                    //});
                    AnimateValidationBorder(addressEdt);
                }
                else
                {
                    addressEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                    addressEdt.Layer.BorderWidth = 0f;
                }

                if (string.IsNullOrEmpty(phnoEdt.Text))
                {
                    //phnoEdt.Layer.BorderColor = UIColor.Red.CGColor;
                    //phnoEdt.Layer.BorderWidth = 1f;
                    AnimateValidationBorder(phnoEdt);
                }
                else
                {
                    phnoEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                    phnoEdt.Layer.BorderWidth = 0f;
                }

                if (string.IsNullOrEmpty(commentsEdt.Text))
                {
                    //commentsEdt.Layer.BorderColor = UIColor.Red.CGColor;
                    //commentsEdt.Layer.BorderWidth = 1f;

                    AnimateValidationBorder(commentsEdt);
                }
                else
                {
                    commentsEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                    commentsEdt.Layer.BorderWidth = 0f;
                }

                if (string.IsNullOrEmpty(nameEdt.Text))
                {
                    //nameEdt.Layer.BorderColor = UIColor.Red.CGColor;
                    //nameEdt.Layer.BorderWidth = 1f;
                    AnimateValidationBorder(nameEdt);
                }
                else
                {
                    nameEdt.Layer.BorderColor = UIColor.Clear.CGColor;
                    nameEdt.Layer.BorderWidth = 0f;
                }
            }
        }
        async void SubmitButton_TouchUpInside(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(EmailAddressTextField.Text) && !string.IsNullOrEmpty(CommentsTextView.Text) && !string.IsNullOrEmpty(NameTextField.Text) && !string.IsNullOrEmpty(PhoneTextField.Text))
            {
                EmailAddressTextField.Layer.BorderColor = UIColor.Clear.CGColor;
                EmailAddressTextField.Layer.BorderWidth = 0f;

                CommentsTextView.Layer.BorderColor = UIColor.Clear.CGColor;
                CommentsTextView.Layer.BorderWidth = 0f;

                NameTextField.Layer.BorderColor = UIColor.Clear.CGColor;
                NameTextField.Layer.BorderWidth = 0f;


                bool isChecked = CheckButton.Selected;

                //Send Inquiry
                //Clay Martin 1/1/18: Change app name to BuyPlane
                var response = await AdInquiryResponse.AdInquiry(int.Parse(AdProperty.ID), NameTextField.Text, EmailAddressTextField.Text, PhoneTextField.Text, CommentsTextView.Text
                                                                 , AdProperty.BrokerId, AdInquirySource.Email, "Inquiry about " + AdProperty.Name + " from GlobalAir.com BuyPlane Magazine", isChecked);

                //AdInquiryResponse response = new AdInquiryResponse();
                //response.Status = "Success";

                if (response.Status != "Success")
                {
                    //var alert = UIAlertController.Create("Oops", "There was a problem sending your email to the aircraft broker. Please try again", UIAlertControllerStyle.Alert);

                    HelperMethods.SendBasicAlert("Oops", "There was a problem sending your email to the aircraft broker. Please try again");

                    //alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null));
                    ////alert.AddAction(UIAlertAction.Create("Snooze", UIAlertActionStyle.Default, action => Snooze()));
                    //if (alert.PopoverPresentationController != null)
                    //{
                    //	alert.PopoverPresentationController.SourceView = this.View;
                    //	alert.PopoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Up;
                    //}
                    //PresentViewController(alert, animated: true, completionHandler: null);
                }
                else
                {
                    var alert = UIAlertController.Create("Congratulations!", "Email sent successfully.", UIAlertControllerStyle.Alert);

                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                    {
                        this.PresentingViewController.DismissViewController(true, null);
                    }));

                    PresentViewController(alert, animated: true, completionHandler: () =>
                    {
                    });
                }
            }
            else
            {
                //Update UI to reflect invalid username or password

                if (string.IsNullOrEmpty(EmailAddressTextField.Text))
                {
                    EmailAddressTextField.Layer.BorderColor = UIColor.Red.CGColor;
                    EmailAddressTextField.Layer.BorderWidth = 1f;
                }
                else
                {
                    EmailAddressTextField.Layer.BorderColor = UIColor.Clear.CGColor;
                    EmailAddressTextField.Layer.BorderWidth = 0f;
                }

                if (string.IsNullOrEmpty(PhoneTextField.Text))
                {
                    PhoneTextField.Layer.BorderColor = UIColor.Red.CGColor;
                    PhoneTextField.Layer.BorderWidth = 1f;
                }
                else
                {
                    PhoneTextField.Layer.BorderColor = UIColor.Clear.CGColor;
                    PhoneTextField.Layer.BorderWidth = 0f;
                }

                if (string.IsNullOrEmpty(CommentsTextView.Text))
                {
                    CommentsTextView.Layer.BorderColor = UIColor.Red.CGColor;
                    CommentsTextView.Layer.BorderWidth = 1f;
                }
                else
                {
                    CommentsTextView.Layer.BorderColor = UIColor.Clear.CGColor;
                    CommentsTextView.Layer.BorderWidth = 0f;
                }

                if (string.IsNullOrEmpty(NameTextField.Text))
                {
                    NameTextField.Layer.BorderColor = UIColor.Red.CGColor;
                    NameTextField.Layer.BorderWidth = 1f;
                }
                else
                {
                    NameTextField.Layer.BorderColor = UIColor.Clear.CGColor;
                    NameTextField.Layer.BorderWidth = 0f;
                }
            }
        }