private void AddDeactivationProcessors()
        {
            if (config.DeactivateAllProcesses || (config.ProcessesToDeactivate != null && config.ProcessesToDeactivate.Count > 0) ||
                (config.PluginsToDeactivate != null && config.PluginsToDeactivate.Count > 0))
            {
                ProcessRepository procRepo = new ProcessRepository(targetEntRepo.GetCurrentOrgService);

                // To prevent deactivating all workflows or plugins if only one list is passed
                if (!config.DeactivateAllProcesses)
                {
                    if (config.ProcessesToDeactivate == null)
                    {
                        config.ResetProcessesToDeactivate();
                    }

                    if (config.PluginsToDeactivate == null)
                    {
                        config.ResetPluginsToDeactivate();
                    }
                }
                else
                {
                    config.ResetProcessesToDeactivate();
                    config.ResetPluginsToDeactivate();
                }

                AddProcessor(new WorkflowsPluginsProcessor(procRepo, Logger, config.PluginsToDeactivate, config.ProcessesToDeactivate));
            }
        }
예제 #2
0
        private static void RunGame()
        {
            ConfigRepository  config            = new ConfigRepository();
            ProcessRepository processRepository = new ProcessRepository(config.Get("FF7ProcessName"));

            // Start the FPSFix tool
            using (Process proc = new Process())
            {
                proc.StartInfo.FileName        = config.Get("FPSFixExecutable");
                proc.StartInfo.UseShellExecute = true;
                proc.StartInfo.Verb            = "runas";
                proc.Start();
                proc.WaitForExit();
            }

            // Look for, and attach to, ff7 process. When found, event handler for exit will relaunch this whole process.
            if (listening)
            {
                processRepository.ProcessEnded -= ProcessRepository_ProcessEnded;
                listening = false;
            }

            processRepository.ProcessEnded += ProcessRepository_ProcessEnded;
            processRepository.WatchForClose();
            listening = true;
        }
예제 #3
0
        private void RegisterProcesses(ApplicationConfiguration config, IRegistrationService resolver, params Assembly[] scanAssemblies)
        {
            var processRepo = new ProcessRepository(scanAssemblies);

            resolver.Register(processRepo);
            processRepo.All().ForEach(type => resolver.Register(type));
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var processRepo = new ProcessRepository();
            var finishProductionProcessId = processRepo.Get(a => a.Name == "اتمام تولید").FirstOrDefault().Id;

            CheckShamsiDateFunctions();
            int id;

            if (Page.Request.QueryString[0].ToSafeInt() == 0)
            {
                id = new WorksheetRepository().GetMaxId();
            }
            else
            {
                id = Page.Request.QueryString[0].ToSafeInt();
            }

            Report report = new ReportWorksheets();

            Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource();
            sqlDataSource.ConnectionString = "Tarin";
            sqlDataSource.SelectCommand    =
                "select WID,[Date],PartNo,WaxNo,ColorName,OperatorId,OperatorName,ProcessId,ProcessName from (" +
                "SELECT distinct w.Id WID, dbo.shamsidate(w.Date) as [Date] ,w.PartNo,w.WaxNo,c.Name ColorName, u.FriendlyName OperatorName," +
                //" d.ProductId,p.Code PCode, cat.Name + ' ' + p.Name PName" +
                "    pro.Name ProcessName," +
                "    pro.Id ProcessId," +
                "    cat.Id CatId," +
                "    u.Id OperatorId " +
                //"    pcat.[order] " +
                "FROM worksheets w " +
                "join Colors c on c.Id = w.ColorId " +
                "join Users u on u.Id = w.OperatorId " +
                "join WorksheetDetails d on w.Id = d.WorksheetId " +
                "join Products p on p.Id = d.ProductId " +
                "join Categories cat on cat.Id = p.ProductCategoryId " +
                "join ProcessCategories pcat on pcat.CategoryId = cat.Id " +
                "join Processes pro on pro.Id = pcat.ProcessId" +
                ") s1 " +
                "where WId = @id " +
                "group by WID,[Date],PartNo,WaxNo,ColorName,OperatorId,OperatorName,ProcessId,ProcessName " +
                "order by ProcessId";



            sqlDataSource.Parameters.Add("@id", System.Data.DbType.Int32, id);
            report.DataSource = sqlDataSource;

            InstanceReportSource reportSource = new InstanceReportSource();

            reportSource.ReportDocument = report;

            ReportViewer1.ReportSource = reportSource;

            var table1 = report.Items.Find("table1", true)[0];

            ((table1 as Telerik.Reporting.Table).DataSource as Telerik.Reporting.SqlDataSource).Parameters[0].Value = id;
            ReportViewer1.RefreshReport();
        }
