Driver.UpdatePrioritization Method

Updates the priorities that are associated with a specific business strategy driver.

Namespace:  [Driver Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/Driver.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/Driver.asmx?wsdl

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Driver/UpdatePrioritization", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Driver/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Driver/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function UpdatePrioritization ( _
    driverPrioritizationDataSet As DriverPrioritizationDataSet _
) As DriverPrioritizationDataSet
'Usage
Dim instance As Driver
Dim driverPrioritizationDataSet As DriverPrioritizationDataSet
Dim returnValue As DriverPrioritizationDataSet

returnValue = instance.UpdatePrioritization(driverPrioritizationDataSet)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Driver/UpdatePrioritization", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Driver/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Driver/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public DriverPrioritizationDataSet UpdatePrioritization(
    DriverPrioritizationDataSet driverPrioritizationDataSet
)

Parameters

Return Value

Type: [Driver Web service].DriverPrioritizationDataSet
Contains the updated prioritization data.

Remarks

Warning

If you create a manual prioritization, you should not use the UpdatePrioritization method to add a driver-to-driver prioritization. In Project Web App, if the prioritization is manual, you are prevented from navigating to the Compare Drivers page (https://ServerName/ProjectServerName/_layouts/PWA/PortfolioStrategy/CompareDrivers.aspx). Although Project Server can perform the update through the PSI, programmatically adding a driver-to-driver prioritization interferes with the manual prioritization.

That is, if the PRIORITIZATION_IS_MANUAL property is True, do not add a DriverPrioritizationDataSet.DriverRelationsRow in the driverPrioritizationDataSet parameter.

Project Server Permissions

Permission

Description

ManagePrioritizations

Allows a user to create or edit prioritizations for project portfolio analyses. Global permission.

Examples

The example uses the SvcDriver namespace in the ProjectServerServices.dll proxy assembly. The ConfigClientEndpoints method uses an app.config file for setting the WCF binding, behavior, and endpoint. For information about creating a PSI proxy assembly and an app.config file, see Prerequisites for WCF-Based Code Samples.

The UpdatePrioritizationInfo method adds a PrioritizationEntriesRow object and a DriverRelationsRow object to the prioritizationDS object. The driver-to-driver relations are set based on the hard-coded lookup table values. The method then calls the UpdatePrioritization method to update the prioritization and returns the updatedPrioritizationDS object. The application writes the XML contents to the PrioritizationInfo.xml. Following are the contents of the PrioritizationInfo.xml file.

<DriverPrioritizationDataSet xmlns="https://schemas.microsoft.com/office/project/server/webservices/DriverPrioritizationDataSet/">
  <Prioritization>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<PRIORITIZATION_NAME>Prioritization-d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_NAME>
<PRIORITIZATION_DESCRIPTION>Test pri
</PRIORITIZATION_DESCRIPTION>
<PRIORITIZATION_IS_MANUAL>false
</PRIORITIZATION_IS_MANUAL>
<PRIORITIZATION_IS_COMPLETE>true
</PRIORITIZATION_IS_COMPLETE>
<RELATIVE_IMPORTANCE_CF_UID>2cd29b66-4cca-4c3e-8421-1e54c6d06dca
</RELATIVE_IMPORTANCE_CF_UID>
<CONSISTENCY_RATIO>0.86625801935397173</CONSISTENCY_RATIO>
<PRIORITIZATION_IS_USED_IN_ANALYSIS>false
</PRIORITIZATION_IS_USED_IN_ANALYSIS>
<CREATED_DATE>2010-03-09T12:38:52.023-08:00</CREATED_DATE>
<MOD_DATE>2010-03-09T12:38:52.49-08:00</MOD_DATE>
<LAST_UPDATED_BY_RES_UID>2a4ba1a7-1d96-4086-8fa5-6dea243ed6b5
</LAST_UPDATED_BY_RES_UID>
<LAST_UPDATED_BY_RES_NAME>Shana Ramamoorthy
</LAST_UPDATED_BY_RES_NAME>
<CREATED_BY_RES_UID>2a4ba1a7-1d96-4086-8fa5-6dea243ed6b5
</CREATED_BY_RES_UID>
<CREATED_BY_RES_NAME>Shana Ramamoorthy</CREATED_BY_RES_NAME>
</Prioritization>
<PrioritizationEntries>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER_UID>e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER_UID>
<DRIVER_NAME>Driver-e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER_NAME>
<DRIVER_PRIORITY>0.58367346938775511
</DRIVER_PRIORITY>
<DRIVER_DESCRIPTION>testDriver-e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER_DESCRIPTION>
<DRIVER_IS_ACTIVE>true</DRIVER_IS_ACTIVE>
</PrioritizationEntries>
<PrioritizationEntries>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER_UID>ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER_UID>
<DRIVER_NAME>Driver-ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER_NAME>
<DRIVER_PRIORITY>0.28108843537414968</DRIVER_PRIORITY>
<DRIVER_DESCRIPTION>testDriver-ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER_DESCRIPTION>
<DRIVER_IS_ACTIVE>true</DRIVER_IS_ACTIVE>
</PrioritizationEntries>
<PrioritizationEntries>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER_UID>d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER_UID>
<DRIVER_NAME>Driver-d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER_NAME>
<DRIVER_PRIORITY>0.13523809523809521</DRIVER_PRIORITY>
<DRIVER_DESCRIPTION>testDriver-d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER_DESCRIPTION>
<DRIVER_IS_ACTIVE>true</DRIVER_IS_ACTIVE>
</PrioritizationEntries>
<DriverRelations>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER1_UID>e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER1_UID>
<DRIVER2_UID>ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER2_UID>
<LT_STRUCT_UID>3e0d4fff-52a6-4235-9b2d-8fb26d74a139
</LT_STRUCT_UID>
</DriverRelations>
<DriverRelations>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER1_UID>e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER1_UID>
<DRIVER2_UID>d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER2_UID>
<LT_STRUCT_UID>3e0d4fff-52a6-4235-9b2d-8fb26d74a139
</LT_STRUCT_UID>
</DriverRelations>
<DriverRelations>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER1_UID>ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER1_UID>
<DRIVER2_UID>e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER2_UID>
<LT_STRUCT_UID>9cecf611-8f36-4ca2-89e4-640537848513
</LT_STRUCT_UID>
</DriverRelations>
<DriverRelations>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER1_UID>ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER1_UID>
<DRIVER2_UID>d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER2_UID>
<LT_STRUCT_UID>3e0d4fff-52a6-4235-9b2d-8fb26d74a139
</LT_STRUCT_UID>
</DriverRelations>
<DriverRelations>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER1_UID>d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER1_UID>
<DRIVER2_UID>e0be5f7d-8c04-4875-be84-04124a6b1206
</DRIVER2_UID>
<LT_STRUCT_UID>9cecf611-8f36-4ca2-89e4-640537848513
</LT_STRUCT_UID>
</DriverRelations>
<DriverRelations>
<PRIORITIZATION_UID>d8d908ce-6400-458f-9edd-554209d4efcf
</PRIORITIZATION_UID>
<DRIVER1_UID>d143b447-4cc3-4f9e-a532-91afdb1db1bd
</DRIVER1_UID>
<DRIVER2_UID>ff0ba75b-a410-4620-bbfe-375a1b1fb6f3
</DRIVER2_UID>
<LT_STRUCT_UID>9cecf611-8f36-4ca2-89e4-640537848513
</LT_STRUCT_UID>
</DriverRelations>
</DriverPrioritizationDataSet>

Following is the complete sample code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ServiceModel;
using PSLibrary = Microsoft.Office.Project.Server.Library;

namespace Microsoft.SDK.Project.Samples.Drivers
{
    class Driver
    {
        private static SvcDriver.DriverClient driverClient;
        private const string DRIVER_ENDPOINT = "basicHttp_Driver";
        private const string OUTPUT_FILES = @"C:\Projects\Samples\Output\";
        private static string outFilePathDriverImpactStmt;
        private static string outFilePathDriverList;
        private static string outFilePathPrioritizationInfo;
        private static string outFilePathPrioritizationRow;
        private static string OutFilePathDrivers;
        private Dictionary<Guid, SortedList<int, SortedList<Guid, object>>> 
            lookupTableValues = 
            new Dictionary<Guid, SortedList<int, SortedList<Guid, object>>>();

        static void Main(string[] args)
        {
            // Configure the endpoints.
            ConfigClientEndpoints(DRIVER_ENDPOINT);

            // If output directory does not exist, create it.
            if (!Directory.Exists(OUTPUT_FILES))
            {
                Directory.CreateDirectory(OUTPUT_FILES);
            }

            outFilePathDriverImpactStmt = OUTPUT_FILES 
                + "DriverImpactStatements.xml";
            outFilePathDriverList = OUTPUT_FILES 
                + "DriverList.xml";
            outFilePathPrioritizationInfo = OUTPUT_FILES 
                + "PrioritizationInfo.xml";
            outFilePathPrioritizationRow = OUTPUT_FILES 
                + "CreatePrioritization.xml";
            OutFilePathDrivers = OUTPUT_FILES + "Drivers.xml";

            // Create the Driver dataset.
            SvcDriver.DriverDataSet driverInfoDS = 
                new SvcDriver.DriverDataSet(); ;

            // Create the drivers.
            driverInfoDS = CreateDrivers();
            driverInfoDS.WriteXml(OutFilePathDrivers);

            // Get the first driver and update its impact statements.
            Guid DRV_UID = 
                new Guid(driverInfoDS.Driver.Rows[0][0].ToString());

            // Update driver impact statements.
            UpdateImpactStatement(DRV_UID);

            // Read the list of drivers.
            SvcDriver.DriverDataSet driverListDS = 
                driverClient.ReadDriverList();
            driverListDS.WriteXml(outFilePathDriverList);
            Console.WriteLine("\nSee XML output of the Updated DataSet at {0}",
            outFilePathDriverList);

            // Create prioritization.
            PrioritizationInfo priInfo = CreateNewPrioritization();
            
            // Create a guids list and add the prioritization GUID to it.
            List<Guid> guids = new List<Guid>();
            guids.Add(priInfo.UniqueId);

            // Read prioritization.
            SvcDriver.DriverPrioritizationDataSet prioritizationDS = 
                driverClient.ReadPrioritization(priInfo.UniqueId);

            // Look-up-table values for comparison (hard-coded here).
            // Change for your installation.
            Guid[] lookUpTableValues = new Guid[2];
            
            // The lookup table value is greater.
            lookUpTableValues[0] = new Guid("3E0D4FFF-52A6-4235-9B2D-8FB26D74A139");
            // The lookup table value is less.
            lookUpTableValues[1] = 
                new Guid("9CECF611-8F36-4CA2-89E4-640537848513");

            // Add drivers to prioritization.
            prioritizationDS = UpdatePrioritizationInfo(
                driverInfoDS, priInfo, prioritizationDS, lookUpTableValues);

            // Read updated prioritization information.
            SvcDriver.DriverPrioritizationDataSet updatedPrioritizationDS = 
                driverClient.ReadPrioritization(priInfo.UniqueId);
            updatedPrioritizationDS.WriteXml(outFilePathPrioritizationInfo);
            Console.WriteLine(
                "\nSee XML output of the Updated Prioritization at {0}",
                outFilePathPrioritizationInfo);

            // Delete prioritization.
            driverClient.DeletePrioritizations(guids.ToArray());
            Console.WriteLine(" Prioritization {0} deleted", priInfo.UniqueId);
            guids.Clear();

            // Delete drivers.
            foreach (SvcDriver.DriverDataSet.DriverRow drvRow in
                driverInfoDS.Driver.Rows)
            {
                guids.Add(drvRow.DRIVER_UID);
            }
            driverClient.DeleteDrivers(guids.ToArray());
            Console.WriteLine("Deleted drivers");
            Console.ReadKey();
        }

        // Update a prioritization.
        private static SvcDriver.DriverPrioritizationDataSet
            UpdatePrioritizationInfo(
            SvcDriver.DriverDataSet driverInfoDS,
            PrioritizationInfo priInfo,
            SvcDriver.DriverPrioritizationDataSet prioritizationDS,
            Guid[] lookUpTableValues)
        {
            // Add a prioritization row.
            foreach (SvcDriver.DriverDataSet.DriverRow dRow in
                driverInfoDS.Driver.Rows)
            {
                SvcDriver.DriverPrioritizationDataSet.PrioritizationEntriesDataTable
                    prioEntries = prioritizationDS.PrioritizationEntries;
                SvcDriver.DriverPrioritizationDataSet.PrioritizationEntriesRow
                    prioritizationEntriesRow =
                    prioEntries.NewPrioritizationEntriesRow();
                prioritizationEntriesRow.PRIORITIZATION_UID =
                    priInfo.UniqueId;
                prioritizationEntriesRow.DRIVER_UID = dRow.DRIVER_UID;
                prioritizationEntriesRow.DRIVER_DESCRIPTION =
                    dRow.DRIVER_DESCRIPTION;
                prioEntries.AddPrioritizationEntriesRow(
                    prioritizationEntriesRow);
            }

            // Add driver-to-driver relations.
            for (int i = 0; i < driverInfoDS.Driver.Rows.Count - 1; i++)
            {
                for (int j = i + 1; j < driverInfoDS.Driver.Rows.Count; j++)
                {
                    SvcDriver.DriverPrioritizationDataSet.DriverRelationsRow
                        driverRelationsRow =
                        prioritizationDS.DriverRelations.NewDriverRelationsRow();
                    driverRelationsRow.PRIORITIZATION_UID = priInfo.UniqueId;
                    driverRelationsRow.DRIVER1_UID =
                        new Guid(driverInfoDS.Driver.Rows[i][0].ToString());
                    driverRelationsRow.DRIVER2_UID =
                        new Guid(driverInfoDS.Driver.Rows[j][0].ToString());
                    driverRelationsRow.LT_STRUCT_UID = lookUpTableValues[i];

                    prioritizationDS.DriverRelations.AddDriverRelationsRow(
                        driverRelationsRow);

                    // Also save the complement values.
                    Guid complementCodeValue =
                        PSLibrary.LookupTables.GetRelativeImportanceComplement(
                        lookUpTableValues[i]);
                    if (complementCodeValue != Guid.Empty)
                    {
                        driverRelationsRow =
                            prioritizationDS.DriverRelations.NewDriverRelationsRow();
                        driverRelationsRow.PRIORITIZATION_UID = priInfo.UniqueId;
                        driverRelationsRow.DRIVER1_UID =
                            new Guid(driverInfoDS.Driver.Rows[j][0].ToString());
                        driverRelationsRow.DRIVER2_UID =
                            new Guid(driverInfoDS.Driver.Rows[i][0].ToString());
                        driverRelationsRow.LT_STRUCT_UID = complementCodeValue;
                        prioritizationDS.DriverRelations.AddDriverRelationsRow(
                            driverRelationsRow);
                    }
                }
            }

            try
            {
                Console.WriteLine("Updating the DataSet....");
                prioritizationDS =
                    driverClient.UpdatePrioritization(prioritizationDS);
                Console.WriteLine(" DataSet updated successfully!");
            }
            catch (CommunicationException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(
                    "\n***System.ServiceModel.CommunicationException:");
                Console.WriteLine(e.ToString());
                Console.ResetColor();
            }
            return prioritizationDS;
        }
        
        // Create a new prioritization.
        private static PrioritizationInfo CreateNewPrioritization()
        {
                SvcDriver.DriverPrioritizationDataSet driverPrioritizationDS =
                    new SvcDriver.DriverPrioritizationDataSet();
                PrioritizationInfo priInfo = new PrioritizationInfo();
                priInfo.UniqueId = Guid.NewGuid();
                priInfo.Name = "Prioritization-" + priInfo.UniqueId;
                priInfo.Description = "Test pri";
            try
            {
                SvcDriver.DriverPrioritizationDataSet.PrioritizationRow 
                    prioritizationRow =
                    driverPrioritizationDS.Prioritization.NewPrioritizationRow();
                prioritizationRow.PRIORITIZATION_UID = priInfo.UniqueId;
                prioritizationRow.PRIORITIZATION_NAME = priInfo.Name;
                prioritizationRow.PRIORITIZATION_DESCRIPTION = 
                    priInfo.Description;
                prioritizationRow.RELATIVE_IMPORTANCE_CF_UID = 
                    PSLibrary.CustomField.RELATIVE_IMPORTANCE_MD_PROP_UID;
                prioritizationRow.PRIORITIZATION_IS_MANUAL = false;

                driverPrioritizationDS.Prioritization.AddPrioritizationRow(
                    prioritizationRow);
                Console.WriteLine("Prioritization: Adding driver prioritization"
                    + priInfo.Name);
                driverClient.CreatePrioritization(driverPrioritizationDS);
                Console.WriteLine("Prioritization: Creation done");
                driverPrioritizationDS.WriteXml(outFilePathPrioritizationRow);
            }
            catch (CommunicationException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(
                    "\n System.ServiceModel.CommunicationException:");
                Console.WriteLine(e.ToString());
                Console.ResetColor();
            }
            return priInfo;
        }

        // Configure the custom field client endpoints.
        public static void ConfigClientEndpoints(string endpt)
        {
            driverClient = new SvcDriver.DriverClient(endpt);
        }

        // Create drivers with impact statements.
        private static SvcDriver.DriverDataSet CreateDrivers()
        {
            DriverInfo drvInfo = new DriverInfo();
            SvcDriver.DriverDataSet updatedDriverDS = 
                new SvcDriver.DriverDataSet();
            try
            {
                // Creates three drivers and the impact statements for each.
                for (int i = 0; i < 3; i++)
                {
                    SvcDriver.DriverDataSet drvDS =
                        new SvcDriver.DriverDataSet();
                    drvInfo.UniqueId = Guid.NewGuid();
                    drvInfo.Name = "Driver-" + drvInfo.UniqueId;
                    drvInfo.Description = "test" + drvInfo.Name;
                    drvInfo.StatementNone = "PROJECT_IMPACT_NONE_VALUE_TXT"
                        + "-" + drvInfo.UniqueId;
                    drvInfo.StatementLow = "PROJECT_IMPACT_LOW_VALUE_TXT"
                        + "-" + drvInfo.UniqueId;
                    drvInfo.StatementModerate = "PROJECT_IMPACT_MODERATE_VALUE_TXT"
                        + "-" + drvInfo.UniqueId;
                    drvInfo.StatementStrong = "PROJECT_IMPACT_STRONG_VALUE_TXT"
                        + "-" + drvInfo.UniqueId;
                    drvInfo.StatementExtreme = "PROJECT_IMPACT_EXTREME_VALUE_TXT"
                        + "-" + drvInfo.UniqueId;

                    SvcDriver.DriverDataSet.DriverRow drvRow = 
                        drvDS.Driver.NewDriverRow();
                    drvRow.DRIVER_UID = drvInfo.UniqueId;
                    drvRow.DRIVER_NAME = drvInfo.Name;
                    drvRow.DRIVER_DESCRIPTION = drvInfo.Description;
                    drvDS.Driver.AddDriverRow(drvRow);

                    SvcDriver.DriverDataSet.DriverImpactStatementsDataTable
                    drvImpStmts = drvDS.DriverImpactStatements;

                    SvcDriver.DriverDataSet.DriverImpactStatementsRow 
                        stmtRow = drvImpStmts.NewDriverImpactStatementsRow();
                    stmtRow.DRIVER_UID = drvInfo.UniqueId;
                    stmtRow.PROJECT_IMPACT_CF_UID = 
                        PSLibrary.CustomField.PROJECT_IMPACT_MD_PROP_UID;
                    stmtRow.LT_STRUCT_UID = 
                        PSLibrary.LookupTables.PROJECT_IMPACT_NONE_LT_STRUCT_UID;
                    stmtRow.DESCRIPTION = drvInfo.StatementNone;
                    drvImpStmts.AddDriverImpactStatementsRow(stmtRow);

                    stmtRow =
                        drvImpStmts.NewDriverImpactStatementsRow();
                    stmtRow.DRIVER_UID = drvInfo.UniqueId;
                    stmtRow.PROJECT_IMPACT_CF_UID = 
                        PSLibrary.CustomField.PROJECT_IMPACT_MD_PROP_UID;
                    stmtRow.LT_STRUCT_UID = 
                        PSLibrary.LookupTables.PROJECT_IMPACT_LOW_LT_STRUCT_UID;
                    stmtRow.DESCRIPTION = drvInfo.StatementLow;
                    drvImpStmts.AddDriverImpactStatementsRow(stmtRow);

                    stmtRow =
                        drvImpStmts.NewDriverImpactStatementsRow();
                    stmtRow.DRIVER_UID = drvInfo.UniqueId;
                    stmtRow.PROJECT_IMPACT_CF_UID = 
                        PSLibrary.CustomField.PROJECT_IMPACT_MD_PROP_UID;
                    stmtRow.LT_STRUCT_UID = 
                        PSLibrary.LookupTables.PROJECT_IMPACT_MODERATE_LT_STRUCT_UID;
                    stmtRow.DESCRIPTION = drvInfo.StatementModerate;
                    drvImpStmts.AddDriverImpactStatementsRow(stmtRow);

                    stmtRow =
                        drvImpStmts.NewDriverImpactStatementsRow();
                    stmtRow.DRIVER_UID = drvInfo.UniqueId;
                    stmtRow.PROJECT_IMPACT_CF_UID = 
                        PSLibrary.CustomField.PROJECT_IMPACT_MD_PROP_UID;
                    stmtRow.LT_STRUCT_UID = 
                        PSLibrary.LookupTables.PROJECT_IMPACT_STRONG_LT_STRUCT_UID;
                    stmtRow.DESCRIPTION = drvInfo.StatementStrong;
                    drvImpStmts.AddDriverImpactStatementsRow(stmtRow);

                    stmtRow =
                        drvImpStmts.NewDriverImpactStatementsRow();
                    stmtRow.DRIVER_UID = drvInfo.UniqueId;
                    stmtRow.PROJECT_IMPACT_CF_UID = 
                        PSLibrary.CustomField.PROJECT_IMPACT_MD_PROP_UID;
                    stmtRow.LT_STRUCT_UID = 
                        PSLibrary.LookupTables.PROJECT_IMPACT_EXTREME_LT_STRUCT_UID;
                    stmtRow.DESCRIPTION = drvInfo.StatementExtreme;
                    drvImpStmts.AddDriverImpactStatementsRow(stmtRow);

                    Console.WriteLine("Adding driver " + drvInfo.Name);
                    driverClient.CreateDriver(
                        (SvcDriver.DriverDataSet)drvDS);
                    Console.WriteLine("Drivers {0} created successfully!", i);
                    updatedDriverDS.Merge(drvDS);
                }
            }
            catch (CommunicationException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(
                    "\n***System.ServiceModel.CommunicationException:");
                Console.WriteLine(e.ToString());
                Console.ResetColor();
            }
            return updatedDriverDS;
        }

        // Update the driver impact statements.
        private static void UpdateImpactStatement(Guid DriverGuid)
        {
            try
            {
                Guid LT_UID = 
                    new Guid("779271C4-894D-4385-9E33-1251A9E80541");
                Guid IMPACT_UID = 
                    new Guid("1728D080-BA74-4D86-A29A-27E4318001C4");
                SvcDriver.DriverDataSet drvInfoDS = 
                    driverClient.ReadDriver(DriverGuid);
                SvcDriver.DriverDataSet.DriverImpactStatementsRow impactRow;
                SvcDriver.DriverDataSet.DriverImpactStatementsDataTable 
                    drvImpactStmts = drvInfoDS.DriverImpactStatements;
                impactRow = 
                  drvImpactStmts.FindByDRIVER_UIDPROJECT_IMPACT_CF_UIDLT_STRUCT_UID(
                  DriverGuid, IMPACT_UID, LT_UID);
                impactRow.DESCRIPTION = "new desc";
                driverClient.UpdateDriver(drvInfoDS);
                drvInfoDS.DriverImpactStatements.WriteXml(
                    outFilePathDriverImpactStmt);
                Console.WriteLine(
                    "\nSee XML output of the Updated DataSet at {0}",
                outFilePathDriverImpactStmt);
            }
            catch (CommunicationException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(
                    "\n***System.ServiceModel.CommunicationException:");
                Console.WriteLine(e.ToString());
                Console.ResetColor();
            }
        }
    }

    // This class contains the driver information.
    public class DriverInfo
    {
        private Guid driverGuid = new Guid();

        public Guid UniqueId
        {
            get { return this.driverGuid; }
            set { this.driverGuid = value; }
        }

        private string driverName = string.Empty;

        public string Name
        {
            get { return this.driverName; }
            set { this.driverName = value; }
        }

        private string driverDescription = string.Empty;

        public string Description
        {
            get { return this.driverDescription; }
            set { this.driverDescription = value; }
        }

        public static int DriverType
        {
            get { return (int)PSLibrary.Optimizer.OptimizerEntities.Driver; }
        }

        private string statementNone = string.Empty;

        public string StatementNone
        {
            get { return this.statementNone; }
            set { this.statementNone = value; }
        }

        private string statementLow = string.Empty;

        public string StatementLow
        {
            get { return this.statementLow; }
            set { this.statementLow = value; }
        }

        private string statementModerate = string.Empty;

        public string StatementModerate
        {
            get { return this.statementModerate; }
            set { this.statementModerate = value; }
        }

        private string statementStrong = string.Empty;

        public string StatementStrong
        {
            get { return this.statementStrong; }
            set { this.statementStrong = value; }
        }

        private string statementExtreme = string.Empty;

        public string StatementExtreme
        {
            get { return this.statementExtreme; }
            set { this.statementExtreme = value; }
        }
    }

    // This class contains the prioritization information.
    class PrioritizationInfo
    {
        private Guid prioritizationGuid = Guid.NewGuid();

        public Guid UniqueId
        {
            get { return this.prioritizationGuid; }
            set { this.prioritizationGuid = value; }
        }
        private string prioritizationName = string.Empty;

        public string Name
        {
            get { return this.prioritizationName; }
            set { this.prioritizationName = value; }
        }

        private string prioritizationDescription = string.Empty;

        public string Description
        {
            get { return this.prioritizationDescription; }
            set { this.prioritizationDescription = value; }
        }
    }
}

See Also

Reference

Driver Class

Driver Members

Driver Web Service