Exemple #1
0
        internal Control_DocumentWorkflow(DBInternPage DBInternPage)
        {
            InitializeComponent();

            documentWorkflowUserService        = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDocumentWorkflowUserService>();
            documentWorkflowAppSettingsService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDocumentWorkflowAppSettingsService>();
            fileStructureService        = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFileStructureService>();
            sessionService              = CommonServiceLocator.ServiceLocator.Current.GetInstance <ISessionService>();
            documentWorkflowAppSettings = documentWorkflowAppSettingsService.Get(DBInternPage.Guid);

            if (documentWorkflowAppSettings == null || string.IsNullOrWhiteSpace(documentWorkflowAppSettings.InternalName))
            {
                MessageBox.Show("Konfiguration nicht vorhanden", "...");
                return;
            }

            PageName = documentWorkflowAppSettings.PublicName;

            documentWorkflowUser = documentWorkflowUserService.Get(sessionService.CurrentSession.UserId);

            if (documentWorkflowUser == null)
            {
                documentWorkflowUser = new DocumentWorkflowUser
                {
                    UserId    = sessionService.CurrentSession.UserId,
                    IsDeleted = false
                                // TODO: Set current tenant
                };

                documentWorkflowUserService.Save(documentWorkflowUser);
            }

            fileStructureConfiguration = fileStructureService.GetByInstanceDataGuid(documentWorkflowUser.Guid);
            if (fileStructureConfiguration == null)
            {
                fileStructureConfiguration = new FileStructure
                {
                    IsTemplate       = false,
                    InstanceDataGuid = documentWorkflowUser.Guid,
                    Id        = Guid.NewGuid(),
                    Name      = documentWorkflowAppSettings.PublicName,
                    StackGuid = stackGuid
                };

                fileStructureService.Save(fileStructureConfiguration);
            }

            fileStructureConfiguration.Name = $"{documentWorkflowAppSettings.PublicName}({Framework.Base.UserManager.Singleton.GetFriendlyName(sessionService.CurrentSession.UserId)})";

            fileStructureControl.Initialize(fileStructureConfiguration);

            Loaded += ControlLoaded;
        }
 public bool Save(DocumentWorkflowUser obj)
 {
     return(documentWorkflowRepository.Save(obj));
 }
 public bool Delete(DocumentWorkflowUser obj)
 {
     return(documentWorkflowRepository.Delete(obj));
 }