예제 #5
0
 public UnitOfWork(ProcessExplorerDbContext context)
 {
     _context       = context;
     Sessions       = new SessionRepository(_context);
     Authentication = new AuthenticationRepository(_context);
     Process        = new ProcessRepository(_context);
     Application    = new ApplicationRepository(_context);
 }
예제 #6
0
 public DataManager()
 {
     _solutionRepository   = new SolutionRepository();
     _runDateRepository    = new SolutionRunDateRepository();
     _jobRepository        = new ProcessJobRepository();
     _triggerRepository    = new ProcessTriggerRepository();
     _extractionRepository = new ProcessRepository();
 }
예제 #7
0
 public frmMain()
 {
     InitializeComponent();
     hex                     = new HexConverter();
     config                  = new ConfigRepository();
     fpsFixRepository        = new FPSFixRepository(config, hex);
     gameProcessRepository   = new ProcessRepository(config.Get("FF7ProcessName"));
     fpsFixProcessRepository = new ProcessRepository(config.Get("FPSFixExecutable"));
 }
예제 #8
0
        private void BindDrpPrevProcess()
        {
            var source = new ProcessRepository().GetAll();

            drpPrevProcess.DataSource     = source;
            drpPrevProcess.DataValueField = "Id";
            drpPrevProcess.DataTextField  = "Name";
            drpPrevProcess.DataBind();
        }
예제 #9
0
        public ActionResult Index()
        {
            ProcessRepository          repository = new ProcessRepository();
            IEnumerable <ProcessModel> processes  = repository.GetAllProcesses();
            var test = processes.ToList();

            ViewBag.Proc = test;
            return(View());
        }
예제 #10
0
        private void BindDrpProcess()
        {
            var source = new ProcessRepository().GetAll().Where(a => a.Id != 999 && a.Id != 1000 && a.Id != 1001 && a.Id != 1002).ToList();

            drpProcesses.DataSource     = source;
            drpProcesses.DataValueField = "Id";
            drpProcesses.DataTextField  = "Name";
            drpProcesses.DataBind();
        }
예제 #11
0
        public HttpResponseMessage List()
        {
            var repo     = new ProcessRepository();
            var entities = repo.List();

            var json = JsonConvert.SerializeObject(entities);

            return(new HttpResponseMessage {
                Content = new StringContent(json, Encoding.UTF8, "application/json")
            });
        }
예제 #12
0
        public HttpResponseMessage GetById(int id)
        {
            var repo   = new ProcessRepository();
            var entity = repo.Get(id);

            var json = JsonConvert.SerializeObject(entity);

            return(new HttpResponseMessage {
                Content = new StringContent(json, Encoding.UTF8, "application/json")
            });
        }
        public RecordFrame(DesignerMainFrame mainFrame)
        {
            InitializeComponent();
            ProcessRepo = new ProcessRepository();
            FillListBoxProcessStep();
            _event += new SenderHandler(mainFrame.RecordMainFrameEvent);
            ThreadStart myThreadDelegate = new ThreadStart(new Recorder(this).StartMousePointer);

            myThread = new Thread(myThreadDelegate);
            myThread.Start();
        }
