Adding Transfer Order lines with C#

 Got past that error, however I am now getting this error for every line after the first line. The first line processes correctly.

 

 

Please enter a quantity to Transfer.



---In vantage@yahoogroups.com, <livingstonmh@...> wrote:

So I have been having issues with this for a few days now. This runs through successfully for the first line it adds, but then for every part I try adding after that I receive an error:

Table: TFOrdDtl

Company='MJP' TFLineNum='' RowIdent='': ForeignKeyConstraint HeadDtl requires the child key values (MJP, T000374) to exist in the parent table.

 

 

 

private void CallTransferOrderEntryAdapterGetNewTFOrdDtlMethod(Infragistics.Win.UltraWinGrid.UltraGridRow row, String TFOrdNum,EpiDataView view, Decimal req, int i )
 {
 
  try
  {
   // Declare and Initialize EpiDataView Variables
   // Declare and create an instance of the Adapter.
   TransferOrderEntryAdapter adapterTransferOrderEntry = new TransferOrderEntryAdapter(this.oTrans);
   adapterTransferOrderEntry.BOConnect();
  EpiDataView edvt = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
     string edvts = edvt.dataView[edvt.Row]["Character01"].ToString();


   // Call Adapter method
   
  
   
    adapterTransferOrderEntry.GetNewTFOrdDtlOrdNum(edvts);
   //TransferOrderEntryDataSet datasettfo = adapterTransferOrderEntry.TransferOrderEntryData;
   //bool dtl = adapterTransferOrderEntry.GetNewTFOrdDtl();
   string partNum=(row.Cells[1].Value.ToString());
   string questionString;
   string serialWarning;
   bool multipleMatch;
   TransferOrderEntryDataSet change = adapterTransferOrderEntry.TransferOrderEntryData;
   adapterTransferOrderEntry.OnChangePartNum(ref partNum,  change, "", "",out  serialWarning,out  questionString, out multipleMatch);
            TransferOrderEntryDataSet toedsdtl = adapterTransferOrderEntry.TransferOrderEntryData;
  
  toedsdtl.TFOrdDtl[0].TFOrdNum     =edvts;
  toedsdtl.TFOrdDtl[0].TFOrdLine    =i;
  toedsdtl.TFOrdDtl[0].OrderFirm          = true;
        toedsdtl.TFOrdDtl[0].CreateOrder        = true;       
  toedsdtl.TFOrdDtl[0].SellingShippedQty  = 0;
  toedsdtl.TFOrdDtl[0].SellingQty         = req;
  toedsdtl.TFOrdDtl[0].AdditionalQty      = 0;
  toedsdtl.TFOrdDtl[0].ReceivedQty        =0;
  toedsdtl.TFOrdDtl[0].OurStockShippedQty =0;
  toedsdtl.TFOrdDtl[0].OurStockQty        = req;
        toedsdtl.TFOrdDtl[0].Selected           = true;
        toedsdtl.TFOrdDtl[0].PartNum      = (row.Cells[1].Value.ToString());
  toedsdtl.TFOrdDtl[0].SellingQtyUOM   =(row.Cells[3].Value.ToString());
  toedsdtl.TFOrdDtl[0].Shipped            = false;
  toedsdtl.TFOrdDtl[0].OurStockQtyUOM     =(row.Cells[3].Value.ToString());
  toedsdtl.TFOrdDtl[0].RowMod       ="U";

  adapterTransferOrderEntry.ChangeSellingQty(toedsdtl); 
  toedsdtl.TFOrdDtl[0].SellingQty = req;
  //bool result = adapterTransferOrderEntry.Update();
  
  MessageBox.Show(toedsdtl.TFOrdDtl[0].SellingQty.ToString());
   // Cleanup Adapter Reference
  // MessageBox.Show("4");
   adapterTransferOrderEntry.Dispose();
   
  } catch (System.Exception ex)
  {
   ExceptionBox.Show(ex);
  }
 }

So I have been having issues with this for a few days now. This runs through successfully for the first line it adds, but then for every part I try adding after that I receive an error:

Table: TFOrdDtl

Company='MJP' TFLineNum='' RowIdent='': ForeignKeyConstraint HeadDtl requires the child key values (MJP, T000374) to exist in the parent table.

 

 

 

private void CallTransferOrderEntryAdapterGetNewTFOrdDtlMethod(Infragistics.Win.UltraWinGrid.UltraGridRow row, String TFOrdNum,EpiDataView view, Decimal req, int i )
 {
 
  try
  {
   // Declare and Initialize EpiDataView Variables
   // Declare and create an instance of the Adapter.
   TransferOrderEntryAdapter adapterTransferOrderEntry = new TransferOrderEntryAdapter(this.oTrans);
   adapterTransferOrderEntry.BOConnect();
  EpiDataView edvt = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
     string edvts = edvt.dataView[edvt.Row]["Character01"].ToString();


   // Call Adapter method
   
  
   
    adapterTransferOrderEntry.GetNewTFOrdDtlOrdNum(edvts);
   //TransferOrderEntryDataSet datasettfo = adapterTransferOrderEntry.TransferOrderEntryData;
   //bool dtl = adapterTransferOrderEntry.GetNewTFOrdDtl();
   string partNum=(row.Cells[1].Value.ToString());
   string questionString;
   string serialWarning;
   bool multipleMatch;
   TransferOrderEntryDataSet change = adapterTransferOrderEntry.TransferOrderEntryData;
   adapterTransferOrderEntry.OnChangePartNum(ref partNum,  change, "", "",out  serialWarning,out  questionString, out multipleMatch);
            TransferOrderEntryDataSet toedsdtl = adapterTransferOrderEntry.TransferOrderEntryData;
  
  toedsdtl.TFOrdDtl[0].TFOrdNum     =edvts;
  toedsdtl.TFOrdDtl[0].TFOrdLine    =i;
  toedsdtl.TFOrdDtl[0].OrderFirm          = true;
        toedsdtl.TFOrdDtl[0].CreateOrder        = true;       
  toedsdtl.TFOrdDtl[0].SellingShippedQty  = 0;
  toedsdtl.TFOrdDtl[0].SellingQty         = req;
  toedsdtl.TFOrdDtl[0].AdditionalQty      = 0;
  toedsdtl.TFOrdDtl[0].ReceivedQty        =0;
  toedsdtl.TFOrdDtl[0].OurStockShippedQty =0;
  toedsdtl.TFOrdDtl[0].OurStockQty        = req;
        toedsdtl.TFOrdDtl[0].Selected           = true;
        toedsdtl.TFOrdDtl[0].PartNum      = (row.Cells[1].Value.ToString());
  toedsdtl.TFOrdDtl[0].SellingQtyUOM   =(row.Cells[3].Value.ToString());
  toedsdtl.TFOrdDtl[0].Shipped            = false;
  toedsdtl.TFOrdDtl[0].OurStockQtyUOM     =(row.Cells[3].Value.ToString());
  toedsdtl.TFOrdDtl[0].RowMod       ="U";

  adapterTransferOrderEntry.ChangeSellingQty(toedsdtl); 
  toedsdtl.TFOrdDtl[0].SellingQty = req;
  //bool result = adapterTransferOrderEntry.Update();
  
  MessageBox.Show(toedsdtl.TFOrdDtl[0].SellingQty.ToString());
   // Cleanup Adapter Reference
  // MessageBox.Show("4");
   adapterTransferOrderEntry.Dispose();
   
  } catch (System.Exception ex)
  {
   ExceptionBox.Show(ex);
  }
 }