Esempio n. 1
0
        private Result Test01()
        {
            return(Result.Succeeded);

            Transaction t = null;

            try
            {
                using (t = new Transaction(AppRibbon.Doc, "Test01"))
                {
                    t.Start();
                    {
                        if (AppRibbon.Doc.IsDetached)
                        {
                            return(Result.Cancelled);
                        }

                        if (XsMgr.AppExStorExists)
                        {
                            return(Result.Failed);
                        }

                        ExStoreRtnCodes result;

                        xsTest.makeSampleDataAppAndCell();
                        result = XsMgr.MakeApp();
                        xsTest.showStat("Create app", result, 2);
                        if (result != ExStoreRtnCodes.XRC_GOOD)
                        {
                            return(Result.Failed);
                        }
                    }

                    t.Commit();
                }
            }
            catch (OperationCanceledException)
            {
                if (t != null && t.HasStarted())
                {
                    t.RollBack();
                }

                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
Esempio n. 2
0
        private Result Test01()
        {
            Transaction t = null;

            // test to create the root datastorage / schema / entity
            // and create the app+cell datastorage

            AppRibbon.msg += "before sample data\n";

            // create the test data
            makeSampleData();
            // xsTest.showStat("Create root", ExStoreRtnCodes.XRC_UNDEFINED, 1);

            bool noSkip = true;

            try
            {
                using (t = new Transaction(AppRibbon.Doc, "Test01"))
                {
                    t.Start();
                    {
                        if (AppRibbon.Doc.IsDetached)
                        {
                            return(Result.Cancelled);
                        }

                        ExStoreRtnCodes result;

                        AppRibbon.msg += "before make root\n";
                        result         = XsMgr.MakeRoot();
                        AppRibbon.msg += "after make root\n";

                        xsTest.showStat("Create root", result, 1);
                        if (result != ExStoreRtnCodes.XRC_GOOD)
                        {
                            t.Commit();
                            return(Result.Failed);
                        }


                        if (noSkip)
                        {
                            AppRibbon.msg += "before make app\n";
                            result         = XsMgr.MakeApp();
                            AppRibbon.msg += "after make app\n";

                            xsTest.showStat("Create root", result, 1);
                            if (result != ExStoreRtnCodes.XRC_GOOD)
                            {
                                t.Commit();
                                return(Result.Failed);
                            }
                        }
                    }
                    t.Commit();
                }
            }
            catch (OperationCanceledException)
            {
                if (t != null && t.HasStarted())
                {
                    t.RollBack();
                }

                return(Result.Failed);
            }

            return(Result.Succeeded);
        }