Click or drag to resize

ProjectOperationsCalculateEarnedValue Method

Run the Calculate Earned Value.

Namespace:  Cobra.WebService.ClientAPI.Application.Files
Assembly:  Cobra.WebService.ClientAPI (in Cobra.WebService.ClientAPI.dll) Version: 8.4.717.3176 (8.4.0717.3176)
Syntax
C#
public ServiceResult CalculateEarnedValue(
	CalculateEarnedValueServiceArguments calculateEarnedValueServiceArguments
)

Parameters

calculateEarnedValueServiceArguments
Type: Cobra.WebService.ClientAPI.Application.FilesCalculateEarnedValueServiceArguments
An instance of CalculateEarnedValueServiceArguments class that contains the options to run the Calculate Earned Value.

Return Value

Type: ServiceResult
The result of running Calculate Earned Value.
Exceptions
ExceptionCondition
InvalidOperationExceptionThrown when state of the instance of the CobraServices that generated the current ProjectOperations is not in opened state.
Examples
This sample shows how to run the Calculate Earned Value.
C#
using Cobra.WebService.ClientAPI;
using Cobra.WebService.ClientAPI.Client;
using Cobra.WebService.ClientAPI.Application.Files;

.
.
.

CobraServices cobraServices = new CobraServices();
cobraServices.ServiceIdentityData.Username = "SYSADMIN";
cobraServices.ServiceIdentityData.SecurePassword = new SecurePassword();
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('P');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('A');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('W');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('O');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('R');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('D');
cobraServices.ServiceIdentityData.DataSourceKey = "COBRA";

LoginResult loginResult = cobraServices.Login();
if (!loginResult.Success) {
    Console.WriteLine("Login failed.");
    return;
}

Console.WriteLine("Login Success.");

ProjectOperations projectOperations = cobraServices.CreateServiceOperations<ProjectOperations>();
CalculateEarnedValueServiceArguments calculateEarnedValueServiceArguments = projectOperations.CreateProjectOperationsServiceArguments<CalculateEarnedValueServiceArguments>();
calculateEarnedValueServiceArguments.Project = "Demo";
calculateEarnedValueServiceArguments.EarnedValueMethod = EarnedValueMethod.Time;

Console.WriteLine("Running Calculate Earned Value...");
ServiceResult calculateEarnedValueResult = projectOperations.CalculateEarnedValue(calculateEarnedValueServiceArguments);
if (calculateEarnedValueResult.Success)
    Console.WriteLine("Calculate Earned Value process completed successfully.");
else
    Console.WriteLine("Calculate Earned Value process did not completed successfully.");

cobraServices.LogOut();
See Also