Beispiel #1
0
        private string getjsonData(BD_SBTZ gt,Dictionary<string, IList<BD_SBTZ_SX>> dicsx) {
            string jsondata = null;
            List<bd_sbsxz> gsonList = new List<bd_sbsxz>();
            Type t = gt.GetType();
            if (!dicsx.ContainsKey(gt.sbtype)) {
                dicsx.Add(gt.sbtype, Client.ClientHelper.PlatformSqlMap.GetList<BD_SBTZ_SX>(" where zldm='" + gt.sbtype + "' and sxcol<>'a1' "));
            }
            foreach(var zlsx in dicsx[gt.sbtype]){
                
                bd_sbsxz sx = new bd_sbsxz() {
                     k=zlsx.sxcol,t=zlsx.sxname,v=t.GetProperty(zlsx.sxcol).GetValue(gt,null).ToString(),
                      bv=zlsx.boxvalue,type=zlsx.sxtype
                };

                gsonList.Add(sx);
            }
            try {
                jsondata = Newtonsoft.Json.JsonConvert.SerializeObject(gsonList);
            } catch (Exception err) { Console.WriteLine(err.Message); }
            return jsondata;
        }