Click here to Skip to main content
14,660,107 members
Home » Discussions » C#
   

C#

 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois12-Jun-20 9:54
professionalKevin Marois12-Jun-20 9:54 
GeneralRe: How To Write And Comsume An Async Method Pin
Richard Deeming14-Jun-20 23:44
mveRichard Deeming14-Jun-20 23:44 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois15-Jun-20 7:31
professionalKevin Marois15-Jun-20 7:31 
GeneralRe: How To Write And Comsume An Async Method Pin
Richard Deeming15-Jun-20 7:38
mveRichard Deeming15-Jun-20 7:38 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois15-Jun-20 7:41
professionalKevin Marois15-Jun-20 7:41 
GeneralRe: How To Write And Comsume An Async Method Pin
Richard Deeming15-Jun-20 7:50
mveRichard Deeming15-Jun-20 7:50 
GeneralRe: How To Write And Comsume An Async Method Pin
Kevin Marois15-Jun-20 9:01
professionalKevin Marois15-Jun-20 9:01 
QuestionRemoving a field from jSon String Pin
simpledeveloper11-Jun-20 8:00
Membersimpledeveloper11-Jun-20 8:00 
I am storing jSon string as hexa-decimal or some characters string, its all working fine whan I retrieving as json string in my code, but there is one field I want to remove from the jSob object after I retrieved.
var t = StoredProcedures.SP_GlobalSearch.Execute(new SP_GlobalSearch_Params
                        {
                            Search = request.search,
                            SourceKey = "",
                            Skip = start,
                            Take = length,
                            ShowDeleted = false
                        }).Select(x => new SP_GlobalSearch
                        {
                            JsonObject = x.Data != null ? new JavaScriptSerializer().DeserializeObject(x.Data.Replace("", "")) : null,
                            Date = x.Date,
                            JsonObjectId = x.JsonObjectId,
                            SourceKey = x.SourceKey,
                            SourceId = x.SourceId,
                            TotalCount = x.TotalCount
                        });
                                           
                        var response = t?.ToList();
    
                        var jsondata = new DataTableResponse<SP_GlobalSearch>
                        {
                            totalCount = (int)response.Where(x => x.TotalCount != null).FirstOrDefault().TotalCount,
                            data = response.Where(x => x.TotalCount == null)
                        };
                       
                        var jsonResult = Json(jsondata);
                        jsonResult.MaxJsonLength = Int32.MaxValue;
                        return jsonResult;
I am reading the text as jSon with the below statement,

JavaScriptSerializer().DeserializeObject(x.Data.Replace("", ""))

I want to remove the violations field from it, any help please. Thanks in advance

Here is my json:

