Exemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View dialogView = inflater.Inflate(Resource.Layout.layout_modules_registration_dialog, container, false);

            Button addProspect = dialogView.FindViewById <Button>(Resource.Id.add_prospect);

            addProspect.Click += (sender, args) =>
            {
                this.Dismiss();

                WizardLauncher.Launch(this.Activity, WizardTypes.ProspectRegistration,
                                      IntentStartPointTracker.IntentStartPoint.Modules);
            };

            Button addCustomer = dialogView.FindViewById <Button>(Resource.Id.add_customer);

            addCustomer.Click += (sender, args) =>
            {
                this.Dismiss();

                WizardLauncher.Launch(this.Activity, WizardTypes.CustomerRegistration,
                                      IntentStartPointTracker.IntentStartPoint.Modules);
            };

            Button cancel = dialogView.FindViewById <Button>(Resource.Id.cancel_button);

            cancel.Click += (sender, args) =>
            {
                this.Dismiss();
            };

            return(dialogView);
        }
Exemplo n.º 2
0
        void LaunchWizard(WizardLauncher wizardLauncher)
        {
            HideAll();
            AllocateGrid.Visibility = Visibility.Visible;

            wizardLauncher.WizardReturn += new WizardReturnEventHandler(wizardLauncher_WizardReturn);
            this.NavigationFrame.Navigate(wizardLauncher);
        }
Exemplo n.º 3
0
        public MovieAddWizard()
        {
            InitializeComponent();

            // Launch the wizard
            WizardLauncher wizardLauncher = new WizardLauncher();
            wizardLauncher.WizardReturn += new WizardReturnEventHandler(wizardLauncher_WizardReturn);
            this.Navigate(wizardLauncher);
        }
Exemplo n.º 4
0
        public WizardDialogBox()
        {
            InitializeComponent();

            // Launch the wizard
            var wizardLauncher = new WizardLauncher();
            wizardLauncher.WizardReturn += wizardLauncher_WizardReturn;
            Navigate(wizardLauncher);
        }
Exemplo n.º 5
0
        public WizardDialogBox()
        {
            InitializeComponent();

            // Launch the wizard
            var wizardLauncher = new WizardLauncher();

            wizardLauncher.WizardReturn += wizardLauncher_WizardReturn;
            Navigate(wizardLauncher);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create and return this fragment's view
        /// </summary>
        /// <param name="inflater">The inflator</param>
        /// <param name="container">The container view</param>
        /// <param name="inState">The saved state if any</param>
        /// <returns>The inflated view</returns>
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState)
        {
            base.OnCreateView(inflater, container, savedState);
            this.FragmentView = this.BindingInflate(Resource.Layout.fragment_ticket_list, null);

            this.BottomToolbar = this.FragmentView.FindViewById <LinearLayout>(Resource.Id.bottom_toolbar);
            this.TicketList    = this.FragmentView.FindViewById <MvxListView>(Resource.Id.ticket_list);
            this.TicketList.SetOnScrollListener(this);

            this.RaiseIssue     = this.FragmentView.FindViewById <TextView>(Resource.Id.raise_issue);
            this.AddProspect    = this.FragmentView.FindViewById <TextView>(Resource.Id.add_prospect);
            this.CreateCustomer = this.FragmentView.FindViewById <TextView>(Resource.Id.add_customer);

            this.RaiseIssue.Click += (sender, args) =>
            {
                new IntentStartPointTracker().StartIntentWithTracker(this.Activity, IntentStartPointTracker.IntentStartPoint.WelcomeScreen, typeof(TicketStartActivity));
            };

            this.AddProspect.Click += (sender, args) =>
            {
                WizardLauncher.Launch(this.Activity, WizardTypes.ProspectRegistration, IntentStartPointTracker.IntentStartPoint.WelcomeScreen);
            };

            this.CreateCustomer.Click += (sender, args) =>
            {
                WizardLauncher.Launch(this.Activity, WizardTypes.CustomerRegistration, IntentStartPointTracker.IntentStartPoint.WelcomeScreen);
            };

            this.vm        = new TicketListViewModel();
            this.ViewModel = vm;

            if (this.Arguments != null)
            {
                this.hasSnackbar = this.Arguments.GetBoolean(HasSnackBarBundleKey);
            }

            if (this.hasSnackbar)
            {
                Snackbar         snackbar         = Snackbar.Make(this.TicketList, this.SnackBarMessage, Snackbar.LengthIndefinite);
                BindableSnackBar bindableSnackBar = new BindableSnackBar(snackbar);

                var set = this.CreateBindingSet <TicketFragmentBase, TicketListViewModel>();
                set.Bind(bindableSnackBar).For(obj => obj.Visible).To(x => x.ShowSnackBar);
                set.Apply();
            }

            return(this.FragmentView);
        }
        public void PositiveAction()
        {
            if (CustomerService.RegistrationSuccessful)
            {
                if (WizardActivity.BundledItems != null)
                {
                    // Clear the bundle just in case it contains prospect conversion info, we dont want it displayed when we relaunch
                    WizardActivity.BundledItems.Clear();
                }

                WizardLauncher.Launch(this.Activity, WizardTypes.CustomerRegistration, ActivityBase.StartPointIntent);
            }
            else
            {
                Save();
            }
        }
