public long SaveSCGDocument(Guid txID, long documentID) { DataSet ds = TransactionService.GetDS(txID); DataTable dtDocument = ds.Tables["Document"]; // Insert, Update, Delete SCGDocument. documentID = ScgeAccountingDaoProvider.SCGDocumentDao.Persist(dtDocument); // Insert, Update, Delete DocumentInitiator. DocumentInitiatorService.SaveDocumentInitiator(txID, documentID); // Insert, Update, Delete DocumentInitiator. DocumentAttachmentService.SaveDocumentAttachment(txID, documentID); return(documentID); }
public long UpdateSCGDocument(Guid txID, long documentID) { DataSet ds = TransactionService.GetDS(txID); DataTable documentTable = ds.Tables["Document"]; SCGDocument document = ScgeAccountingQueryProvider.SCGDocumentQuery.FindProxyByIdentity(documentID); if (documentTable.Rows.Count > 0) { this.BuildDTODocument(documentTable, document); ScgeAccountingDaoProvider.SCGDocumentDao.SaveOrUpdate(document); } // Save Document Attachment to Database. DocumentAttachmentService.InsertDocumentAttachment(txID, documentID); DocumentAttachmentService.DeleteDocumentAttachment(txID); // Save Document Initiator to Database. // Wait for save document initiator from transaction to database. DocumentInitiatorService.InsertDocumentInitiator(txID, documentID); DocumentInitiatorService.UpdateDocumentInitiator(txID, documentID); DocumentInitiatorService.DeleteDocumentInitiator(txID); return(documentID); }
public void PrepareDataInternalToDataset(DataSet documentDataset, long documentID, bool isCopy) { SCGDocument document = ScgeAccountingQueryProvider.SCGDocumentQuery.FindByIdentity(documentID); //// Set data to Document row in documentDataset. DataRow documentRow = documentDataset.Tables["Document"].NewRow(); if (document.CompanyID != null) { documentRow["CompanyID"] = document.CompanyID.CompanyID; } if (document.DocumentType != null) { documentRow["DocumentTypeID"] = document.DocumentType.DocumentTypeID; } if (document.RequesterID != null) { documentRow["RequesterID"] = document.RequesterID.Userid; } if (document.ApproverID != null) { documentRow["ApproverID"] = document.ApproverID.Userid; } if (document.ReceiverID != null) { documentRow["ReceiverID"] = document.ReceiverID.Userid; } if (document.CreatorID != null) { documentRow["CreatorID"] = document.CreatorID.Userid; } if (!isCopy) { documentRow["DocumentID"] = document.DocumentID; documentRow["DocumentNo"] = document.DocumentNo; if (document.CreatorID != null) { documentRow["CreatorID"] = document.CreatorID.Userid; } //add new field if (document.PaymentMethodID != null) { documentRow["PaymentMethodID"] = document.PaymentMethodID; } if (document.PostingDate != null) { documentRow["PostingDate"] = document.PostingDate; } else { documentRow["PostingDate"] = DateTime.MinValue; } if (document.BaseLineDate != null) { documentRow["BaseLineDate"] = document.BaseLineDate; } else { documentRow["BaseLineDate"] = DateTime.MinValue; } if (document.BankAccount != null) { documentRow["BankAccount"] = document.BankAccount; } if (!string.IsNullOrEmpty(document.BranchCode)) { documentRow["BranchCode"] = document.BranchCode; } else { documentRow["BranchCode"] = string.Empty; } if (!string.IsNullOrEmpty(document.BusinessArea)) { documentRow["BusinessArea"] = document.BusinessArea; } else { documentRow["BusinessArea"] = string.Empty; } if (!string.IsNullOrEmpty(document.Supplementary)) { documentRow["Supplementary"] = document.Supplementary; } else { documentRow["Supplementary"] = string.Empty; } if (document.ApproveDate != null) { documentRow["ApproveDate"] = document.ApproveDate; } else { documentRow["ApproveDate"] = DateTime.MinValue; } if (!string.IsNullOrEmpty(document.PostingStatus)) { documentRow["PostingStatus"] = document.PostingStatus; } else { documentRow["PostingStatus"] = string.Empty; } documentRow["IsVerifyImage"] = document.IsVerifyImage; if (document.DocumentDate != null) { documentRow["DocumentDate"] = document.DocumentDate; } else { documentRow["DocumentDate"] = DateTime.MinValue; } } documentRow["Subject"] = document.Subject; documentRow["Memo"] = document.Memo; documentRow["Active"] = document.Active; documentRow["CreBy"] = document.CreBy; documentRow["CreDate"] = document.CreDate; documentRow["UpdBy"] = document.UpdBy; documentRow["UpdDate"] = document.UpdDate; documentRow["UpdPgm"] = document.UpdPgm; // Add document row to documentDataset. documentDataset.Tables["Document"].Rows.Add(documentRow); if (!isCopy) { // Prepare data to DocumentAttachment datatable. DocumentAttachmentService.PrepareDataToDataset(documentDataset, documentID); } // Prepare data to DocumentInitiator datatable. DocumentInitiatorService.PrepareDataToDataset(documentDataset, documentID); }