/// <summary> ///Locking and unlocking project tasks/// </summary> /// <param name= "Projectuid" >Project UID</param> /// <param name= "Islock" >is locked</param> /// <returns></returns> Public BOOLCloseprojecttask (Guid Projectuid,BOOLIslock) { Try{queuesystemutils queuesystemutils=Newqueuesystemutils (); Projectdataset DST=Getprojectbyuid (PROJECTUID); Statusingwebsvc.projectdataset STATUSING_PRO_DST=NewStatusingwebsvc.projectdataset (); foreach(ProjectWebSvc.ProjectDataSet.TaskRow TaskrowinchDST. Task) {if(Taskrow. Task_lockdown_by_manager! =Islock) {Taskrow. Task_lockdown_by_manager=Islock; Statusing_pro_dst. Task.importrow (Taskrow); } } if(STATUSING_PRO_DST. Task.count >0) { inttemp =0; intTotal_update_count =0; intTotalCount =STATUSING_PRO_DST. Task.count; Statusingwebsvc.projectdataset statusing_pro_dst_update=NewStatusingwebsvc.projectdataset (); foreach(StatusingWebSvc.ProjectDataSet.TaskRow IteminchSTATUSING_PRO_DST. Task) {Temp++; Total_update_count++; Statusing_pro_dst_update. Task.importrow (item); if(Total_update_count >= -|| Temp >=totalcount) {Guid Jobuid=Guid.NewGuid (); Statusingclient.queuelockdowntasks (Jobuid, Projectuid, statusing_pro_dst_update); Queuesystemutils. Waitforqueue (JOBUID); Total_update_count=0; Statusing_pro_dst_update=NewStatusingwebsvc.projectdataset (); } } } return true; } Catch(Exception ex) {NewLoghelper (). WriteLine (ex. ToString ()); return false; } }
Note: If the number of scheduled tasks exceeds 500, an error occurs, the task must be processed in batches, call Queuelockdowntasks to close the project task has been updated, lock and unlock the project scheduled task
Project Server calls the PSI Shutdown task for update lockout tasks