当前位置: 首页>>代码示例>>C#>>正文


C# JObject.GetValue方法代码示例

本文整理汇总了C#中JObject.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetValue方法的具体用法?C# JObject.GetValue怎么用?C# JObject.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JObject的用法示例。


在下文中一共展示了JObject.GetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInstance

 public static StarEvent GetInstance(JObject data, bool starred)
 {
     return new StarEvent() {
         Id = data.GetValue("id").Value<string>(),
         Type = data.GetValue("type").Value<string>(),
         Starred = starred
     };
 }
开发者ID:freezy,项目名称:vpdb-agent,代码行数:8,代码来源:RealtimeManager.cs

示例2: CnvJsonDataToList

 /// <summary>
 ///     Convert JSON Data
 /// </summary>
 /// <param name="jsondata">JSON Object</param>
 /// <returns>List of Adverse Drug Events</returns>
 /// <remarks></remarks>
 public static List<AdverseDrugEvent> CnvJsonDataToList(JObject jsondata)
 {
     return jsondata.GetValue("results").
                     Select(obj => new AdverseDrugEvent
                                   {
                                       CompanyNumb = Utilities.GetJTokenString(obj, "companynumb"),
                                       SafetyReportId = Utilities.GetJTokenString(obj, "safetyreportid"),
                                       FulfillExpediteCriteria = Utilities.GetJTokenString(obj, "fulfillexpeditecriteria"),
                                       ReceiveDateFormat = Utilities.GetJTokenString(obj, "receivedateformat"),
                                       ReceiptDateFormat = Utilities.GetJTokenString(obj, "receiptdateformat"),
                                       PrimarySource = obj["primarysource"],
                                       ReceiveDate = Utilities.GetJTokenString(obj, "receivedate"),
                                       OccurCountry = Utilities.GetJTokenString(obj, "occurcountry"),
                                       Serious = Utilities.GetJTokenString(obj, "serious"),
                                       SeriousnessCongenitalAnomali = Utilities.GetJTokenString(obj, "seriousnesscongenitalanomali"),
                                       SeriousnessDeath = Utilities.GetJTokenString(obj, "seriousnessdeath"),
                                       SeriousnessDisabling = Utilities.GetJTokenString(obj, "seriousnessdisabling"),
                                       SeriousnessHospitalization = Utilities.GetJTokenString(obj, "seriousnesshospitalization"),
                                       SeriousnessLifeThreatening = Utilities.GetJTokenString(obj, "seriousnesslifethreatening"),
                                       SeriousnessOther = Utilities.GetJTokenString(obj, "seriousnessother"),
                                       SafetyReportVersion = Utilities.GetJTokenString(obj, "safetyreportversion"),
                                       Patient = PatientData.ConvertJsonDate(((JObject) Utilities.GetJTokenObject(obj, "patient")))
                                   }).
                     ToList();
 }
开发者ID:Steve-Frost,项目名称:Total-Recall-DEV,代码行数:31,代码来源:AdverseDrugEvent.cs

