Exemplo n.º 1
0
 public AdminPanelController()
 {
     _context = new ApplicationDbContext();
     _manufacturerRepository = new ManufacturerRepository(_context);
     _typeRepository         = new TypeRepository(_context);
     _goodRepository         = new GoodRepository(_context);
 }
Exemplo n.º 2
0
        public override BaseRepository <TypeEntity, Topic> CreateRepository()
        {
            IMMRequestContext IMMRequestContext = ContextFactory.GetNewContext();
            TypeRepository    TypeRepo          = new TypeRepository(IMMRequestContext);

            return(TypeRepo);
        }
Exemplo n.º 3
0
        internal async Task <HandlerCall[]> FindCalls(JasperOptionsBuilder registry)
        {
            if (_conventionalDiscoveryDisabled)
            {
                return(_explicitTypes.SelectMany(actionsFromType).ToArray());
            }

            if (registry.ApplicationAssembly == null)
            {
                return(new HandlerCall[0]);
            }


            // TODO -- need to expose the module assemblies off of this

            var types = await TypeRepository.FindTypes(registry.ApplicationAssembly,
                                                       TypeClassification.Concretes | TypeClassification.Closed, type => _typeFilters.Matches(type))
                        .ConfigureAwait(false);


            return(types
                   .Where(x => !x.HasAttribute <JasperIgnoreAttribute>())
                   .Concat(_explicitTypes)
                   .Distinct()
                   .SelectMany(actionsFromType).ToArray());
        }
 public EntitiesContext()
 {
     Namespaces = new NamespaceRepository();
     Types      = new TypeRepository();
     Classes    = new ClassRepository();
     Enums      = new EnumRepository();
 }
Exemplo n.º 5
0
        public ActionResult TypeChart()
        {
            TypeChartViewModel typeChart = new TypeChartViewModel();

            //get all TypeMatchups
            TypeRepository allTypes = new TypeRepository(TypeRepository.GetAllTypes());

            typeChart.TypeMatchups = new Dictionary <String, Dictionary <String, Double> >();

            foreach (var matchup in allTypes.GetTypeMatchups())
            {
                //add key if doesn't exist
                if (!typeChart.TypeMatchups.ContainsKey(matchup.AttackingType))
                {
                    typeChart.TypeMatchups.Add(matchup.AttackingType, new Dictionary <String, Double>());
                }

                //add matchup
                typeChart.TypeMatchups[matchup.AttackingType].Add(matchup.DefendingType, matchup.Modifier);
            }

            //Get all types as String
            typeChart.allTypes = new List <string>();
            foreach (Models.PKM.Type type in TypeRepository.GetAllTypes())
            {
                typeChart.allTypes.Add(type.Name);
            }

            ViewBag.TypeChart = typeChart;

            return(View("TypeChart"));
        }
Exemplo n.º 6
0
 public TransactionBusiness(IUnitOfWork _unitOfWork)
 {
     unitOfWork = _unitOfWork;
     tsRep      = new TransactionRepository(unitOfWork);
     accRep     = new AccountRepository(unitOfWork);
     tRep       = new TypeRepository(unitOfWork);
 }
Exemplo n.º 7
0
        public DefaultRegistry()
        {
            try
            {
                Scan(scanner =>
                {
                    scanner.Assembly("OpenCBS.GUI");
                    scanner.TheCallingAssembly();
                    scanner.WithDefaultConventions();
                    scanner.ConnectImplementationsToTypesClosing(typeof(ICommand <>));
                    scanner.AssembliesFromPath("Extensions");
                    scanner.LookForRegistries();
                    scanner.AddAllTypesOf <IMainView>();
                });
            }
            catch (System.Exception)
            {
                Scan(scanner =>
                {
                    scanner.Assembly("OpenCBS.GUI");
                    scanner.TheCallingAssembly();
                    scanner.WithDefaultConventions();
                    scanner.ConnectImplementationsToTypesClosing(typeof(ICommand <>));
                    scanner.LookForRegistries();
                    scanner.AddAllTypesOf <IMainView>();
                });
            }

            For <ITranslationService>().Singleton().Use <TranslationService>();
            For <IApplicationController>().Singleton().Use <ApplicationController>();
            For <ITinyMessengerHub>().Singleton().Use <TinyMessengerHub>();
            For <IConnectionProvider>().Singleton().Use <ConnectionProvider>();

            TypeRepository.AssertNoTypeScanningFailures();
        }
        public TypeLogic CreateLogic()
        {
            var Repository = new TypeRepository(Context);
            var Logic      = new TypeLogic(Repository);

            return(Logic);
        }
