Пример #1
0
        /// <summary>
        /// 2014-02-28 
        /// ReadWBS & Set
        /// </summary>
        /// <param name="projectObjectId">projectId</param>
        /// /// <param name="Url">Url</param>
        /// <param name="userName">userName</param>
        /// <param name="password">password</param>
        public SigmaResultTypeDTO ReadP6WBSManager(int projectId, string Url, string userName, string password, string userId)
        {
            UserInfoDTO userinfo = new UserInfoDTO();
            userinfo = (new TrueTask.Common()).GetUserInfo(userId);

            SigmaResultTypeDTO Result = new SigmaResultTypeDTO();
            Web.Biz.Common.CommonCodeMgr commonMgr = new Web.Biz.Common.CommonCodeMgr();
            string getUrl = Url;

            P6WS.WBSService.WBSPortBinding wbsp = new P6WS.WBSService.WBSPortBinding();
            wbsp.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_WBS_SERVICE].ToString();
            P6WS.WBSService.ReadWBS rwbs = new P6WS.WBSService.ReadWBS();

            //For Test
            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
            {
                string[] P6LoginInfo = GetP6Login();
                userName = P6LoginInfo[0];
                password = P6LoginInfo[1];
            }

            wbsp.CookieContainer = P6Login(userName, password);
            P6WS.WBSService.WBSFieldType[] wbsFields = new P6WS.WBSService.WBSFieldType[17];

            P6ProjectCombo(userName, password);
            projectRow = P6DT.Select("ProjectObjectId ='" + projectId.ToString() + "'");

            #region set p6
            wbsFields[0] = P6WS.WBSService.WBSFieldType.ObjectId;
            wbsFields[2] = P6WS.WBSService.WBSFieldType.Name;
            wbsFields[3] = P6WS.WBSService.WBSFieldType.ProjectId;
            wbsFields[4] = P6WS.WBSService.WBSFieldType.ProjectObjectId;
            wbsFields[5] = P6WS.WBSService.WBSFieldType.SummaryRemainingDuration;
            wbsFields[6] = P6WS.WBSService.WBSFieldType.StartDate;
            wbsFields[7] = P6WS.WBSService.WBSFieldType.FinishDate;
            wbsFields[8] = P6WS.WBSService.WBSFieldType.ObjectId;
            wbsFields[9] = P6WS.WBSService.WBSFieldType.Code;
            wbsFields[10] = P6WS.WBSService.WBSFieldType.Name;
            wbsFields[11] = P6WS.WBSService.WBSFieldType.SequenceNumber;
            wbsFields[12] = P6WS.WBSService.WBSFieldType.Code;
            wbsFields[13] = P6WS.WBSService.WBSFieldType.ParentObjectId;
            rwbs.Field = wbsFields;
            rwbs.Filter = "ProjectObjectId='" + projectId + "'";
            P6WS.WBSService.WBS[] wbs = wbsp.ReadWBS(rwbs);
            #endregion

            if (wbs != null && wbs.Length > 0)
            {
                for (int i = 0; i < wbs.Length; i++)
                {
                    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();

                    if (wbs[i].Name != "WBSFIWP" && wbs[i].Code != "FIWP")
                    {
                        #region  set Level = 3
                        // Set TypeExternalSchedule
                        TypeExSchedule.Level = "3";
                        TypeExSchedule.StartDate = wbs[i].StartDate.ToString();
                        TypeExSchedule.EndDate = wbs[i].FinishDate.ToString();
                        TypeExSchedule.ProjectObjectId = projectId;
                        TypeExSchedule.ParentObjectId = 0;
                        TypeExSchedule.OriginalDuration = Convert.ToInt32(wbs[i].SummaryRemainingDuration);
                        TypeExSchedule.RemainingDuration = Convert.ToInt32(wbs[i].SummaryRemainingDuration);
                        TypeExSchedule.ActivityObjectId = wbs[i].ObjectId;
                        TypeExSchedule.ExternalProjectName = projectRow[0]["P6ProjectName"].ToString();
                        TypeExSchedule.CalendarId = 0;
                        TypeExSchedule.CreatedBy = userinfo.SigmaUserId;
                        //Result = ExSchMgr.AddExternalSchedule(TypeExSchedule);//////////////////////

                        // Set TypeScheduledWorkItem
                        TypeSWI.ExternalScheduleId = Result.ScalarValue;
                        TypeSWI.CwpId = null;
                        TypeSWI.ScheduleName = wbs[i].Name;
                        TypeSWI.StartDate = wbs[i].StartDate.ToString();
                        TypeSWI.EndDate = wbs[i].FinishDate.ToString();
                        TypeSWI.CrewMemebersAssigned = 0;
                        TypeSWI.TotalWorkingHours = 0;
                        TypeSWI.LeaderId = "0";
                        TypeSWI.CreatedBy = userinfo.SigmaUserId;
                        //Result = SchMgr.AddScheduledWorkItem(TypeSWI);//////////////////////
                        #endregion

                        //Level 4 로 Input
                        ReadActivities(TypeExSchedule.ActivityObjectId, projectId, userName, password, userinfo);
                    }

                }
            }

            return Result;
        }
