예제 #1
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();
        }
예제 #2
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()));
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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()));
 }
예제 #7
0
 public void Initialize()
 {
     FrameworkEnvironment.Configure();
     OapContext  = new IrmaOapDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());
     IrmaContext = new IrmaDbContext(FrameworkEnvironment.Instance.Configuration.GetConnectionString());
 }
예제 #8
0
        public void ConfigurationEnvironmentTest()
        {
            var env = FrameworkEnvironment.Configure();

            Assert.IsNotNull(env);
        }