ProjectOperationsRecalculate Method (RecalculateServiceArguments) |
Run the Recalculate.
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 Exceptions Exception | Condition |
---|
InvalidOperationException | Thrown 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 Recalculate.
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>();
Cobra.Model.WebService.RecalculateServiceArguments recalculateServiceArguments = projectOperations.CreateProjectOperationsServiceArguments<Cobra.Model.WebService.RecalculateServiceArguments>();
recalculateServiceArguments.Project = "Demo";
recalculateServiceArguments.ClassList = new StringCollection();
recalculateServiceArguments.ClassList.Add("Budget");
recalculateServiceArguments.ClassList.Add("OTB");
recalculateServiceArguments.ClassList.Add("Replanned");
recalculateServiceArguments.ResultList = new StringCollection();
recalculateServiceArguments.ResultList.Add("DIRECT");
recalculateServiceArguments.ResultList.Add("GANDA");
recalculateServiceArguments.ResultList.Add("HOURS");
recalculateServiceArguments.ResultList.Add("OVERHEAD");
Console.WriteLine("Running Recalculate...");
ServiceResult recalculateResult = projectOperations.Recalculate(recalculateServiceArguments);
if (recalculateResult.Success)
Console.WriteLine("Calculate Recalculate process completed successfully.");
else
Console.WriteLine("Calculate Recalculate process did not completed successfully.");
cobraServices.LogOut();
See Also