예제 #1
0
        public static bool AllowExecution_PreviousStepNotSuccessfulOnErrorlineTest(ItemWorker itemWorker, BlockingCollection <ItemWorker> itemWorkers, BlockingCollection <ConnectionBase> connectionList)
        {
            IEnumerable <ConnectionBase> incomingConnections = GetIncomingConnections(itemWorker.DesignerItem.ID, connectionList);

            // If any previous item is successful on successful line, continue is ok
            foreach (ConnectionBase connection in incomingConnections.Where(t => t.ConnectionType == ConnectorType.Default))
            {
                ItemWorker sourceItemWorker = itemWorkers.Where(t => t.DesignerItem.ID == connection.SourceID).FirstOrDefault();
                if (sourceItemWorker.DesignerItem.State == ItemState.Stopped)
                {
                    return(true);
                }
            }

            // If previous item is ok on errorline, continue is not allowed
            foreach (ConnectionBase connection in incomingConnections)
            {
                ItemWorker sourceItemWorker = itemWorkers.Where(t => t.DesignerItem.ID == connection.SourceID).FirstOrDefault();

                if (connection.ConnectionType == ConnectorType.Error && sourceItemWorker.DesignerItem.State == ItemState.Stopped)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
 private void DoNotExecuteDesignerItem(ItemWorker itemWorker)
 {
     itemWorker.DesignerItem.State = ItemState.NotExecuted;
     progress.Report(new ProgressReport()
     {
         State = ItemEvent.StoppedNotExecuted, DesignerItem = itemWorker.DesignerItem, Message = "Not Executed"
     });
 }
예제 #3
0
 public SubFlowExecution(ItemWorker parentItemWorker, ItemLog parentItemLog, ObjectResolver objectResolver, FlowGraph flowGraph)
 {
     this.parentItemWorker = parentItemWorker;
     this.parentItemLog    = parentItemLog;
     this.objectResolver   = objectResolver;
     this.FlowGraph        = flowGraph;
     this.DataStreams      = new Dictionary <ConnectionBase, IDatastore>();
 }
예제 #4
0
        private void ExecuteDesignerItem(ItemWorker itemWorker)
        {
            progress.Report(new ProgressReport()
            {
                State = ItemEvent.Started, DesignerItem = itemWorker.DesignerItem, Message = "Started"
            });

            itemWorker.DesignerItem.State = ItemState.Running;
            itemWorker.BackgroundWorker.RunWorkerAsync(itemWorker);
        }
예제 #5
0
        public async Task <IActionResult> AddWorker()
        {
            ItemWorker worker = new ItemWorker();

            worker.LCompany = await getItems.GetCompanyAllNameDataSqlAsync();

            worker.LPosition = await getItems.GetPositionAllNameDataSqlAsync();

            return(View(worker));
        }
예제 #6
0
        public Editor()
        {
            forcePause    = true;
            doCloseButton = false;

            _itemWorker  = new ItemWorker();
            _pawnWorker  = new PawnWorker();
            _eventWorker = new EventWorker();
            _traitWorker = new TraitWorker();
        }
예제 #7
0
        void BackgroundWorker_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
        {
            ItemWorker backgroundWorker = itemWorkers.FirstOrDefault(t => t.BackgroundWorker == (BackgroundWorker)sender);

            ProgressReport currentProgress = e.UserState as ProgressReport;

            currentProgress.DesignerItem = backgroundWorker.DesignerItem;
            currentProgress.State        = ItemEvent.ProgressReport;
            if (progress != null)
            {
                progress.Report(currentProgress);
            }
        }
예제 #8
0
        private ItemWorker InitializeItemWorker(DesignerItemBase designerItem, StepConfigurationBase stepConfiguration)
        {
            designerItem.State = ItemState.Initialized;

            ItemWorker itemWorker = new ItemWorker(designerItem, stepConfiguration);

            itemWorker.BackgroundWorker = new System.ComponentModel.BackgroundWorker();
            itemWorker.BackgroundWorker.WorkerReportsProgress = true;
            itemWorker.BackgroundWorker.DoWork             += bgw_DoWork;
            itemWorker.BackgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;
            itemWorker.BackgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            return(itemWorker);
        }
예제 #9
0
        public static bool AllowExecution_OnPreviousErrorTest(ItemWorker itemWorker, BlockingCollection <ItemWorker> itemWorkers, BlockingCollection <ConnectionBase> connectionList)
        {
            IEnumerable <ConnectionBase> incomingConnections = GetIncomingConnections(itemWorker.DesignerItem.ID, connectionList);

            foreach (ConnectionBase connection in incomingConnections.Where(t => t.ConnectionType == ConnectorType.Default))
            {
                ItemWorker sourceItemWorker = itemWorkers.FirstOrDefault(t => t.DesignerItem.ID == connection.SourceID);

                bool allowExecution = AllowExecution_OnPreviousErrorTest_Recursive(sourceItemWorker, itemWorkers, connectionList);
                if (allowExecution == false)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #10
0
        public FlowManager(ObservableCollection <ConnectionConfigurationBase> connectionConfigurations, List <ModuleDescription> loadedModules, Package package)
        {
            this.connectionConfigurations = connectionConfigurations;
            this.loadedModules            = loadedModules;
            this.package = package;

            IntegrationTool.SDK.Diagram.DiagramDeserializer deserializer = new SDK.Diagram.DiagramDeserializer(this.loadedModules, this.package.Diagram.Diagram);

            this.connectionList = deserializer.Connections;
            foreach (DesignerItemBase item in deserializer.DesignerItems)
            {
                StepConfiguration configuration = package.Configurations.FirstOrDefault(t => t.ConfigurationId == item.ID) as StepConfiguration;
                ItemWorker        itemWorker    = InitializeItemWorker(item, configuration);
                itemWorkers.Add(itemWorker);
            }
        }
예제 #11
0
        private void ExecuteDesignerItem(ItemWorker itemWorker)
        {
            if (itemWorker.Configuration.Status == StepExecutionStatus.Active)
            {
                progress.Report(new ProgressReport()
                {
                    State = ItemEvent.Started, DesignerItem = itemWorker.DesignerItem, Message = "Started"
                });

                itemWorker.DesignerItem.State = ItemState.Running;
                itemWorker.BackgroundWorker.RunWorkerAsync(itemWorker);
            }
            else
            {
                DoNotExecuteDesignerItem(itemWorker);
            }
        }
예제 #12
0
        void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            ItemLog resultItemLog = e.Result as ItemLog;

            ItemWorker itemWorker = itemWorkers.FirstOrDefault(t => t.BackgroundWorker == (BackgroundWorker)sender);

            itemWorker.DesignerItem.State = resultItemLog.ExecutionSuccessful ? ItemState.Stopped : ItemState.Error;

            ProgressReport progressReport = new SDK.ProgressReport()
            {
                State = resultItemLog.ExecutionSuccessful ?
                        ItemEvent.StoppedSuccessful :
                        ItemEvent.StoppedWithError,
                DesignerItem = itemWorker.DesignerItem,
                Message      = resultItemLog.ExecutionSuccessful ? "Successful" : "Error"
            };

            progress.Report(progressReport);
        }
예제 #13
0
        public async Task <IActionResult> EditWorker([FromQuery] string id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            ItemWorker worker  = new ItemWorker();
            var        workers = await getItems.GetWorlerDataSqlAsync(id);

            if (workers.Count() == 1)
            {
                worker = workers.First();
            }

            worker.LCompany = await getItems.GetCompanyAllNameDataSqlAsync();

            worker.LPosition = await getItems.GetPositionAllNameDataSqlAsync();

            return(View(worker));
        }
예제 #14
0
        private static bool AllowExecution_OnPreviousErrorTest_Recursive(ItemWorker itemWorker, BlockingCollection <ItemWorker> itemWorkers, BlockingCollection <ConnectionBase> connectionList)
        {
            if (itemWorker.DesignerItem.State == ItemState.Error && itemWorker.Configuration.OnError == StepExecutionErrorHandling.StopFollwingSteps)
            {
                return(false);
            }

            IEnumerable <ConnectionBase> incomingConnections = GetIncomingConnections(itemWorker.DesignerItem.ID, connectionList);

            foreach (ConnectionBase connection in incomingConnections.Where(t => t.ConnectionType == ConnectorType.Default))
            {
                ItemWorker sourceItemWorker = itemWorkers.Where(t => t.DesignerItem.ID == connection.SourceID).FirstOrDefault();
                bool       allowExecution   = AllowExecution_OnPreviousErrorTest_Recursive(sourceItemWorker, itemWorkers, connectionList);
                if (allowExecution == false)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #15
0
        public async Task <List <ItemWorker> > GetWorlerDataSqlAsync(string id = "%")
        {
            try
            {
                List <ItemWorker> workers     = new List <ItemWorker>();
                ReadDb            db          = new ReadDb();
                string            QueryString = "select Worker.IdTable, Worker.Surname, Worker._Name, Worker.Patronymic, Worker.EmploymentDate, Position._Name as '_NamePos', Company.NameCompany" +
                                                " from Worker" +
                                                " join Position on Worker.PositionId = Position.IdTable" +
                                                " join Company on Worker.CompanyId = Company.IdTable" +
                                                " where Worker.IdTable like '" + id + "'";

                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    await connection.OpenAsync();

                    SqlCommand command = new SqlCommand(QueryString, connection);
                    using (SqlDataReader sdr = command.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            ItemWorker worker = new ItemWorker();
                            worker.IdTable        = Convert.ToInt32(sdr["IdTable"]);
                            worker.Surname        = sdr["Surname"].ToString();
                            worker._Name          = sdr["_Name"].ToString();
                            worker.Patronymic     = sdr["Patronymic"].ToString();
                            worker.EmploymentDate = DateTime.Parse(sdr["EmploymentDate"].ToString());
                            worker.Position       = sdr["_NamePos"].ToString();
                            worker.Company        = sdr["NameCompany"].ToString();
                            workers.Add(worker);
                        }
                    }
                    return(workers);
                }
            }
            catch (Exception ex)
            {
                return(new List <ItemWorker>());
            }
        }
예제 #16
0
 public ItemExecution(ItemWorker itemWorker, ObjectResolver objectResolver, RunLog runLog)
 {
     this.itemWorker     = itemWorker;
     this.objectResolver = objectResolver;
     this.runLog         = runLog;
 }