예제 #14
0
        public async Task GetNextJob()
        {
            // arrange
            var options = new DbContextOptionsBuilder <StorageContext>()
                          .UseInMemoryDatabase(databaseName: "NextJob")
                          .Options;

            Guid newJobAgentId       = Guid.NewGuid();
            Guid completedJobAgentId = Guid.NewGuid();
            var  context             = new StorageContext(options);

            var newDummyJob = new Job
            {
                Id        = Guid.NewGuid(),
                JobStatus = JobStatusType.New,
                AgentId   = newJobAgentId,
                CreatedOn = DateTime.Now
            };

            var completedDummyJob = new Job
            {
                Id        = Guid.NewGuid(),
                JobStatus = JobStatusType.Completed,
                AgentId   = completedJobAgentId,
                CreatedOn = DateTime.Now
            };

            Seed(context, newDummyJob);
            Seed(context, completedDummyJob);

            var jobLogger     = Mock.Of <ILogger <Job> >();
            var agentLogger   = Mock.Of <ILogger <AgentModel> >();
            var processLogger = Mock.Of <ILogger <Process> >();

            var httpContextAccessor = new Mock <IHttpContextAccessor>();

            httpContextAccessor.Setup(req => req.HttpContext.User.Identity.Name).Returns(It.IsAny <string>());

            var jobRepository = new JobRepository(context, jobLogger, httpContextAccessor.Object);
            var agentRepo     = new AgentRepository(context, agentLogger, httpContextAccessor.Object);
            var processRepo   = new ProcessRepository(context, processLogger, httpContextAccessor.Object);

            var manager = new JobManager(jobRepository, agentRepo, processRepo);

            // act
            var jobsAvailable = manager.GetNextJob(newJobAgentId);
            var jobsCompleted = manager.GetNextJob(completedJobAgentId);

            // assert
            Assert.True(jobsAvailable.IsJobAvailable);
            Assert.False(jobsCompleted.IsJobAvailable);
        }
예제 #15
0
파일: App.cs 프로젝트: kzu/OctoFlow
        private static void GenerateReport(ProcessRepository process, ProcessType type)
        {
            tracer.Info("Generating report for {0}...", type);

            var flow = process.GetFlow(type);

            var generator = new FlowIssueGenerator(type, flow);

            var body = generator.Render();
            var baseDir = GitRepo.Find(".") ?? ".";
            var output = Path.Combine(baseDir, "~" + type + ".md");
            File.WriteAllText(output, body, Encoding.UTF8);
        }
예제 #16
0
        static void Main(string[] args)
        {
            bool              done              = false;
            ConfigRepository  config            = new ConfigRepository();
            HexConverter      hex               = new HexConverter();
            FPSFixRepository  fPSFixRepository  = new FPSFixRepository(config, hex);
            ProcessRepository processRepository = new ProcessRepository(config.Get("FF7ProcessName"));

            List <CommandOption> colors = Enum.GetValues(typeof(CommandOption)).Cast <CommandOption>().ToList();

            for (;;)
            {
                Inquirer.Prompt(Question.List("Choose favourite color", colors)).Then((command) => {
                    switch (command)
                    {
                    case CommandOption.Exit:
                        done = true;
                        return;

                    case CommandOption.GetFPSFixValueFromFile:
                        Console.Clear();
                        Console.WriteLine("Get FPSFix value");
                        Console.WriteLine(fPSFixRepository.GetFPSFIXValue().ToString());
                        Console.ReadLine();
                        break;

                    case CommandOption.SaveFPSFixValueToFile:
                        Console.Clear();
                        Console.WriteLine("Enter a new value: (integer only!)");
                        int newValue = int.Parse(Console.ReadLine());
                        Console.WriteLine($"New value is: {newValue.ToString()}");
                        fPSFixRepository.SaveFPSFixValue(newValue);
                        Console.ReadLine();
                        break;

                    case CommandOption.AttachToGame:
                        Task.Run(() => RunGame());
                        break;

                    case CommandOption.DetatchFromGame:
                        break;
                    }
                });
                Inquirer.Go();

                if (done)
                {
                    return;
                }
            }
        }
 public UnitOfWork(ApplicationDataBaseContext applicationDataBaseContext)
 {
     _applicationDataBaseContext = applicationDataBaseContext;
     Computers            = new ComputerRepository(_applicationDataBaseContext);
     ComputerSystems      = new ComputerSystemRepository(_applicationDataBaseContext);
     Processors           = new ProcessorRepository(_applicationDataBaseContext);
     PhysicalMemories     = new PhysicalMemoryRepository(_applicationDataBaseContext);
     DiskDrives           = new DiskDriveRepository(_applicationDataBaseContext);
     MotherBoards         = new MotherBoardRepository(_applicationDataBaseContext);
     VideoCards           = new VideoCardRepository(_applicationDataBaseContext);
     Processes            = new ProcessRepository(_applicationDataBaseContext);
     ProcessesInformation = new ProcessInformationRepository(_applicationDataBaseContext);
     ProcessesPerfomance  = new ProcessPerfomanceRepository(_applicationDataBaseContext);
 }
