// ui-->json private string DataFromUIToJSONStr() { PDFInstanceData data = new PDFInstanceData(); data.CorpID = this.CorpID; data.PersonID = this.PersonID; data.TempletDocPath = this.TempletDocPath; data.TempletID = this.TempletID; data.Items = new List<PDFInstanceFieldItem>(); for (int x = 0; x < FieldsHolderTable.Rows.Count; x++) { TableRow row = FieldsHolderTable.Rows[x]; TextBox tb = (TextBox)row.Cells[1].Controls[0]; string fieldName = tb.ID.Substring(4); string fieldValue = tb.Text; PDFInstanceFieldItem i = new PDFInstanceFieldItem { FieldKey = fieldName, FeildValue = fieldValue }; data.Items.Add(i); } return data.ToJSON(); }
//添加条目 public void AddItem(string fieldKey, string fieldValue) { PDFInstanceFieldItem fi = new PDFInstanceFieldItem(); fi.FieldKey = fieldKey; fi.FeildValue = fieldValue; this.Items.Add(fi); }