示例#1
0
        private Result test01()
        {
            Transaction      T        = null;
            string           vendorId = "PRO.CYBERSTUDIO";
            Tuple <int, int> result;

            try
            {
                using (T = new Transaction(AppRibbon.Doc, "delete by vendor id"))
                {
                    T.Start();
                    result = XsMgr.DeleteByVendorId(vendorId);
                    T.Commit();
                }
                xsTest.taskDialogWarning_Ok("delete schema by vendor id",
                                            $"Delete by| {vendorId}", $"total found {result.Item1}\n"
                                            + $"total erased| {result.Item2}");

                return(Result.Succeeded);
            }
            catch (Exception e)
            {
                if (T != null && T.HasStarted())
                {
                    T.RollBack();
                }

                string msg  = e.Message;
                string imsg = e.InnerException.Message;
            }

            return(Result.Succeeded);
        }
示例#2
0
        private Result test01Fail(string title, string desc,
                                  ExStoreRtnCodes result)
        {
            XsMgr.ExStoreFail(title, desc, result.ToString());

            return(Result.Failed);
        }
        private Result Test01()
        {
            ExStoreHelper xsHlpr = new ExStoreHelper();

            // ExStoreRoot xRoot = ExStoreRoot.Instance();

            try
            {
                // ExStoreRtnCodes result = XsMgr.ReadRoot(/*ref xRoot*/);
                ExStoreRtnCodes result = XsMgr.RootExStorExists ?
                                         ExStoreRtnCodes.XRC_GOOD : ExStoreRtnCodes.XRC_ROOT_NOT_EXIST;

                if (result != ExStoreRtnCodes.XRC_GOOD)
                {
                    XsMgr.ReadSchemaFail(XsMgr.OpDescription);
                    return(Result.Failed);
                }

                // SchemaGuidManager.AppGuidUniqueString = xRoot.Data[SchemaRootKey.APP_GUID].Value;
            }
            catch (OperationCanceledException)
            {
                return(Result.Failed);
            }

            ShowData(XsMgr.XRoot);

            return(Result.Succeeded);
        }
示例#4
0
        private Result Test01()
        {
            Transaction t = null;

            AppRibbon.xm = XsMgr;
            AppRibbon.dm = DsMgr;

            // test to reset and eliminate everything from memory
            try
            {
                using (t = new Transaction(AppRibbon.Doc, "Test01"))
                {
                    t.Start();
                    {
                        if (AppRibbon.Doc.IsDetached)
                        {
                            return(Result.Cancelled);
                        }

                        AppRibbon.msg += "before reset\n";

                        if (!xsTest.Reset())
                        {
                            xsTest.showStat("Reset", ExStoreRtnCodes.XRC_UNDEFINED, 0);
                            t.RollBack();
                            return(Result.Failed);
                        }

                        AppRibbon.msg += "after reset\n";

                        xsTest.showStat("Reset", ExStoreRtnCodes.XRC_UNDEFINED, 0);

                        AppRibbon.msg += "before config\n";

                        XsMgr.Configure();

                        AppRibbon.msg += "after config\n";

                        xsTest.showStat("re-configure", ExStoreRtnCodes.XRC_UNDEFINED, 0);
                    }

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

                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
示例#5
0
        private Result Test01()
        {
            ExStoreRtnCodes result = XsMgr.DeleteApp();

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                XsMgr.DeleteSchemaFail(XsMgr.OpDescription);
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
示例#6
0
        private ExStoreRtnCodes makeRoot()
        {
            ExStoreRtnCodes result;

            XsMgr.XRoot = ExStoreRoot.Instance();

            result = XsMgr.WriteRoot();
            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }
示例#7
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);
        }
示例#8
0
        private Result updateCellData(ExStoreCell xCell, string title)
        {
            ExStoreRtnCodes result;

            // todo fix how to update cells

            XsMgr.XCell = xCell;

            result = XsMgr.UpdateCells(/*xCell*/);
            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(test01Fail(title, "update Cells", result));
            }

            ExStorageTests.ShowDataCell(XsMgr.XCell);

            return(Result.Succeeded);
        }
示例#9
0
        private Result updateAppData(ExStoreApp xApp, string title)
        {
            ExStoreRtnCodes result;

            // todo fix update method

            XsMgr.XApp = xApp;

            result = XsMgr.UpdateApp(/*xApp*/);
            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(test01Fail(title, "update App", result));
            }

            ExStorageTests.ShowDataApp(XsMgr.XApp);
            ExStorageTests.ShowDataCell(XsMgr.XCell);

            return(Result.Succeeded);
        }