{
   "InspectionResultId":846,
   "InspectionResultNumber":"T00846",
   "InspectionRequestId":507,
   "InspectionRequestNumber":"R00507",
   "CaseId":689,
   "InspectionResultStatusId":605,
   "EnforcementSectionId":104,
   "ViolationTypeId":603,
   "DateOfInspection":"\/Date(1589439600000)\/",
   "InspectionComment":"send to office staff, open investigation",
   "InspectedCompanyDataId":964,
   "ContactTypeId":701,
   "EnteredById":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
   "InspectionResultTimestamp":"\/Date(1588280817470)\/",
   "DateCreated":"\/Date(1588280817487)\/",
   "DateUpdated":"\/Date(1588281867967)\/",
   "CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
   "UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
   "Case":{
      "RelatedContactId":0,
      "CaseId":689,
      "CaseNumber":"I00689",
      "IsInvestigation":true,
      "CaseStatusId":801,
      "InspectionItemSourceId":211,
      "EnforcementSectionId":104,
      "ReminderDate":"\/Date(1590044400000)\/",
      "PreCaseSummary":"send to office staff, open investigation",
      "AssignedToInspectorId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "CaseTimestamp":"\/Date(1588281867403)\/",
      "CaseCompanyId":964,
      "DateCreated":"\/Date(1588281867437)\/",
      "DateUpdated":"\/Date(1588281867840)\/",
      "CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "IsDeleted":false,
      "InterpreterNeeded":false,
      "VoluntaryDisclosure":false,
      "PenaltyAdjustment":0,
      "Company":{
         "ContactId":964,
         "ContactTypeId":1000,
         "FirstName":"04.30.2020 new co",
         "Notes":"new request",
         "Active":true,
         "Created":"\/Date(1588279909680)\/",
         "Updated":"\/Date(1588279909680)\/",
         "DateCreated":"\/Date(1588279909680)\/",
         "DateUpdated":"\/Date(1588279909680)\/",
         "IsEJArea":false,
         "CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
         "UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
         "Classification":{

         },
         "Class":"Company",
         "IsSpecial":false,
         "Address":{
            "Street1":"5678 Street",
            "City":"Sacramento",
            "StateCode":"CA",
            "Zip":"95812",
            "Country":"0"
         }
      }
   },
   "InspectionResultStatus":{
      "InspectionResultStatusId":605,
      "InspectionResultStatusName":"Clean",
      "InspectionResultStatusSortOrder":5
   },
   "EnforcementSection":{
      "EnforcementSectionId":104,
      "EnforcementSectionName":"STBES",
      "EnforcementSectionSortOrder":0,
      "BranchId":2
   },
   "InspectedCompanyData":{
      "ContactId":964,
      "ContactTypeId":1000,
      "FirstName":"04.30.2020 new co",
      "Notes":"new request",
      "Active":true,
      "Created":"\/Date(1588279909680)\/",
      "Updated":"\/Date(1588279909680)\/",
      "DateCreated":"\/Date(1588279909680)\/",
      "DateUpdated":"\/Date(1588279909680)\/",
      "IsEJArea":false,
      "CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "Classification":{

      },
      "Class":"Company",
      "IsSpecial":false
   },
   "InspectionItems":[
      {
         "InspectionItemId":1054,
         "InspectionItemNumber":"T00000",
         "InspectionRequestId":507,
         "InspectionResultId":846,
         "CaseId":689,
         "InspectionItemSourceId":229,
         "IsCreatedInCase":false,
         "ShowYearMakeModel":"",
         "ShowYearMakeModelVIN":"",
         "GrossWeight":0.00,
         "RegHoldSet":false,
         "InspectionItemTimestamp":"\/Date(1588280802553)\/",
         "DateCreated":"\/Date(1588280802567)\/",
         "DateUpdated":"\/Date(1588281868153)\/",
         "CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
         "UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
         "Violations":[

         ]
      }
   ],
   "CompletedBy":[
      {
         "IsActive":true,
         "FirstName":"Daphne",
         "LastName":"Greene",
         "ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
         "NameLoginFormat":"dgreene",
         "NameFirstLast":"Daphne Greene",
         "NameLastFirst":"Greene Daphne",
         "Email":"daphne.greene@arb.ca.gov",
         "EmailConfirmed":false,
         "SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
         "PhoneNumberConfirmed":false,
         "TwoFactorEnabled":false,
         "LockoutEnabled":false,
         "AccessFailedCount":0,
         "Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
         "UserName":"dgreene"
      }
   ],
   "EnteredBy":{
      "IsActive":true,
      "FirstName":"Daphne",
      "LastName":"Greene",
      "ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
      "NameLoginFormat":"dgreene",
      "NameFirstLast":"Daphne Greene",
      "NameLastFirst":"Greene Daphne",
      "Email":"daphne.greene@arb.ca.gov",
      "EmailConfirmed":false,
      "SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
      "PhoneNumberConfirmed":false,
      "TwoFactorEnabled":false,
      "LockoutEnabled":false,
      "AccessFailedCount":0,
      "Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "UserName":"dgreene"
   },
   "MyGridContacts":[

   ],
   "CreatedByUser":{
      "IsActive":true,
      "FirstName":"Daphne",
      "LastName":"Greene",
      "ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
      "NameLoginFormat":"dgreene",
      "NameFirstLast":"Daphne Greene",
      "NameLastFirst":"Greene Daphne",
      "Email":"daphne.greene@arb.ca.gov",
      "EmailConfirmed":false,
      "SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
      "PhoneNumberConfirmed":false,
      "TwoFactorEnabled":false,
      "LockoutEnabled":false,
      "AccessFailedCount":0,
      "Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "UserName":"dgreene"
   },
   "UpdatedByUser":{
      "IsActive":true,
      "FirstName":"Daphne",
      "LastName":"Greene",
      "ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
      "NameLoginFormat":"dgreene",
      "NameFirstLast":"Daphne Greene",
      "NameLastFirst":"Greene Daphne",
      "Email":"daphne.greene@arb.ca.gov",
      "EmailConfirmed":false,
      "SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
      "PhoneNumberConfirmed":false,
      "TwoFactorEnabled":false,
      "LockoutEnabled":false,
      "AccessFailedCount":0,
      "Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
      "UserName":"dgreene"
   }
}


