Ejemplo n.º 1
0
        public static SequenceNode Sequence(this object self, FrameworkEnvironment env, bool autoRecyle = true)
        {
            SequenceNode node = Allocate <SequenceNode>(env);

            node.Config(autoRecyle);
            return(node);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            FrameworkEnvironment.Configure();
            var context = new IrmaOapDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());

            var log = Ensco.Irma.Logging.Log.GetLogger(typeof(Program));

            //Activity activity = ActivityXamlServices.Load("TestWfActivity.xaml", new ActivityXamlServicesSettings { CompileExpressions = true });



            var rchl    = new RigOapChecklistRepository(context, log);
            var oacpChl = new OapChecklistRepository(context, log);
            var rigR    = new RigRepository(context, log);



            var rigChecklist = rchl.Get(Guid.Parse("407F66ED-82BB-E811-BA80-30E37A858A8A"));

            ProcessWorkflow(rigChecklist, log, context);

            /*
             * if (rigChecklist == null)
             * {
             *  var rig = rigR.Get(1);
             *
             *  if (rig == null)
             *  {
             *      var r = new Irma.Models.Domain.Oap.Rig()
             *      {
             *          Name = "Rig 1",
             *          Description = "Test Rig 1",
             *          RigNumber = "1",
             *          StartDateTime = DateTime.Now.AddYears(-10),
             *          EndDateTime = DateTime.MaxValue,
             *
             *      };
             *
             *      var rid = rigR.Add(r);
             *      rig = rigR.Get(rid);
             *  }
             *
             *  rigChecklist = new RigOapChecklist()
             *  {
             *      OapChecklist = oacpChl.GetAll(DateTime.MinValue, DateTime.MaxValue).FirstOrDefault(),
             *      Rig = rig
             *  };
             *
             *  var id = rchl.Add(rigChecklist);
             *  rigChecklist = rchl.Get(id);
             * }
             */
            AddWorkflow(rigChecklist, log, context);

            ProcessWorkflow(rigChecklist, log, context);

            Console.Write("Enter some value:");
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        private static T Allocate <T>(FrameworkEnvironment env) where T : ActionNode
        {
            T t = RecyclableObject.Allocate <T>(env);

            while (t.disposed)
            {
                t = RecyclableObject.Allocate <T>(env);
            }
            return(t);
        }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="chunck"></param>
 /// <param name="env"></param>
 /// <param name="bind"></param>
 public FrameworkModuleContainer(string chunck, FrameworkEnvironment env, bool bind = true)
 {
     _chunck     = chunck;
     this._env   = env;
     moudle_list = new List <FrameworkModule>();
     moudle_dic  = new Dictionary <Type, List <FrameworkModule> >();
     if (bind)
     {
         BindEnv();
     }
 }
Ejemplo n.º 5
0
        public void Initialize()
        {
            FrameworkEnvironment.Configure();
            Context = new IrmaOapDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());

            IrmaContext = new IrmaDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());

            OapChecklistRepository = new OapChecklistRepository(Context, Log.GetLogger(this.GetType()));

            OapChecklistTopicRepository = new OapChecklistTopicRepository(Context, Log.GetLogger(this.GetType()));

            RigOapChecklistRepository = new RigOapChecklistRepository(Context, Log.GetLogger(this.GetType()));
        }
Ejemplo n.º 6
0
        public void CheckConnectionStringTest()
        {
            var env = FrameworkEnvironment.Configure();

            Assert.IsNotNull(env);
            Assert.IsNotNull(env.Configuration);
            Assert.IsNotNull(env.Configuration.Data);

            var actualConnection = "Server=(local);Database=test;User Id=sa;Password=helloWorld123;multipleactiveresultsets=True;";

            var connection = env.Configuration.GetConnectionString();

            Assert.IsFalse(String.IsNullOrEmpty(connection));

            Assert.AreEqual(connection, actualConnection, true);
        }
Ejemplo n.º 7
0
        public void CheckDataConfigurationTest()
        {
            var env = FrameworkEnvironment.Configure();

            Assert.IsNotNull(env);

            var dbServer     = "(local)";
            var databaseName = "Test";
            var dbLogin      = "******";
            var dbPassword   = "******";

            var config = env.Configuration;

            Assert.IsNotNull(config);

            Assert.AreEqual(config.Data.Server, dbServer, true);
            Assert.AreEqual(config.Data.Database, databaseName, true);
            Assert.AreEqual(config.Data.Username, dbLogin, true);
            Assert.AreEqual(config.Data.Password, dbPassword, true);
        }
