protected override IEnumerable <CardPrefixViewModel> GetModelRecordsToBindInGrid()
        {
            var programId = ParentEntityId.ToInteger();

            return(_cardPrefixService.Filter(o => o.ProgramId == programId)
                   .Select(o => o.Convert <CardPrefix, CardPrefixViewModel>()));
        }
예제 #2
0
        protected override string GetIndexViewTitle()
        {
            var programId = ParentEntityId.ToInteger();
            var program   = _programService.Find(programId);

            return(string.Format("{0} - Products", program.Name));
        }
        protected override string GetIndexViewTitle()
        {
            var userService = new UserService(new UnitOfWorkWrapper());
            var user        = userService.Find(ParentEntityId.ToInteger());

            return(string.Format("{0} - User Group Map", user.UserName));
        }
예제 #4
0
        protected override IEnumerable <DosageViewModel> GetModelRecordsToBindInGrid()
        {
            var id          = ParentEntityId.ToInteger();
            var dosageItems = _dosageService.Filter(o => o.ProductId == id).Select(o => o.Convert <Dosage, DosageViewModel>());

            return(dosageItems);
        }
        protected override IEnumerable <UserGroupFunctionViewModel> GetModelRecordsToBindInGrid()
        {
            var theParentId = ParentEntityId.ToInteger();
            var unitOfWork  = new UnitOfWorkWrapper();
            var model       = unitOfWork.Repository <UserGroupFunction>().GetAllIncluding(o => o.CentralFunction.CentralModule)
                              .Where(c => c.UserGroupId == (theParentId == 0 ? c.UserGroupId : theParentId))
                              .Select(source => new UserGroupFunctionViewModel
            {
                UserGroupFunctionId = source.UserGroupFunctionId,
                ModuleName          = source.CentralFunction.CentralModule.ModuleName,
                FunctionName        = source.CentralFunction.FunctionName,
                CentralFunctionId   = source.CentralFunction.CentralFunctionId,
                UserGroupId         = source.UserGroupId
            });

            //var model = _service.Filter(c => c.UserGroupId == (theParentId == 0 ? c.UserGroupId : theParentId))
            //    .Select(source => new UserGroupFunctionViewModel
            //    {
            //        UserGroupFunctionId = source.UserGroupFunctionId,
            //        ModuleName = source.CentralFunction.CentralModule.ModuleName,
            //        FunctionName = source.CentralFunction.FunctionName,
            //        CentralFunctionId = source.CentralFunction.CentralFunctionId,
            //        UserGroupId = source.UserGroupId
            //    });
            //.OrderBy(c => c.CentralFunction.FunctionName)
            //.Select(AssignEntityToViewModel);

            return(model);
        }
예제 #6
0
        public void Entity_updates_StateModel_by_events()
        {
            var id     = ParentEntityId.Generate();
            var parent = new ParentEntity(new ParentCreated(id, "test parent", DateTime.UtcNow));

            parent.StateModel.Id.Should().Be(id);
            parent.StateModel.Name.Should().Be("test parent");
        }
        protected override void SetViewBagsForCreate(int?id)
        {
            var programId = ParentEntityId.ToInteger();
            var program   = _programService.Find(programId);

            ViewBag.ProgramName = program.Name;
            ViewBag.ProgramId   = programId;
        }
        protected override ConversionFactorViewModel SetViewModelData(ConversionFactorViewModel viewModel)
        {
            viewModel.DosageId = ParentEntityId.ToInteger();
            var dosage = _dosageService.Find(viewModel.DosageId);

            viewModel.DosageForm  = dosage.Name;
            viewModel.ProductName = _productService.Find(dosage.ProductId).Name;
            return(base.SetViewModelData(viewModel));
        }
예제 #9
0
        public void Entity_updates_StateModel()
        {
            var id = ParentEntityId.Generate();

            var parent = new ParentEntity(id, "test parent");

            parent.StateModel.Id.Should().Be(id);
            parent.StateModel.Name.Should().Be("test parent");
        }
예제 #10
0
        public void GetHashCode_should_be_the_state_hashcode()
        {
            var id    = ParentEntityId.Generate();
            var state = new ParentState().Apply(new ParentCreated(id, "test parent", DateTime.UtcNow));

            var parent = new ParentEntity(Enumerable.Empty <IEvent>(), state);

            parent.GetHashCode().Should().Be(parent.StateModel.GetHashCode());
        }