예제 #18
0
        public ProcessFlowTest()
        {
            github = new GitHubClient(new ProductHeaderValue("kzu-client"))
            {
                Credentials = credentials
            };

            var repository = new ProcessRepository(
                github,
                new ProcessSettings("netfx", "LearnGit"));

            repository.Initialize();
            Repository = repository;
        }
예제 #19
0
파일: QAFlowTests.cs 프로젝트: kzu/OctoFlow
        public void when_given_issues_then_should_cataloge_process_status()
        {
            var issues = JsonConvert.DeserializeObject<List<Issue>>(File.ReadAllText(@"..\..\json\qa.json"));
            var process = new ProcessRepository(issues);

            var flow = process.GetFlow(ProcessType.QA);

            var generator = new FlowIssueGenerator(ProcessType.QA, flow);

            var body = generator.Render();

            Console.WriteLine(body);

            //var obj = JObject.Parse(body);

            //Console.WriteLine(obj.ToString(Formatting.Indented));
        }
예제 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //BindDrpType();

                if (Page.RouteData.Values["Id"].ToSafeInt() != 0)
                {
                    var repo         = new ProcessRepository();
                    var toBeEditedPr = repo.GetById(Page.RouteData.Values["Id"].ToSafeInt());

                    if (toBeEditedPr != null)
                    {
                        txtName.Text = toBeEditedPr.Name;
                        //drpKind.SelectedValue = toBeEditedUser.Type.ToString();
                    }
                }
            }
        }
예제 #21
0
파일: App.cs 프로젝트: kzu/OctoFlow
        void Generate(
            [DefaultProvider(typeof(OutDirProvider))]
            [Aliases("d")]
            string outDir,
            [DefaultProvider(typeof(OwnerDefaultProvider))]
            [Aliases("o")]
            string owner,
            [DefaultProvider(typeof(RepoDefaultProvider))]
            [Aliases("r")]
            string repo,
            [DefaultProvider(typeof(TokenProvider))]
            [Aliases("t")]
            string apiToken,
            [Description("Maximum age in days of issues to consider for the generation.")]
            [DefaultValue("180")]
            [Aliases("a")] 
            int maxAge)
        {
            tracer.Info("Generating flows for {0}/{1}...", owner, repo);

            var github = new GitHubClient(new ProductHeaderValue("OctoFlow"))
            {
                Credentials = new Credentials(apiToken)
            };

            var process = new ProcessRepository(
                github,
                new ProcessSettings(owner, repo) { MaxAge = TimeSpan.FromDays(maxAge) });

            tracer.Info("Initializing local cache of issues...");

            process.Initialize();

            GenerateReport(process, ProcessType.QA);
            GenerateReport(process, ProcessType.Doc);

            tracer.Info("Done.");
        }
예제 #22
0
 public TestProcessRepository()
 {
     repoProcess = new ProcessRepository();
     repoProject = new ProjectRepository();
 }
