Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new resource with some of the physical properties defined and a membership selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonNewResource_Click(object sender, EventArgs e)
        {
            //Creating a new instance of a resource
            IResource resource = _dataHelper.CreateNewResource("Example4 Resource");
            bool      success  = _dataHelper.ResourceSetNotes(resource, "Notes for this automatically created resource");

            success &= _dataHelper.ResourceSetState(resource, Resources.PhysicalState.liquid);
            success &= _dataHelper.ResourceSetIsPrimary(resource, true);
            success &= _dataHelper.ResourceSetCRatio(resource, 0.25); //25% by mass
            success &= _dataHelper.ResourceSetSRatio(resource, 0.26); //26% by mass
            success &= _dataHelper.ResourceSetMarketValue(resource, "us_dollars/joule", 10);
            success &= _dataHelper.ResourceSetLHV(resource, "grams/joule", 1);
            //success &= _dataHelper.ResourceUnsetLHV(resource);
            success &= _dataHelper.ResourceSetHHV(resource, "grams/joule", 1.2);
            //success &= _dataHelper.ResourceUnsetHVV(resource);
            success &= _dataHelper.ResourceSetDensity(resource, "grams/cu_meter", 1000000);
            //success &= _dataHelper.ResourceUnsetDensity(resource);
            success &= _dataHelper.DataInsertOrUpdateResource(resource);

            if (success)
            {
                MessageBox.Show("Resource named : '" + resource.Name + "' inserted in dataset");
            }
            else
            {
                MessageBox.Show("Failure");
            }
        }