Esempio n. 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;
        }
Esempio n. 2
0
        public int generateRptTest(int div, string userId)
        {
            byte[] bytes = null;
            rptProjectCwaIwpDTO rptInfo = GetProjectCwaIwpByIwp(1);

            UserInfoDTO userInfo = new UserInfoDTO();
            userInfo = (new TrueTask.Common()).GetUserInfo(userId);

            switch (div)
            {
                case 1:
                    bytes = GenerateReportForCover("", rptInfo);
                    break;
                case 2:
                    List<FiwpequipDTO> equips = new List<FiwpequipDTO>();
                    for (int i = 1; i < 10; i++)
                    {
                        FiwpequipDTO equip = new FiwpequipDTO();
                        equip.FiwpEquipID = i;
                        equip.EquipmentName = i.ToString();
                        equip.EquipDesc = i.ToString();
                        equip.StartUseDate = DateTime.Now;
                        equip.FinishUseDate = DateTime.Now;
                        equips.Add(equip);
                    }
                    bytes = GenerateReportForEquipment(equips, rptInfo);
                    break;
                case 3:
                    List<FiwpmaterialDTO> materials = new List<FiwpmaterialDTO>();
                    for (int i = 1; i < 10; i++)
                    {
                        FiwpmaterialDTO material = new FiwpmaterialDTO();
                        material.FIWPMaterialID = i;
                        material.PartNo = i.ToString();
                        material.Vendor = i.ToString();
                        material.Qty = Convert.ToDecimal(i);
                        materials.Add(material);
                    }
                    bytes = GenerateReportForMaterial(materials, rptInfo);
                    break;
                case 4:
                    List<ComboBoxDTO> combos = new List<ComboBoxDTO>();
                    for (int i = 1; i < 10; i++)
                    {
                        ComboBoxDTO combo = new ComboBoxDTO();
                        combo.DataID = i;
                        combo.DataName = i.ToString();
                        combo.ExtraValue1 = i.ToString();
                        combo.ExtraValue2 = i.ToString();
                        combo.ExtraValue3 = i.ToString();
                        combos.Add(combo);
                    }
                    bytes = GenerateReportForCombo(combos, rptInfo, "List");
                    break;
            }

            string rootPath = "/SigmaStorage/";
            string childPath = "SigmaDoc/" + userInfo.CompanyName + "/" + userInfo.CurrentProjectId + "/";

            int newRevision = 0;

            string uploadFolder = HttpContext.Current.Server.MapPath(rootPath + childPath + newRevision.ToString() + "/");
            if (!Directory.Exists(uploadFolder))
            {
                Directory.CreateDirectory(uploadFolder);
            }
            string filePath = Path.Combine(uploadFolder, "TEST.jpg");

            System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
            // Writes a block of bytes to this stream using data from
            // a byte array.
            fs.Write(bytes, 0, bytes.Length);

            fs.Close();

            return 1;
        }
Esempio n. 3
0
        /// <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;
        }