Exemplo n.º 9
0
        Task <ActionCall[]> IActionSource.FindActions(Assembly applicationAssembly)
        {
            var assemblies = _applies.Assemblies.Any() ? _applies.Assemblies : new Assembly[] { applicationAssembly };

            return(TypeRepository.FindTypes(assemblies, TypeClassification.Concretes, _typeFilters.Matches)
                   .ContinueWith(x => x.Result.SelectMany(actionsFromType).ToArray()));
        }
        public void find_type_set()
        {
            var widget1 = typeof(IWidget).Assembly;
            var widget2 = typeof(StructureMap.Testing.Widget2.Rule1).Assembly;
            var widget3 = typeof(StructureMap.Testing.Widget3.ColorService).Assembly;

            var task = TypeRepository.FindTypes(new[] { widget1, widget2, widget3 }, type => type.Name.Contains("Color"));

            task.Wait();

            var types = task.Result;

            /*
             * ColorRule
             * ColorService
             * ColorWidget
             * ColorWidgetMaker
             * IColor
             * Widget1Color
             * Widget2Color
             */

            types.AllTypes().OrderBy(x => x.Name).Select(x => x.Name)
            .ShouldHaveTheSameElementsAs("ColorRule", "ColorService", "ColorWidget", "ColorWidgetMaker", "IColor", "Widget1Color", "Widget2Color");

            types.FindTypes(TypeClassification.Interfaces).OrderBy(x => x.Name)
            .ShouldHaveTheSameElementsAs(typeof(IColor));
        }
Exemplo n.º 11
0
        internal async Task <HandlerCall[]> FindCalls(JasperOptions options)
        {
            if (_conventionalDiscoveryDisabled)
            {
                return(_explicitTypes.SelectMany(actionsFromType).ToArray());
            }

            if (options.ApplicationAssembly == null)
            {
                return(new HandlerCall[0]);
            }

            _assemblies.Add(options.ApplicationAssembly);


            var types = await TypeRepository.FindTypes(_assemblies,
                                                       TypeClassification.Concretes | TypeClassification.Closed, type => _typeFilters.Matches(type))
                        .ConfigureAwait(false);


            return(types
                   .Where(x => !x.HasAttribute <JasperIgnoreAttribute>())
                   .Concat(_explicitTypes)
                   .Distinct()
                   .SelectMany(actionsFromType).ToArray());
        }
Exemplo n.º 12
0
        public async Task <ActionResult> Get(string id1, string id2, string id3, string id4, string id5, int size, string ext)
        {
            var md5 = string.Concat(id1, id2, id3, id4, id5);

            var image = await ImageRepository.FindByMd5AndSizeAsync(new Guid(md5), size);

            if (image == null && size != 0)
            {
                image = await ImageRepository.FindByMd5AndSizeAsync(new Guid(md5), 0);
            }

            if (image == null)
            {
                return(NotFound());
            }

            var type = await TypeRepository.FindByIdAsync(image.Type);

            var fileName = id5;

            if (size != 0)
            {
                fileName += $"_{size}";
            }
            fileName += $".{type.Ext}";

            return(File(image.Data, type.Mime, fileName));
        }
Exemplo n.º 13
0
 public BE.Type GetTypeByUrl(string url)
 {
     List<QueryParameter> parameters = new List<QueryParameter>();
     parameters.Add(new QueryParameter("url", url));
     List<BE.Type> types = new TypeRepository().GetByParameter("getByUrl", parameters);
     return types.Count > 0 ? types[0] : null;
 }
Exemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Repeater1.DataSource = FilmRepository.GetAllFilms();
     Repeater1.DataBind();
     if (!IsPostBack)
     {
         ddlType.DataSource     = TypeRepository.GetAllTypes();
         ddlType.DataTextField  = "TypeName";
         ddlType.DataValueField = "TypeID";
         ddlType.DataBind();
         ddlDirector.DataSource     = DirectorRepository.GetAllDirectors();
         ddlDirector.DataTextField  = "DirectorName";
         ddlDirector.DataValueField = "DirectorID";
         ddlDirector.DataBind();
         ddlType.Items.Add("Hepsi");
         ddlType.SelectedIndex = ddlType.Items.Count - 1;
         ddlDirector.Items.Add("Hepsi");
         ddlDirector.SelectedIndex = ddlDirector.Items.Count - 1;
     }
     if (Request.QueryString["filmID"] != null)
     {
         FilmRepository.DeleteFilm(int.Parse(Request.QueryString["filmID"]));
     }
     if (Request.QueryString["directorID"] != null)
     {
         ddlDirector.SelectedValue = Request.QueryString["directorID"];
         ddlDirector_SelectedIndexChanged(sender, e);
         ddlDirector.Enabled = false;
         return;
     }
 }
Exemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ddlDirector.DataSource     = DirectorRepository.GetAllDirectors();
         ddlDirector.DataTextField  = "DirectorName";
         ddlDirector.DataValueField = "DirectorID";
         ddlDirector.DataBind();
         ddlTypes.DataSource     = TypeRepository.GetAllTypes();
         ddlTypes.DataTextField  = "TypeName";
         ddlTypes.DataValueField = "TypeID";
         ddlTypes.DataBind();
         if (Request.QueryString["ID"] != null)
         {
             Film _film = FilmRepository.GetFilm(int.Parse(Request.QueryString["ID"]));
             txtFilmDescription.Text   = _film.Description;
             ddlDirector.SelectedValue = _film.DirectorID.ToString();
             ddlTypes.SelectedValue    = _film.TypeID.ToString();
             txtFilmName.Text          = _film.FilmName;
             calender1.VisibleDate     = _film.PublishDate;
             calender1.SelectedDate    = _film.PublishDate.Date;
             btnKaydet.Text            = "Güncelle";
         }
     }
 }
Exemplo n.º 16
0
        public void BuildProductivities_IntegrationTest()
        {
            var service = GetFakeRaportService();

            var sheetTable = ExcelImporter.GetSheetTable("test.xlsx".AppendAssemblyPath("Contexts\\IntegrationTests"));

            TypeRepository.TryGetPropertyMap(sheetTable, typeof(TestImportModel), out var propertyMap);
            var visitor = new TestImportModelVisitor(_operations);
            var actions = ExcelImporter.GetDataFromTable(sheetTable, propertyMap, new ImportModelConverter <TestImportModel, EmployeeActionBase>(visitor));

            var shortBreaks = new ShortBreakSchedule {
                Duration       = TimeSpan.FromMinutes(10),
                FirstBreakTime = new TimeSpan(9, 55, 0),
                Periodicity    = TimeSpan.FromHours(2)
            };

            var shift = new Shift {
                Lunch = TimeSpan.FromMinutes(30),
            };

            var productivities = service.Build(actions, shortBreaks, shift);

            var employeeProductivity = new EmployeeProductivity(new Employee(), productivities);

            var totalTime = employeeProductivity.GetTotalWorkHours();

            Assert.That(totalTime, Is.GreaterThan(5.7));

            var pause = employeeProductivity.DowntimePeriods.Sum(d => d.Duration.TotalSeconds);

            Assert.That(pause, Is.GreaterThan(16000));
        }
Exemplo n.º 17
0
        public void SetUp()
        {
            _dbContextOptions = new DbContextOptionsBuilder <DueltankDbContext>()
                                .UseInMemoryDatabase("dueltank")
                                .Options;

            _sut = new TypeRepository(new DueltankDbContext(_dbContextOptions));
        }
