//Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyCarVendorGroupItem policyCarVendorGroupItem)
        {
            //PolicyCarStatusDescription
            if (policyCarVendorGroupItem.PolicyCarStatusId != null)
            {
                int policyCarStatusId = (int)policyCarVendorGroupItem.PolicyCarStatusId;
                PolicyCarStatusRepository policyCarStatusRepository = new PolicyCarStatusRepository();
                PolicyCarStatus policyCarStatus = new PolicyCarStatus();
                policyCarStatus = policyCarStatusRepository.GetPolicyCarStatus(policyCarStatusId);
                policyCarVendorGroupItem.PolicyCarStatus = policyCarStatus.PolicyCarStatusDescription;
            }

            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup policyGroup = new PolicyGroup();
            policyGroup = policyGroupRepository.GetGroup(policyCarVendorGroupItem.PolicyGroupId);
            policyCarVendorGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;

            //SupplierName
            SupplierRepository supplierRepository = new SupplierRepository();
            Supplier supplier = new Supplier();
            supplier = supplierRepository.GetSupplier(policyCarVendorGroupItem.SupplierCode, policyCarVendorGroupItem.ProductId);
            if (supplier != null)
            {
                policyCarVendorGroupItem.SupplierName = supplier.SupplierName;
            }

            //PolicyLocationName
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
            PolicyLocation policyLocation = new PolicyLocation();
            policyLocation = policyLocationRepository.GetPolicyLocation(policyCarVendorGroupItem.PolicyLocationId);
            if (policyLocation != null)
            {
                policyCarVendorGroupItem.PolicyLocationName = policyLocation.PolicyLocationName;
            }

            ProductRepository productRepository = new ProductRepository();
            Product product = new Product();
            product = productRepository.GetProduct(policyCarVendorGroupItem.ProductId);
            if (product != null)
            {
                policyCarVendorGroupItem.ProductName = product.ProductName;
            }
        }
Ejemplo n.º 2
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyCarTypeGroupItem policyCarTypeGroupItem)
        {
            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyCarTypeGroupItem.PolicyGroupId);
            policyCarTypeGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;

            //CarStatus
            PolicyCarStatusRepository policyCarStatusRepository = new PolicyCarStatusRepository();
            PolicyCarStatus           policyCarStatus           = new PolicyCarStatus();

            policyCarStatus = policyCarStatusRepository.GetPolicyCarStatus(policyCarTypeGroupItem.PolicyCarStatusId);
            policyCarTypeGroupItem.PolicyCarStatusDescription = policyCarStatus.PolicyCarStatusDescription;

            //CarType Category
            CarTypeCategoryRepository carTypeCategoryRepository = new CarTypeCategoryRepository();
            CarTypeCategory           carTypeCategory           = new CarTypeCategory();

            carTypeCategory = carTypeCategoryRepository.GetCarTypeCategory(policyCarTypeGroupItem.CarTypeCategoryId);
            if (carTypeCategory != null)
            {
                policyCarTypeGroupItem.CarTypeCategoryName = carTypeCategory.CarTypeCategoryName;
            }

            //PolicyLocation
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
            PolicyLocation           policyLocation           = new PolicyLocation();

            policyLocation = policyLocationRepository.GetPolicyLocation(policyCarTypeGroupItem.PolicyLocationId);
            if (policyLocation != null)
            {
                policyCarTypeGroupItem.PolicyLocation = policyLocation.PolicyLocationName;
            }
        }