I have used the Wizard to add the Sales Order Adapter Update Method. I want to be able to change the OTS Ship information for a job and update the sales order. I have a DataView of the Order Header. How do I tell it to update a specific field. So for an example I have text box: tbOrderNameUpdateShip.Text that I want to be able to change and then update the Sales Order Header field: OrderHed.OTSName with the change. I think I have everything but how to tell it what fields equal what.
private void CallSalesOrderAdapterUpdateMethod()
{
try
{
// Declare and Initialize EpiDataView Variables
// Declare and create an instance of the Adapter.
SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);
adapterSalesOrder.BOConnect();
//adapterSalesOrder.SalesOrderAdapter.OrderHed.OTSName = tbOrderNameUpdateShip.Text;
// Call Adapter method
bool result = adapterSalesOrder.Update();
// Cleanup Adapter Reference
adapterSalesOrder.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
The problem is above. .OrderHed is a table, with rows. You have to specific a row you want to modify like:
adapterSalesOrder.SalesOrderAdapter.OrderHed[0].OTSName
How do you know which row? I cant answer that. If there is only 1 I suppose that easy enough.
Thatās one of the nice things about using an EDV. The EDV stores the active row:
myEDV.dataView[myEDV.Row][āMyFieldā]
Okay, I am so not following. Probably because I just donāt know much about how to properly write this.
Here is what I have and I am getting an error⦠( āErp.Adapters.SalesOrderAdapterā does not contain a definition for āSalesOrderDataViewā and no extension method āSalesOrderDataViewā accepting a first argument of type āErp.Adapters.SalesOrderAdapterā 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();
adapterSalesOrder.SalesOrderDataView.OrderHed[0].OTSName = edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderHed_OTSName"];
// Call Adapter method
bool result = adapterSalesOrder.Update();
// Cleanup Adapter Reference
adapterSalesOrder.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
Okay another question. I canāt actually change the text box that is bound to the data view because it is read only and it wonāt let me change it. So I was entering the new data into a different text box. How do I tell it I want it to update with that text box?
Okay, sorry guys. Iām an idiot. My goal is to be able to click a button and have customer service change a Ship to name and then click a button and update the Sales Order Record. On the image above the one marked Data View is attached to the DataView and I cannot change it to be editable. So, in order for Customer SErvice to be able to enter what it needs to change to I was going to have this text box pop up, they enter the data there and then save and I take that data from the text box and update the Sales Order.
Youāre not an idiot! This stuff isnāt easy and it takes guts to learn/attempt challenging things.
Is this built on a custom form or a customization on an existing Epicor form?
Breaking this down into its simplest components is where to start. Sounds like you need to have the user enter a value in a field, take that value, and then update a sales order record?
Think like so: store the value of the text box in a variable. Call sales order adapter and find appropriate sales order record. Set sales order record data to variable value, then call update on sales order.
Well I know Iām not really an idiot but I havenāt had any formal training in C# or epicor. This is all self taught, learn by doing and googling lol. Frustrating to say the least! It is all hands on deck here at work as we have been implementing for a loong time and the deadline is looming.
Anyway, It is that simple that I just need the user to enter the value in the field. take that value and update the sales order record. This is what I have. Iām not getting any errors but it isnāt doing a darn thing either. Do I have the right syntax and in the right order?
{
try
{
// Declare and Initialize EpiDataView Variables
// Declare and create an instance of the Adapter.
MessageBox.Show("Sales Order Adapter");
SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);
adapterSalesOrder.BOConnect();
var shipname = tbOrderNameUpdateShip.Text;
adapterSalesOrder.SalesOrderData.OrderHed[0].OTSName = shipname.ToString();
//adapterSalesOrder.SalesOrderData.OrderHed[0].OTSName = edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderHed_OTSName"].ToString();
// Call Adapter method
bool result = adapterSalesOrder.Update();
MessageBox.Show("Sales Order Adapter After Update");
// Cleanup Adapter Reference
adapterSalesOrder.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}```
If this is a BEFORE adapter call, you could check to see which Heads have RowMod = āUā or āAā. However. it gets sneaky, because if you change a Dtl and not the Head, that doesnt work.
If I knew that I wouldnāt be asking for help lol. Okay, so do I need to add a GetbyID or something. I search the DataView and I am on the current record based upon job number. But it isnāt the Data View Iām actually needing to update itās the sales order record.