BPM QuoteDtl for Kit Components

I need a BPM that’ll update UD fields on the Kit Parent quote line of a component priced kit on a quote. The thing is, all the kit’s “component” parts are really also lines in the QuoteDtl table.

In my code, the loops appear to be working via the MsgBox, but it’s not updating the Parent line. What am I missing? I’ve tried it as a Data and Method directive but no luck.

Edit: Code below is fixed.

foreach (var ttDtl in ttQuoteDtl)
    if (ttDtl != null)
        int qNum = (int)ttDtl.QuoteNum;
        int qLine = (int)ttDtl.QuoteLine;
        decimal kitDocDisc = Decimal.Zero;
        decimal kitDocExtP = Decimal.Zero;       
        foreach(var qdC in (from kitCr in Db.QuoteDtl where kitCr.Company == Session.CompanyID
                                && kitCr.QuoteNum == qNum 
                                && kitCr.KitParentLine == qLine
                                && kitCr.KitPricing == "C" 
                                && kitCr.KitFlag == "C"
                            select kitCr))
            var kitC = qdC; 
            if (kitC != null)
                int qdCNum = kitC.QuoteNum;
                var qdCPLine = kitC.KitParentLine;
                foreach(var qdP in(from kitPr in ttQuoteDtl where kitPr.Company == Session.CompanyID &&
                                        kitPr.QuoteNum == qdCNum &&
                                        kitPr.QuoteLine == qdCPLine
                                    select kitPr))
                    var kitP = qdP;        
                    if (kitP != null) 
                      kitP["KitDiscPct_c"] = kitC.DiscountPercent;
                      kitDocDisc = kitDocDisc + kitC.DocDiscount;                        
                      kitDocExtP = kitDocExtP + kitC.DocExtPriceDtl;                       
                      kitP["KitDocDisc_c"] = kitDocDisc; 
                      kitP["KitDocExtPrice_c"] = kitDocExtP;

// Show MsgBox
string body2 = "kitPr "+" kitDocDisc: "+kitDocDisc+" kitDocExtP: "+kitDocExtP+" kitDiscPct: "+kitP["KitDiscPct_c"];
this.PublishInfoMessage(body2, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual,"FirstVar","SecondVar");

                }  //qdP     
        } //qdC 
} //ttDtl

I figured it out.

Needed to use Db.QuoteDtl for the KitC loop but needed to set the UD fields on the Parent row in the KitP loop via the ttQuoteDtl. Bangs head against wall