Instead of obj1.ATAVOYAGEREPORT
, try to specify obj1.ATAVOYAGEREPORT?.ToString( ) ?? "null"
.
If it is a string, then use obj1.ATAVOYAGEREPORT ?? "null"
.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Source code:
sr.Body.RequestBody = string.Format
((string)configData.PostFSObj, obj1.AiConfiguration, obj1.AircraTypeIndex, obj1.Arrivadelaytime,
obj1.ATAVOYAGEREPORT, obj1.ATDVOYAGEREPORT,
obj1.Carrier, obj1.Departdelaytime, obj1.FlightLegCode, obj1.FlightNumber,
obj1.OperationDay, obj1.Sctimeofarrival, obj1.timeofdeparture
, obj1.TotalPassengers, dsStrProp, asStrProp, regStrProp);
```CustomConfig.CommonFactory.WriteToFile("Request Obj => " + sr.Body.RequestBody, pr.ProcessID);
I have a result for obj1 as below:
"AiConfiguration": "Scheduled Service", "AircraTypeIndex": "7M8", "Arrivadelaytime": "", "ATAVOYAGEREPORT": null, "ATDVOYAGEREPORT": null, "CarrierIndex": "FZ", "Departdelaytime": null, "FlightLegCode": " ", "FlightNumber": 27, "OperationDay": "2024-03-28T00:00:00+05:30", "Sctimeofarrival": "2024-03-28T09:00:00Z", "timeofdeparture": null, "TotalPassengers": 0,
but after convverting to string format:
sr.Body.RequestBody : ATAVOYAGEREPORT : "","ATDVOYAGEREPORT:""
I want sr.Body.RequestBody result as it is like ATAVOYAGEREPORT : null please help me.
Instead of obj1.ATAVOYAGEREPORT
, try to specify obj1.ATAVOYAGEREPORT?.ToString( ) ?? "null"
.
If it is a string, then use obj1.ATAVOYAGEREPORT ?? "null"
.
Hi @Rashmitha B ,
sr.Body.RequestBody = string.Format(
"{0}: {1}, {2}: {3}, {4}: {5}, {6}: {7}, {8}: {9}, {10}: {11}, {12}: {13}, {14}: {15}, {16}: {17}, {18}: {19}, {20}: {21}, {22}: {23}, {24}: {25}, {26}: {27}, {28}: {29}, {30}: {31}, {32}: {33}",
"AiConfiguration", obj1.AiConfiguration,
"AircraTypeIndex", obj1.AircraTypeIndex,
"Arrivadelaytime", obj1.Arrivadelaytime,
"ATAVOYAGEREPORT", obj1.ATAVOYAGEREPORT != null ? "\"" + obj1.ATAVOYAGEREPORT + "\"" : "null",
"ATDVOYAGEREPORT", obj1.ATDVOYAGEREPORT != null ? "\"" + obj1.ATDVOYAGEREPORT + "\"" : "null",
"Carrier", obj1.Carrier,
"Departdelaytime", obj1.Departdelaytime,
"FlightLegCode", obj1.FlightLegCode,
"FlightNumber", obj1.FlightNumber,
"OperationDay", obj1.OperationDay,
"Sctimeofarrival", obj1.Sctimeofarrival,
"timeofdeparture", obj1.timeofdeparture != null ? "\"" + obj1.timeofdeparture + "\"" : "null",
"TotalPassengers", obj1.TotalPassengers,
dsStrProp,
asStrProp,
regStrProp
);
CustomConfig.CommonFactory.WriteToFile("Request Obj => " + sr.Body.RequestBody, pr.ProcessID);
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.