示例#10
0
        private Result Test01()
        {
            // ExStoreCell xCell = ExStoreCell.Instance(3);

            // ExStoreCell xCell = null;

            // ExStoreRtnCodes result = XsMgr.ReadCells();
            ExStoreRtnCodes result = XsMgr.AppExStorExists ?
                                     ExStoreRtnCodes.XRC_GOOD : ExStoreRtnCodes.XRC_EX_STORE_NOT_EXISTS;

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                XsMgr.ReadSchemaFail(XsMgr.OpDescription);
                return(Result.Failed);
            }

            ShowData(XsMgr.XCell);

            return(Result.Succeeded);
        }
示例#11
0
        private Result Test01()
        {
            ExStoreHelper xsHlpr = new ExStoreHelper();

            // ExStoreRtnCodes result = ReadRootExStore(xsHlpr);
            ExStoreRtnCodes result = XsMgr.RootExStorExists ?
                                     ExStoreRtnCodes.XRC_GOOD : ExStoreRtnCodes.XRC_ROOT_NOT_EXIST;

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                XsMgr.ReadSchemaFail(XsMgr.OpDescription);
                return(Result.Failed);
            }

            // ExStoreApp xApp = ExStoreApp.Instance();

            try
            {
                // result = XsMgr.ReadApp();
                result = XsMgr.AppExStorExists ?
                         ExStoreRtnCodes.XRC_GOOD : ExStoreRtnCodes.XRC_APP_NOT_EXIST;

                // result = xsHlpr.ReadAppData(xApp);

                if (result != ExStoreRtnCodes.XRC_GOOD)
                {
                    XsMgr.ReadSchemaFail(XsMgr.OpDescription);
                    return(Result.Failed);
                }
            }
            catch (OperationCanceledException)
            {
                return(Result.Failed);
            }

            ExStorageTests.ShowDataApp(XsMgr.XApp);

            return(Result.Succeeded);
        }
示例#12
0
        private ExStoreRtnCodes test01_4()
        {
            ExStoreRtnCodes result = ExStoreRtnCodes.XRC_GOOD;

            switch (step)
            {
            case 0:
            {
                // step 0 - just the initial status
                stat("Initial status", result);

                // temp to show the schema structure
                if (false)
                {
                    makeSampleDataAppAndCell();
                    XsMgr.xxx();
                }

                break;
            }

            case 1:
            {
                // step one - make the root data store
                XsMgr.XRoot = ExStoreRoot.Instance();
                result      = XsMgr.CreateRoot();

                stat("step 1| create root", result);
                break;
            }

            case 2:
            {
                // step two - make the app & cell data store
                makeSampleDataAppAndCell();
                result = XsMgr.CreateAppDs();

                stat("Step 2| create app", result);
                break;
            }

            case 3:
            {
                result = ExStoreRtnCodes.XRC_FAIL;
                stat("Step 3", result);
                break;
            }

            case 4:
            {
                result = ExStoreRtnCodes.XRC_FAIL;
                stat("Step 4", result);
                break;
            }

            case 5:
            {
                result = ExStoreRtnCodes.XRC_FAIL;
                stat("Step 5", result);
                step = 0;
                break;
            }
            }

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                step -= 1;
            }

            step++;

            return(result);
        }
示例#13
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);
        }