示例3: CnvJsonDataToList

            /// <summary>
            ///     Convert JSON Data
            /// </summary>
            /// <param name="jsondata">JSON Object</param>
            /// <returns>List of Adverse Device Events</returns>
            /// <remarks></remarks>
            public static List<AdverseDeviceEvent> CnvJsonDataToList(JObject jsondata)
            {
                var result = new List<AdverseDeviceEvent>();
                //jsondata.dump("In")
                foreach (var obj in jsondata.GetValue("results"))
                {
                    //obj.Dump("Obj")
                    var tmp = new AdverseDeviceEvent();

                    tmp.AdverseEventFlag = Utilities.GetJTokenString(obj, "adverse_event_flag");
                    tmp.ProductProblemFlag = Utilities.GetJTokenString(obj, "product_problem_flag");
                    tmp.DateOfEvent = Utilities.GetJTokenString(obj, "date_of_event");
                    tmp.DateReport = Utilities.GetJTokenString(obj, "date_report");
                    tmp.DateReceived = Utilities.GetJTokenString(obj, "date_received");
                    tmp.NumberDevicesInEvent = Utilities.GetJTokenString(obj, "number_devices_in_event");
                    tmp.NumberPatientsInEvent = Utilities.GetJTokenString(obj, "number_patients_in_event");
                    //Source
                    tmp.ReportSourceCode = Utilities.GetJTokenString(obj, "report_source_code");
                    tmp.HealthProfessional = Utilities.GetJTokenString(obj, "health_professional");
                    tmp.ReporterOccupationCode = Utilities.GetJTokenString(obj, "reporter_occupation_code");
                    tmp.InitialReportToFda = Utilities.GetJTokenString(obj, "initial_report_to_fda");
                    tmp.ReprocessedAndReusedFlag = Utilities.GetJTokenString(obj, "reprocessed_and_reused_flag");

                    var reportTypes = obj.Value<JArray>("type_of_report");

                    if (reportTypes != null)
                    {
                        foreach (var itm in reportTypes)
                        {
                            tmp.TypeOfReport.Add((itm).ToString());
                        }
                    }

                    // Not an array
                    //var remedialAction = obj.Value<JArray>("remedial_action");

                    //if (remedialAction != null)
                    //{
                    //    foreach (var itm in remedialAction)
                    //    {
                    //        tmp.RemedialAction.Add((itm).ToString());
                    //    }
                    //}

                    var sourceType = obj.Value<JArray>("source_type");

                    if (sourceType != null)
                    {
                        foreach (var itm in sourceType)
                        {
                            tmp.SourceType.Add((itm).ToString());
                        }
                    }

                    tmp.DateFacilityAware = Utilities.GetJTokenString(obj, "date_facility_aware");
                    tmp.ReportDate = Utilities.GetJTokenString(obj, "report_date");
                    tmp.ReportToFda = Utilities.GetJTokenString(obj, "report_to_fda");
                    tmp.DateReportToFda = Utilities.GetJTokenString(obj, "date_report_to_fda");
                    tmp.ReportToManufacturer = Utilities.GetJTokenString(obj, "report_to_manufacturer");
                    tmp.DateReportToManufacturer = Utilities.GetJTokenString(obj, "date_report_to_manufacturer");
                    tmp.EventLocation = Utilities.GetJTokenString(obj, "event_location");

                    tmp.DistributorName = Utilities.GetJTokenString(obj, "distributor_name");
                    tmp.DistributorAddress1 = Utilities.GetJTokenString(obj, "distributor_address_1");
                    tmp.DistributorAddress2 = Utilities.GetJTokenString(obj, "distributor_address_2");
                    tmp.DistributorCity = Utilities.GetJTokenString(obj, "distributor_city");
                    tmp.DistributorState = Utilities.GetJTokenString(obj, "distributor_state");
                    tmp.DistributorZipCode = Utilities.GetJTokenString(obj, "distributor_zip_code");
                    tmp.DistributorZipCodeExt = Utilities.GetJTokenString(obj, "distributor_zip_code_ext");

                    tmp.ManufacturerName = Utilities.GetJTokenString(obj, "manufacturer_name");
                    tmp.ManufacturerAddress1 = Utilities.GetJTokenString(obj, "manufacturer_address_1");
                    tmp.ManufacturerAddress2 = Utilities.GetJTokenString(obj, "manufacturer_address_2");
                    tmp.ManufacturerCity = Utilities.GetJTokenString(obj, "manufacturer_city");
                    tmp.ManufacturerState = Utilities.GetJTokenString(obj, "manufacturer_state");
                    tmp.ManufacturerZipCode = Utilities.GetJTokenString(obj, "manufacturer_zip_code");
                    tmp.ManufacturerZipCodeExt = Utilities.GetJTokenString(obj, "manufacturer_zip_code_ext");
                    tmp.ManufacturerCountry = Utilities.GetJTokenString(obj, "manufacturer_country");
                    tmp.ManufacturerPostalCode = Utilities.GetJTokenString(obj, "manufacturer_postal_code");

                    tmp.EventType = Utilities.GetJTokenString(obj, "event_type");
                    tmp.DeviceDateOfManufacture = Utilities.GetJTokenString(obj, "device_date_of_manufacture");
                    tmp.SingleUseFlag = Utilities.GetJTokenString(obj, "single_use_flag");
                    tmp.PreviousUseCode = Utilities.GetJTokenString(obj, "previous_use_code");

                    tmp.RemovalCorrectionNumber = Utilities.GetJTokenString(obj, "removal_correction_number");

                    tmp.ManufactureContactNameTitle = Utilities.GetJTokenString(obj, "manufacturer_contact_t_name");
                    tmp.ManufactureContactNameFirst = Utilities.GetJTokenString(obj, "manufacturer_contact_f_name");
                    tmp.ManufactureContactNameLast = Utilities.GetJTokenString(obj, "manufacturer_contact_l_name");

                    tmp.ManufactureContactStreet1 = Utilities.GetJTokenString(obj, "manufacturer_contact_street_1");
                    tmp.ManufactureContactStreet2 = Utilities.GetJTokenString(obj, "manufacturer_contact_street_2");
                    tmp.ManufactureContactCity = Utilities.GetJTokenString(obj, "manufacturer_contact_city");
//.........这里部分代码省略.........
开发者ID:Steve-Frost,项目名称:Total-Recall-DEV,代码行数:101,代码来源:AdverseDeviceEvent.cs

示例4: GetValue

        public void GetValue()
        {
            JObject a = new JObject();
            a["Name"] = "Name!";
            a["name"] = "name!";
            a["title"] = "Title!";

            Assert.Equal(null, a.GetValue("NAME", StringComparison.Ordinal));
            Assert.Equal(null, a.GetValue("NAME"));
            Assert.Equal(null, a.GetValue("TITLE"));
            Assert.Equal("Name!", (string)a.GetValue("NAME", StringComparison.OrdinalIgnoreCase));
            Assert.Equal("name!", (string)a.GetValue("name", StringComparison.Ordinal));
            Assert.Equal(null, a.GetValue(null, StringComparison.Ordinal));
            Assert.Equal(null, a.GetValue(null));

            JToken v;
            Assert.False(a.TryGetValue("NAME", StringComparison.Ordinal, out v));
            Assert.Equal(null, v);

            Assert.False(a.TryGetValue("NAME", out v));
            Assert.False(a.TryGetValue("TITLE", out v));

            Assert.True(a.TryGetValue("NAME", StringComparison.OrdinalIgnoreCase, out v));
            Assert.Equal("Name!", (string)v);

            Assert.True(a.TryGetValue("name", StringComparison.Ordinal, out v));
            Assert.Equal("name!", (string)v);

            Assert.False(a.TryGetValue(null, StringComparison.Ordinal, out v));
        }
开发者ID:extesla,项目名称:OpenGamingLibrary,代码行数:30,代码来源:JObjectTests.cs

示例5: CnvJsonDataToList

            /// <summary>
            ///     Converts JSON Data to List
            /// </summary>
            /// <param name="jsondata">JSON Object Data</param>
            /// <returns>List of Recall Data</returns>
            /// <remarks></remarks>
            public static List<ResultRecall> CnvJsonDataToList(JObject jsondata)
            {
                var result = new List<ResultRecall>();

                foreach (var obj in jsondata.GetValue("results"))
                {
                    var tmp = new ResultRecall();

                    tmp.City = (obj["city"]).ToString();
                    tmp.Classification = (obj["classification"]).ToString();
                    tmp.Code_info = (obj["code_info"]).ToString();
                    tmp.Country = (obj["country"]).ToString();
                    tmp.Distribution_Pattern = (obj["distribution_pattern"]).ToString();
                    tmp.Event_Id = (obj["event_id"]).ToString();
                    tmp.Initial_Firm_Notification = (obj["initial_firm_notification"]).ToString();
                    //tmp.openfda = zz("city")
                    tmp.Product_Description = (obj["product_description"]).ToString();
                    tmp.Product_Quantity = (obj["product_quantity"]).ToString();
                    tmp.Product_Type = (obj["product_type"]).ToString();
                    tmp.Reason_For_Recall = (obj["reason_for_recall"]).ToString();
                    tmp.Recall_Initiation_Date = (obj["recall_initiation_date"]).ToString();
                    tmp.Recall_Number = (obj["recall_number"]).ToString();
                    tmp.Recalling_Firm = (obj["recalling_firm"]).ToString();
                    tmp.Report_Date = (obj["report_date"]).ToString();
                    tmp.State = (obj["state"]).ToString();
                    tmp.Status = (obj["status"]).ToString();
                    tmp.Voluntary_Mandated = (obj["voluntary_mandated"]).ToString();

                    result.Add(tmp);
                }

                return result;
            }
开发者ID:Steve-Frost,项目名称:Total-Recall-DEV,代码行数:39,代码来源:ResultRecall.cs


注:本文中的JObject.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。