Exemplo n.º 18
0
        public IEnumerable <Type> Find()
        {
            var assemblies = AssemblyFinder.FindDependentAssemblies().ToArray();

            return
                (TypeRepository.FindTypes(assemblies, TypeClassification.Concretes,
                                          x => x.IsConcreteTypeOf <FubuRegistry>() && x.IsConcreteWithDefaultCtor()).Result());
        }
Exemplo n.º 19
0
        private static ITypeRepository GetTypeRepository()
        {
            var repo = new TypeRepository();

            repo.Fill();

            return(repo);
        }
Exemplo n.º 20
0
        public void GetByQualifiedName_ForTypeInDefaultNamespace()
        {
            sut = new TypeRepository(RuntimeTypeSource, new TypeFactoryDummy(), new TypeFeatureProviderDummy());

            var xamlType = sut.GetByQualifiedName("DummyClass");

            Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass));
        }
Exemplo n.º 21
0
 public int Save(BE.Type type)
 {
     TypeRepository repository = new TypeRepository();
     if(type.ID > 0)
         return repository.Update(type);
     else
         return repository.Insert(type);
 }
Exemplo n.º 22
0
        public void GetByQualifiedName_ForTypeInDefaultNamespace()
        {
            sut = new TypeRepository(RuntimeTypeSource, new TypeFactoryDummy(), new TypeFeatureProviderDummy());

            var xamlType = sut.GetByQualifiedName("DummyClass");

            Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass));
        }
Exemplo n.º 23
0
        public void assert_no_type_scanning_failures_happy_path()
        {
            TypeRepository.ClearAll();
            TypeRepository.FindTypes(GetType().GetAssembly(), TypeClassification.All).Wait();

            #region sample_assert-no-type-scanning-failures
            TypeRepository.AssertNoTypeScanningFailures();
            #endregion
        }
Exemplo n.º 24
0
        }         // constructor

        public void AddArgument(SafeReader sr, TypeRepository oTypeRepo)
        {
            long nArgID = sr["ArgumentID"];

            if (nArgID > 0)
            {
                m_oArguments.Add(new JobArgument(sr, oTypeRepo));
            }
        }         // AddArgument
Exemplo n.º 25
0
        private void checkStatusDB_Click(object sender, EventArgs e)  //Polaczenie z baza danych
        {
            ProductRepository us = new ProductRepository();
            TypeRepository    tp = new TypeRepository();

            us.getAllProducts();
            Console.WriteLine();
            tp.getAllTypes();
        }
Exemplo n.º 26
0
 protected void btnKaydet_Click(object sender, EventArgs e)
 {
     Entity.Model.Type _type = new Entity.Model.Type()
     {
         TypeName = txtTypeName.Text,
     };
     TypeRepository.AddType(_type);
     Response.Redirect("FilmList.aspx");
 }
Exemplo n.º 27
0
        public Task <BehaviorChain[]> BuildChains(BehaviorGraph graph, IPerfTimer timer)
        {
            var types = TypeRepository.FindTypes(graph.AllAssemblies(), TypeClassification.Concretes,
                                                 type => type.CanBeCastTo <Topic>());

            return
                (types.ContinueWith(
                     t => { return t.Result.Select(x => new SseTopicChain(x).As <BehaviorChain>()).ToArray(); }));
        }
Exemplo n.º 28
0
 public void LookForFeatures()
 {
     _types = TypeRepository
              .FindTypes(
         GetType().Assembly,
         TypeClassification.Concretes | TypeClassification.Closed,
         x => x.CanBeCastTo <IFeatureSettings>()
         );
 }
Exemplo n.º 29
0
        public void assert_no_type_scanning_failures_happy_path()
        {
            TypeRepository.ClearAll();
            TypeRepository.FindTypes(GetType().GetTypeInfo().Assembly, TypeClassification.All).Wait();

            // SAMPLE: assert-no-type-scanning-failures
            TypeRepository.AssertNoTypeScanningFailures();
            // ENDSAMPLE
        }
