Ejemplo n.º 1
0
        public SigmaResultTypeDTO AddUploadFileHistoryInfo(UploadFileHistoryInfoDTO anObj)
        {
            TransactionScope scope = null;
            SigmaResultTypeDTO result = new SigmaResultTypeDTO();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@FileName", anObj.FileName));
            paramList.Add(new SqlParameter("@FilePath", anObj.FilePath));
            paramList.Add(new SqlParameter("@RelationTable", anObj.RelationTable));
            paramList.Add(new SqlParameter("@MobileLoginId", anObj.MobileLoginId));
            paramList.Add(new SqlParameter("@MobileUdId", anObj.MobileUdId));
            paramList.Add(new SqlParameter("@CreatedDate", anObj.CreatedDate));

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "tsp_AddUploadFileHistoryInfo", paramList.ToArray());
                result.IsSuccessful = true;
                scope.Complete();
            }

            return result;
        }
Ejemplo n.º 2
0
        public SigmaResultTypeDTO AddDataSyncHistoryInfo(String FromFileVerSionId, String ToFileVerSionId, String MobileLoginId, String MobileUdId, String CreatedDate)
        {
            TransactionScope scope = null;
            SigmaResultTypeDTO result = new SigmaResultTypeDTO();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@FromFileVerSionId", FromFileVerSionId));
            paramList.Add(new SqlParameter("@ToFileVerSionId", ToFileVerSionId));
            paramList.Add(new SqlParameter("@MobileLoginId", MobileLoginId));
            paramList.Add(new SqlParameter("@MobileUdId", MobileUdId));
            paramList.Add(new SqlParameter("@CreatedDate", CreatedDate));

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "tsp_AddDataSyncHistoryInfo", paramList.ToArray());
                result.IsSuccessful = true;
                scope.Complete();
            }

            RFIWorkFlowSubmit(MobileLoginId);
            return result;
        }
Ejemplo n.º 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 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;
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
        /// <summary>
        ///  Set P6Project Info To ComboBox 
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public SigmaResultTypeDTO P6ProjectCombo(string userName, string password)
        {
            SigmaResultTypeDTO result = new SigmaResultTypeDTO();
            P6WS.ProjectService.ProjectPortBinding apb = new P6WS.ProjectService.ProjectPortBinding();

            apb.CookieContainer = P6Login(userName, password);
            apb.Url = System.Configuration.ConfigurationManager.AppSettings[P6WS_SERVICES_PROJECT_SERVICE].ToString();
            P6WS.ProjectService.ReadProjects rp = new P6WS.ProjectService.ReadProjects();
            P6WS.ProjectService.ProjectFieldType[] projectFields = new P6WS.ProjectService.ProjectFieldType[3];

            projectFields[0] = P6WS.ProjectService.ProjectFieldType.ObjectId;
            projectFields[1] = P6WS.ProjectService.ProjectFieldType.Id;
            projectFields[2] = P6WS.ProjectService.ProjectFieldType.Name;
            rp.Field = projectFields;
            P6WS.ProjectService.Project[] projects = apb.ReadProjects(rp);

            P6DT = new DataTable("P6ProjectList");
            P6DT.Columns.Add("ProjectObjectID");
            P6DT.Columns.Add("P6ProjectID");
            P6DT.Columns.Add("P6ProjectName");

            if (projects != null && projects.Length > 0)
            {
                for (int i = 0; i < projects.Length; i++)
                {
                    if (!projects[i].Name.ToLower().Contains("reflection"))
                    {
                        DataRow newRow = P6DT.NewRow();
                        newRow["ProjectObjectID"] = projects[i].ObjectId;
                        newRow["P6ProjectID"] = projects[i].Id;
                        newRow["P6ProjectName"] = projects[i].Name;
                        P6DT.Rows.Add(newRow);
                    }
                }
            }

            result.JsonDataSet = JsonHelper.convertDataTableToJson(P6DT);
            result.IsSuccessful = true;

            return result;
        }
