protected override IEnumerable <CardPrefixViewModel> GetModelRecordsToBindInGrid() { var programId = ParentEntityId.ToInteger(); return(_cardPrefixService.Filter(o => o.ProgramId == programId) .Select(o => o.Convert <CardPrefix, CardPrefixViewModel>())); }
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)); }
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); }
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)); }
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"); }
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()); }
protected override void SetViewBagForIndexView(int?id) { var cardTypeId = ParentEntityId.ToInteger(); var cardTypeItem = _cardTypeService.Find(cardTypeId); if (cardTypeItem != null) { ViewBag.CardTypeName = cardTypeItem.Name; } }
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"); }
private void SetViewBags() { var classItem = _classService.Find(ParentEntityId.ToInteger()); if (classItem != null) { ViewBag.ClassName = classItem.Name; } ViewBag.ClassId = ParentEntityId.ToString(); }
private void SetViewBag() { var productId = ParentEntityId.ToInteger(); var productItem = _productService.Find(productId); if (productItem != null) { ViewBag.ProductName = productItem.Name; } ViewBag.ProductId = ParentEntityId.ToString(); }
private void SetViewBags() { var classItem = _dosageService.Find(ParentEntityId.ToInteger()); if (classItem != null) { //TODO:Kevin Check ViewBag.ClassName = classItem.Name; } ViewBag.ClassId = ParentEntityId.ToString(); }
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 })); }
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); }
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>())); }
protected override IEnumerable <CardTypeViewModel> GetModelRecordsToBindInGrid() { var id = ParentEntityId.ToInteger(); return(_service.Filter(o => o.ClassId.Equals(id)).Select(o => o.Convert <CardType, CardTypeViewModel>())); }
protected override IEnumerable <ProgramViewModel> GetModelRecordsToBindInGrid() { var cardTypeId = ParentEntityId.ToInteger(); return(_service.Filter(o => o.CardTypeId == cardTypeId).Select(o => o.Convert <Program, ProgramViewModel>())); }