Пример #2
0
        public virtual P6ActivityDTO ReadWBSFilter(string filter, string userName, string password, int projectId = 0)
        {
            P6WS.WBSService.WBSPortBinding wbsp = new P6WS.WBSService.WBSPortBinding();

            wbsp.CookieContainer = P6Login(userName, password);
            wbsp.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_WBS_SERVICE].ToString();

            P6WS.WBSService.ReadWBS rwbs = new P6WS.WBSService.ReadWBS();
            P6WS.WBSService.WBSFieldType[] wbsFields = new P6WS.WBSService.WBSFieldType[17];

            wbsFields[0] = P6WS.WBSService.WBSFieldType.ObjectId;
            wbsFields[2] = P6WS.WBSService.WBSFieldType.Name;
            wbsFields[3] = P6WS.WBSService.WBSFieldType.ProjectId;
            wbsFields[4] = P6WS.WBSService.WBSFieldType.ProjectObjectId;
            wbsFields[5] = P6WS.WBSService.WBSFieldType.SummaryRemainingDuration;
            wbsFields[6] = P6WS.WBSService.WBSFieldType.StartDate;
            wbsFields[7] = P6WS.WBSService.WBSFieldType.FinishDate;
            wbsFields[8] = P6WS.WBSService.WBSFieldType.ObjectId;
            wbsFields[9] = P6WS.WBSService.WBSFieldType.Code;
            wbsFields[10] = P6WS.WBSService.WBSFieldType.Name;
            wbsFields[11] = P6WS.WBSService.WBSFieldType.SequenceNumber;
            wbsFields[12] = P6WS.WBSService.WBSFieldType.Code;
            wbsFields[13] = P6WS.WBSService.WBSFieldType.ParentObjectId;

            rwbs.Field = wbsFields;
            rwbs.Filter = filter; // "ObjectId='" + wbsObjectId + "'";

            P6WS.WBSService.WBS[] wbs = wbsp.ReadWBS(rwbs);

            P6ActivityDTO dto = null;

            if (wbs != null && wbs.Length > 0)
            {
                dto = new P6ActivityDTO();
                dto.P6ActivityObjectID = wbs[0].ObjectId;
                dto.P6ProjectID = wbs[0].ProjectId;
                dto.P6ProjectObjectID = wbs[0].ProjectObjectId;
                dto.P6RemainingDuration = Convert.ToSingle(wbs[0].SummaryRemainingDuration);
                dto.P6StartDate = wbs[0].StartDate;
                dto.P6FinishDate = wbs[0].FinishDate;
                dto.P6WBSName = wbs[0].Name;
                dto.P6WBSCode = wbs[0].Code;
                dto.P6WBSObjectID = wbs[0].ObjectId;
                dto.P6ActivitySeq = 0;
                dto.P6ActivityLevel = 0;
                dto.P6ParentObjectId = Convert.ToInt32(wbs[0].ParentObjectId);
                dto.CalendarObjectID = 0;
            }

            return dto;
        }
Пример #3
0
        /// <summary>
        /// 2014-02-28 
        /// ReadWBS & Set
        /// </summary>
        /// <param name="projectObjectId">projectId</param>
        /// /// <param name="Url">Url</param>
        /// <param name="userName">userName</param>
        /// <param name="password">password</param>
        public SigmaResultType ReadP6WBSManager(int p6projectId)
        {
            SigmaResultType Result = new SigmaResultType();
            CommonCodeMgr commonMgr = new CommonCodeMgr();
            string p6username, p6password, p6login;

            p6login = System.Configuration.ConfigurationManager.AppSettings["P6Login"].ToString();
            p6username = p6login.Split(';')[0].Split('=')[1].Trim();
            p6password = p6login.Split(';')[1].Split('=')[1].Trim();

            P6WS.WBSService.WBSPortBinding wbsp = new P6WS.WBSService.WBSPortBinding();
            //wbsp.Url = ConfigurationManager.AppSettings[P6WS_SERVICES_WBS_SERVICE].ToString();//임시루

            wbsp.Url = System.Configuration.ConfigurationManager.AppSettings["P6WS.WBSService"];

            P6WS.WBSService.ReadWBS rwbs = new P6WS.WBSService.ReadWBS();

            wbsp.CookieContainer = P6Login(p6username, p6password);
            P6WS.WBSService.WBSFieldType[] wbsFields = new P6WS.WBSService.WBSFieldType[17];

            P6ProjectCombo(p6username, p6password); // 이 구문이 실행되면 P6DT에 값이 채워짐.
            projectRow = P6DT.Select("ProjectObjectId ='" + p6projectId.ToString() + "'");

            #region set p6
            wbsFields[0] = P6WS.WBSService.WBSFieldType.ObjectId;
            wbsFields[2] = P6WS.WBSService.WBSFieldType.Name;
            wbsFields[3] = P6WS.WBSService.WBSFieldType.ProjectId;
            wbsFields[4] = P6WS.WBSService.WBSFieldType.ProjectObjectId;
            wbsFields[5] = P6WS.WBSService.WBSFieldType.SummaryRemainingDuration;
            wbsFields[6] = P6WS.WBSService.WBSFieldType.StartDate;
            wbsFields[7] = P6WS.WBSService.WBSFieldType.FinishDate;
            wbsFields[8] = P6WS.WBSService.WBSFieldType.ObjectId;
            wbsFields[9] = P6WS.WBSService.WBSFieldType.Code;
            wbsFields[10] = P6WS.WBSService.WBSFieldType.Name;
            wbsFields[11] = P6WS.WBSService.WBSFieldType.SequenceNumber;
            wbsFields[12] = P6WS.WBSService.WBSFieldType.Code;
            wbsFields[13] = P6WS.WBSService.WBSFieldType.ParentObjectId;
            rwbs.Field = wbsFields;
            rwbs.Filter = "ProjectObjectId='" + p6projectId + "'";
            P6WS.WBSService.WBS[] wbs = wbsp.ReadWBS(rwbs);
            #endregion

            if (wbs != null && wbs.Length > 0)
            {
                for (int i = 0; i < wbs.Length; i++)
                {
                    TypeExternalSchedule TypeExSchedule = new TypeExternalSchedule();
                    TypeScheduledWorkItem TypeSWI = new TypeScheduledWorkItem();
                    ExternalScheduleMgr ExSchMgr = new ExternalScheduleMgr();
                    ScheduledWorkItemMgr SchMgr = new ScheduledWorkItemMgr();

                    if (wbs[i].Name != "WBSFIWP" && wbs[i].Code != "FIWP") // 뭐냐 이건...
                    {
                        #region  set Level = 3
                        // Set TypeExternalSchedule
                        TypeExSchedule.Level = "3";
                        TypeExSchedule.StartDate = wbs[i].StartDate.ToString();
                        TypeExSchedule.EndDate = wbs[i].FinishDate.ToString();
                        TypeExSchedule.ProjectObjectId = p6projectId;
                        TypeExSchedule.ParentObjectId = 0;
                        TypeExSchedule.OriginalDuration = Convert.ToInt32(wbs[i].SummaryRemainingDuration);
                        TypeExSchedule.RemainingDuration = Convert.ToInt32(wbs[i].SummaryRemainingDuration);
                        TypeExSchedule.ActivityObjectId = wbs[i].ObjectId;
                        TypeExSchedule.ExternalProjectName = projectRow[0]["P6ProjectName"].ToString();
                        TypeExSchedule.CalendarId = 0;
                        TypeExSchedule.CreatedBy = userinfo.SigmaUserId;
                        TypeExSchedule.ProjectId = userinfo.CurrentProjectId;
                        Result = ExSchMgr.AddExternalSchedule(TypeExSchedule);

                        // Set TypeScheduledWorkItem
                        TypeSWI.ExternalScheduleId = Result.ScalarValue;
                        TypeSWI.CwpId = null;
                        TypeSWI.ScheduleName = wbs[i].Name;
                        TypeSWI.StartDate = wbs[i].StartDate.ToString();
                        TypeSWI.EndDate = wbs[i].FinishDate.ToString();
                        TypeSWI.CrewMemebersAssigned = 0;
                        TypeSWI.TotalWorkingHours = 0;
                        TypeSWI.LeaderId = "0";
                        TypeSWI.CreatedBy = userinfo.SigmaUserId;
                        Result = SchMgr.AddScheduledWorkItem(TypeSWI);
                        #endregion

                        //Level 4 로 Input
                        ReadActivities(TypeExSchedule.ActivityObjectId,  p6projectId, p6username, p6password);
                    }

                }
            }

            return Result;
        }