Пример #1
0
        public List<DocumentDTO> SaveDocumentWithOZformForAssembleIWP(List<FiwpDTO> fiwps, UpfileDTOS upFileCollection, string curStepCode, string userId)
        {
            //TransactionScope scope = null;
            //byte[] bytes = null;
            string fileType = string.Empty;

            //Check FileType
            switch (curStepCode)
            {
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.SUMMARY:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.SUMMARY;
                    break;
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.SAFETY_CHECK:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.SAFETY_CHECK;
                    break;
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.SCAFFOLD_CHECK:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.SCAFFOLD_CHECK;
                    break;
            }

            int iwpDocumentId = 0;
            int fileStoreId = 0;
            //string fileExtension = "jpg";
            string fileName = fiwps[0].FiwpName + "_" + fileType;

            //Get Default Info
            rptProjectCwaIwpDTO rptInfo = GetProjectCwaIwpByIwp(fiwps[0].FiwpID);

            //Check existence
            List<ComboBoxDTO> exists = GetIwpDocumentByIwpProjectFileType_Combo(fiwps[0].FiwpID, fiwps[0].ProjectID, fileType, "Y");
            if (exists != null && exists.Count > 0)
            {
                iwpDocumentId = exists[0].DataID;
                int.TryParse(exists[0].ExtraValue3, out fileStoreId);
                fileName = exists[0].DataName;
                //fileExtension = exists[0].ExtraValue4;
            }

            //using (scope = new TransactionScope(TransactionScopeOption.RequiresNew))
            //{

            #region Upload Report File & Save File Info

            if (upFileCollection.fileStoreDTOList == null || upFileCollection.fileStoreDTOList.Count <= 0)
            {
                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 = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
                fileStore.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
                fileStore.FileStoreId = fileStoreId;
                fileStore.ProjectId = fiwps[0].ProjectID;

                fileStoreList.Add(fileStore);
                upFileCollection.fileStoreDTOList = fileStoreList;
            }
            //UploadedFileInfoDTO uploadFile = new UploadedFileInfoDTO();
            //uploadFile.Name = fileName;
            //uploadFile.Size = bytes.Length;
            //uploadFile.FileExtension = fileExtension;
            //uploadFile.UploadedBy = fiwps[0].UpdatedBy;
            //uploadFile.UploadedDate = DateTime.Now;
            //uploadFile.CreatedBy = fiwps[0].UpdatedBy;
            //uploadFile.UpdatedBy = fiwps[0].UpdatedBy;
            ////uploadFile.byteFile = bytes;
            //uploadFile.UploadedFileInfoId = 0;
            //uploadFile.FileStoreId = fileStoreId;

            //uploadFileList.Add(uploadFile);
            //upFileCollection.uploadedFileDTOList = uploadFileList;

            upFileCollection = (new TrueTask.Common()).SaveMultiUploadFile(upFileCollection, userId, fileName);

            #endregion

            #region Save Report Document Info

            List<DocumentDTO> documents = new List<DocumentDTO>();
            #region "old code _ uploadedFileInfo"
            //foreach (UploadedFileInfoDTO uploadFile in upFileCollection.uploadedFileDTOList)
            //{
            //    DocumentDTO iwpDocument = new DocumentDTO();
            //    //iwpDocument.DocumentID = iwpDocumentId;
            //    iwpDocument.FIWPID = fiwps[0].FiwpID;
            //    iwpDocument.SPCollectionID = uploadFile.UploadedFileInfoId;
            //    iwpDocument.UpdatedBy = fiwps[0].UpdatedBy;

            //    if (uploadFile.FileExtension.ToLower() == "jpg")
            //        iwpDocument.IsDisplayable = "Y";
            //    else
            //        iwpDocument.IsDisplayable = "N";

            //    //if (iwpDocument.DocumentID > 0)
            //    //  iwpDocument.DTOStatus = (int)RowStatusNo.Update;
            //    //else
            //    iwpDocument.DTOStatus = (int)RowStatusNo.New;

            //    documents.Add(iwpDocument);
            //}
            #endregion

            DocumentDTO iwpDocument = new DocumentDTO();
            iwpDocument.DocumentID = iwpDocumentId;
            iwpDocument.FIWPID = fiwps[0].FiwpID;
            iwpDocument.FileStoreId = upFileCollection.uploadedFileDTOList[0].FileStoreId;
            iwpDocument.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            iwpDocument.IsDisplayable = "Y";
            if (iwpDocument.DocumentID > 0)
                iwpDocument.DTOStatus = (int)RowStatusNo.Update;
            else
            iwpDocument.DTOStatus = (int)RowStatusNo.New;

            documents.Add(iwpDocument);

            documents = SaveDocument(documents);

            #endregion

            //Update Assemble Step
            if (fiwps[0].DocEstablishedLUID != Element.Reveal.DataLibrary.Utilities.AssembleStep.APPROVER)
                fiwps = (new TrueTask.Build()).SaveIwp(fiwps);

            //    scope.Complete();
            //}

            return documents;
        }
