Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set property of variable
    primarykey
    data
    text
    <p>this is my function which gets all projects placed in database.</p> <pre><code> public bool getUserProjects(ref List&lt;erpAssets&gt;userProjects) { string arguments = "{\"sessionId\":\"" + m_LoggedInUser.sessionId + "\"," + "\"assetType\":\"" + PROJECT_ASSET_TYPE_NAME + "\"" + "}"; string response = UrlParser(METHOD_GET_ASSETS, MODULE_ADMINISTRATION, arguments); //calling the function urlParse to get the response from that page erpAPIResponse basicResponse = JsonConvert.DeserializeObject&lt;erpAPIResponse&gt;(response); if (basicResponse.success.Equals("yes")) { try { erpAssets[] Projects = JsonConvert.DeserializeObject&lt;erpAssets[]&gt;(basicResponse.arguments); userProjects.AddRange(Projects); } catch (Exception e) { } } else return false; return true; // sending the response back to client } </code></pre> <p>My erpAsset class is as follows:</p> <pre><code> class erpAssets { public string assetId { get; set; } public string assetSerialNo { get; set; } public string serialNo { get; set; } public string assetDescription { get; set; } public string assetType { get; set; } public string parentId { get; set; } public string assetIsTrakable { get; set; } public bool isTrackable { get; set; } public bool isMovable { get; set; } public string assetInheritsRegion { get; set; } public string inheritsRegion { get; set; } public string assetModel { get; set; } public string model { get; set; } public erpPoint[] assetRegion { get; set; } } </code></pre> <p>and my erpPoint class is as follows:</p> <pre><code>class erpPoint { public double X { get; set; } public double Y { get; set; } } </code></pre> <p>Now issue i am facing is this when assetRegion is null then i get following exception</p> <p>Error converting value "" to type 'erp.erpPoint[]'.</p> <p>scenario1 which is working fine: { "assetId": "43711", "assetSerialNo": "Sector43", "assetDescription": "", "assetVersion": "", "assetIsMovable": "f", "assetType": "Project", "assetModel": "Project", "parentId": "32537", "assetIsTrackable": "f", "assetInheritsRegion": "f", "assetRegion": [ { "X": -122.69103924537, "Y": 49.105749366835 }, { "X": -122.69103924537, "Y": 49.119046702041 }, { "X": -122.68010753619, "Y": 49.119046702041 }, { "X": -122.68010753619, "Y": 49.105749366835 } ] }</p> <p>this is working fine.</p> <p>Scenario2:</p> <p>{ "assetId": "64374", "assetSerialNo": "FeedLot", "assetDescription": "", "assetVersion": "", "assetIsMovable": "t", "assetType": "Project", "assetModel": "Project", "parentId": "64374", "assetIsTrackable": "t", "assetInheritsRegion": "f", "assetRegion": "" }</p> <p>this is where i am getting exception. assetregion is null and now i am getting exception in setting its values</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload