{
try
{
// Declare and Initialize EpiDataView Variables
// Declare and create an instance of the Adapter.
SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);
adapterSalesOrder.BOConnect();
var orderHead = oTrans.Factory("OrderHead"); //is this spelled right?
int orderNum = (int)orderHead.dataView[orderHead.Row]["OrderNum"];
(Line 1640) var currentOrder = adapterSalesOrder.SalesOrderData.OrderHed.AsEnumerable().Where(w => (int)w["OrderNum"] == orderNum).FirstOrDefault();
if(currentOrder != null)
{
currentOrder["OrderHed_OTSName"] = tbOrderNameUpdateShip.Text;
}
// Call Adapter method
bool result = adapterSalesOrder.Update();
// Cleanup Adapter Reference
adapterSalesOrder.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}```
Error: CS1061 - line 1641 (9349) - 'System.Data.EnumerableRowCollection<System.Data.DataRow>' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'System.Data.EnumerableRowCollection<System.Data.DataRow>' could be found (are you missing a using directive or an assembly reference?)
Still getting this error:
Error: CS1061 - line 1640 (9348) - ‘System.Data.EnumerableRowCollection<System.Data.DataRow>’ does not contain a definition for ‘FirstOrDefault’ and no extension method ‘FirstOrDefault’ accepting a first argument of type ‘System.Data.EnumerableRowCollection<System.Data.DataRow>’ could be found (are you missing a using directive or an assembly reference?)
{
try
{
// Declare and Initialize EpiDataView Variables
// Declare and create an instance of the Adapter.
SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);
adapterSalesOrder.BOConnect();
var orderHead = oTrans.Factory("OrderHed"); //is this spelled right?
int orderNum = (int)orderHead.dataView[orderHead.Row]["OrderNum"];
(Line 1640) var currentOrder = adapterSalesOrder.SalesOrderData.OrderHed.AsEnumerable().Where(w => (int)w["OrderNum"] == orderNum).FirstOrDefault();
if(currentOrder != null)
{
currentOrder["OTSName"] = tbOrderNameUpdateShip.Text;
}
// Call Adapter method
bool result = adapterSalesOrder.Update();
// Cleanup Adapter Reference
adapterSalesOrder.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
ok no BO Connect needed you are getting a hold of the current adapter… I’m assuming there’s one there already? But frankly this thread is too long to follow… Is this happening inside Order Entry?
OH!!! I take it back… put it back the way you had it then you need to do a GetByID
However I see you are doing a oTrans.Factory(“OrdereHed”) I doubt you have a dataview called OrderHed in the current dashboard…
This thread is just too long for me to go back and figure this out… What is the name of your DataView which contains the OrderNum?
Okay so I have a Dashboard in which I have a BAQ Data View called edvGS_Order_Detail_DataView;. I find a record in that DataView by Order Num. Once it is displayed in my dashboard I want to be able to change the OTSName in the actual Sales Order Record. I would like to be able to have Customer Service just enter text into a text box and click update and it will change in the Sales Order Record.
ok so get a hold of your orderNumber… something like this should work. Mind you I’m going from memory so spelling may be crap…
var orderNum = yourDataView.dataView[yourDataView.Row]["OrderDtl_OrderNum"] as int;
//Then do this
SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans)
adapterSalesOrder.BOConnect();
adapterSalesOrder.GetByID(orderNum);
adapterSalesOrder.SalesOrderData.OrderHed[0].OTSName ="Your thing";
adapterSalesOrder.SalesOrderData.OrderHed[0].RowMod="U";
adapterSalesOrder.Update();
adapterSalesOrder.Dispose();