[E9] C# Event Handling Code

I'd wager it can be done the easy way, any chance you can find out the "reasons"? Also what version are you on?Â


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Thu, Oct 2, 2014 at 5:07 PM, tooheymomster@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Thanks Jose,</p><div>That&#39;s what I have been reading all day on Google. From what I was told, we can&#39;t do it the easy way because of it messing up with other things in our system and something about server side, which again, messes with our system...</div><div><br></div><div>I just don&#39;t know what it wants from me. I found everything it needs and converted the code and after all that, I am lost.</div><p></p>

</div><span class="ygrps-yiv-1307979074">
 


<div style="color:#fff;min-height:0;"></div>


Hi,

I have been working on a project with one of the tasks being to make the Reason Drop Down Box a REQUIRED field WHEN the Hold Flag is turned on in the Sales Order Entry screen.


So far, this is what I have done regarding this project:

SALES MANAGEMENT

> CUSTOMER RELATION MANAGEMENT > GENERAL OPERATIONS > ORDER ENTRY

 

Made a copy of SalesOrderEntry_CT_005

 

Renamed the copy to SalesOrderEntry_CT_006

 

Header > Detail tab

 

Added EpiLabel named lblHoldReason (Hold Reason:)

 

Added EpiUltraCombo named cboHoldReasons

 

Added the reasons in the drop down box:

Kanban/Blanket Order

Price Roll Up Due

Customer Hold

Unconfirmed Delivery

Documentation Review PRIOR to Shipment

 

Set EpiLabel : lblHoldReason

Set EpiBinding : ShortChar01 to OrderHed

 

Went into Method Directives and found SalesOrder.Update

Pre-Processing > BlanketToHold

Enabled was checked

Unchecked Enabled box

Saved Method Directives form

 

Instead of taking Blanket Checkbox and Blanket Button out:

Made Visible False for both

and

Enabled False for both

 

Added Form Event Wizard:

Event Type: BeforeAdapterMethod

Adapter: OrderAdapter

 

Traced to find out what METHOD NAME is being used

Method Name : MasterUpdate

 

Went into CUSTOM OBJECT EXPLORER to find the

 

Converted vb.net code to c#


=====================================================

Now for the part that I am not sure about:


In the Form Event Wizard, I need to edit the View/Edit Event Handling Code


private void oTrans_ordAdapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)

{

// ** Argument Properties and Uses **

// ** args.MasterUpdate **

// ** Add Event Handler Code **


// ** Use MessageBox to find adapter method name

// EpiMessageBox.Show(args.MethodName)

switch (args.MethodName)

{

case "Update":

// DialogResult dialogResult = EpiMessageBox.Show("Cancel Update?", "Cancel", MessageBoxButtons.YesNo);

// if ((dialogResult == DialogResult.Yes))

// {

// args.Cancel = true;

// } else

// {

// DoSomethingElse();

// }

break;

}


}


====================================================

Through the Object Explorer I was able to find the code for the OrderHeld Checkbox and the ShortChar01 Reason Drop Down Box

=====================================================

OrderHed.ShortChar01

Dim [edvVarName] As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)

Dim [VarName] As String = [edvVarName].dataView([edvVarName].Row)("ShortChar01")

 

'// ** Or

'// Dim [dvVarName] As DataView = [edvVarName].dataView

'// Dim [VarName] As String = [dvVarName]([edvVarName].Row)("ShortChar01")

 

CONVERTED FROM VB.NET TO C#

EpiDataView edvVarName = (EpiDataView)oTrans.EpiDataViews("OrderHed");

string VarName = edvVarName.dataView(edvVarName.Row)("ShortChar01");
//// ** Or
//// Dim [dvVarName] As DataView = [edvVarName].dataView
//// Dim [VarName] As String = [dvVarName]([edvVarName].Row)("ShortChar01")

 

==========================================================

 

OrderHed.OrderHeld

Dim [edvVarName] As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)

Dim [VarName] As Boolean = [edvVarName].dataView([edvVarName].Row)("OrderHeld")

 

'// ** Or

'// Dim [dvVarName] As DataView = [edvVarName].dataView

'// Dim [VarName] As Boolean = [dvVarName]([edvVarName].Row)("OrderHeld")

 

CONVERTED FROM VB.NET TO C#

EpiDataView edvVarName = (EpiDataView)oTrans.EpiDataViews("OrderHed");

bool VarName = edvVarName.dataView(edvVarName.Row)("OrderHeld");
//// ** Or
//// Dim [dvVarName] As DataView = [edvVarName].dataView
//// Dim [VarName] As Boolean = [dvVarName]([edvVarName].Row)("OrderHeld")


=======================================================================

And now....I am lost. Could someone give me a little direction?

I don't know what Epicor is looking for or what/where I should be putting the code.

Thank you!!!