Пример #2
0
        /// <summary>
        /// SaveFiwpMaterialForAssembleIWP
        /// </summary>
        /// <param name="fiwpmaterials"></param>
        /// <param name="fiwps"></param>
        /// <param name="documents"></param>
        /// <returns></returns>
        public List<FiwpmaterialDTO> SaveFiwpMaterialForAssembleIWP(List<FiwpmaterialDTO> fiwpmaterials, List<FiwpDTO> fiwps, string userId)
        {
            //TransactionScope scope = null;
            byte[] bytes = null;
            string fileType = Element.Reveal.DataLibrary.Utilities.FileType.CONSUMABLE;

            int iwpDocumentId = 0;
            int fileStoreId = 0;
            string fileExtension = "jpg";
            string fileName = fiwps[0].FiwpName + "_" + fileType;

            //Get Default Info
            rptProjectCwaIwpDTO rptInfo = GetProjectCwaIwpByIwp(fiwps[0].FiwpID);

            //Check existence
            List<ComboBoxDTO> exists = GetIwpDocumentByIwpProjectFileType_Combo(fiwps[0].FiwpID, fiwps[0].ProjectID, fileType, "Y");
            if (exists != null && exists.Count > 0)
            {
                iwpDocumentId = exists[0].DataID;
                int.TryParse(exists[0].ExtraValue3, out fileStoreId);
                fileName = exists[0].DataName;
                fileExtension = exists[0].ExtraValue4;
            }

            //using (scope = new TransactionScope(TransactionScopeOption.RequiresNew))
            //{

            //Save user manipulated data
            if (fiwpmaterials != null && fiwpmaterials.Count > 0)
                fiwpmaterials = SaveFiwpMaterial(fiwpmaterials);
            //Get Latest Data
            fiwpmaterials = (new TrueTask.Build()).GetFiwpMaterialByFIWP(fiwps[0].FiwpID, fiwps[0].ProjectID, "");
            //Generate Report
            bytes = GenerateReportForMaterial(fiwpmaterials, rptInfo);

            #region Upload Report File & Save File Info

            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 = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            fileStore.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            fileStore.FileStoreId = fileStoreId;
            fileStore.ProjectId = fiwps[0].ProjectID;

            fileStoreList.Add(fileStore);
            upFileCollection.fileStoreDTOList = fileStoreList;

            UploadedFileInfoDTO uploadFile = new UploadedFileInfoDTO();
            uploadFile.Name = fileName;
            uploadFile.Size = bytes.Length;
            uploadFile.FileExtension = fileExtension;
            uploadFile.UploadedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            uploadFile.UploadedDate = DateTime.Now;
            uploadFile.CreatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            uploadFile.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            uploadFile.byteFile = bytes;
            uploadFile.UploadedFileInfoId = 0;
            uploadFile.FileStoreId = fileStoreId;

            uploadFileList.Add(uploadFile);
            upFileCollection.uploadedFileDTOList = uploadFileList;

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

            #endregion

            #region Save Report Document Info

            List<DocumentDTO> documents = new List<DocumentDTO>();

            DocumentDTO iwpDocument = new DocumentDTO();
            iwpDocument.DocumentID = iwpDocumentId;
            iwpDocument.FIWPID = fiwps[0].FiwpID;
            //iwpDocument.SPCollectionID = upFileCollection.uploadedFileDTOList[0].UploadedFileInfoId;
            iwpDocument.FileStoreId = upFileCollection.uploadedFileDTOList[0].FileStoreId;
            iwpDocument.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            iwpDocument.IsDisplayable = "Y";
            if (iwpDocument.DocumentID > 0)
                iwpDocument.DTOStatus = (int)RowStatusNo.Update;
            else
                iwpDocument.DTOStatus = (int)RowStatusNo.New;

            documents.Add(iwpDocument);

            documents = SaveDocument(documents);

            #endregion

            //Update Assemble Step
            if (fiwps[0].DocEstablishedLUID != Element.Reveal.DataLibrary.Utilities.AssembleStep.APPROVER)
                fiwps = (new TrueTask.Build()).SaveIwp(fiwps);

            //    scope.Complete();
            //}

            return fiwpmaterials;
        }
