skearney
(Shannon Kearney)
August 16, 2019, 3:24pm
1
I am trying to delete a Memo by using the DeleteByID Method but I am getting an error. My code is below:
private void CallMemoAdapterDeleteByIDMethod()
{
try
{
MessageBox.Show("Call Memo Delete");
Int32 memoNum = Convert.ToInt32(neMemoNumber.Value);
string relatedToSchema = "Erp";
string relatedToFile = "Customer";
System.Guid relatedToSysRowID = System.Guid.Parse(tbMemoGuid.Text);
MemoAdapter adapterMemo = new MemoAdapter(this.oTrans);
adapterMemo.BOConnect();
bool result = adapterMemo.DeleteByID(relatedToSchema,relatedToFile,relatedToSysRowID,memoNum);
adapterMemo.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
MessageBox.Show("Memo Could NOT be Deleted.");
}
}
Error I am getting:
I have tried using the BL Tester Method to see what data I need to input and I’m not getting it to work either.
jgehling
(Jeff Gehling)
August 16, 2019, 3:32pm
2
Have you tried running a trace through the UI immediately before you delete to examine all the methods and the data changes?
skearney
(Shannon Kearney)
August 16, 2019, 3:38pm
3
Yes and it is deleting by Dataset and that isn’t what I want to do.
josecgomez
(Jose C Gomez)
August 16, 2019, 3:52pm
4
A lot of business objects don’t implement all the methods. Follow the trace.
skearney
(Shannon Kearney)
August 16, 2019, 4:20pm
5
Okay, I don’t understand how to follow the trace. How would I know which row it is on the Memo Table when I am only showing certain memos from a BAQ.
josecgomez
(Jose C Gomez)
August 16, 2019, 4:27pm
6
You’ll have to do a GetById first.
skearney
(Shannon Kearney)
August 16, 2019, 6:36pm
7
Unless someone has any other advice for me, I give up. I cannot figure this one out at all.
private void CallMemoAdapterDeleteByIDMethod()
{
try
{
// Declare and Initialize EpiDataView Variables
EpiDataView edvGS_TrafficCustomerNotes = ((EpiDataView)(this.oTrans.EpiDataViews["GS_TrafficCustomerNotes"]));
// Check if valid EpiDataView Row(s) are selected
if ((edvGS_TrafficCustomerNotes.Row < 0))
{
return;
}
// Declare and create an instance of the Adapter.
MemoAdapter adapterMemo = new MemoAdapter(this.oTrans);
adapterMemo.BOConnect();
// Declare and Initialize Variables
// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
int intId = ((int)(edvGS_TrafficCustomerNotes.dataView[edvGS_TrafficCustomerNotes.Row]["Memo_MemoNum"]));
string relatedToSchema = "Erp";
string relatedToFile = "Customer";
System.Guid relatedToSysRowID = System.Guid.Parse(edvGS_TrafficCustomerNotes.dataView[edvGS_TrafficCustomerNotes.Row]["Memo_RelatedToSysRowID"].ToString());
MessageBox.Show(relatedToSchema + ", " + relatedToFile + ", " + relatedToSysRowID + ", " + intId);
// Call Adapter method
bool result = adapterMemo.DeleteByID(relatedToSchema, relatedToFile, relatedToSysRowID, intId);
// Cleanup Adapter Reference
adapterMemo.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
MessageBox.Show("Did not delete record");
}
}
This is what pops up in my messge box:
This is the error I get:
josecgomez
(Jose C Gomez)
August 16, 2019, 6:42pm
8
As I stated, DeleteByID is probably not implemented on that method. You need to do it the same way Epicor does it, do a trace on memo entry and follow it.
GetByID, Mark Record as Deleted Call Update.
skearney
(Shannon Kearney)
August 16, 2019, 7:00pm
9
Ive got this part for Get By ID:
{
try
{
// Declare and Initialize EpiDataView Variables
EpiDataView edvGS_TrafficCustomerNotes = ((EpiDataView)(this.oTrans.EpiDataViews["GS_TrafficCustomerNotes"]));
// Check if valid EpiDataView Row(s) are selected
if ((edvGS_TrafficCustomerNotes.Row < 0))
{
return;
}
// Declare and create an instance of the Adapter.
MemoAdapter adapterMemo = new MemoAdapter(this.oTrans);
adapterMemo.BOConnect();
// Declare and Initialize Variables
// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
int intId = ((int)(edvGS_TrafficCustomerNotes.dataView[edvGS_TrafficCustomerNotes.Row]["Memo_MemoNum"]));
// Call Adapter method
bool result = adapterMemo.GetByID(intId);
// Cleanup Adapter Reference
adapterMemo.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
How do I mark the record as Deleted?
josecgomez
(Jose C Gomez)
August 16, 2019, 7:03pm
10
ok so do it manually and do a trace, what does the trace show? I don’t have a memo handy I can do it with but do a trace on the delete and look at what epicor does.
What is it? Which method do they call?
skearney
(Shannon Kearney)
August 16, 2019, 7:10pm
13
<tracePacket>
<businessObject>Ice.Proxy.BO.MemoImpl</businessObject>
<methodName>Update</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>System.Void</returnType>
<localTime>8/16/2019 14:09:07:5299085 PM</localTime>
<threadID>1</threadID>
<executionTime total="19" roundTrip="17" channel="0" bpm="0" other="2" />
<retries>0</retries>
<parameters>
<parameter name="ds" type="Ice.BO.MemoDataSet">
<MemoDataSet xmlns="http://www.epicor.com/Ice/300/BO/Memo/Memo" />
</parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.UserCodesImpl</businessObject>
<methodName>GetRows</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>Ice.Tablesets.UserCodesTableset</returnType>
<localTime>8/16/2019 14:09:07:5611591 PM</localTime>
<threadID>1</threadID>
<executionTime total="18" roundTrip="13" channel="0" bpm="0" other="5" />
<retries>0</retries>
<parameters>
<parameter name="whereClauseUDCodeType" type="System.String"><![CDATA[]]></parameter>
<parameter name="whereClauseUDCodes" type="System.String"><![CDATA[CodeTypeID = 'M-2']]></parameter>
<parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.ReportMonitorImpl</businessObject>
<methodName>GetRowsKeepIdleTime</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>Ice.Tablesets.ReportMonitorTableset</returnType>
<localTime>8/16/2019 14:09:08:0611687 PM</localTime>
<threadID>11</threadID>
<executionTime total="9" roundTrip="8" channel="0" bpm="0" other="1" />
<retries>0</retries>
<parameters>
<parameter name="whereClauseSysRptLst" type="System.String"><![CDATA[((PrintDriver='TEXT' AND (AutoAction='PRINT' OR AutoAction='PREVIEW')) OR (PrintDriver='CRYSTAL' AND (AutoAction='PRINT' OR AutoAction='AUTOPRT' OR AutoAction='PREVIEW' OR AutoAction='AUTOPRV')) OR (PrintDriver='EPIFIN' AND (AutoAction='PRINT' OR AutoAction='PREVIEW')) OR (PrintDriver='BARTENDER' AND (AutoAction='AUTOPRT' OR AutoAction='AUTOPRV')) OR (PrintDriver='EDI' AND AutoAction<>'') OR (PrintDriver='SSRS' AND (AutoAction='PREVIEW' OR AutoAction='PRINT') AND LastAction='SSRSREADY')) AND WorkStationID='LEANADMIN-VM-02 skearney']]></parameter>
<parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
</parameters>
</tracePacket>
josecgomez
(Jose C Gomez)
August 16, 2019, 7:12pm
14
That’s only a little bit of the trace. You need to do a GetByID and then a delete with a full trace on so you can see what happens.
skearney
(Shannon Kearney)
August 16, 2019, 7:18pm
15
Okay, I launched the Memo and found my customer. Then I cleared my log and starting logging.
1st step I made a new one. Saved, clicked on another note, clicked back on the one I wanted to delete and clicked delete.
<tracePacket>
<businessObject>Ice.Proxy.BO.MemoImpl</businessObject>
<methodName>Update</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>System.Void</returnType>
<localTime>8/16/2019 14:15:48:4439752 PM</localTime>
<threadID>1</threadID>
<executionTime total="25" roundTrip="22" channel="0" bpm="1" other="2" />
<retries>0</retries>
<parameters>
<parameter name="ds" type="Ice.BO.MemoDataSet">
<MemoDataSet xmlns="http://www.epicor.com/Ice/300/BO/Memo/Memo" />
</parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.MemoImpl</businessObject>
<methodName>GetNewMemo</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>System.Void</returnType>
<localTime>8/16/2019 14:15:48:4752256 PM</localTime>
<threadID>1</threadID>
<executionTime total="9" roundTrip="6" channel="0" bpm="0" other="3" />
<retries>0</retries>
<parameters>
<parameter name="ds" type="Ice.BO.MemoDataSet">
<MemoDataSet xmlns="http://www.epicor.com/Ice/300/BO/Memo/Memo" />
</parameter>
<parameter name="relatedToSchemaName" type="System.String"><![CDATA[Erp]]></parameter>
<parameter name="relatedToFile" type="System.String"><![CDATA[Customer]]></parameter>
<parameter name="relatedToSysRowID" type="System.Guid"><![CDATA[b735d249-9aa8-4fc2-8f7b-f3e9d48acd1d]]></parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.UserCodesImpl</businessObject>
<methodName>GetRows</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>Ice.Tablesets.UserCodesTableset</returnType>
<localTime>8/16/2019 14:15:48:4908508 PM</localTime>
<threadID>1</threadID>
<executionTime total="14" roundTrip="11" channel="0" bpm="0" other="3" />
<retries>0</retries>
<parameters>
<parameter name="whereClauseUDCodeType" type="System.String"><![CDATA[]]></parameter>
<parameter name="whereClauseUDCodes" type="System.String"><![CDATA[CodeTypeID = 'M-']]></parameter>
<parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.Lib.BOReaderImpl</businessObject>
<methodName>GetList</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>System.Data.DataSet</returnType>
<localTime>8/16/2019 14:15:50:0650912 PM</localTime>
<threadID>1</threadID>
<executionTime total="12" roundTrip="11" channel="0" bpm="0" other="1" />
<retries>0</retries>
<parameters>
<parameter name="serviceNamespace" type="System.String"><![CDATA[Ice:BO:MemoCat]]></parameter>
<parameter name="whereClause" type="System.String"><![CDATA[RelatedToFile = 'Customer']]></parameter>
<parameter name="columnList" type="System.String"><![CDATA[CategoryID,RelatedToFile,RelatedToSchemaName,Description]]></parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.UserCodesImpl</businessObject>
<methodName>GetRows</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>Ice.Tablesets.UserCodesTableset</returnType>
<localTime>8/16/2019 14:15:51:0026032 PM</localTime>
<threadID>1</threadID>
<executionTime total="20" roundTrip="17" channel="0" bpm="0" other="3" />
<retries>0</retries>
<parameters>
<parameter name="whereClauseUDCodeType" type="System.String"><![CDATA[]]></parameter>
<parameter name="whereClauseUDCodes" type="System.String"><![CDATA[CodeTypeID = 'M-4']]></parameter>
<parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.MemoImpl</businessObject>
<methodName>Update</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>System.Void</returnType>
<localTime>8/16/2019 14:16:02:3777488 PM</localTime>
<threadID>1</threadID>
<executionTime total="61" roundTrip="58" channel="0" bpm="0" other="3" />
<retries>0</retries>
<parameters>
<parameter name="ds" type="Ice.BO.MemoDataSet">
<MemoDataSet xmlns="http://www.epicor.com/Ice/300/BO/Memo/Memo" />
</parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.MemoImpl</businessObject>
<methodName>Update</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>System.Void</returnType>
<localTime>8/16/2019 14:16:06:2840488 PM</localTime>
<threadID>1</threadID>
<executionTime total="19" roundTrip="16" channel="0" bpm="0" other="3" />
<retries>0</retries>
<parameters>
<parameter name="ds" type="Ice.BO.MemoDataSet">
<MemoDataSet xmlns="http://www.epicor.com/Ice/300/BO/Memo/Memo" />
</parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.UserCodesImpl</businessObject>
<methodName>GetRows</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>Ice.Tablesets.UserCodesTableset</returnType>
<localTime>8/16/2019 14:16:06:3152992 PM</localTime>
<threadID>1</threadID>
<executionTime total="19" roundTrip="14" channel="0" bpm="0" other="5" />
<retries>0</retries>
<parameters>
<parameter name="whereClauseUDCodeType" type="System.String"><![CDATA[]]></parameter>
<parameter name="whereClauseUDCodes" type="System.String"><![CDATA[CodeTypeID = 'M-2']]></parameter>
<parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
</parameters>
</tracePacket>
<tracePacket>
<businessObject>Ice.Proxy.BO.ReportMonitorImpl</businessObject>
<methodName>GetRowsKeepIdleTime</methodName>
<appServerUri>net.tcp://ep10appdev01/EpicorITPlayPen10/</appServerUri>
<returnType>Ice.Tablesets.ReportMonitorTableset</returnType>
<localTime>8/16/2019 14:16:08:7997060 PM</localTime>
<threadID>11</threadID>
<executionTime total="9" roundTrip="9" channel="0" bpm="0" other="0" />
<retries>0</retries>
<parameters>
<parameter name="whereClauseSysRptLst" type="System.String"><![CDATA[((PrintDriver='TEXT' AND (AutoAction='PRINT' OR AutoAction='PREVIEW')) OR (PrintDriver='CRYSTAL' AND (AutoAction='PRINT' OR AutoAction='AUTOPRT' OR AutoAction='PREVIEW' OR AutoAction='AUTOPRV')) OR (PrintDriver='EPIFIN' AND (AutoAction='PRINT' OR AutoAction='PREVIEW')) OR (PrintDriver='BARTENDER' AND (AutoAction='AUTOPRT' OR AutoAction='AUTOPRV')) OR (PrintDriver='EDI' AND AutoAction<>'') OR (PrintDriver='SSRS' AND (AutoAction='PREVIEW' OR AutoAction='PRINT') AND LastAction='SSRSREADY')) AND WorkStationID='LEANADMIN-VM-02 skearney']]></parameter>
<parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
</parameters>
</tracePacket>
josecgomez
(Jose C Gomez)
August 16, 2019, 7:18pm
16
You aren’t showing the datasets in your trace, that’s where the changes happen. Run it with a full trace
skearney
(Shannon Kearney)
August 16, 2019, 7:22pm
17
josecgomez
(Jose C Gomez)
August 16, 2019, 7:26pm
18
ok if you look at the trace you’ll see that your last update has a parameter dataset change of RowState Deleted
So you need to mimic the same behavior, do a GetByID on the Memo, find the record that matches, mark that Row as Deleted then call update.
c#, delete-row
2 Likes