I have a SOAP API call from Deltek Vision
to the following function. Now all of the sudden out of no where I get the following error.
"Error creating XML Insert Project From Proposal File There is no row at position 0"
Nothing has changed on the system. Here is the really crazy part. vda.GetProposalRecord(ProposalUDIC_ID)
fires a stored procedure. I modified the procedure to make sure it was getting data. However, the procedure never fires off, yet it continues to the second function where it kicks out the error. Its like it's bypassing vda.GetProposalRecord(ProposalUDIC_ID)
code line completely and passing a blank dataset to the next function. I don't understand how this could happen randomly out of nowhere
Public Function CreateRegularProjectFromProposal(ProposalUDIC_ID As String) As String Implements IPNPUtilityService.CreateRegularProjectFromProposal
Dim _repository As New VisionAPIRepository
Dim ds As Data.DataSet
Dim vda As New VisionDataAccess
Dim content As String = ""
Try
ds = vda.GetProposalRecord(ProposalUDIC_ID)
content = _repository.CreateRegularProjectFromProposalFile(ds)
_repository.SendProjectCreateFileToVision(content)
Catch ex As Exception
Dim _errMsg As String = "Error in CreateRegularProjectFromProposal: " & vbCrLf & content & vbCrLf & ex.Message & vbCrLf & ex.InnerException.Message '& "Trace:" & ex.StackTrace
Return "<errors><error>" & _errMsg & "</error></errors>"
Finally
If Not vda Is Nothing Then
vda.CloseConnection()
vda = Nothing
End If
End Try
Return "<errors></errors>"
End Function
This passes a data set to the following function in a separate DLL
Public Function CreateRegularProjectFromProposalFile(ds As Data.DataSet) As String
Try
Dim drows As DataRowCollection
Dim drow As DataRow
Dim root As XElement = <RECS/>
Dim tsPR As XElement = <empty/>
Dim tsPRCust As XElement = <empty/>
Dim tsPhase As XElement = <empty/>
Dim tsPRCustPhase As XElement = <empty/>
'Get the DataRowCollection from the given dataset
drows = ds.Tables("UDIC_Proposal").Rows
drow = drows(0)
'create new REC structure
tsPR = <PR name="PR" alias="PR" keys="WBS1,WBS2,WBS3"/>
tsPRCust = <ProjectCustomTabFields name="ProjectCustomTabFields" alias="ProjectCustomTabFields" keys="WBS1,WBS2,WBS3"/>
tsPhase = <PR name="PR" alias="PR" keys="WBS1,WBS2,WBS3"/>
tsPRCustPhase = <ProjectCustomTabFields name="ProjectCustomTabFields" alias="ProjectCustomTabFields" keys="WBS1,WBS2,WBS3"/>
'create the Project
tsPR.Add(<ROW tranType="INSERT">
<WBS1><%= "[AUTONUMBER]" %></WBS1>
<WBS2><%= " " %></WBS2>
<WBS3><%= " " %></WBS3>
<Name><%= Left(CStr(drow("OrigName")), 40) %></Name>
<ChargeType>R</ChargeType>
<SubLevel>N</SubLevel>
<Principal><%= "216" %></Principal>
<ProjMgr><%= CStr(drow("CustProposalManager")) %></ProjMgr>
<ClientID><%= CStr(drow("CustClient")) %></ClientID>
<CLAddress><%= "<Primary>" %></CLAddress>
<Status>I</Status>
<Org>FRE:COR:ACT</Org>
<Memo><%= "Converted from Proposal: " & CStr(drow("CustlID")) & " " & CStr(drow("CustDescription")) %></Memo>
<CLBillingAddr></CLBillingAddr>
<LongName><%= CStr(drow("LongName")) %></LongName>
<County><%= CStr(drow("sCounty")) %></County>
<Responsibility><%= CStr(drow("CustRole")) %></Responsibility>
<OpportunityID></OpportunityID>
<AvailableForCRM>Y</AvailableForCRM>
<ReadyForApproval>Y</ReadyForApproval>
<ReadyForProcessing>Y</ReadyForProcessing>
<BillingClientID><%= CStr(drow("CustClient")) %></BillingClientID>
<BillingContactID></BillingContactID>
<ProposalWBS1><%= IIf(IsDBNull(drow("CustPromotionalProject")), "", CStr(drow("CustPromotionalProject"))) %></ProposalWBS1>
<Biller>390</Biller>
</ROW>)
tsPRCust.Add(<ROW tranType="INSERT">
<WBS1><%= "[AUTONUMBER]" %></WBS1>
<WBS2><%= " " %></WBS2>
<WBS3><%= " " %></WBS3>
<CustFolder>5</CustFolder>
<CustPrevailingWageProject>0</CustPrevailingWageProject>
<CustHoldRateForProjLife>0</CustHoldRateForProjLife>
<CustContractType><%= CStr(drow("CustContractType")) %></CustContractType>
<CustBillingManager><%= CStr(drow("CustProposalManager")) %></CustBillingManager>
<CustProposal><%= CStr(drow("UDIC_UID")) %></CustProposal>
<CustInvoiceBackupReq>N</CustInvoiceBackupReq>
</ROW>)
'create the Phase
tsPhase.Add(<ROW tranType="INSERT">
<WBS1><%= "[AUTONUMBER]" %></WBS1>
<WBS2><%= "0001" %></WBS2>
<WBS3><%= " " %></WBS3>
<Name><%= Left(CStr(drow("OrigName")), 34) & " Phase" %></Name>
<ChargeType>R</ChargeType>
<SubLevel>N</SubLevel>
<Principal><%= "216" %></Principal>
<ProjMgr><%= CStr(drow("CustProposalManager")) %></ProjMgr>
<ClientID><%= CStr(drow("CustClient")) %></ClientID>
<CLAddress><%= "<Primary>" %></CLAddress>
<Status>I</Status>
<Org>FRE:COR:ACT</Org>
<BillByDefault>Y</BillByDefault>
<Memo><%= "Project Default Phase" %></Memo>
<CLBillingAddr></CLBillingAddr>
<LongName><%= CStr(drow("LongName")) & " Phase" %></LongName>
<County><%= CStr(drow("sCounty")) %></County>
<ProjectType><%= CStr(drow("CustFacilityType")) %></ProjectType>
<Responsibility><%= CStr(drow("CustRole")) %></Responsibility>
<OpportunityID></OpportunityID>
<AvailableForCRM>Y</AvailableForCRM>
<ReadyForApproval>Y</ReadyForApproval>
<ReadyForProcessing>Y</ReadyForProcessing>
<BillingClientID><%= CStr(drow("CustClient")) %></BillingClientID>
<BillingContactID></BillingContactID>
<Biller>390</Biller>
<FeeDirLab><%= CStr(drow("CustTotalLabor")) %></FeeDirLab>
</ROW>)
tsPRCustPhase.Add(<ROW tranType="INSERT">
<WBS1><%= "[AUTONUMBER]" %></WBS1>
<WBS2><%= "0001" %></WBS2>
<WBS3><%= " " %></WBS3>
<CustFolder>5</CustFolder>
<CustPrevailingWageProject>0</CustPrevailingWageProject>
<CustHoldRateForProjLife>0</CustHoldRateForProjLife>
<CustContractType><%= CStr(drow("CustContractType")) %></CustContractType>
<CustInvoiceFormat>1</CustInvoiceFormat>
<CustContractPaymentTerms>3</CustContractPaymentTerms>
<CustPhaseDirectLabor><%= CStr(drow("CustTotalLabor")) %></CustPhaseDirectLabor>
<CustServiceType1><%= CStr(drow("CustServiceType")) %></CustServiceType1>
<CustBillingManager><%= CStr(drow("CustProposalManager")) %></CustBillingManager>
<CustInvoiceBackupReq>N</CustInvoiceBackupReq>
</ROW>)
'add last items to new REC structure
'root.Add(New XElement("REC", tsPR, tsPRCust))
root.Add(New XElement("REC", tsPR, tsPRCust))
root.Add(New XElement("REC", tsPhase, tsPRCustPhase))
'Return "<?xml version=""1.0"" encoding=""utf-8""?> " + root.ToString
Return root.ToString.Replace("<RECS>", "<RECS xmlns=""http://deltek.vision.com/XMLSchema"">")
Catch ex As Exception
Throw New ApplicationException("Error creating XML Insert Project From Proposal File", ex)
Return ""
End Try
End Function