Hi,
When trying to add a data row to a data table I get a
"System.ArgumentException: This row already belongs to another table."
error. I have tried using ImportRow instead but with no joy. If
anyone can find a solution to this it would be greatly appreciated.
My code is below. It error on the following line:
qi.AllRisksCover.AddAllRisksCoverRow(GetAllRisksCo ver(risk,
phraseBook));
Confused.HomeInsurance.BOB.HomeInsurer.ISISService .QuoteInput qi = new
Confused.HomeInsurance.BOB.HomeInsurer.ISISService .QuoteInput();
//Add all risk cover to quoteinput table
qi.AllRisksCover.AddAllRisksCoverRow(GetAllRisksCo ver(risk,
phraseBook));
private QuoteInput.AllRisksCoverRow GetAllRisksCover(Risk risk,
PhraseBook phraseBook)
{
QuoteInput.AllRisksCoverDataTable dt = new
QuoteInput.AllRisksCoverDataTable();
QuoteInput.AllRisksCoverRow ar = dt.NewAllRisksCoverRow();
if (risk.CoverType !=
Confused.HomeInsurance.DataContracts.Enumerations. CoverType.BuildingsOnly)
{
ar.ID = 1;
ar.ProspectID = 1;
ar.PhotoTotalValue = (int)totalValue;
ar.PhotoHighestValue = highestValue == null ? 0 :
(int)highestValue;
ar.ValuablesTotalValue =
risk.Contents.TotalHighRiskLimit == null ? 0 :
(int)risk.Contents.TotalHighRiskLimit;
}
ar.ValuablesTerritory = "UK";
//Defaulted to UK.
ar.PhotoTerritory = "UK";
//Defaulted to zero as we do not hold this value
ar.SportsTotalValue = 0;
//Defaulted to zero as we do not hold this value
ar.SportsHighestValue = 0;
//Defaulted to UK.
ar.SportsTerritory = "UK";
//Defaulted to zero as we do not hold this value
ar.CashValue = 0;
//Defaulted to UK.
ar.CashTerritory = "UK";
//Defaulted to zero as we do not hold this value
ar.CardValue = 0;
//Defaulted to UK.
ar.CardTerritory = "UK";
//Defaulted to zero as we do not hold this value
ar.FreezerValue = 0;
//Defaulted to zero as we do not hold this value
ar.AgeOfOldestFreezer = 0;
//check if personal belongings cover
}
return ar;
}