/// <summary> /// Updates the specified characteristics in the database. /// </summary> /// <param name="characteristics">characteristics parts to update.</param> /// <param name="versioningEnabled">Specifies whether to create a new inspection plan version entry.</param> /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param> public Task UpdateCharacteristics( InspectionPlanCharacteristic[] characteristics, bool versioningEnabled = false, CancellationToken cancellationToken = default(CancellationToken) ) { var parameter = ParameterDefinition.Create( "versioningEnabled", versioningEnabled.ToString() ); return Put( "characteristics", characteristics, cancellationToken, parameter ); }
/// <summary> /// This methods creates a new part as well as three characteristics below. /// </summary> private async void AddPartButtonClick( object sender, EventArgs e ) { LogMessage( "Creating inspection plan items" ); var sw = System.Diagnostics.Stopwatch.StartNew(); var partPath = PathHelper.String2PartPathInformation( _PartTextBox.Text ); var char1Path = GetCharPath( _Char1TextBox ); var char2Path = GetCharPath( _Char2TextBox ); var char3Path = GetCharPath( _Char3TextBox ); try { var part = new InspectionPlanPart { Path = partPath, Uuid = Guid.NewGuid() }; var char1 = new InspectionPlanCharacteristic { Path = char1Path, Uuid = Guid.NewGuid() }; var char2 = new InspectionPlanCharacteristic { Path = char2Path, Uuid = Guid.NewGuid() }; var char3 = new InspectionPlanCharacteristic { Path = char3Path, Uuid = Guid.NewGuid() }; var characteristics = new[] { char1, char2, char3 }; await _RestDataServiceClient.CreateParts( new[] { part } ); await _RestDataServiceClient.CreateCharacteristics( characteristics ); _CurrentPart = part; _CurrentCharacteristics = characteristics; _RawDataListView.Items.Clear(); sw.Stop(); LogMessage( "Succesfully created inspection plan items in {0} ms\r\n", sw.ElapsedMilliseconds ); } catch( Exception ex ) { LogMessage( String.Format( "Error creating part '{0}': '{1}'.\r\n", partPath, ex.Message ) ); _CurrentPart = null; _CurrentCharacteristics = null; } }
/// <summary> /// Adds the specified characteristics to the database. /// </summary> /// <param name="characteristics">The characteristics to add.</param> /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param> public Task CreateCharacteristics( InspectionPlanCharacteristic[] characteristics, CancellationToken cancellationToken = default(CancellationToken) ) { return Post( "characteristics", characteristics, cancellationToken ); }