Обновление только обязательных полей во вложенном массиве для MongoDB в C # - PullRequest
0 голосов
/ 12 февраля 2019
{

   "DistributionChannel":[
      {
         "ChannelNumber":0,
         "Title":"Direct-Primary",
         "TargetClasses" : [
                {
                    "ClassID" : "T00000001",
                    "TypeOfRisk" : "<p>Test 1&nbsp;Accountants</p>\n"
                },
                {
                    "ClassID" : "T00000002",
                    "TypeOfRisk" : "<p>Test 2&nbsp;Agents</p>\n"
                }
            ],
         "IneligibleClasses" : [
                {
                    "ClassID" : "T283373"
                },
                {
                    "ClassID" : "T00000005"
                }
            ],
         "EligibleCountries":null,
         "EligibleStates":null,
         "IneligibleStates":null,
         "OtherGeoExclusions":null,
         "AggregateLimits":"1000",
         "OccurrenceLimits":null,
         "MinimumPremium":null,
         "UnderwritingVerticalID":"",
         "UnderwritingVertical":null,
         "IssuingPapers" : [
                {
                    "IssuingPaperID" : "IP000001"
                },
                {
                    "IssuingPaperID" : "IP000002"
                }
            ],
         "DistributionMethod":[
            {
               "DMID":"DM000001",
               "DM":"Direct"
            }
         ],
         "ParticipationLayerID":"PLC000002",
         "ParticipationLayer":"Primary",
         "RiskComplexityTypeID":"",
         "RiskComplexityType":null,
         "Submission":null,
         "CustomHierarchy":false,
         "StateWide":null,
         "RegionWide":null,
         "NationWide":null,
         "Leadership":null,
         "Applications":null
      }
   ],
   "ProductState":null,
   "MarkelProductInitiation":null,
   "ProducerExclusivity":null,
   "TopProducer":null,
   "TopRecentDeals":null,
   "PremiumVolumeByCalendarYear":null,
   "PremiumProjectionByCalendarYear":null,
   "KeyCompetitors":null,
   "StateOfMarket":null,
   "TargetsOfOpportunity":null,
   "ImportantConferences":null,
   "UnderwritingGuidelinesDoc":null,
   "UnderwritingGuidanceWebsites":null,
   "ProducerCommisionArrangements":null,
   "BillingPaymentOptions":null,
   "PeakUnderwritingSeason":null,
   "AutoDecisionGoals":null,
   "QuotingSLA":null,
   "CommonDeclines":null,
   "CompetitorApplications":null,
   "StartUps":null,
   "Status":"submit",
   "Role":null,
   "Comments":null,
   "ChangedFields":[

      {

        "FieldName":"Name",
         "IsApproved" : true,
         "ChangedStatus":[
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            }
         ]
      },
      {
         "FieldName":"Quoting",
         "IsApproved" : true,

         "ChangedStatus":[
            {
               "Status":"5",
               "Indexes":0,
               "NestedField":null
            }
         ]
      },
      {
         "FieldName":"ProductWebsite",
         "IsApproved" : false,
         "ChangedStatus":[
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            }
         ]
      },

      {
         "FieldName":"CrossSellProduct",
         "IsApproved" : true,
         "ChangedStatus":
         [
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            },
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            },
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            }

         ]
      },

       {
         "FieldName":"MarketingProductMaterial",
         "IsApproved" : true,
         "ChangedStatus":
         [
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            },
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            },
            {
               "Status":"4",
               "Indexes":0,
               "NestedField":null
            }

         ]
      },


      {

  "FieldName": "DistributionChannel",
  "IsApproved": false,
  "ChangedStatus": [
    {
      "Status": 2,
      "Ischanged": true,
      "Indexes": 0,
      "NestedField": [
        {
          "FieldName": "TargetClasses",
          "IsApproved": true,
          "ChangedStatus": [
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            },
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            }
          ]
        },

        {
          "FieldName": "IssuingPapers",
          "IsApproved": true,
          "ChangedStatus": [
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            },
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            }
          ]
        },

        {
          "FieldName": "IneligibleClasses",
          "IsApproved": false,
          "ChangedStatus": [
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            },
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            }
          ]
        },

        {
          "FieldName": "AggregateLimits",
          "IsApproved": true,
          "ChangedStatus": [
            {
              "Status": 1,
              "Ischanged": true,
              "Indexes": 2,
              "NestedField": null
            }

          ]








        }







      ]




    }
  ]
}

   ],
   "id":"5c49980d4825a541a04c6d02",
   "CreatedDate":"2019-01-31T09:03:25.653Z",
   "UpdatedDate":"2019-01-31T09:06:15.892Z",
   "CreatedBy":"EMP012",
   "UpdatedBy":null

}

Нет, я хочу обновить только "TargetClasses" из вложенных полей, основываясь на имени файла.

1 Ответ

0 голосов
/ 12 февраля 2019

Вы должны создать класс этого объекта, десериализовать его и работать с ним в C #.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...