Exemplo n.º 8
0
        public override void SetListeners()
        {
            // set the item click listeners
            this.PersonListView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                AdapterItemClick(sender as ListView, args);
            };

            this.RaiseIssue.Click += (sender, args) =>
            {
                new IntentStartPointTracker().StartIntentWithTracker(this, this.IntentStartPoint, typeof(TicketStartActivity));
            };

            this.AddProspect.Click += (sender, args) =>
            {
                WizardLauncher.Launch(this, WizardTypes.ProspectRegistration, this.IntentStartPoint);
            };

            this.CreateCustomer.Click += (sender, args) =>
            {
                WizardLauncher.Launch(this, WizardTypes.CustomerRegistration, this.IntentStartPoint);
            };
        }
Exemplo n.º 9
0
        void LaunchWizard(WizardLauncher wizardLauncher)
        {
            HideAll();
            AllocateGrid.Visibility = Visibility.Visible;

            wizardLauncher.WizardReturn += new WizardReturnEventHandler(wizardLauncher_WizardReturn);
            this.NavigationFrame.Navigate(wizardLauncher);
        }
Exemplo n.º 10
0
        public async void onActionSelected(int selection)
        {
            var trans = GetFragmentManager().BeginTransaction();

            switch (selection)
            {
            case 0:
                this.Finish();
                break;

            case 1:
                RefreshUi();
                InitializeUi();
                break;

            case 2:
                Prospect props = _originalProspect.SearchResult.CastTo <Prospect>();
                SaveResponse <Prospect> saveResult = await ProspectsController.SaveAsync(props);

                if (saveResult.SavedModel == null || saveResult.SavedModel.Id == default(Guid))
                {
                    throw new Exception("Could not save prospect");
                }
                break;

            case 3:
                // App trackking
                GoogleAnalyticService.Instance.TrackEvent(GetString(Resource.String.prospect_details), GetString(Resource.String.prospect_details), "Convert Prospect");

                Dictionary <string, object> bundledItems = new Dictionary <string, object>
                {
                    { FragmentBasicInfo.KeyProspectIdBundled, _originalProspect.SearchResult }
                };

                // if we accessed prospect details from a reminder, then return to home after the conversion

                IntentStartPointTracker.IntentStartPoint startPoint = IntentStartPointTracker.IntentStartPoint.ProspectConversion;

                if (this._origin == Enums.ProspectDetailsOrigin.ProspectReminderClick)
                {
                    startPoint = IntentStartPointTracker.IntentStartPoint.WelcomeScreen;
                }

                WizardLauncher.Launch
                (
                    this,
                    WizardTypes.CustomerRegistration,
                    startPoint,
                    bundledItems
                );
                Finish();
                break;

            case 10:
                CreatingReminder = true;
                trans.Hide(_prospectDetailsMainFragment);
                trans.Show(_customDatePickerFragment);
                trans.Commit();
                SetTitle(Resource.String.create_reminder);

                break;

            case 11:
                CreatingReminder = true;
                SetTitle(Resource.String.edit_reminder);
                trans.Hide(_prospectDetailsMainFragment);
                trans.Show(_customDatePickerFragment);
                trans.Commit();
                break;
            }
        }
