public void should_success_instantiate()
        {
            VBRealizationDocumentNonPOUnitCostViewModel viewModel = new VBRealizationDocumentNonPOUnitCostViewModel()
            {
                Unit = new UnitViewModel()
                {
                    Division = new DivisionViewModel()
                    {
                        Code = "Code"
                    }
                }
            };
            VBRealizationDocumentUnitCostsItemModel model = new VBRealizationDocumentUnitCostsItemModel(1, viewModel);

            model.SetUnit(1, "newUnitName", "newUnitCode", "user", "userAgent");
            model.SetDivision(1, "newDivisionName", "newDivisionCode", "user", "userAgent");
            model.SetIsSelected(true, "user", "userAgent");
            model.SetAmount(1, "user", "userAgent");
        }
Beispiel #2
0
        public VBRealizationDocumentUnitCostsItemModel(int vbRealizationDocumentId, VBRealizationDocumentNonPOUnitCostViewModel viewModel)
        {
            if (viewModel.Unit != null)
            {
                UnitId   = viewModel.Unit.Id;
                UnitName = viewModel.Unit.Name;
                UnitCode = viewModel.Unit.Code;

                if (viewModel.Unit.Division != null)
                {
                    DivisionId   = viewModel.Unit.Division.Id;
                    DivisionName = viewModel.Unit.Division.Name;
                    DivisionCode = viewModel.Unit.Division.Code;
                }

                VBDocumentLayoutOrder = viewModel.Unit.VBDocumentLayoutOrder;
            }

            Amount     = viewModel.Amount;
            IsSelected = viewModel.IsSelected;

            VBRealizationDocumentId = vbRealizationDocumentId;
        }