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; }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(BD_SBTZ newobj) { if (gridView1.FocusedRowHandle > -1) { //BD_SBTZ tq = gridView1.GetFocusedRow() as BD_SBTZ; //Ebada.Core.ConvertHelper.CopyTo(tq, newobj); newobj.sb_id = newobj.CreateID(); } newobj.OrgCode = parentObj.OrgCode; newobj.a1 = parentType.mc; newobj.sbtype = parentType.dm; newobj.jxzq = int.Parse(parentType.jxzq); }