Making fields required is a lot easier to do via a BPM, simply put a pre-processing BPM on Update / Master Update which checks if the Flag is Set and Raises an Exception if your field is Empty saves you all the heart ache and it works across the board.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Thu, Oct 2, 2014 at 4:53 PM, tooheymomster@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p></p><p>Hi,</p><p>I have been working on a project with one of the tasks being to make the Reason Drop Down Box a REQUIRED field WHEN the Hold Flag is turned on in the Sales Order Entry screen.</p><p><br></p><p>So far, this is what I have done regarding this project:</p><p style="margin:0in;font-family:Calibri;font-size:11.0pt;">SALES MANAGEMENT

> CUSTOMER RELATION MANAGEMENT > GENERAL OPERATIONS > ORDER ENTRY

Â

Made a copy of
SalesOrderEntry_CT_005

Â

Renamed the copy to
SalesOrderEntry_CT_006

Â

Header > Detail
tab

Â

Added EpiLabel named
lblHoldReason (Hold Reason:)

Â

Added EpiUltraCombo
named cboHoldReasons

Â

Added the reasons in
the drop down box:

Kanban/Blanket Order

Price Roll Up Due

Customer Hold

Unconfirmed Delivery

Documentation Review
PRIOR to Shipment

Â

Set EpiLabel :
lblHoldReason

Set EpiBinding :
ShortChar01 to OrderHed

Â

Went into Method
Directives and found SalesOrder.Update

Pre-Processing >
BlanketToHold

Enabled was checked

Unchecked Enabled
box

Saved Method
Directives form

Â

Instead of taking
Blanket Checkbox and Blanket Button out:

Made Visible False
for both

and

Enabled False for
both

Â

Added Form Event
Wizard:

Event Type:
BeforeAdapterMethod

Adapter:
OrderAdapter

Â

Traced to find out
what METHOD NAME is being used

Method Name :
MasterUpdate

Â

Went into CUSTOM
OBJECT EXPLORER to find the

Â

Converted vb.net code to c#


=====================================================

Now for the part that I am not sure about:


In the Form Event Wizard, I need to edit the View/Edit Event Handling Code


private void oTrans_ordAdapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)

{

// ** Argument Properties and Uses **

// ** args.MasterUpdate **

// ** Add Event Handler Code **


// ** Use MessageBox to find adapter method name

// EpiMessageBox.Show(args.MethodName)

switch (args.MethodName)

{

case "Update":

// DialogResult dialogResult = EpiMessageBox.Show("Cancel Update?", "Cancel", MessageBoxButtons.YesNo);

// if ((dialogResult == DialogResult.Yes))

// {

// args.Cancel = true;

// } else

// {

// DoSomethingElse();

// }

break;

}


}


====================================================

Through the Object Explorer I was able to find the code for the OrderHeld Checkbox and the ShortChar01 Reason Drop Down Box

=====================================================

OrderHed.ShortChar01

Dim [edvVarName] As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)

Dim [VarName] As String = [edvVarName].dataView([edvVarName].Row)("ShortChar01")

Â

'// ** Or

'// Dim [dvVarName] As DataView = [edvVarName].dataView

'// Dim [VarName] As String = [dvVarName]([edvVarName].Row)("ShortChar01")

Â

CONVERTED FROM VB.NET TO C#

EpiDataView edvVarName = (EpiDataView)oTrans.EpiDataViews("OrderHed");

string VarName = edvVarName.dataView(edvVarName.Row)("ShortChar01");
//// ** Or
//// Dim [dvVarName] As DataView = [edvVarName].dataView
//// Dim [VarName] As String = [dvVarName]([edvVarName].Row)("ShortChar01")

Â

==========================================================

Â

OrderHed.OrderHeld

Dim [edvVarName] As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)

Dim [VarName] As Boolean = [edvVarName].dataView([edvVarName].Row)("OrderHeld")

Â

'// ** Or

'// Dim [dvVarName] As DataView = [edvVarName].dataView

'// Dim [VarName] As Boolean = [dvVarName]([edvVarName].Row)("OrderHeld")

Â

CONVERTED FROM VB.NET TO C#

EpiDataView edvVarName = (EpiDataView)oTrans.EpiDataViews("OrderHed");

bool VarName = edvVarName.dataView(edvVarName.Row)("OrderHeld");
//// ** Or
//// Dim [dvVarName] As DataView = [edvVarName].dataView
//// Dim [VarName] As Boolean = [dvVarName]([edvVarName].Row)("OrderHeld")


=======================================================================

And now....I am lost. Could someone give me a little direction?

I don't know what Epicor is looking for or what/where I should be putting the code.

Thank you!!!


</div>
 


<div style="color:#fff;min-height:0;"></div>

Thanks Jose,
That's what I have been reading all day on Google. From what I was told, we can't do it the easy way because of it messing up with other things in our system and something about server side, which again, messes with our system...

I just don't know what it wants from me. I found everything it needs and converted the code and after all that, I am lost.