Ejemplo n.º 1
0
        //Assuming at least one ShippingMethod has been created using the Orders UI
        public Guid GetShippingMethodID()
        {
            Guid    shippingMethodId = Guid.Empty;
            Boolean shipMethodFound  = false;

            //Get all PaymentMethods in default language - Hopefully there is one of each type
            DataSet         shipMethods = orderCtx.GetShippingMethods();
            DataTableReader reader      = shipMethods.CreateDataReader();

            IEnumerator readerEnum = reader.GetEnumerator();

            while (readerEnum.MoveNext() && !shipMethodFound)
            {
                DbDataRecord rec = (DbDataRecord)readerEnum.Current;
                shippingMethodId = rec.GetGuid(rec.GetOrdinal("ShippingMethodId"));
                shipMethodFound  = true;
            }

            if (Guid.Empty == shippingMethodId)
            {
                throw new ApplicationException("This demo requires at least one ShippingMethod to be defined!");
            }

            return(shippingMethodId);
        }