예제 #23
0
        //public enum ActionName
        //{
        //    Create,
        //    Edit,
        //    Delete
        //}

        public static void Run(string moduleName, string actionName, int?IdData, int?UserId, object beforeEntityData = null, object afterEntityData = null, string DrugStore = null)
        {
            if (afterEntityData == null)
            {
                return;
            }

            string                   Entity                   = afterEntityData.GetType().Name;
            ProcessRepository        processRepository        = new ProcessRepository(new Domain.Crm.ErpCrmDbContext());
            ProcessAppliedRepository processAppliedRepository = new ProcessAppliedRepository(new Domain.Crm.ErpCrmDbContext());
            UserRepository           userRepository           = new UserRepository(new Domain.ErpDbContext());

            //Lấy danh sách proccess theo thứ tự
            //   var q = processRepository.GetAllProcess().Where(item => item.Category == "Workflow" && item.DataSource == Entity && item.IsActive.Value);
            List <Process> q      = new List <Process>();
            var            action = processAppliedRepository.GetAllProcessApplied().Where(x => x.ModuleName == moduleName && x.ActionName == actionName).ToList();

            foreach (var i in action)
            {
                var process = processRepository.GetProcessById(i.ProcessId.Value);
                q.Add(process);
            }
            //if (actionName == ActionName.Create)
            //{
            //  q = q.Where(item => item.RecordIsCreated.Value);
            //}
            //else if (actionName == ActionName.Edit)
            //{
            //Check case user proceed assignee user
            //var assignedUserId_Before = beforeEntityData.GetType().GetProperties()
            //    .Where(p => p.Name == "AssignedUserId").FirstOrDefault()
            //    .GetGetMethod().Invoke(beforeEntityData, null);

            //var assignedUserId_After = afterEntityData.GetType().GetProperties()
            //    .Where(p => p.Name == "AssignedUserId").FirstOrDefault()
            //    .GetGetMethod().Invoke(afterEntityData, null);

            //var hasAssignee = assignedUserId_Before != assignedUserId_After ? true : false;

            //  q = q.Where(item => (item.RecordIsAssigned.Value && hasAssignee) || item.RecordFieldsChanges.Value);
            //}
            //else if (actionName == ActionName.Delete)
            //{
            //    q = q.Where(item => item.RecordIsDeleted.Value);
            //}

            var qFiltered = q.ToList();

            if (qFiltered != null && qFiltered.Count > 0)
            {
                ProcessActionRepository      processActionRepository      = new ProcessActionRepository(new Domain.Crm.ErpCrmDbContext());
                ModuleRelationshipRepository moduleRelationshipRepository = new ModuleRelationshipRepository(new Domain.ErpDbContext());
                ModuleRepository             moduleRepository             = new ModuleRepository(new Domain.ErpDbContext());
                Dictionary <string, string>  data = (from x in afterEntityData.GetType().GetProperties() select x)
                                                    .ToDictionary(x => "{" + Entity + "." + x.Name + "}", x => (x.GetGetMethod().Invoke(afterEntityData, null) == null ? "" : x.GetGetMethod().Invoke(afterEntityData, null).ToString()));

                //Add module relationship data
                var moduleRelationship = moduleRelationshipRepository.GetAllModuleRelationship()
                                         .Where(item => item.First_ModuleName == Entity)
                                         .ToList();

                if (moduleRelationship != null && moduleRelationship.Count > 0)
                {
                    foreach (var item in moduleRelationship)
                    {
                        //Get table name
                        var secondTableName = moduleRepository.GetAllModule().Where(i => i.Name == item.Second_ModuleName).FirstOrDefault().TableName;
                        //Get data of each module_relationship item
                        string keyValue = data["{" + Entity + "." + item.First_MetadataFieldName + "}"];
                        if (!string.IsNullOrEmpty(keyValue))
                        {
                            string sql    = string.Format("select * from [{0}] where [{1}] = {2}", secondTableName, item.Second_MetadataFieldName, keyValue);
                            var    q_temp = Domain.Helper.SqlHelper.QuerySQL(sql).FirstOrDefault();

                            if (q_temp != null)
                            {
                                foreach (KeyValuePair <string, object> c in q_temp)
                                {
                                    data.Add("{" + item.Second_ModuleName_Alias + "." + c.Key + "}", c.Value == null ? "" : c.Value.ToString());
                                }
                            }
                        }
                    }
                }

                foreach (var item in qFiltered)
                {
                    //Lấy danh sách action theo thứ tự
                    var actionList = processActionRepository.GetAllProcessAction().Where(x => x.ProcessId == item.Id).ToList();
                    if (UserId != null)
                    {
                        var user = userRepository.GetUserById(UserId.Value);
                        item.QueryRecivedUser = item.QueryRecivedUser.Replace("{UserTypeId}", "'" + user.UserTypeId.ToString() + "'");
                        item.QueryRecivedUser = item.QueryRecivedUser.Replace("{BranchId}", "'" + user.BranchId.ToString() + "'");
                        item.QueryRecivedUser = item.QueryRecivedUser.Replace("{AssignedUserId}", "'" + user.Id.ToString() + "'");
                    }
                    if (DrugStore != null)
                    {
                        item.QueryRecivedUser = item.QueryRecivedUser.Replace("{DrugStore}", DrugStore);
                    }
                    var collection = Domain.Helper.SqlHelper.QuerySQL <int>(item.QueryRecivedUser);

                    foreach (var x in actionList)
                    {
                        switch (x.ActionType)
                        {
                        case "SendEmail":
                            foreach (var ii in collection)
                            {
                                sendEmail(data, x.TemplateObject);
                            }
                            break;

                        case "CreateTask":
                            createTask(data, x.TemplateObject);
                            break;

                        case "CreateNotifications":
                            foreach (var ii in collection)
                            {
                                createNotifications(data, x.TemplateObject, ii, moduleName, IdData);
                            }
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
예제 #24
0
 public override void Initialize()
 {
     base.Initialize();
     blobRepository = new Mock <IBlobRepository>();
     sut            = new ProcessRepository(ProcesadorContext, blobRepository.Object);
 }
예제 #25
0
        public string GetProcessName(int prId)
        {
            var repo = new ProcessRepository();

            return(repo.GetById(prId)?.Name);
        }
 public GenerateSchema_Fixture()
 {
     repoProcess     = new ProcessRepository();
     repoProject     = new ProjectRepository();
     repoProcessStep = new ProcessStepRepository();
 }
예제 #27
0
        /// <summary>
        /// Handle the request
        /// </summary>
        /// <param name="context">For testing</param>
        /// <returns></returns>
        public MiddlewareResult Dispatch(IHttpContextWrapper context = null)
        {
            var httpContext = context ?? SystemBootstrapper.GetInstance <IHttpContextWrapper>();

            // execute custom url handlers
            foreach (var handler in CustomUrlHandlers)
            {
                var result = handler.RenderContent(httpContext);
                // check if url maches
                if (result != MiddlewareResult.DoNothing)
                {
                    return(result);
                }
            }

            // get valid process type
            var validType = ProcessRepository.All(type => Filters.All(filter => filter.IsCorrectProcessType(type, httpContext))).FirstOrDefault();

            if (validType.IsNull())
            {
                return(MiddlewareResult.StopExecutionAndInvokeNextMiddleware);
            }

            // create instance
            var process = ProcessFactory.Create <VoidResult>(validType);

            if (process.IsNull())
            {
                return(MiddlewareResult.StopExecutionAndInvokeNextMiddleware);
            }

            // execute factory filters
            foreach (var createEvent in FactoryFilters)
            {
                var result = createEvent.IsValidInstance(process, validType, httpContext);
                if (result != MiddlewareResult.DoNothing)
                {
                    return(result);
                }
            }

            var method = EnumExtensions.FromString <SignalsApiMethod>(httpContext.HttpMethod?.ToUpper());

            // determine the parameter binding method
            var parameterBindingAttribute = validType?
                                            .GetCustomAttributes(typeof(SignalsParameterBindingAttribute), false)
                                            .Cast <SignalsParameterBindingAttribute>()
                                            .FirstOrDefault();

            // resolve default if not provided
            if (parameterBindingAttribute.IsNull())
            {
                DefaultModelBinders.TryGetValue(method, out var modelBinder);
                parameterBindingAttribute = new SignalsParameterBindingAttribute(modelBinder);
            }

            var requestInput = parameterBindingAttribute.Binder.Bind(httpContext);

            // execute process
            var response = new VoidResult();

            // decide if we need to execute
            switch (method)
            {
            case SignalsApiMethod.OPTIONS:
            case SignalsApiMethod.HEAD:
                break;

            default:
                response = ProcessExecutor.Execute(process, requestInput);
                break;
            }

            // post execution events
            foreach (var executeEvent in ResultHandlers)
            {
                var result = executeEvent.HandleAfterExecution(process, validType, response, httpContext);
                if (result != MiddlewareResult.DoNothing)
                {
                    // flag to stop pipe execution
                    return(result);
                }
            }

            // flag to stop pipe execution
            return(MiddlewareResult.StopExecutionAndStopMiddlewarePipe);
        }