/// <summary>
        /// This function is called when the IlcCore Server request informations for an InfoPoint.
        /// Step 2
        /// To get Informations into your apps you need insert the appropiate BusinessObject into the dataInterface
        /// </summary>
        /// <param name="context"></param>
        /// <param name="infoPoint"></param>
        /// <param name="dataInterface"></param>
        public void CollectInformations(InformationProcess context, InfoPoint infoPoint, IInformationDataInterface dataInterface)
        {
            var company = infoPoint.Value as Company;
            if (company == null)
                return;
            dataInterface.Insert(company);
            dataInterface.Flush();

            if (dataInterface.MustCollect<ContactPerson>())
            {
                var contactsLoader = new ContactsLoader();
                var contacts = contactsLoader.LoadContactsByCompany(company);
                dataInterface.Insert(contacts);
                dataInterface.Flush();
            }
            
            // Step 3 
            // we Add the ProductsLoader and the Ilc.BusinessObjects.AdventureWorks Library
            // to showcase the Detail-Loading procedure
            // Details-Loading is deferred by creating and setting an DetailsLink for the InformationObject
            if (dataInterface.MustCollect<BikeProduct>())
            {
                var productsLoader = new ProductsLoader();
                var products = productsLoader.LoadProductByCompany(company);

                foreach (var product in products)
                {
                    var detailsLink = new List<DetailsLink>();
                    detailsLink.Add(dataInterface.CreateDetailsLink(Constants.ProductPhotoDetailslink, product.Id));
                    dataInterface.Insert(product, null, detailsLink);
                }
                dataInterface.Flush();
            }
        }
コード例 #2
0
        /// <summary>
        /// This function is called when the IlcCore Server request informations for an InfoPoint.
        /// Step 2
        /// To get Informations into your apps you need insert the appropiate BusinessObject into the dataInterface
        /// </summary>
        /// <param name="context"></param>
        /// <param name="infoPoint"></param>
        /// <param name="dataInterface"></param>
        public void CollectInformations(InformationProcess context, InfoPoint infoPoint, IInformationDataInterface dataInterface)
        {
            var company = infoPoint.Value as Company;

            if (company == null)
            {
                return;
            }
            dataInterface.Insert(company);
            dataInterface.Flush();

            if (dataInterface.MustCollect <ContactPerson>())
            {
                var contactsLoader = new ContactsLoader();
                var contacts       = contactsLoader.LoadContactsByCompany(company);
                dataInterface.Insert(contacts);
                dataInterface.Flush();
            }

            // Step 3
            // we Add the ProductsLoader and the Ilc.BusinessObjects.AdventureWorks Library
            // to showcase the Detail-Loading procedure
            // Details-Loading is deferred by creating and setting an DetailsLink for the InformationObject
            if (dataInterface.MustCollect <BikeProduct>())
            {
                var productsLoader = new ProductsLoader();
                var products       = productsLoader.LoadProductByCompany(company);

                foreach (var product in products)
                {
                    var detailsLink = new List <DetailsLink>();
                    detailsLink.Add(dataInterface.CreateDetailsLink(Constants.ProductPhotoDetailslink, product.Id));
                    dataInterface.Insert(product, null, detailsLink);
                }
                dataInterface.Flush();
            }
        }