Exemplo n.º 11
0
        public async Task <bool> ShowOverlayIfPhoneNumberDuplicate(string phone, string nationalId = null)
        {
            ErrorFilterFlags flag = ErrorFilterFlags.DisableErrorHandling;
            Person           person;

            SalesApp.Core.BL.Models.People.Customer customer = await new CustomersController().GetPersonIfExists(phone, nationalId, filterFlags: flag, checkDuplicate: false);
            SalesApp.Core.BL.Models.People.Prospect prospect = null;

            if (customer == null)
            {
                prospect = await new ProspectsController().GetPersonIfExists(phone, filterFlags: flag, checkDuplicate: false);
                person   = JsonConvert.DeserializeObject <Person>(JsonConvert.SerializeObject(prospect));
            }
            else
            {
                if (customer.PersonType == PersonTypeEnum.Prospect)
                {
                    prospect =
                        JsonConvert.DeserializeObject <SalesApp.Core.BL.Models.People.Prospect>(
                            JsonConvert.SerializeObject(customer));
                }
                else
                {
                    string         urlParam       = customer.Phone + "&foradditionalproduct=true";
                    CustomerStatus customerStatus = await new CustomerStatusApi().GetAsync(urlParam);

                    if (customerStatus != null)
                    {
                        customer.AccountStatus = customerStatus.AccountStatus;
                    }
                }

                person = JsonConvert.DeserializeObject <Person>(JsonConvert.SerializeObject(customer));
            }

            if (person == null)
            {
                return(false);
            }

            this._fragmentInfo = new FragmentInfo();
            this._fragmentInfo.SetArgument(FragmentInfo.ResourceIdBundleKey, Resource.Layout.fragment_unified_existing_person);

            this._fragmentInfo.ViewCreated += (sender, args) =>
            {
                ViewsHelper <Person> viewsHelper = new ViewsHelper <Person>(Activity as ActivityBase,
                                                                            _fragmentInfo.InflatedView);

                viewsHelper.BindEvent
                (
                    BindableEvents.OnClick
                    , Resource.Id.linEditCustomer
                    , linEditCustomer =>
                {
                    WizardActivity.HideOverlay(true);
                });

                viewsHelper.BindEvent(
                    BindableEvents.OnClick,
                    Resource.Id.linAddProduct,
                    linAddProduct =>
                {
                    // if doing prospect registration, do conversion to customer
                    if (WizardActivity.WizardType == WizardTypes.ProspectRegistration)
                    {
                        // do conversion to customer
                        if (person.PersonType == PersonTypeEnum.Prospect)
                        {
                            ProspectSearchResult psr = JsonConvert.DeserializeObject <ProspectSearchResult>(JsonConvert.SerializeObject(prospect));
                            Dictionary <string, object> bundledItems = new Dictionary <string, object>();
                            bundledItems.Add(KeyProspectIdBundled, psr);

                            WizardLauncher.Launch(Activity, WizardTypes.CustomerRegistration, WizardActivity.StartPoint, bundledItems);
                        }
                        else
                        {
                            // posible additional product
                            if (customer != null)
                            {
                                WizardActivity.HideOverlay(true);
                                IsAdditionalProduct = true;
                                WizardActivity.IsProspectConversion      = true;
                                CustomerSearchResult csr                 = JsonConvert.DeserializeObject <CustomerSearchResult>(JsonConvert.SerializeObject(customer));
                                Dictionary <string, object> bundledItems = new Dictionary <string, object>();
                                bundledItems.Add(KeyCustomerIdBundled, csr);

                                WizardLauncher.Launch(Activity, WizardTypes.CustomerRegistration, WizardActivity.StartPoint, bundledItems);
                            }
                        }
                    }
                    else
                    {
                        // customer registration
                        if (person.PersonType == PersonTypeEnum.Prospect)
                        {
                            // auto fill the details
                            FillFromExistingRecord(prospect);
                            WizardActivity.IsProspectConversion = true;
                        }
                        else
                        {
                            // auto fill the details
                            FillFromExistingRecord(customer);
                        }

                        WizardActivity.HideOverlay(true);
                        IsAdditionalProduct = true; // though this may be cheating ;)
                        WizardActivity.GoNext();
                    }
                });

                viewsHelper.Write(Resource.Id.tvPersonName, person.FullName);
                viewsHelper.Write(Resource.Id.tvPhone, person.Phone);
                viewsHelper.WriteBoundViews(customer);

                if (customer != null && customer.AccountStatus != null && !customer.AccountStatus.Equals("Active"))
                {
                    ShowConversionButton(_fragmentInfo.InflatedView, ViewStates.Gone);
                    ShowPersonStatus(_fragmentInfo.InflatedView);
                }

                if (person.PersonType == PersonTypeEnum.Prospect)
                {
                    // show conversion button
                    ShowConversionButton(_fragmentInfo.InflatedView, ViewStates.Visible);
                }
            };

            WizardActivity.ShowOverlay(_fragmentInfo, false);
            return(true);
        }