Пример #3
0
 public async Task<List<DataLibrary.DocumentDTO>> SaveDocumentWithOZformForAssembleIWP(List<DataLibrary.FiwpDTO> fiwps, UpfileDTOS upFileCollection, string curStepCode, string userId)
 {
     Dictionary<string, dynamic> dParams = new Dictionary<string, dynamic>();
     dParams.Add("fiwps", fiwps);
     dParams.Add("upFileCollection", upFileCollection);
     dParams.Add("curStepCode", curStepCode);
     dParams.Add("userId", userId);
     return await JsonHelper.PutDataAsync<List<DataLibrary.DocumentDTO>>("JsonSaveDocumentWithOZformForAssembleIWP", dParams, JsonHelper.ProjectService);
 }
Пример #4
0
        /// <summary>
        /// SaveDocumentForAssembleIWP
        /// </summary>
        /// <param name="documents"></param>
        /// <param name="fiwps"></param>
        /// <returns></returns>
        public List<DocumentDTO> SaveDocumentForAssembleIWP(List<FiwpDTO> fiwps, List<DocumentDTO> documents, string curStepCode, string userId, string webPath)
        {
            //TransactionScope scope = null;
            byte[] bytes = null;
            string fileType = string.Empty;

            //Check FileType
            switch (curStepCode)
            {
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.COVER:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.COVER;
                    break;
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.SAFETY_FORM:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.SAFETY_FORM;
                    break;
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.ITR:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.ITR;
                    break;
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.SPEC:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.SPEC;
                    break;
                case Element.Reveal.DataLibrary.Utilities.AssembleStep.MOC:
                    fileType = Element.Reveal.DataLibrary.Utilities.FileType.MOC;
                    break;
            }

            int iwpDocumentId = 0;
            int fileStoreId = 0;
            string fileExtension = "jpg";
            string fileName = fiwps[0].FiwpName + "_" + fileType;
            string coverImageUrl = string.Empty;

            //Get Default Info
            rptProjectCwaIwpDTO rptInfo = GetProjectCwaIwpByIwp(fiwps[0].FiwpID);

            //Check existence
            List<ComboBoxDTO> exists = GetIwpDocumentByIwpProjectFileType_Combo(fiwps[0].FiwpID, fiwps[0].ProjectID, fileType, "Y");
            if (exists != null && exists.Count > 0)
            {
                iwpDocumentId = exists[0].DataID;
                int.TryParse(exists[0].ExtraValue3, out fileStoreId);
                fileName = exists[0].DataName;
                fileExtension = exists[0].ExtraValue4;
            }

            //using (scope = new TransactionScope(TransactionScopeOption.RequiresNew))
            //{

            //Save user manipulated data
            if (documents != null && documents.Count > 0)
            {
                coverImageUrl = string.IsNullOrEmpty(documents[0].LocationURL) ? "" : HttpContext.Current.Server.MapPath(documents[0].LocationURL.Replace(webPath, ""));
                documents[0].IsDisplayable = "N";
                documents = SaveDocument(documents);
            }

            //Generate Report
            if (curStepCode == Element.Reveal.DataLibrary.Utilities.AssembleStep.COVER)
                bytes = GenerateReportForCover(coverImageUrl, rptInfo);
            else
            {
                string listTitle = "List";
                List<ComboBoxDTO> combos = GetIwpDocumentByIwpProjectFileType_Combo(fiwps[0].FiwpID, fiwps[0].ProjectID, fileType, "N");
                List<ComboCodeBoxDTO> type = (new TrueTask.Common()).GetSigmaCodeByCodeCategory_Code_Combo(null, fileType);
                if (type != null && type.Count > 0)
                    listTitle = type[0].DataName;

                bytes = GenerateReportForCombo(combos, rptInfo, listTitle);
            }

            #region Upload Report File & Save File Info

            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 = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            fileStore.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            fileStore.FileStoreId = fileStoreId;
            fileStore.ProjectId = fiwps[0].ProjectID;

            fileStoreList.Add(fileStore);
            upFileCollection.fileStoreDTOList = fileStoreList;

            UploadedFileInfoDTO uploadFile = new UploadedFileInfoDTO();
            uploadFile.Name = fileName;
            uploadFile.Size = bytes.Length;
            uploadFile.FileExtension = fileExtension;
            uploadFile.UploadedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            uploadFile.UploadedDate = DateTime.Now;
            uploadFile.CreatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            uploadFile.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            uploadFile.byteFile = bytes;
            uploadFile.UploadedFileInfoId = 0;
            uploadFile.FileStoreId = fileStoreId;

            uploadFileList.Add(uploadFile);
            upFileCollection.uploadedFileDTOList = uploadFileList;

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

            #endregion

            #region Save Report Document Info

            DocumentDTO iwpDocument = new DocumentDTO();
            iwpDocument.DocumentID = iwpDocumentId;
            iwpDocument.FIWPID = fiwps[0].FiwpID;
            //iwpDocument.SPCollectionID = upFileCollection.uploadedFileDTOList[0].UploadedFileInfoId;
            iwpDocument.FileStoreId = upFileCollection.uploadedFileDTOList[0].FileStoreId;
            iwpDocument.UpdatedBy = string.IsNullOrEmpty(fiwps[0].UpdatedBy) ? userId : fiwps[0].UpdatedBy;
            iwpDocument.IsDisplayable = "Y";
            if (iwpDocument.DocumentID > 0)
                iwpDocument.DTOStatus = (int)RowStatusNo.Update;
            else
                iwpDocument.DTOStatus = (int)RowStatusNo.New;

            documents.Clear();
            documents.Add(iwpDocument);

            documents = SaveDocument(documents);

            #endregion

            //Update Assemble Step
            if (fiwps[0].DocEstablishedLUID != Element.Reveal.DataLibrary.Utilities.AssembleStep.APPROVER)
                fiwps = (new TrueTask.Build()).SaveIwp(fiwps);

            //    scope.Complete();
            //}

            return documents;
        }