Ejemplo n.º 6
0
        public SigmaResultTypeDTO MultiDataSyncHistoryInfo(List<DataSyncHistoryInfoDTO> objList)
        {
            TransactionScope scope = null;
            SigmaResultTypeDTO result = new SigmaResultTypeDTO();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            using (scope = new TransactionScope(TransactionScopeOption.RequiresNew))
            {
                foreach (DataSyncHistoryInfoDTO anObj in objList)
                {
                    switch (anObj.SigmaOperation)
                    {
                        case "C":
                            AddDataSyncHistoryInfo(anObj);
                            break;
                        case "U":
                            //UpdateSigmaRole(anObj);
                            break;
                        case "D":
                            //RemoveSigmaRole(anObj);
                            break;
                    }
                }
                result.IsSuccessful = true;
                scope.Complete();
            }

            return result;
        }
Ejemplo n.º 7
0
        private void RFIWorkFlowSubmit(String loginId)
        {
            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@LoginId", loginId)
                };

            DataSet ds = SqlHelper.ExecuteDataset(connStr, "usp_ListRfi", parameters);
            WorkflowMgr workflowMgr = new WorkflowMgr();
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    List<Element.Sigma.Web.Biz.Types.Common.TypeTransition> transitionList = new List<Element.Sigma.Web.Biz.Types.Common.TypeTransition>();
                    Element.Sigma.Web.Biz.Types.Common.TypeTransition typeTransition = new Element.Sigma.Web.Biz.Types.Common.TypeTransition();

                    transitionList.Add(typeTransition);
                    Common common = new Common();
                    UserInfoDTO userInfo = common.GetUserInfo(ds.Tables[0].Rows[i]["ToUserId"].ToString());

                    typeTransition.UserId = ds.Tables[0].Rows[i]["ToUserId"].ToString();
                    typeTransition.Role = userInfo.CurrentSigmaRoleId;
                    typeTransition.Row = 0;
                    transitionList.Add(typeTransition);

                    workflowMgr.GetWorkflowRoleTitle("WORKFLOW_TYPE_RFI");
                    workflowMgr.SaveWorkflowCrew("WORKFLOW_TYPE_RFI", 0, loginId, transitionList, ds.Tables[0].Rows[i]["Subject"].ToString(), ds.Tables[0].Rows[i]["ReasonRequested"].ToString(), ds.Tables[0].Rows[i]["ProposedSolution"].ToString(), (int)ds.Tables[0].Rows[i]["RfiId"], (int)ds.Tables[0].Rows[i]["IwpId"]);
                    workflowMgr.SaveWorkflowForEasyEx("WORKFLOW_TYPE_RFI", (int)ds.Tables[0].Rows[i]["RfiId"], 0, "Y", loginId, ds.Tables[0].Rows[i]["ReasonRequested"].ToString(), ds.Tables[0].Rows[i]["ProposedSolution"].ToString());

                    TransactionScope scope = null;
                    SigmaResultTypeDTO result = new SigmaResultTypeDTO();

                    List<SqlParameter> paramList = new List<SqlParameter>();
                    paramList.Add(new SqlParameter("@RfiId", (int)ds.Tables[0].Rows[i]["RfiId"]));
                    paramList.Add(new SqlParameter("@ClientRfiNo", loginId));

                    using (scope = new TransactionScope(TransactionScopeOption.Required))
                    {
                        result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "usp_UpdateRfi", paramList.ToArray());
                        result.IsSuccessful = true;
                        scope.Complete();
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public SigmaResultTypeDTO SaveCrewAttendance_Rpt(int dailybrassId, string sigmauserId)
        {
            SigmaResultTypeDTO result = new SigmaResultTypeDTO();

            DataSet ds = GetCrewAttendance_Rpt(dailybrassId);
            int projectId = 0;
            List<rptDailyBrassInOutDTO> brassList = DTOHelper.DataTableToListDTO<rptDailyBrassInOutDTO>(ds, 0);
            List<rptCrewAttendanceHeader> headerList = DTOHelper.DataTableToListDTO<rptCrewAttendanceHeader>(ds, 1);

            if (brassList.Count > 0 && headerList.Count > 0)
            {
                projectId = headerList[0].ProjectId;
                List<ReportParameter> Params = new List<ReportParameter>();
                Params.Add(new ReportParameter("DailyBrassID", dailybrassId.ToString()));
                Params.Add(new ReportParameter("ProjectID", projectId.ToString()));
                //Params.Add(new ReportParameter("imgurl", @".\Resource\images\Logo.png"));

                LocalReport report = new LocalReport();
                report.ReportPath = @"..\Element.Sigma.Web.Biz\TrueTask\Resource\rdl\RPTCrewAttendance.rdl";
                report.EnableExternalImages = true;
                report.SetParameters(Params);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource("dsDailyBrassSign", brassList));
                report.DataSources.Add(new ReportDataSource("dsHeader", headerList));

                byte[] bytes = report.Render("Image");
                string fileName = headerList[0].ForemanId + '_' + dailybrassId.ToString();

                #region Upload Report File & Save File Info

                string fileType = Element.Reveal.DataLibrary.Utilities.FileType.CREW_ATTENDANCE;
                int dailyBrassReportId = 0;
                int fileStoreId = 0;
                string fileExtension = "jpg";

                //Check existence
                List<ComboBoxDTO> exists = GetDailybrassreportByDailybrassFiletype_Combo(dailybrassId, fileType);
                if (exists != null && exists.Count > 0)
                {
                    dailyBrassReportId = exists[0].DataID;
                    int.TryParse(exists[0].ExtraValue3, out fileStoreId);
                    fileName = exists[0].DataName;
                    fileExtension = exists[0].ExtraValue4;
                }

                UpfileDTOS upFileCollection = new UpfileDTOS();
                List<FileStoreDTO> fileStoreList = new List<FileStoreDTO>();
                List<UploadedFileInfoDTO> uploadFileList = new List<UploadedFileInfoDTO>();

                FileStoreDTO fileStore = new FileStoreDTO();
                fileStore.FileTitle = fileName;
                fileStore.FileDescription = DateTime.Now.ToString();
                fileStore.FileCategory = Element.Reveal.DataLibrary.Utilities.FileCategory.REPORT;
                fileStore.FileTypeCode = fileType;
                fileStore.CreatedBy = sigmauserId;
                fileStore.UpdatedBy = sigmauserId;
                fileStore.FileStoreId = fileStoreId;
                fileStore.ProjectId = projectId;
                fileStoreList.Add(fileStore);
                upFileCollection.fileStoreDTOList = fileStoreList;

                UploadedFileInfoDTO uploadFile = new UploadedFileInfoDTO();
                uploadFile.Name = fileName;
                uploadFile.Size = bytes.Length;
                uploadFile.FileExtension = fileExtension;
                uploadFile.UploadedBy = sigmauserId;
                uploadFile.UploadedDate = DateTime.Now;
                uploadFile.CreatedBy = sigmauserId;
                uploadFile.UpdatedBy = sigmauserId;
                uploadFile.byteFile = bytes;
                uploadFile.UploadedFileInfoId = 0;
                uploadFile.FileStoreId = fileStoreId;
                uploadFileList.Add(uploadFile);
                upFileCollection.uploadedFileDTOList = uploadFileList;

                upFileCollection = (new TrueTask.Common()).SaveSingleUploadFile(upFileCollection, sigmauserId);

                #endregion

                #region Save Report Document Info

                List<DailybrassreportDTO> reportDTOList = new List<DailybrassreportDTO>();

                DailybrassreportDTO reportDTO = new DailybrassreportDTO();
                reportDTO.DailyBrassReportId = dailyBrassReportId;
                reportDTO.DailyBrassId = dailybrassId;
                reportDTO.UploadedFileInfoId = upFileCollection.uploadedFileDTOList[0].UploadedFileInfoId;
                reportDTO.UpdatedBy = sigmauserId;
                reportDTO.DTOStatus = (int)RowStatusNo.New;
                reportDTOList.Add(reportDTO);

                reportDTOList = SaveDailyBrassReport(reportDTOList);

                #endregion

                result.IsSuccessful = true;
            }
            else
            {
                result.AffectedRow = -1;
                result.ErrorCode = "";
                result.ErrorMessage = "no data";
                result.IsSuccessful = false;
            }

            return result;
        }
Ejemplo n.º 9
0
        public SigmaResultTypeDTO SaveTimeAndProgress_Rpt(int dailybrassId, string sigmauserId)
        {
            SigmaResultTypeDTO result = new SigmaResultTypeDTO();

            return result;
        }