コード例 #1
0
        /// <summary>
        ///
        /// This method will retrieve data via an instance of the official Nethereum Storage contract.
        ///
        /// NOTE: UNDER CONSTRUCTION
        ///
        /// <param name="poStorageSource">The address that represents the instance on the chain</param>
        /// <param name="poSaveEntity">The entity that we are trying to save to the chain</param>
        /// <param name="psWeb3Url">The URL for the Ethereum client to which we want to connect</param>
        /// <returns>Contains indicator of success</returns>
        /// </summary>
        public static async Task <bool> PersistEntityAsync(this Wonka.Eth.Init.WonkaEthSource poStorageSource, WonkaProduct poSaveEntity, string psWeb3Url = "")
        {
            BizDataStorageService storageService = poStorageSource.GetStorageService(psWeb3Url);

            // NOTE: Additional work needed
            // storageService.SetEntityRequestAsync(setEntityFunction);

            return(true);
        }
コード例 #2
0
        /// <summary>
        ///
        /// This method will retrieve data via an instance of the official Nethereum Storage contract.
        ///
        /// NOTE: UNDER CONSTRUCTION
        ///
        /// <param name="poStorageSource">The address that represents the instance on the chain</param>
        /// <param name="psWeb3Url">The URL for the Ethereum client to which we want to connect</param>
        /// <returns>Contains the assembled product data that represents the current product</returns>
        /// </summary>
        public static async Task <WonkaProduct> RetrieveEntityAsync(this Wonka.Eth.Init.WonkaEthSource poStorageSource, string psWeb3Url = "")
        {
            WonkaProduct CurrentEntity = new WonkaProduct();

            BizDataStorageService storageService = poStorageSource.GetStorageService(psWeb3Url);

            // NOTE: Additional work needed
            // storageService.GetEntityRequestAsync(getEntityFunction);

            return(CurrentEntity);
        }
コード例 #3
0
        /// <summary>
        ///
        /// This method will assemble the new product by iterating through the known Attributes
        /// and retrieving the data via the Wonka engine on the chain (acting as a proxy).
        ///
        /// <param name="poEngineSource">The address that represents the instance on the chain</param>
        /// <param name="psWeb3Url">The URL for the Ethereum client to which we want to connect</param>
        /// <returns>Contains the assembled product data that represents the current product</returns>
        /// </summary>
        public static WonkaProduct AssembleCurrentProductFromChainWonka(this Wonka.Eth.Init.WonkaEthSource poEngineSource, string psWeb3Url = "")
        {
            var RefEnv = WonkaRefEnvironment.GetInstance();

            WonkaProduct CurrentProduct = new WonkaProduct();

            var AllAttributes = new HashSet <string>();

            RefEnv.AttrCache.ForEach(x => AllAttributes.Add(x.AttrName));

            var CurrRecordOnChain = poEngineSource.GetAttrValuesViaChainEngine(AllAttributes, psWeb3Url);

            foreach (string sTmpAttrName in CurrRecordOnChain.Keys)
            {
                WonkaRefAttr TargetAttr = RefEnv.GetAttributeByAttrName(sTmpAttrName);

                CurrentProduct.SetAttribute(TargetAttr, CurrRecordOnChain[sTmpAttrName]);
            }

            return(CurrentProduct);
        }
コード例 #4
0
        /// <summary>
        ///
        /// This method will return an Attribute value using.
        ///
        /// NOTE: UNDER CONSTRUCTION
        ///
        /// <param name="poEngine">The Wonka.NET instance that represents the instance on the chain</param>
        /// <param name="poEngineSource">The address that represents the instance on the chain</param>
        /// <param name="pnEpochTimeToStartFrom">The time of the reports from which we want to start pulling reports</param>
        /// <param name="psWeb3Url">The URL for the Ethereum client to which we want to connect</param>
        /// <returns>Contains the array of rule reports</returns>
        /// </summary>
        public static async Task <List <Wonka.Eth.Extensions.RuleTreeReport> > GetRuleTreeReportsFromChainStorageAsync(this WonkaBizRulesEngine poEngine,
                                                                                                                       Wonka.Eth.Init.WonkaEthSource poEngineSource,
                                                                                                                       long pnEpochTimeToStartFrom = 0,
                                                                                                                       string psWeb3Url            = "")
        {
            var RuleTreeReports = new List <Wonka.Eth.Extensions.RuleTreeReport>();

            // NOTE: Do work here

            return(RuleTreeReports);
        }