Пример #5
0
 public List<DocumentDTO> JsonSaveDocumentWithOZformForAssembleIWP(List<FiwpDTO> fiwps, UpfileDTOS upFileCollection, string curStepCode, string userId)
 {
     return (new Element.Sigma.Web.Biz.TrueTask.Assemble()).SaveDocumentWithOZformForAssembleIWP(fiwps, upFileCollection, Helper.RemoveJsonParameterWrapper(curStepCode), Helper.RemoveJsonParameterWrapper(userId));
 }
Пример #6
0
 //public void UpdateQaqcformForSign(int qaqcformId, string savedUrl, int SPCollectionID, bool isSubmitted)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateQaqcformForSign(qaqcformId, savedUrl, SPCollectionID, isSubmitted);
 //}
 //public void JsonUpdateQaqcformForSign(string qaqcformId, string savedUrl, string SPCollectionID, string isSubmitted)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateQaqcformForSign(Int32.Parse(qaqcformId), savedUrl, Int32.Parse(SPCollectionID), bool.Parse(isSubmitted));
 //}
 //public void UpdateSingleMaterialWithReelNo(int materialId, string newReelNo)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateMaterialWithReelNo(materialId, newReelNo);
 //}
 //public void JsonUpdateSingleMaterialWithReelNo(string materialId, string newReelNo)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateMaterialWithReelNo(Int32.Parse(materialId), newReelNo);
 //}
 //public void UpdateSingleProgressWithCWP(int progressId, int newCwpId)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateProgressWithCWP(progressId, newCwpId);
 //}
 //public void JsonUpdateSingleProgressWithCWP(string progressId, string newCwpId)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateProgressWithCWP(Int32.Parse(progressId), Int32.Parse(newCwpId));
 //}
 //public void UpdateTimesheetToP6(int fiwpId, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).UpdateTimesheetToP6(fiwpId, userName, password);
 //}
 //public void JsonUpdateTimesheetToP6(string fiwpId, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).UpdateTimesheetToP6(Int32.Parse(fiwpId), userName, password);
 //}
 //public void SyncProjectScheduleToP6(int projectscheduleId, int projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncProjectScheduleToP6(projectscheduleId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), userName, password);
 //}
 //public void JsonSyncProjectScheduleToP6(string projectscheduleId, string projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncProjectScheduleToP6(Int32.Parse(projectscheduleId), Int32.Parse(projectId), Int32.Parse(disciplineCode), userName, password);
 //}
 //public void SyncFIWPResourceToP6(int fiwpId, int projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncFIWPResourceToP6(fiwpId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), userName, password);
 //}
 //public void JsonSyncFIWPResourceToP6(string fiwpId, string projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncFIWPResourceToP6(Int32.Parse(fiwpId), Int32.Parse(projectId), Int32.Parse(disciplineCode), userName, password);
 //}
 //public void SyncScheduleResourceToP6(int fiwpId, int projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncScheduleResourceToP6(fiwpId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), userName, password);
 //}
 //public void JsonSyncScheduleResourceToP6(string fiwpId, string projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncScheduleResourceToP6(Int32.Parse(fiwpId), Int32.Parse(projectId), Int32.Parse(disciplineCode), userName, password);
 //}
 //public void SyncScheduleResourceToP6ByProjectSchedule(int projectscheduleId, int projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncScheduleResourceToP6ByProjectSchedule(projectscheduleId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), userName, password);
 //}
 //public void JsonSyncScheduleResourceToP6ByProjectSchedule(string projectscheduleId, string projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncScheduleResourceToP6ByProjectSchedule(Int32.Parse(projectscheduleId), Int32.Parse(projectId), Int32.Parse(disciplineCode), userName, password);
 //}
 //public void SyncScheduleFIWPResourceToP6(int fiwpId, int projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncScheduleFIWPResourceToP6(fiwpId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), userName, password);
 //}
 //public void JsonSyncScheduleFIWPResourceToP6(string fiwpId, string projectId, string disciplineCode, string userName, string password)
 //{
 //    (new Element.Reveal.Server.BALC.ScheduleWriter()).SyncScheduleFIWPResourceToP6(Int32.Parse(fiwpId), Int32.Parse(projectId), Int32.Parse(disciplineCode), userName, password);
 //}
 ////LibInsul-------------------------------------------------------------
 //public List<LibinsulfactorDTO> SaveLibinsulfactor(List<LibinsulfactorDTO> lib)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveLibinsulfactor(lib);
 //}
 //public List<LibinsulpaintmanhourDTO> SaveLibinsulpaintmanhour(List<LibinsulpaintmanhourDTO> lib)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveLibinsulpaintmanhour(lib);
 //}
 //public List<LibinsulpipefactorDTO> SaveLibinsulpipefactor(List<LibinsulpipefactorDTO> lib)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveLibinsulpipefactor(lib);
 //}
 //public List<LibinsulpipemanhourDTO> SaveLibinsulpipemanhour(List<LibinsulpipemanhourDTO> lib)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveLibinsulpipemanhour(lib);
 //}
 //public int UploadSharePointForSPCollectionID(int projectId, string collection, string docName)
 //{
 //    try
 //    {
 //        return (new Element.Reveal.Server.BALC.ProjectWriter()).UploadSharePointForSPCollectionID(projectId, collection, docName, null, null, null, null, null, Cookies.GetSPCredential());
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 //public int JsonUploadSharePointForSPCollectionID(string projectId, string collection, string docName)
 //{
 //    try
 //    {
 //        return (new Element.Reveal.Server.BALC.ProjectWriter()).UploadSharePointForSPCollectionID(Int32.Parse(projectId), collection, docName, null, null, null, null, null, Cookies.GetSPCredential());
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 ///// <summary>
 ///// 2013-11-25 
 ///// </summary>
 ///// <param name="dbInstance"></param>
 ///// <param name="DrawingData"></param>
 ///// <param name="drwaings"></param>
 ///// <param name="fileNm"></param>
 ///// <param name="siteInstance"></param>
 ///// <param name="webPath"></param>
 ///// <param name="physicalpath"></param>
 ///// <returns></returns>
 //public DrawingDTO SaveMultiDrawingAndUpload(byte[] DrawingData, DrawingDTO drwaings, string fileNm, string siteInstance, string webPath, string physicalpath)
 //{
 //    try
 //    {
 //        return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveMultiDrawingAndUpload(DrawingData, drwaings, siteInstance, webPath, physicalpath, fileNm, Cookies.GetSPCredential());
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 //public List<DrawingDTO> SaveMultiDrawingAndUpload2(List<DrawingDTO> drwaings)
 //{
 //    try
 //    {
 //        return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveMultiDrawingAndUpload2(drwaings, Cookies.GetSPCredential());
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 //public DrawingDTO SaveDrawingAndUpload(DrawingDTO drwaings, string fileNm, string siteInstance, string webPath, string physicalpath)
 //{
 //    try
 //    {
 //        return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveDrawingAndUpload(drwaings, siteInstance, webPath, physicalpath, fileNm, Cookies.GetSPCredential());
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 //public DrawingDTO SaveDrawingAndGenerate(DrawingDTO drwaings, string siteInstance, string webPath)
 //{
 //    try
 //    {
 //        return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveDrawingAndGenerate(drwaings, siteInstance, webPath, Helper.GetImagePhysicalPath());
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 //public void RegenerateCXML(int projectId, string siteInstance, string webPath)
 //{
 //    (new Element.Reveal.Server.BALC.ProjectWriter()).RegenerateCXML(projectId, siteInstance, webPath, Helper.GetImagePhysicalPath());
 //}
 //public string GetImagePhysicalPath()
 //{
 //    try
 //    {
 //        return Helper.GetImagePhysicalPath();
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 //public string GetImageLocationURL()
 //{
 //    try
 //    {
 //        return Helper.GetImageLocationURL();
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 ///// <summary>
 ///// Delete MTO and Importedfilename objects which object contains the specified ImportedfilenameID to match.
 ///// </summary>
 ///// <param name="dbInstance">The name of the database instance is what you use to refer to a particular connection string for a particular provider via code</param>
 ///// <param name="importedfilenameId">ImportedfilenameID to search for</param>
 ///// <returns></returns>
 ///// <summary>
 ///// Save(contains Update and Delete) Documentmarkup objects.
 ///// </summary>
 ///// <param name="dbInstance">The name of the database instance is what you use to refer to a particular connection string for a particular provider via code</param>
 ///// <param name="documentmarkup">Documentmarkup objects to save</param>
 ///// <returns>DocumentmarkupDTO</returns>
 //public List<DocumentmarkupDTO> SaveDocumentmarkup(List<DocumentmarkupDTO> documentmarkup)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveDocumentmarkup(documentmarkup);
 //}
 ///// <summary>
 ///// Save(contains Update and Delete) Documentmarkup objects.
 ///// </summary>
 ///// <param name="dbInstance">The name of the database instance is what you use to refer to a particular connection string for a particular provider via code</param>
 ///// <param name="documentmarkup">Documentmarkup objects to save</param>
 ///// <returns>DocumentmarkupDTO</returns>
 //public List<DocumentmarkupDTO> JsonSaveDocumentmarkup(List<DocumentmarkupDTO> documentmarkup)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveDocumentmarkup(documentmarkup);
 //}
 ///// <summary>
 ///// Create Documentmarkup object and Make default sharepoint item.
 ///// </summary>
 ///// <param name="dbInstance">The name of the database instance is what you use to refer to a particular connection string for a particular provider via code</param>
 ///// <param name="projectId">ProjectID to search for</param>
 ///// <param name="documentmarkup">Documentmarkup object to save</param>
 ///// <returns>DocumentmarkupDTO</returns>
 //public DocumentmarkupDTO SaveDocumentmarkupWithSharePoint(int projectId, DocumentmarkupDTO documentmarkup)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveDocumentmarkupWithSharePoint(projectId, documentmarkup, Cookies.GetSPCredential());
 //}
 ///// <summary>
 ///// Create Documentmarkup object and Make default sharepoint item.
 ///// </summary>
 ///// <param name="dbInstance">The name of the database instance is what you use to refer to a particular connection string for a particular provider via code</param>
 ///// <param name="projectId">ProjectID to search for</param>
 ///// <param name="documentmarkup">Documentmarkup object to save</param>
 ///// <returns>DocumentmarkupDTO</returns>
 //public DocumentmarkupDTO JsonSaveDocumentmarkupWithSharePoint(string projectId, DocumentmarkupDTO documentmarkup)
 //{
 //    return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveDocumentmarkupWithSharePoint(Int32.Parse(projectId), documentmarkup, Cookies.GetSPCredential());
 //}
 public DocumentmarkupDTO JsonSaveDocumentmarkupWithMarkupImage(DocumentmarkupDTO documentmarkup, UpfileDTOS upFileCollection)
 {
     return (new Element.Sigma.Web.Biz.TrueTask.Viewer()).SaveDocumentmarkupWithMarkupImage(documentmarkup, upFileCollection);
 }