I want to remove the Violations part from the jSon object, can you please help me in this regards thank you.

modified 11-Jun-20 18:08pm.

AnswerRe: Removing a field from jSon String Pin
OriginalGriff11-Jun-20 22:44
mveOriginalGriff11-Jun-20 22:44 
GeneralRe: Removing a field from jSon String Pin
simpledeveloper12-Jun-20 9:05
Membersimpledeveloper12-Jun-20 9:05 
GeneralRe: Removing a field from jSon String Pin
OriginalGriff12-Jun-20 9:06
mveOriginalGriff12-Jun-20 9:06 
AnswerRe: Removing a field from jSon String Pin
James Curran17-Jun-20 20:23
MemberJames Curran17-Jun-20 20:23 
QuestionIs there any good C# desktop library to implement Card liked UI dashboard? Pin
yccheok11-Jun-20 6:31
Memberyccheok11-Jun-20 6:31 
AnswerRe: Is there any good C# desktop library to implement Card liked UI dashboard? Pin
Richard MacCutchan11-Jun-20 21:36
mveRichard MacCutchan11-Jun-20 21:36 
GeneralRe: Is there any good C# desktop library to implement Card liked UI dashboard? Pin
yccheok12-Jun-20 6:13
Memberyccheok12-Jun-20 6:13 
GeneralRe: Is there any good C# desktop library to implement Card liked UI dashboard? Pin
Richard MacCutchan12-Jun-20 6:43
mveRichard MacCutchan12-Jun-20 6:43 
QuestionHow to handle excel - multiple sheets integration with ODBC Driver connection in C# Pin
Member 1485915110-Jun-20 3:10
MemberMember 1485915110-Jun-20 3:10 
AnswerRe: How to handle excel - multiple sheets integration with ODBC Driver connection in C# Pin
jsc423-Jul-20 6:43
professionaljsc423-Jul-20 6:43 
QuestionSystem.Timers.Timer() called method doesn't run all code Pin
jsmjsm10-Jun-20 1:09
Memberjsmjsm10-Jun-20 1:09 
AnswerRe: System.Timers.Timer() called method doesn't run all code Pin
Richard Deeming10-Jun-20 1:30
mveRichard Deeming10-Jun-20 1:30 
AnswerRe: System.Timers.Timer() called method doesn't run all code Pin
Luc Pattyn10-Jun-20 1:31
sitebuilderLuc Pattyn10-Jun-20 1:31 
QuestionUnable to load file or assembly 'Oracle.DataAccess' Pin
Member 1483395810-Jun-20 0:30
MemberMember 1483395810-Jun-20 0:30 
AnswerRe: Unable to load file or assembly 'Oracle.DataAccess' Pin
OriginalGriff10-Jun-20 0:40
mveOriginalGriff10-Jun-20 0:40 
AnswerRe: Unable to load file or assembly 'Oracle.DataAccess' Pin
Dave Kreskowiak10-Jun-20 2:14
mveDave Kreskowiak10-Jun-20 2:14 
GeneralRe: Unable to load file or assembly 'Oracle.DataAccess' Pin
Member 1483395810-Jun-20 5:33
MemberMember 1483395810-Jun-20 5:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.