BalanceType in Dynamics GP Web Services, How to use? -


i trying create customer in gp web services , came across balancetype property on customer class , not know how set value. expecting integer of value 0 or 1, receive "cannot implicitly convert type 'int' [...].balancetype".

here definition it. believe problem lack of experience c# , .net in general , enumeration types specifically.

public enum balancetype : int {      [system.runtime.serialization.enummemberattribute(value="open item")]     openitem = 0,      [system.runtime.serialization.enummemberattribute(value="balance forward")]     balanceforward = 1, } 

in code have class property

public int balancetype 

later in method have following _customer parameter object passed in , customerobj web services class object.

customerobj.balancetype = _customer.balancetype; 

your time , brainpower appreciated.

an enumeration type provides convenient way define named constants value. in case, openitem = 0 , balanceforward = 1.

you set enum this:

customerobj.balancetype = balancetype.openitem; 

i change property in code of balancetype so:

public balancetype balancetype; 

that way avoid need casting between integer , enumeration type. able set easily:

customerobj.balancetype = balancetype; 

in case need cast enumeration type integer, see related question.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -