public long SaveTADocument(Guid txID, long taDocumentID) { TADocumentDataSet taDocumentDS = (TADocumentDataSet)TransactionService.GetDS(txID); TADocumentDataSet.TADocumentRow taDocumentRow = taDocumentDS.TADocument.FindByTADocumentID(taDocumentID); long documentID = taDocumentRow.DocumentID; // Insert, Update SCGDocument. // Insert, Update, Delete DocumentInitiator. // Insert, Delete DocumentAttachment. documentID = SCGDocumentService.SaveSCGDocument(txID, documentID); // Insert, Update, Delete TADocument. taDocumentID = ScgeAccountingDaoProvider.TADocumentDao.Persist(taDocumentDS.TADocument); // Insert, Update, Delete TADocumentTraveller. TADocumentTravellerService.SaveTADocumentTraveller(txID, taDocumentID); // Insert, Update, Delete TADocumentSchedule. TADocumentScheduleService.SaveTADocumentSchedule(txID, taDocumentID); return(taDocumentID); }
public DataSet PrepareDataToDataset(long documentID, bool isCopy) { TADocumentDataSet taDocumentDS = new TADocumentDataSet(); TADocument taDocument = ScgeAccountingQueryProvider.TADocumentQuery.GetTADocumentByDocumentID(documentID); Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors(); if (taDocument == null) { errors.AddError("Provider.Error", new Spring.Validation.ErrorMessage("NoTADocumentFound")); } if (!errors.IsEmpty) { throw new ServiceValidationException(errors); } // Prepare Data to Document datatable. if (!isCopy) { SCGDocumentService.PrepareDataToDataset(taDocumentDS, documentID); } else { SCGDocumentService.PrepareDataInternalToDataset(taDocumentDS, documentID, isCopy); } // Set data to Budget Document row in budgetDocumentDS. TADocumentDataSet.TADocumentRow taDocumentRow = taDocumentDS.TADocument.NewTADocumentRow(); taDocumentRow.TADocumentID = taDocument.TADocumentID; if (!isCopy) { if (taDocument.DocumentID != null) { taDocumentRow.DocumentID = taDocument.DocumentID.DocumentID; } } else { if (taDocumentDS.Document.Rows.Count > 0) { TADocumentDataSet.DocumentRow docRow = (TADocumentDataSet.DocumentRow)taDocumentDS.Document.Rows[0]; taDocumentRow.DocumentID = docRow.DocumentID; } } taDocumentRow.FromDate = taDocument.FromDate; taDocumentRow.ToDate = taDocument.ToDate; taDocumentRow.IsBusinessPurpose = taDocument.IsBusinessPurpose; taDocumentRow.IsTrainningPurpose = taDocument.IsTrainningPurpose; taDocumentRow.IsOtherPurpose = taDocument.IsOtherPurpose; if (taDocument.OtherPurposeDescription != null) { taDocumentRow.OtherPurposeDescription = taDocument.OtherPurposeDescription; } taDocumentRow.TravelBy = taDocument.TravelBy; if (taDocument.Province != null) { taDocumentRow.Province = taDocument.Province; } if (taDocument.Country != null) { taDocumentRow.Country = taDocument.Country; } taDocumentRow.Ticketing = taDocument.Ticketing; //if (taDocument.CostCenterID != null) //{ // taDocumentRow.CostCenterID = taDocument.CostCenterID.CostCenterID; //} //if (taDocument.Account != null) //{ // taDocumentRow.AccountID = taDocument.Account.AccountID; //} //if (taDocument.IOID != null) //{ // taDocumentRow.IOID = taDocument.IOID.IOID; //} taDocumentRow.Active = taDocument.Active; taDocumentRow.CreBy = taDocument.CreBy; taDocumentRow.CreDate = taDocument.CreDate; taDocumentRow.UpdBy = taDocument.UpdBy; taDocumentRow.UpdDate = taDocument.UpdDate; taDocumentRow.UpdPgm = taDocument.UpdPgm; // Add ta document row to taDocument. taDocumentDS.TADocument.AddTADocumentRow(taDocumentRow); // Prepare Data to TADocumentTravellerService Datatable. TADocumentTravellerService.PrepareDataToDataset(taDocumentDS, taDocument.TADocumentID); // Prepare Data to TADocumentScheduleService Datatable. TADocumentScheduleService.PrepareDataToDataset(taDocumentDS, taDocument.TADocumentID); //Not Save to TADocumemtAdvance Table. // Prepare Data to TADocumentAdvanceService Datatable. ////TADocumentAdvanceService.PrepareDataToDataset(taDocumentDS, taDocument.TADocumentID); return(taDocumentDS); }