Ejemplo n.º 1
0
        public long SaveToDatabase()
        {
            // Save all table in dataset to database and clear transaction.
            long caDocumentID = CADocumentService.SaveCADocument(this.TransactionID, this.CADocumentID);
            // Get ta document
            CADocument caDocument = ScgeAccountingQueryProvider.CADocumentQuery.FindProxyByIdentity(caDocumentID);

            TransactionService.Commit(this.TransactionID);

            #region Work Flow
            long workFlowID = 0;

            // Save New WorkFlow.
            if ((caDocument != null) && (caDocument.DocumentID != null))
            {
                SCGDocument document = ScgeAccountingQueryProvider.SCGDocumentQuery.FindProxyByIdentity(caDocument.DocumentID.DocumentID);
                SS.Standard.WorkFlow.DTO.WorkFlow workFlow = new SS.Standard.WorkFlow.DTO.WorkFlow();
                // WorkFlow Type ID = 9 is CA Workflow Image. wait confirm where to store this data.
                workFlow.WorkFlowType = new SS.Standard.WorkFlow.DTO.WorkFlowType(WorkFlowTypeID.CAWorkFlow);
                // WorkFlow Type ID = 9 is CA Workflow Image. wait confirm where to store this data.
                workFlow.CurrentState = WorkFlowQueryProvider.WorkFlowStateQuery.FindWorkFlowStateIDByTypeIDAndStateName(WorkFlowTypeID.CAWorkFlow, WorkFlowStateFlag.Draft);
                workFlow.Description  = null;
                workFlow.Document     = document;
                workFlow.Active       = true;
                workFlow.CreBy        = document.CreBy;
                workFlow.CreDate      = document.CreDate;
                workFlow.UpdBy        = document.UpdBy;
                workFlow.UpdDate      = document.UpdDate;
                workFlow.UpdPgm       = document.UpdPgm;

                workFlowID = WorkFlowService.CheckExistAndAddNew(workFlow);
            }
            #endregion Work Flow

            return(workFlowID);
        }