Пример #7
0
 //#endregion
 public UpfileDTOS JsonSaveUploadFile(UpfileDTOS upFileDS, string userId)
 {
     //string rootPath = System.Web.Configuration.WebConfigurationManager.AppSettings["DocumentUpload"];
     //return (new Element.Sigma.Web.Biz.TrueTask.Common()).JsonSaveUploadFile(upFileInfo, rootPath);
     return (new Element.Sigma.Web.Biz.TrueTask.Common()).SaveSingleUploadFile(upFileDS, userId);
 }
Пример #8
0
        public DocumentmarkupDTO SaveDocumentmarkupWithMarkupImage(DocumentmarkupDTO documentmarkup, UpfileDTOS upFileCollection)
        {
            //TransactionScope scope = null;
            //byte[] bytes = null;
            string fileType = Element.Reveal.DataLibrary.Utilities.FileType.DRAWING_MARKUP;
            string fileName = documentmarkup.PersonnelID + "_" + documentmarkup.DrawingID + "_" + fileType;

            //using (scope = new TransactionScope(TransactionScopeOption.RequiresNew))
            //{

            #region Upload Report File & Save File Info

            upFileCollection.fileStoreDTOList[0].FileTitle = fileName;
            upFileCollection.fileStoreDTOList[0].FileDescription = DateTime.Now.ToString();
            upFileCollection.fileStoreDTOList[0].FileCategory = Element.Reveal.DataLibrary.Utilities.FileCategory.REPORT;
            upFileCollection.fileStoreDTOList[0].FileTypeCode = fileType;

            upFileCollection.uploadedFileDTOList[0].Name = fileName;
            upFileCollection.uploadedFileDTOList[0].UploadedBy = documentmarkup.UpdatedBy;
            upFileCollection.uploadedFileDTOList[0].UploadedDate = DateTime.Now;
            upFileCollection.uploadedFileDTOList[0].CreatedBy = documentmarkup.UpdatedBy;
            upFileCollection.uploadedFileDTOList[0].UpdatedBy = documentmarkup.UpdatedBy;

            upFileCollection = (new TrueTask.Common()).SaveSingleUploadFile(upFileCollection, documentmarkup.PersonnelID);

            #endregion

            #region Save Report Document Info

            List<DocumentmarkupDTO> documentmarkups = new List<DocumentmarkupDTO>();

            //documentmarkup.SPCollectionID = upFileCollection.uploadedFileDTOList[0].UploadedFileInfoId;
            documentmarkup.FileStoreId = upFileCollection.uploadedFileDTOList[0].FileStoreId;
            documentmarkups.Add(documentmarkup);

            documentmarkups = SaveDrawingMarkup(documentmarkups);

            if (documentmarkups != null && documentmarkups.Count > 0)
                documentmarkup = documentmarkups[0];

            #endregion

            //    scope.Complete();
            //}

            return documentmarkup;
        }
Пример #9
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;
        }