Adding resource to a resource plan w.r.t a project

D

Dave

Hi

This is what i'm trying to do. I want to add a resource to a resource plan
via ResourcePlan.asmx webservice.

Here's my code:
ResourcePlanWebSvc.ResourcePlan resourcePlan = new
ResourcePlanWebSvc.ResourcePlan();
ResourcePlanWebSvc.ResourcePlanDataSet resourcePlanDS = new
ResourcePlanWebSvc.ResourcePlanDataSet();

ResourcePlanWebSvc.ResourcePlanDataSet.PlanResourcesDataTable
planResourcesDT = new
ResourcePlanWebSvc.ResourcePlanDataSet.PlanResourcesDataTable();
ResourcePlanWebSvc.ResourcePlanDataSet.PlanResourcesRow
planResourceRow = planResourcesDT.NewPlanResourcesRow();


resourcePlan.Url =
System.Configuration.ConfigurationSettings.AppSettings["ResourcePlanWebSvc.resourceplan"];
resourcePlan.Credentials = CredentialCache.DefaultCredentials;

Guid projectGuid = GetProjectGuid(projectName);

planResourceRow.RES_NAME = resourceName;
planResourceRow.RES_UID = GetResourceId(resourceName);
planResourceRow.PROJ_UID = projectGuid;
planResourceRow.ASSN_BOOKING_TYPE = 0;
planResourceRow.ASSN_UID = Guid.NewGuid();
planResourceRow.RES_TYPE = 0;
planResourceRow.RES_CAN_LEVEL = true;
planResourceRow.RES_HIRE_DATE = DateTime.Now;
planResourceRow.RES_TERMINATION_DATE = DateTime.Now.AddDays(7);

planResourcesDT.AddPlanResourcesRow(planResourceRow);


resourcePlan.QueueCreateResourcePlan(projectGuid,
resourcePlanDS, false , true, Guid.NewGuid());
System.Threading.Thread.Sleep(3000);


Guid[] projectId = new Guid[1];
projectId[0] = planResourceRow.PROJ_UID;

Guid[] jobId = new Guid[1];
jobId[0] = Guid.NewGuid();

resourcePlan.CheckOutResourcePlans(projectId);
resourcePlan.QueuePublishResourcePlan(planResourceRow.PROJ_UID,
jobId[0]);
System.Threading.Thread.Sleep(3000);
resourcePlan.QueueCheckInResourcePlans(projectId, true, jobId);

This code executes fine without any errors however it doesn't show up in
resource plan for a specific project.

What is see i if i add a resource to a resource plan via pwa it updates to
tables in Drafts and Publish database i,e MSP_Resource_Plans and
MSP_Resource_Plans_Assignements. when i do the same via code it insert a row
in
MSP_Resource_Plans but not in MSP_Resource_Plans_Assignments.

I want to add resources to resource plan for a specific project, Can anybody
help me with, it will be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top