public virtual P6WS.ActivityService.Activity[] CreateActivity(P6WS.ActivityService.Activity newActivity, string userName, string password) { P6WS.ActivityService.Activity[] results = null; P6WS.ActivityService.Activity[] act = new P6WS.ActivityService.Activity[1]; P6WS.ActivityService.ActivityPortBinding apb = new P6WS.ActivityService.ActivityPortBinding(); apb.CookieContainer = P6Login(userName, password); apb.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_ACTIVITY_SERVICE].ToString(); act[0] = newActivity; act[0].StartDateSpecified = true; act[0].FinishDateSpecified = true; act[0].ProjectObjectIdSpecified = true; act[0].WBSObjectIdSpecified = true; //act[0].CalendarObjectIdSpecified = true; int[] ids = apb.CreateActivities(act); if (ids.Length > 0) { results = new P6WS.ActivityService.Activity[ids.Length]; for (int i = 0; i < ids.Length; i++) { P6WS.ActivityService.Activity[] added = ReadActivities(ids[0], userName, password); if (added.Length > 0) results[i] = added[0]; } } return results; }
public virtual bool DeleteActivities(int[] Ids, string userName, string password) { P6WS.ActivityService.ActivityPortBinding apb = new P6WS.ActivityService.ActivityPortBinding(); apb.CookieContainer = P6Login(userName, password); apb.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_ACTIVITY_SERVICE].ToString(); P6WS.ActivityService.DeleteActivitiesResponse rtn = apb.DeleteActivities(Ids); return rtn.Return; }
public virtual P6WS.ActivityService.Activity[] UpdateActivities(P6WS.ActivityService.Activity[] acts, string userName, string password) { P6WS.ActivityService.Activity[] results = null; P6WS.ActivityService.ActivityPortBinding apb = new P6WS.ActivityService.ActivityPortBinding(); apb.CookieContainer = P6Login(userName, password); apb.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_ACTIVITY_SERVICE].ToString(); P6WS.ActivityService.UpdateActivitiesResponse rtn = apb.UpdateActivities(acts); if (rtn.Return) { results = new P6WS.ActivityService.Activity[acts.Length]; for (int i = 0; i < acts.Length; i++) { P6WS.ActivityService.Activity[] updated = ReadActivities(acts[0].ObjectId, userName, password); if (updated.Length > 0) results[i] = updated[0]; } } return results; }
/// <summary> /// ReadActivities & Set /// </summary> /// <param name="activityObjectId"></param> /// <param name="userName"></param> /// <param name="password"></param> /// <returns></returns> public virtual SigmaResultTypeDTO ReadActivities(int activityObjectId, int projectId, string userName, string password, UserInfoDTO userinfo) { SigmaResultTypeDTO Result = new SigmaResultTypeDTO(); Types.Common.TypeExternalSchedule TypeExSchedule = new Types.Common.TypeExternalSchedule(); Types.Common.TypeScheduledWorkItem TypeSWI = new Types.Common.TypeScheduledWorkItem(); Web.Biz.Common.ExternalScheduleMgr ExSchMgr = new Web.Biz.Common.ExternalScheduleMgr(); Web.Biz.Common.ScheduledWorkItemMgr SchMgr = new Web.Biz.Common.ScheduledWorkItemMgr(); P6WS.ActivityService.ActivityPortBinding apb = new P6WS.ActivityService.ActivityPortBinding(); apb.CookieContainer = P6Login(userName, password); apb.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_ACTIVITY_SERVICE].ToString(); P6WS.ActivityService.ReadActivities ra = new P6WS.ActivityService.ReadActivities(); P6WS.ActivityService.ActivityFieldType[] actFields = new P6WS.ActivityService.ActivityFieldType[18]; #region set Activity Data actFields[0] = P6WS.ActivityService.ActivityFieldType.Id; actFields[1] = P6WS.ActivityService.ActivityFieldType.ObjectId; actFields[2] = P6WS.ActivityService.ActivityFieldType.Name; actFields[3] = P6WS.ActivityService.ActivityFieldType.ProjectId; actFields[4] = P6WS.ActivityService.ActivityFieldType.ProjectObjectId; actFields[5] = P6WS.ActivityService.ActivityFieldType.RemainingDuration; actFields[6] = P6WS.ActivityService.ActivityFieldType.StartDate; actFields[7] = P6WS.ActivityService.ActivityFieldType.FinishDate; actFields[8] = P6WS.ActivityService.ActivityFieldType.WBSObjectId; actFields[9] = P6WS.ActivityService.ActivityFieldType.ActualDuration; actFields[10] = P6WS.ActivityService.ActivityFieldType.ActualStartDate; actFields[11] = P6WS.ActivityService.ActivityFieldType.ExpectedFinishDate; actFields[12] = P6WS.ActivityService.ActivityFieldType.DurationPercentComplete; actFields[13] = P6WS.ActivityService.ActivityFieldType.AtCompletionDuration; actFields[14] = P6WS.ActivityService.ActivityFieldType.RemainingDuration; actFields[15] = P6WS.ActivityService.ActivityFieldType.ActualStartDate; actFields[16] = P6WS.ActivityService.ActivityFieldType.Status; actFields[17] = P6WS.ActivityService.ActivityFieldType.CalendarObjectId; #endregion ra.Field = actFields; ra.Filter = string.Format("WBSObjectId={0}", activityObjectId); P6WS.ActivityService.Activity[] acts = apb.ReadActivities(ra); if (acts != null && acts.Length > 0) { for (int i = 0; i < acts.Length; i++) { // Set TypeExternalSchedule TypeExSchedule.Level = "4"; TypeExSchedule.StartDate = acts[i].StartDate.ToString(); TypeExSchedule.EndDate = acts[i].FinishDate.ToString(); TypeExSchedule.ProjectObjectId = projectId; TypeExSchedule.ParentObjectId = activityObjectId; TypeExSchedule.OriginalDuration = Convert.ToInt32(acts[i].ActualDuration); TypeExSchedule.RemainingDuration = Convert.ToInt32(acts[i].RemainingDuration); TypeExSchedule.ActivityObjectId = Convert.ToInt32(acts[i].ObjectId); TypeExSchedule.CalendarId = Convert.ToInt32(acts[i].CalendarObjectId); TypeExSchedule.ExternalProjectName = projectRow[0]["P6ProjectName"].ToString(); TypeExSchedule.CreatedBy = userinfo.SigmaUserId; //Result = ExSchMgr.AddExternalSchedule(TypeExSchedule);////////////////////// // Set TypeScheduledWorkItem TypeSWI.ExternalScheduleId = Result.ScalarValue; TypeSWI.CwpId = null; TypeSWI.ScheduleName = acts[i].Name.ToString(); TypeSWI.StartDate = acts[i].StartDate.ToString(); TypeSWI.EndDate = acts[i].FinishDate.ToString(); TypeSWI.CrewMemebersAssigned = 0; TypeSWI.TotalWorkingHours = 0;//차후 확인 필요 TypeSWI.LeaderId = "";//차후 확인 필요 TypeSWI.CreatedBy = userinfo.SigmaUserId; //Result = SchMgr.AddScheduledWorkItem(TypeSWI);////////////////////// ReadCalendars(TypeExSchedule.CalendarId, userName, password); } } return Result; }
public virtual P6WS.ActivityService.Activity[] ReadActivities(int activityObjectId, string userName, string password) { P6WS.ActivityService.ActivityPortBinding apb = new P6WS.ActivityService.ActivityPortBinding(); apb.CookieContainer = P6Login(userName, password); apb.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_ACTIVITY_SERVICE].ToString(); P6WS.ActivityService.ReadActivities ra = new P6WS.ActivityService.ReadActivities(); P6WS.ActivityService.ActivityFieldType[] actFields = new P6WS.ActivityService.ActivityFieldType[18]; actFields[0] = P6WS.ActivityService.ActivityFieldType.Id; actFields[1] = P6WS.ActivityService.ActivityFieldType.ObjectId; actFields[2] = P6WS.ActivityService.ActivityFieldType.Name; actFields[3] = P6WS.ActivityService.ActivityFieldType.ProjectId; actFields[4] = P6WS.ActivityService.ActivityFieldType.ProjectObjectId; actFields[5] = P6WS.ActivityService.ActivityFieldType.RemainingDuration; actFields[6] = P6WS.ActivityService.ActivityFieldType.StartDate; actFields[7] = P6WS.ActivityService.ActivityFieldType.FinishDate; actFields[8] = P6WS.ActivityService.ActivityFieldType.WBSObjectId; actFields[9] = P6WS.ActivityService.ActivityFieldType.ActualDuration; actFields[10] = P6WS.ActivityService.ActivityFieldType.ActualStartDate; actFields[11] = P6WS.ActivityService.ActivityFieldType.ExpectedFinishDate; actFields[12] = P6WS.ActivityService.ActivityFieldType.DurationPercentComplete; actFields[13] = P6WS.ActivityService.ActivityFieldType.AtCompletionDuration; actFields[14] = P6WS.ActivityService.ActivityFieldType.RemainingDuration; actFields[15] = P6WS.ActivityService.ActivityFieldType.ActualStartDate; actFields[16] = P6WS.ActivityService.ActivityFieldType.Status; actFields[17] = P6WS.ActivityService.ActivityFieldType.CalendarObjectId; ra.Field = actFields; ra.Filter = string.Format("ObjectId={0}", activityObjectId); P6WS.ActivityService.Activity[] acts = apb.ReadActivities(ra); return acts; }