Example #1
0
        /// <summary>
        /// Типовое действие "Сохранить"
        /// </summary>
        /// <param name="action"> </param>
        /// <param name="saveOnly">true-выполняется действие Save, false-выполняется действие OK</param>
        private bool ActionSave(ActionMetaItem action, bool saveOnly)
        {
            if (!BusinessObject.HasChanges)
            {
                return(true);
            }
            var form = FindForm();

            if (form != null)
            {
                form.BringToFront();
            }
            var canProceed = saveOnly ? WinUtils.ConfirmSave() : WinUtils.ConfirmOk();

            if (!canProceed)
            {
                return(false);
            }
            using (new WaitDialog(WaitDialogType.FormSaving))
            {
                using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
                {
                    return(action.RunAction(manager, BusinessObject).result);
                }
            }
        }