예제 #11
0
        protected override void SetViewBagForIndexView(int?id)
        {
            var cardTypeId   = ParentEntityId.ToInteger();
            var cardTypeItem = _cardTypeService.Find(cardTypeId);

            if (cardTypeItem != null)
            {
                ViewBag.CardTypeName = cardTypeItem.Name;
            }
        }
예제 #12
0
        public void Entity_updates_StateModel_by_inital_state()
        {
            var id    = ParentEntityId.Generate();
            var state = new ParentState().Apply(new ParentCreated(id, "test parent", DateTime.UtcNow));

            var parent = new ParentEntity(Enumerable.Empty <IEvent>(), state);

            parent.StateModel.Id.Should().Be(id);
            parent.StateModel.Name.Should().Be("test parent");
        }
예제 #13
0
        private void SetViewBags()
        {
            var classItem = _classService.Find(ParentEntityId.ToInteger());

            if (classItem != null)
            {
                ViewBag.ClassName = classItem.Name;
            }
            ViewBag.ClassId = ParentEntityId.ToString();
        }
예제 #14
0
        private void SetViewBag()
        {
            var productId   = ParentEntityId.ToInteger();
            var productItem = _productService.Find(productId);

            if (productItem != null)
            {
                ViewBag.ProductName = productItem.Name;
            }
            ViewBag.ProductId = ParentEntityId.ToString();
        }
예제 #15
0
        private void SetViewBags()
        {
            var classItem = _dosageService.Find(ParentEntityId.ToInteger());

            if (classItem != null)
            {
                //TODO:Kevin Check
                ViewBag.ClassName = classItem.Name;
            }
            ViewBag.ClassId = ParentEntityId.ToString();
        }
예제 #16
0
        protected override IEnumerable <ProgramProductMappingViewModel> GetModelRecordsToBindInGrid()
        {
            var parentId = ParentEntityId.ToInteger();

            return(_service.Filter(o => o.ProgramId == parentId)
                   .Select(o => new ProgramProductMappingViewModel
            {
                ProgramProductMappingId = o.ProgramProductMappingId,
                ProductName = o.Product.Name,
                Status = o.Status
            }));
        }
예제 #17
0
        public void Equals_should_call_equals_of_state()
        {
            var id    = ParentEntityId.Generate();
            var state = new ParentState().Apply(new ParentCreated(id, "test parent", DateTime.UtcNow));

            var parent = new ParentEntity(Enumerable.Empty <IEvent>(), state);

            parent.Equals(parent.StateModel).Should().Be(true);

            var state2  = new ParentState().Apply(new ParentCreated(id, "test parent", DateTime.UtcNow));
            var parent2 = new ParentEntity(Enumerable.Empty <IEvent>(), state2);

            parent.Equals(parent2).Should().Be(true);

            parent.Equals(null).Should().Be(false);
        }
예제 #18
0
        protected override IEnumerable <SalesRetailPriceViewModel> GetModelRecordsToBindInGrid()
        {
            //TODO: check if it returns product and dosage
            var id               = ParentEntityId.ToInteger();
            var dosageItem       = _dosageService.Find(id);
            var productId        = dosageItem.ProductId;
            var productItem      = _productService.Find(productId);
            var salesRetailItems = _service.Filter(o => o.DosageId.Equals(id)).ToList();

            foreach (var item in salesRetailItems)
            {
                item.DosageId     = id;
                item.ProductId    = productId;
                item.Dosage.Name  = dosageItem.Name;
                item.Product.Name = productItem.Name;
            }

            return(salesRetailItems.Where(o => o.SalesRetailPriceId.Equals(id)).Select(o => o.Convert <SalesRetailPrice, SalesRetailPriceViewModel>()));

            var items = _service.Filter(o => o.SalesRetailPriceId.Equals(id)).Select(o => o.Convert <SalesRetailPrice, SalesRetailPriceViewModel>());

            return(_service.Filter(o => o.SalesRetailPriceId.Equals(id)).Select(o => o.Convert <SalesRetailPrice, SalesRetailPriceViewModel>()));
        }
예제 #19
0
        protected override IEnumerable <CardTypeViewModel> GetModelRecordsToBindInGrid()
        {
            var id = ParentEntityId.ToInteger();

            return(_service.Filter(o => o.ClassId.Equals(id)).Select(o => o.Convert <CardType, CardTypeViewModel>()));
        }
예제 #20
0
        protected override IEnumerable <ProgramViewModel> GetModelRecordsToBindInGrid()
        {
            var cardTypeId = ParentEntityId.ToInteger();

            return(_service.Filter(o => o.CardTypeId == cardTypeId).Select(o => o.Convert <Program, ProgramViewModel>()));
        }