Example #1
0
        private void RunPortalAction(ShowViewParameters svp)
        {
            var softPortal = new CashDiscipline.Module.AppNavigation.ActionPortalLogic();
            var hardPortal = new ActionPortalHardLogic(softPortal);

            var portalObj = View.CurrentObject as ActionPortal;

            if (portalObj == null)
            {
                return;
            }
            var appArgs = new CashDiscipline.Module.AppNavigation.ActionPortalEventArgs(Application, ObjectSpace, svp);

            switch (portalObj.ActionPortalType)
            {
            case ActionPortalType.Internal:
                hardPortal.ExecutePortalAction(appArgs, portalObj.ActionName);
                break;

            case ActionPortalType.ChoiceAction:
                softPortal.ExecuteChoiceActionByCaptionPath(
                    appArgs,
                    portalObj.ObjectType, portalObj.ControllerType,
                    portalObj.ActionName, portalObj.ActionPath);
                break;

            case ActionPortalType.SimpleAction:
                softPortal.ExecuteSimpleAction(
                    appArgs,
                    portalObj.ObjectType,
                    portalObj.ControllerType,
                    portalObj.ActionName);
                break;

            case ActionPortalType.View:
                softPortal.OpenNavigationItem(appArgs, portalObj.ObjectType);
                break;
            }
        }
        private void Populate()
        {
            if (ActionPortalList == null)
            {
                throw new InvalidOperationException("ActionPortalList cannot be null");
            }

            #region Fix Forecast
            ActionPortalList.Add(new ActionPortalItem()
            {
                ActionName        = CashFlowViewController.fixForecastFormCaption,
                ActionDescription = "Cash Flow Fix Forecast",
                ExecutableAction  = (args) =>
                {
                    var nav = new NavigationHelper();
                    logic.OpenNavigationItem(args, typeof(CashFlowFixParam));
                }
            });
            #endregion

            #region Purge
            ActionPortalList.Add(new ActionPortalItem()
            {
                ActionName        = "Purge",
                ActionDescription = "Purge Deleted Objects",
                ExecutableAction  = (args) =>
                {
                    var objSpace = (XPObjectSpace)args.ObjectSpace;
                    objSpace.Session.PurgeDeletedObjects();
                    var conn = (SqlConnection)objSpace.Session.Connection;
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "MSDB.dbo.sp_start_job 'cashdisc_purge_objects'";
                        cmd.ExecuteNonQuery();
                    }
                }
            });

            #endregion

            #region Reindex Cash
            ActionPortalList.Add(new ActionPortalItem()
            {
                ActionName        = "Reindex CashFlow",
                ActionDescription = "Reindex CashFlow",
                ExecutableAction  = (args) =>
                {
                    var objSpace = (XPObjectSpace)args.ObjectSpace;
                    var conn     = (SqlConnection)objSpace.Session.Connection;
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "MSDB.dbo.sp_start_job 'cashdisc_reindex_cash'";
                        cmd.ExecuteNonQuery();
                    }
                }
            });

            #endregion

            //#region Process Cube
            //ActionPortalList.Add(new ActionPortalItem()
            //{
            //    ActionName = "Actions",
            //    ActionDescription = "Cash Report - Process Cube - Current",
            //    ExecutableAction = (args) =>
            //    {
            //        logic.ExecuteChoiceActionByCaptionPath(args,
            //            typeof(CashFlow),
            //            typeof(CashFlowViewController),
            //            CashFlowViewController.ActionId,
            //            CashFlowViewController.processCubeCaption
            //                + "/" + CashFlowViewController.processCubeCurrentCaption);
            //    }
            //});
            //#endregion

            //#region Import Forex Rates
            //ActionPortalList.Add(new ActionPortalItem()
            //{
            //    ActionName = "Import Forex Rates",
            //    ActionDescription = "Import Foreign Exchange Rates",
            //    ExecutableAction = (args) =>
            //    {
            //        var nav = new NavigationHelper();
            //        logic.OpenNavigationItem(args, typeof(ImportForexRatesParam));
            //    }
            //});
            //#endregion

            //#region SQL Test
            //ActionPortalList.Add(new ActionPortalItem()
            //{
            //    ActionName = "GenLedger SQL Test",
            //    ActionDescription = "GenLedger SQL Test",
            //    ExecutableAction = (args) =>
            //    {
            //        var objSpace = args.ObjectSpace;
            //        var paramObj = FinGenJournalParam.GetInstance(objSpace);
            //        var sqlJnlr = new GenLedgerUnpostedCreator((XPObjectSpace)objSpace, paramObj);
            //        sqlJnlr.Process();
            //    }
            //});
            //#endregion
        }