public void GetViewCollections(IDependencyResolver resolver, CollectionTypesModel model, Dictionary<string, IEnumerable<object>> result)
        {
            if (model.AdditionalCostTypes)
            	result.Add("AdditionalCostTypes", GetViewCollection<AdditionalCostTypes, int, IAdditionalCostTypesManager>(
            		(IAdditionalCostTypesManager)resolver.GetService(typeof(IAdditionalCostTypesManager))));

            if (model.ProceedsAccounts)
            	result.Add("ProceedsAccounts", GetViewCollection<ProceedsAccounts, int, IProceedsAccountsManager>(
            		(IProceedsAccountsManager)resolver.GetService(typeof(IProceedsAccountsManager))));

            if (model.Materials)
            	result.Add("Materials", GetViewCollection<Materials, int, IMaterialsManager>(
            		(IMaterialsManager)resolver.GetService(typeof(IMaterialsManager))));

            if (model.Autos)
            	result.Add("Autos", GetViewCollection<Autos, int, IAutosManager>(
            		(IAutosManager)resolver.GetService(typeof(IAutosManager))));

            if (model.Permission)
            	result.Add("Permission", GetViewCollection<Permission, int, IPermissionManager>(
            		(IPermissionManager)resolver.GetService(typeof(IPermissionManager))));

            if (model.JobPositions)
            	result.Add("JobPositions", GetViewCollection<JobPositions, int, IJobPositionsManager>(
            		(IJobPositionsManager)resolver.GetService(typeof(IJobPositionsManager))));

            if (model.Role)
            	result.Add("Role", GetViewCollection<Role, int, IRoleManager>(
            		(IRoleManager)resolver.GetService(typeof(IRoleManager))));

            if (model.Employees)
            	result.Add("Employees", GetViewCollection<Employees, int, IEmployeesManager>(
            		(IEmployeesManager)resolver.GetService(typeof(IEmployeesManager))));

            if (model.TransportProducts)
            	result.Add("TransportProducts", GetViewCollection<TransportProducts, int, ITransportProductsManager>(
            		(ITransportProductsManager)resolver.GetService(typeof(ITransportProductsManager))));

            if (model.ProductTypes)
            	result.Add("ProductTypes", GetViewCollection<ProductTypes, int, IProductTypesManager>(
            		(IProductTypesManager)resolver.GetService(typeof(IProductTypesManager))));

            if (model.Instruments)
            	result.Add("Instruments", GetViewCollection<Instruments, int, IInstrumentsManager>(
            		(IInstrumentsManager)resolver.GetService(typeof(IInstrumentsManager))));

        }
        public IHttpActionResult Get([FromUri] CollectionTypesModel model)
        {
            if (model == null)
            {
                return(NotFound());
            }

            var result = new Dictionary <string, IEnumerable <object> >();

            if (model.CommunicationPartners)
            {
                var manager = (ICommunicationPartnersManager)GlobalConfiguration.Configuration.DependencyResolver.
                              GetService(typeof(ICommunicationPartnersManager));

                result.Add("CommunicationPartners", manager.GetEntities().
                           Select(o => new { id = o.Id, name = o.Title, customerId = o.CustomerId }).ToList());
            }

            if (model.PaymentIntervals)
            {
                result.Add("PaymentIntervals", new[]
                {
                    new { id = 0, name = "Sofort" },
                    new { id = 5, name = "5 Tage" },
                    new { id = 10, name = "10 Tage" },
                    new { id = 30, name = "30 Tage" },
                });
            }

            if (model.PaymentTypes)
            {
                result.Add("PaymentTypes", new[]
                {
                    new { id = 0, name = "Standard" },
                    new { id = 1, name = "Pauschal" },
                });
            }

            if (model.ProductAmountTypes)
            {
                result.Add("ProductAmountTypes", new[]
                {
                    new { id = 0, name = "Stunde" },
                    new { id = 1, name = "Stück" },
                });
            }

            if (model.MaterialAmountTypes)
            {
                result.Add("MaterialAmountTypes", new[]
                {
                    new { id = 0, name = "Stück" },
                    new { id = 1, name = "Meter" },
                });
            }

            if (model.SalaryTypes)
            {
                result.Add("SalaryTypes", new[]
                {
                    new { id = 0, name = "Monatseinkommen" },
                    new { id = 1, name = "Stundensatz" },
                });
            }

            new MasterDataViewCollectionControllerFactory().GetViewCollections(
                GlobalConfiguration.Configuration.DependencyResolver, model, result);

            return(Ok(result));
        }
Exemple #3
0
        public void GetViewCollections(IDependencyResolver resolver, CollectionTypesModel model, Dictionary <string, IEnumerable <object> > result)
        {
            if (model.AdditionalCostTypes)
            {
                result.Add("AdditionalCostTypes", GetViewCollection <AdditionalCostTypes, int, IAdditionalCostTypesManager>(
                               (IAdditionalCostTypesManager)resolver.GetService(typeof(IAdditionalCostTypesManager))));
            }

            if (model.ProceedsAccounts)
            {
                result.Add("ProceedsAccounts", GetViewCollection <ProceedsAccounts, int, IProceedsAccountsManager>(
                               (IProceedsAccountsManager)resolver.GetService(typeof(IProceedsAccountsManager))));
            }

            if (model.Materials)
            {
                result.Add("Materials", GetViewCollection <Materials, int, IMaterialsManager>(
                               (IMaterialsManager)resolver.GetService(typeof(IMaterialsManager))));
            }

            if (model.Autos)
            {
                result.Add("Autos", GetViewCollection <Autos, int, IAutosManager>(
                               (IAutosManager)resolver.GetService(typeof(IAutosManager))));
            }

            if (model.Permission)
            {
                result.Add("Permission", GetViewCollection <Permission, int, IPermissionManager>(
                               (IPermissionManager)resolver.GetService(typeof(IPermissionManager))));
            }

            if (model.JobPositions)
            {
                result.Add("JobPositions", GetViewCollection <JobPositions, int, IJobPositionsManager>(
                               (IJobPositionsManager)resolver.GetService(typeof(IJobPositionsManager))));
            }

            if (model.Role)
            {
                result.Add("Role", GetViewCollection <Role, int, IRoleManager>(
                               (IRoleManager)resolver.GetService(typeof(IRoleManager))));
            }

            if (model.Employees)
            {
                result.Add("Employees", GetViewCollection <Employees, int, IEmployeesManager>(
                               (IEmployeesManager)resolver.GetService(typeof(IEmployeesManager))));
            }

            if (model.TransportProducts)
            {
                result.Add("TransportProducts", GetViewCollection <TransportProducts, int, ITransportProductsManager>(
                               (ITransportProductsManager)resolver.GetService(typeof(ITransportProductsManager))));
            }

            if (model.ProductTypes)
            {
                result.Add("ProductTypes", GetViewCollection <ProductTypes, int, IProductTypesManager>(
                               (IProductTypesManager)resolver.GetService(typeof(IProductTypesManager))));
            }

            if (model.Instruments)
            {
                result.Add("Instruments", GetViewCollection <Instruments, int, IInstrumentsManager>(
                               (IInstrumentsManager)resolver.GetService(typeof(IInstrumentsManager))));
            }
        }