Beispiel #1
0
        public AssetsResultDto GetResultDto(int entityId)
        {
            var main = Get(entityId);

            if (null == main)
            {
                return(null);
            }

            var result = new AssetsResultDto
            {
                AssetsMain     = main,
                AssetsType     = main.CatCode.GetAssetsTypeByCatCode(),
                AssetsTypeName = main.CatCode.GetAssetsTypeNameByCatCode()
            };

            switch (result.AssetsType)
            {
            case AssetsTypes.Land:
                result.Land = _landRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.House:
                result.House = _houseRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.Building:
                result.Building = _buildingRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.Car:
                result.Car = _carRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.GeneralEquipment:
                result.General = _generalRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.SpecialEquipment:
                result.Special = _specialRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.Culturalrelic:
                result.Culturalrelic = _culturalrelicRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.Book:
                result.Book = _bookRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            case AssetsTypes.Animalandplant:
                result.Animalandplant = _animalRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
                break;

            /*case AssetsTypes.Furniture:
             * result.f = _landRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);
             * break;*/
            default:
                break;
            }

            return(result);
        }