using BPA.Helper; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPASmartClient.DosingSystem.Service { public class FromT { public APIResult Result { get; set; } = new APIResult(); public FromT(string msg) { if (string.IsNullOrEmpty(msg)) return; //Result.Content = msg.ToJson("content").FromJSON(); if (msg.ToJson("content").TryFromJSON(out T temp)) Result.Content = temp; else { Result.Content = (T)Convert.ChangeType(msg.ToJson("content"), typeof(T)); } Result.ErrorMesg = msg.ToJson("message"); Result.IsSuccess = msg.ToJson("isSuccess").ToLower().FromJSON(); } } public class FromT { public APIResult Result { get; set; } = new APIResult(); public FromT(string msg) { if (string.IsNullOrEmpty(msg)) return; Result.ErrorMesg = msg.ToJson("message"); Result.IsSuccess = msg.ToJson("isSuccess").ToLower().FromJSON(); } } }