예제 #1
0
        /// <summary>
        /// Closes the organizer allowed with delegate.
        /// </summary>
        /// <param name="closeOrganizerDelegate">The close organizer delegate.</param>
        /// <returns></returns>
        public override bool CloseOrganizerAllowedWithDelegate(UPMCloseOrganizerDelegate closeOrganizerDelegate)
        {
            if (this.ConflictHandlingMode)
            {
                return(true);
            }

            this.CloseOrganizerDelegate = closeOrganizerDelegate;
            this.finishActionName       = null;

            UPSerialEntryFinalSaveResult finalSaveResult = this.ExecuteFinalSave();

            switch (finalSaveResult)
            {
            case UPSerialEntryFinalSaveResult.Abort:
                this.CloseOrganizerDelegate = null;
                return(false);

            case UPSerialEntryFinalSaveResult.Finished:
                this.CloseOrganizerDelegate = null;
                return(true);

            default:
                return(false);
            }
        }
        /// <summary>
        /// Closes the organizer allowed with delegate.
        /// </summary>
        /// <param name="closeOrganizerDelegate">The close organizer delegate.</param>
        /// <returns></returns>
        public override bool CloseOrganizerAllowedWithDelegate(UPMCloseOrganizerDelegate closeOrganizerDelegate)
        {
            if (this.HasChanges())
            {
                this.CloseOrganizerDelegate = closeOrganizerDelegate;

#if PORTING
                await SimpleIoc.Default.GetInstance <IDialogService>().ShowMessage(
                    LocalizedString.TextReallyAbortAndLoseChanges,
                    LocalizedString.TextYouMadeChanges,
                    LocalizedString.TextYes,
                    LocalizedString.TextNo,
                    c =>
                {
                    if (c)
                    {
                        if (this.CloseOrganizerDelegate != null)
                        {
                            this.CloseOrganizerDelegate.UpOrganizerModelControllerAllowedClosingOrganizer(this);
                            this.CloseOrganizerDelegate = null;
                        }
                        else
                        {
                            this.ModelControllerDelegate.PopToPreviousContentViewController();
                        }
                    }
                });
#endif
                return(false);
            }

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Closes the organizer allowed with delegate.
        /// </summary>
        /// <param name="closeOrganizerDelegate">The close organizer delegate.</param>
        /// <returns></returns>
        public override bool CloseOrganizerAllowedWithDelegate(UPMCloseOrganizerDelegate closeOrganizerDelegate)
        {
            if (this.HasChanges())
            {
                this.CloseOrganizerDelegate = closeOrganizerDelegate;
                //UIAlertView alertview = new UIAlertView(LocalizationKeys.upTextYouMadeChanges, LocalizationKeys.upTextReallyAbortAndLoseChanges, this, LocalizationKeys.upTextNO, LocalizationKeys.upTextYES, null);
                //alertview.Show();
                return(false);
            }

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Closes the organizer allowed with delegate.
        /// </summary>
        /// <param name="closeOrganizerDelegate">The close organizer delegate.</param>
        /// <returns></returns>
        public override bool CloseOrganizerAllowedWithDelegate(UPMCloseOrganizerDelegate closeOrganizerDelegate)
        {
            List <UPCRMRecord> changedRecords = this.ChangedRecordsWithRootTemplateFilter(null, null, true);

            if (changedRecords.Count > 0)
            {
                this.CloseOrganizerDelegate = closeOrganizerDelegate;
                //UIAlertView alertview = new UIAlertView(LocalizedString.TextYouMadeChanges, LocalizedString.TextReallyAbortAndLoseChanges, this, LocalizedString.TextNo, LocalizedString.TextYes, null);
                //alertview.Show();
                return(false);
            }

            return(true);
        }
예제 #5
0
        /// <summary>
        /// Alerts the index of the view did dismiss with button.
        /// </summary>
        /// <param name="alertView">The alert view.</param>
        /// <param name="buttonIndex">Index of the button.</param>
        public void AlertViewDidDismissWithButtonIndex(/*UIAlertView*/ object alertView, int buttonIndex)
        {
            if (this.isErrorSaveDialog)
            {
                if (buttonIndex == 1)
                {
                    this.waitForSerialEntrySave = false;
                    this.isSaving = false;
                    if (!this.waitForSave)
                    {
                        if (this.serialEntryPageModelController.SerialEntry.ChangedRecordsForEndingSerialEntry().Count > 0)
                        {
                            this.closeOnErrors = true;
                            this.isSaving      = true;
                            this.serialEntryPageModelController.SaveWithDiscardedChanges();
                            return;
                        }

                        if (this.CloseOrganizerDelegate != null)
                        {
                            UPMCloseOrganizerDelegate del = this.CloseOrganizerDelegate;
                            this.CloseOrganizerDelegate = null;
                            del.UpOrganizerModelControllerAllowedClosingOrganizer(this);
                        }
                        else
                        {
                            this.HandleChangeManager();
                            this.HandleSaved();
                        }
                    }
                }
                else if (this.CloseOrganizerDelegate != null)
                {
                    this.Organizer.Status       = null;
                    this.CloseOrganizerDelegate = null;
                    this._modelControllerToRedraw.Page.Status  = null;
                    this._modelControllerToRedraw.Page.Invalid = true;
                    this.RedisplayPage(null, true);
                    this._modelControllerToRedraw = null;
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Observes the value for key path of object change context.
        /// </summary>
        /// <param name="keyPath">The key path.</param>
        /// <param name="theObject">The object.</param>
        /// <param name="change">The change.</param>
        /// <param name="context">The context.</param>
        public void ObserveValueForKeyPathOfObjectChangeContext(string keyPath, object theObject, Dictionary <string, object> change, object context)
        {
            if (keyPath == "hasRunningChangeRequests")
            {
                SerialEntryPageModelController modelController = (SerialEntryPageModelController)theObject;
                this.PageModelControllerSetContextValueForKey(modelController, modelController.ChangeRequestError, "organizerError");
                if (modelController.ChangeRequestError != null && !this.closeOnErrors)
                {
                    this.isSaving = false;
                    if (this.organizerDealsWithSaveErrors)
                    {
                        this.Organizer.Status        = null;
                        modelController.Page.Status  = null;
                        modelController.Page.Invalid = true;
                        this.RedisplayPage(null, true);
                    }
                    else if (this.CloseOrganizerDelegate != null)
                    {
                        this._modelControllerToRedraw = modelController;
                    }

                    if (this.organizerDealsWithSaveErrors || this.CloseOrganizerDelegate != null)
                    {
                        this.organizerDealsWithSaveErrors = false;
                        if (modelController.SerialEntry.ConflictHandling)
                        {
                            this.currentModelController = modelController;
                            this.RedisplayPage(null, true);
                            return;
                        }
                        else
                        {
                            this.serialEntryPageModelController = modelController;
                            //UIAlertView alertview = new UIAlertView(LocalizationKeys.upTextYouMadeChanges, LocalizationKeys.upTextProcessSerialEntrySaveErrors, this, LocalizationKeys.upTextOK, LocalizationKeys.upTextBasicDiscardChanges, null);
                            //this.isErrorSaveDialog = true;
                            //alertview.Show();
                        }

                        return;
                    }
                }

                foreach (UPPageModelController pageModelController in this.PageModelControllers)
                {
                    var controller = pageModelController as SerialEntryWebContentModelController;
                    if (controller != null)
                    {
                        controller.Page.Invalid = true;
                        controller.ShouldWaitForPendingChanges = modelController.HasRunningChangeRequests;
                    }
                }

                if (this.isSaving && !modelController.HasRunningChangeRequests)
                {
                    this.organizerDealsWithSaveErrors = false;
                    this.waitForSerialEntrySave       = false;
                    this.isSaving = false;
                    if (!this.waitForSave)
                    {
                        if (this.CloseOrganizerDelegate != null)
                        {
                            UPMCloseOrganizerDelegate del = this.CloseOrganizerDelegate;
                            this.CloseOrganizerDelegate = null;
                            del.UpOrganizerModelControllerAllowedClosingOrganizer(this);
                        }
                        else
                        {
                            this.HandleChangeManager();
                            this.HandleSaved();
                        }
                    }
                }
            }
        }