Beispiel #1
0
        private void saveBlocks()
        {
            bool abort = false;

            foreach (TapestryDesignerBlock block in _blocksToBuild)
            {
                try
                {
                    saveBlockContent(block);
                    _progressHandler.IncrementProgress("blockContent");
                }
                catch (Exception e)
                {
                    while (e.Message.Contains("An error occurred while updating the entries. See the inner exception for details."))
                    {
                        e = e.InnerException;
                    }

                    _progressHandler.Error($"{block.Name} - {e.Message}");
                    abort = true;
                }
            }
            _progressHandler.SetMessage("blockContent", "Saving generated block content", MessageType.InProgress);
            _context.SaveChanges();

            if (abort)
            {
                throw new Exception("během aktualizace workflow došlo k chybám");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Generate workflow cs files
        /// </summary>
        private void GenerateCsFiles()
        {
            List <TapestryDesignerBlock> designerBlocksToBuild = _rebuild
                ? _application.TapestryDesignerMetablocks.SelectMany(mb => mb.Blocks).Where(b => !b.IsDeleted).ToList()
                : _application.TapestryDesignerMetablocks.SelectMany(mb => mb.Blocks).Where(b => !b.IsDeleted && b.IsChanged).ToList();

            _progressHandler.SetMessage("T2_block", "Creating blocks", MessageType.InProgress, designerBlocksToBuild.Count(b => b.BlockCommits.Any()));
            _progressHandler.SetMessage("T2_wfRule", "Creating workflow rules", MessageType.InProgress);

            foreach (TapestryDesignerBlock designerBlock in designerBlocksToBuild)
            {
                TapestryDesignerBlockCommit blockCommit = designerBlock.BlockCommits.OrderByDescending(bc => bc.Timestamp).FirstOrDefault();
                if (blockCommit == null)
                {
                    continue;
                }

                try
                {
                    // init block
                    if (designerBlock.IsInitial)
                    {
                        GenerateInitBlock(blockCommit.Name.RemoveDiacritics());
                    }

                    //
                    _currentBlockCommit = blockCommit;
                    GenerateBlock();
                    designerBlock.IsChanged = false;
                    _context.SaveChanges();
                }
                catch (Exception ex)
                {
                    _progressHandler.Error(
                        (ex is TapestrySyntacticOmniusException)
                            ? $"[Block:{(ex as TapestrySyntacticOmniusException).BlockName},WF:{(ex as TapestrySyntacticOmniusException).WorkflowName},WFItemId:{(ex as TapestrySyntacticOmniusException).WFItemId}] {ex.Message}"
                            : ex.Message
                        );
                    designerBlock.IsChanged = true;
                    _context.SaveChanges();
                }
                finally
                {
                    _progressHandler.IncrementProgress("T2_block");
                }
            }

            GenerateAssemblyInfoFile();

            _progressHandler.SetMessage("T2_block", "Create blocks - complete", MessageType.Success);
            _progressHandler.SetMessage("T2_wfRule", "Create workflow rules - complete", MessageType.Success, 0);
        }
Beispiel #3
0
        public void Build(int ApplicationId, string menuPath, bool forceRebuild)
        {
            try
            {
                // INIT
                core             = COREobject.i;
                masterContext    = core.Context;
                core.Application = masterContext.Applications.Find(ApplicationId);
                masterApp        = core.Application;
                context          = core.AppContext;
                app = context != masterContext
                    ? context.Applications.SingleOrDefault(a => a.Name == masterApp.Name)
                    : masterApp;

                _rebuildInAction = forceRebuild;
                _menuPath        = menuPath;

                applicationViewPath     = $"{AppDomain.CurrentDomain.BaseDirectory}Views\\App\\{app.Name}";
                applicationPageViewPath = $"{applicationViewPath}\\Page";

                // Shared tables
                if (masterApp.IsSystem)
                {
                    progressHandler.Section(EModule.Entitron, "Actualize database");
                    BuildEntitron();
                    return;
                }

                // FrontEnd
                progressHandler.Section(EModule.Master, "Copy application");
                progressHandler.Section(EModule.Persona, "Copy user roles");
                progressHandler.Section(EModule.Entitron, "Actualize database");
                progressHandler.Section(EModule.Mozaic, "Generate pages");
                progressHandler.Section(EModule.Tapestry, "Generate workflow");
                progressHandler.Section(EModule.CORE, "Generate menu");
                progressHandler.Section(EModule.Hermes, "Copy email template");

                MoveApp();
                BuildPersona();
                BuildEntitron();
                BuildMozaic();
                BuildTapestry();
                BuildTapestry2();
                BuildMenu();
                BuildHermes();

                progressHandler.Section(EModule.Watchtower, "All DONE");
            }
            catch (OmniusMultipleException ex)
            {
                if (!ex.AllExceptions.Any())
                {
                    progressHandler.Error("Unknown error");
                }

                foreach (Exception e in ex.AllExceptions)
                {
                    progressHandler.Error(e.Message);
                }
            }
            catch (Exception ex)
            {
                progressHandler.Error(ex.Message);
            }
        }