Ejemplo n.º 8
0
        public void Register(HttpConfiguration config)
        {
            FrameworkEnvironment.Configure();
            var container = FrameworkEnvironment.Instance.Container;

            config.SuppressDefaultHostAuthentication();
            config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

            var json = config.Formatters.JsonFormatter;

            json.UseDataContractJsonSerializer = false;

            if (json != null)
            {
                config.Formatters.Remove(json);
            }

            json = new BrowserJsonFormatter();
            config.Formatters.Insert(0, new JsonNewtonFormatter());
            config.Formatters.Insert(0, json);

            json = config.Formatters.JsonFormatter;

            // Web API routes
            config.MapHttpAttributeRoutes();

            MapRoutes(config);

            // Web API configuration and services
            RegisterDependencyContainer(config, container);

            config.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);

            //config.Filters.Add(new LoggingFilter(config));
            config.Filters.Add(new GlobalExceptionFilter(config));
            config.Filters.Add(new ValidateModelFilter());

            Container = container;
        }
 public IrmaOapDbContext Create()
 {
     FrameworkEnvironment.Configure();
     return(new IrmaOapDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString()));
 }
Ejemplo n.º 10
0
 public static bool Subscribe(this IMessageListener listener, FrameworkEnvironment env, Type publishType)
 {
     return(env.modules.Message.Subscribe(publishType, listener));
 }
Ejemplo n.º 11
0
 public static bool Publish(this object obj, FrameworkEnvironment env, Type publishType, int code, IEventArgs args, params object[] param)
 {
     return(env.modules.Message.Publish(publishType, code, args, param));
 }
Ejemplo n.º 12
0
 public static bool Publish <T>(this T obj, FrameworkEnvironment env, int code, IEventArgs args, params object[] param) where T : IMessagePublisher
 {
     return(Publish(obj, env, typeof(T), code, args, param));
 }
Ejemplo n.º 13
0
 public static bool UnSubscribe <T>(this object obj, MessageListener listener, FrameworkEnvironment env) where T : IMessagePublisher
 {
     return(UnSubscribe(obj, typeof(T), listener, env));
 }
Ejemplo n.º 14
0
        public static bool Publish(this object obj, EnvironmentType envType, Type publishType, int code, IEventArgs args, params object[] param)
        {
            FrameworkEnvironment _env = Framework.GetEnv(envType);

            return(_env.modules.Message.Publish(publishType, code, args, param));
        }
Ejemplo n.º 15
0
        public static bool UnSubscribe(this object obj, Type publishType, MessageListener listener, EnvironmentType envType)
        {
            FrameworkEnvironment _env = Framework.GetEnv(envType);

            return(_env.modules.Message.UnSubscribe(publishType, listener));
        }
Ejemplo n.º 16
0
 public static bool UnSubscribe(this object obj, Type publishType, MessageListener listener, FrameworkEnvironment env)
 {
     return(env.modules.Message.UnSubscribe(publishType, listener));
 }
Ejemplo n.º 17
0
 public void Initialize()
 {
     FrameworkEnvironment.Configure();
     OapContext  = new IrmaOapDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());
     IrmaContext = new IrmaDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());
 }
Ejemplo n.º 18
0
 public static bool Subscribe <T>(this IMessageListener listener, FrameworkEnvironment env) where T : IMessagePublisher
 {
     return(Subscribe(listener, env, typeof(T)));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="env"></param>
 public ModuleContainer(FrameworkEnvironment env)
 {
     this._env = env;
     _dic      = new Dictionary <Type, Dictionary <string, Module> >();
     _queue    = new SimplePriorityQueue <Module, int>();
 }
Ejemplo n.º 20
0
        public void ConfigurationEnvironmentTest()
        {
            var env = FrameworkEnvironment.Configure();

            Assert.IsNotNull(env);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 开启一个携程
        /// </summary>
        /// <param name="obj"></param>
        /// <param name=" envType"></param>
        /// <param name="routine">迭代器</param>
        /// <returns></returns>
        public static Coroutine StartCoroutine(this object obj, EnvironmentType envType, IEnumerator routine)
        {
            FrameworkEnvironment _env = Framework.GetEnv(envType);

            return(_env.modules.Coroutine.StartCoroutine(routine));
        }
Ejemplo n.º 22
0
 /// <summary>
 /// 开启一个携程
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="env"></param>
 /// <param name="routine">迭代器</param>
 /// <returns></returns>
 public static Coroutine StartCoroutine(this object obj, FrameworkEnvironment env, IEnumerator routine)
 {
     return(env.modules.Coroutine.StartCoroutine(routine));
 }
Ejemplo n.º 23
0
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释

        internal Modules(FrameworkEnvironment env) : base(env)
        {
        }