Exemplo n.º 12
0
 public void PositiveAction()
 {
     WizardLauncher.Launch(Activity, WizardTypes.ProspectRegistration, WizardActivity.StartPoint);
 }
Exemplo n.º 13
0
 void welcomeView_registerCustomerTouched(object sender, EventArgs e)
 {
     WizardLauncher.Launch(this, WizardTypes.CustomerRegistration, IntentStartPointTracker.IntentStartPoint.WelcomeScreen);
 }
        /// <summary>
        /// Called when registration information has changed
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        private async void RegistrationStatusChanged(object sender, CustomerService.RegistrationStatusChangedEventArgs e)
        {
            this.registrationFailedFragment     = null;
            this.registrationSuccessfulFragment = null;

            this.Logger.Verbose(e.Response != null ? e.Response.ResponseText : "No response...");

            this.maxSmsTries = Settings.Instance.MaxFallbackRetries;

            // still trying to post via API
            if (!e.Response.Successful && e.Channel != DataChannel.Fallback)
            {
                // still trying to register customer, show progress
                string message       = this.WizardActivity.GetString(Resource.String.not_able_to_send);
                string messageDetail = string.Format(this.WizardActivity.GetString(Resource.String.retrying), e.NumberOfTries);
                this.WizardActivity.ShowWaitInfo(message, messageDetail);
            }
            else if (e.Response.RegistrationSuccessful)
            {
                this.savingProgress = SavingProgress.Succeeded;

                // make sure we show the processing fragment for some time
                // await this.FragmentShowAwaiter(this.processingShown, DateTime.Now);

                // pass boolean whether the registration was SMS to control the message to the user
                this.registrationSuccessfulFragment = new RegistrationFinishedFragment();
                Bundle arguments = new Bundle();
                arguments.PutBoolean(RegistrationFinishedFragment.WasRegistrationKey, e.Channel == DataChannel.Fallback);
                arguments.PutBoolean(RegistrationFinishedFragment.SuccessKey, true);
                arguments.PutString(RegistrationFinishedFragment.IntentStartPointKey, this.ActivityBase.StartPointIntent.ToString());
                this.registrationSuccessfulFragment.Arguments = arguments;
                this.WizardActivity.ShowOverlay(this.registrationSuccessfulFragment, true);
            }
            else if (e.Response.Successful && !e.Response.RegistrationSuccessful)
            {
                // if registration is not done, show error
                this.savingProgress = SavingProgress.Failed;

                // make sure we show the processing fragment for some time
                await this.FragmentShowAwaiter(this.processingShown, DateTime.Now);

                // pass boolean whether the registration was SMS to control the message to the user
                this.registrationFailedFragment = new RegistrationFinishedFragment();/*
                                                                                      * e.Channel == DataChannel.Fallback,
                                                                                      * true,
                                                                                      * this.ActivityBase.StartPointIntent);*/

                Bundle arguments = new Bundle();
                arguments.PutBoolean(RegistrationFinishedFragment.WasRegistrationKey, e.Channel == DataChannel.Fallback);
                arguments.PutBoolean(RegistrationFinishedFragment.SuccessKey, true);
                arguments.PutString(RegistrationFinishedFragment.IntentStartPointKey, this.ActivityBase.StartPointIntent.ToString());
                this.registrationFailedFragment.Arguments = arguments;

                this.WizardActivity.ShowOverlay(this.registrationFailedFragment, true);
            }
            else if (e.Channel == DataChannel.Fallback)
            {
                // process the case of SMS
                this.savingProgress = SavingProgress.Failed;

                // make sure we show the processing fragment for some time
                await this.FragmentShowAwaiter(this.processingShown, DateTime.Now);

                this.smsFailed++;

                // depending on how many times SMS failed, decide what to show
                string posButtonTxt;
                string negButtonTxt;
                if (this.smsFailed >= this.maxSmsTries)
                {
                    posButtonTxt = this.WizardActivity.GetString(Resource.String.add_new_customer);
                    switch (this.ActivityBase.StartPointIntent)
                    {
                    case IntentStartPointTracker.IntentStartPoint.CustomerList:
                        negButtonTxt = this.WizardActivity.GetString(Resource.String.prospect_followup_return_to_customer_list);
                        break;

                    case IntentStartPointTracker.IntentStartPoint.ProspectsList:
                        negButtonTxt = this.WizardActivity.GetString(Resource.String.prospect_followup_return_to_prospect_list);
                        break;

                    case IntentStartPointTracker.IntentStartPoint.WelcomeScreen:
                        negButtonTxt = this.WizardActivity.GetString(Resource.String.return_to_home);
                        break;

                    default:
                        negButtonTxt = this.WizardActivity.GetString(Resource.String.return_to_home);
                        break;
                    }
                }
                else
                {
                    posButtonTxt = this.WizardActivity.GetString(Resource.String.try_again);
                    negButtonTxt = this.WizardActivity.GetString(Resource.String.cancel_registration);
                }

                bool stillTryingToSendSms = this.smsFailed < this.maxSmsTries;

                // SMS must have failed otherwise if statement before would have caught it
                string message = stillTryingToSendSms
                    ? this.WizardActivity.GetString(Resource.String.sms_registration_failed)
                    : string.Format(this.WizardActivity.GetString(Resource.String.unified_sms_registration_failed_n_tries), this.smsFailed);

                this.registrationFailedFragment = new RegistrationFinishedFragment();

                /*
                 *  e.Channel == DataChannel.Fallback,
                 *  false,
                 *  message,
                 *  posButtonTxt,
                 *  negButtonTxt,
                 *  this.ActivityBase.StartPointIntent);
                 */

                Bundle arguments = new Bundle();
                arguments.PutBoolean(RegistrationFinishedFragment.WasRegistrationKey, e.Channel == DataChannel.Fallback);
                arguments.PutBoolean(RegistrationFinishedFragment.SuccessKey, false);
                arguments.PutString(RegistrationFinishedFragment.MessageKey, message);
                arguments.PutString(RegistrationFinishedFragment.BtnPositiveKey, posButtonTxt);
                arguments.PutString(RegistrationFinishedFragment.BtnNegativeKey, negButtonTxt);
                arguments.PutString(RegistrationFinishedFragment.IntentStartPointKey, this.ActivityBase.StartPointIntent.ToString());
                this.registrationFailedFragment.Arguments = arguments;

                // depending on sms retries, decide the event hadler
                if (this.smsFailed >= this.maxSmsTries)
                {
                    (this.registrationFailedFragment as RegistrationFinishedFragment).PositiveAction += delegate
                    {
                        WizardLauncher.Launch(this.Activity, WizardTypes.CustomerRegistration, ActivityBase.StartPointIntent);
                        (this.WizardActivity as Activity).Finish();
                    };

                    (this.registrationFailedFragment as RegistrationFinishedFragment).NegativeAction += this.OnCancel;
                }
                else
                {
                    (this.registrationFailedFragment as RegistrationFinishedFragment).PositiveAction += this.Save;
                    (this.registrationFailedFragment as RegistrationFinishedFragment).NegativeAction += this.OnCancel;
                }

                this.WizardActivity.ShowOverlay(this.registrationFailedFragment, true);
            }

            await this.SaveCustomerToDevice(e, this.smsFailed, this.maxSmsTries);

            this.registrationInProgress = false;
            this.savingProgress         = SavingProgress.Done;
        }