Exemplo n.º 30
0
        public void TypeRepository_mechanics()
        {
            var task = TypeRepository.FindTypes(GetType().Assembly, TypeClassification.Interfaces);
            task.Wait();

            task.Result.ShouldContain(typeof(Interface1));
            task.Result.ShouldContain(typeof(Interface2));
            task.Result.ShouldNotContain(typeof(Concrete1));
        }
        public void Initialize()
        {
            this.db = new RedisDatabase();

            var typeRepo = new TypeRepository(new TypeMetadataGenerator(false));

            this.dbRecordBuilder = new DbRecordBuilder(typeRepo);
            this.stub            = new DynamicProxyStub(typeRepo, this.db, this.dbRecordBuilder);
        }
Exemplo n.º 32
0
        public void Start()
        {
            if (!Conventions.Any())
            {
                throw new InvalidOperationException($"There are no {nameof(IRegistrationConvention)}'s in this scanning operation. ");
            }

            _typeFinder = TypeRepository.FindTypes(_assemblies, type => _filter.Matches(type));
        }
Exemplo n.º 33
0
 public static Task Compile(BehaviorGraph graph, IPerfTimer timer, FubuRegistry registry)
 {
     return(TypeRepository.FindTypes(graph.AllAssemblies(),
                                     TypeClassification.Concretes | TypeClassification.Closed, IsValidationRegistration)
            .ContinueWith(t =>
     {
         t.Result.Distinct()
         .Each(type => registry.Services.For(typeof(IValidationRegistration)).Add(type));
     }));
 }
Exemplo n.º 34
0
        public TypeRepositoryTests()
        {
            nsRegistryMock = new Mock<INamespaceRegistry>();

            var type = typeof(DummyClass);

            var fullyConfiguredMapping = XamlNamespace
                .Map("root")
                .With(new[] {Route.Assembly(type.Assembly).WithNamespaces(new[] {type.Namespace})});

            nsRegistryMock.Setup(registry => registry.GetNamespace("root"))
                .Returns(fullyConfiguredMapping);

            nsRegistryMock.Setup(registry => registry.GetNamespace("clr-namespace:DummyNamespace;Assembly=DummyAssembly"))
                .Returns(new ClrNamespace(type.Assembly, type.Namespace));

            sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
        }
Exemplo n.º 35
0
 public void Initialize()
 {
     sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
 }
Exemplo n.º 36
0
        public static IRuntimeTypeSource FromAttributes(IEnumerable<Assembly> assemblies)
        {
            var allExportedTypes = assemblies.AllExportedTypes();

            var typeFactory = new TypeFactory();

            var xamlNamespaceRegistry = new NamespaceRegistry();
            xamlNamespaceRegistry.FillFromAttributes(assemblies);

            var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider());
            typeFeatureProvider.FillFromAttributes(allExportedTypes);
                
            var xamlTypeRepo = new TypeRepository(xamlNamespaceRegistry, typeFactory, typeFeatureProvider);

            return new RuntimeTypeSource(xamlTypeRepo, xamlNamespaceRegistry);
        }
        private static IRuntimeTypeSource CreateRuntimeTypeSource()
        {
            var typeFactory = new MultiFactory(
                new List<TypeFactoryRegistration>
                {
                    new TypeFactoryRegistration(new TypeFactory(), type => type != typeof (ChildClass)),
                    new TypeFactoryRegistration(new TypeFactoryMock((type, args) => new ChildClass {Name = "InnerName"}), type => type == typeof (ChildClass)),
                });

            var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider());
            var xamlTypeRepository = new TypeRepository(new NamespaceRegistry(), typeFactory, typeFeatureProvider);
            var typeSource = new RuntimeTypeSource(xamlTypeRepository, new NamespaceRegistry());
            typeFeatureProvider.RegisterMetadata(typeof (DummyObject), new Metadata {RuntimePropertyName = "Name"});
            return typeSource;
        }