public string GetEditFieldJson() { var data = DataSearchSource.Select("CoreSource > 0"); if (data.Any()) { return(JsonConvert.SerializeObject(data.CopyToDataTable())); } return(""); }
public async Task EditField(DataRow row) { var data = DataSearchSource.Select("CoreSource > 0"); if (data.Any()) { foreach (DataRow item in data) { if (item["CoreSource"].ToString().Length == 2) { item["CoreSource"] = item["CoreSource"].ToString().Replace("4", ""); } else { item["CoreSource"] = "0"; } } } row["CoreSource"] = "4" + row["CoreSource"]; }
public async Task SaveField() { if (RowEdit == null && DataSearchSource != null) { var row = DataSearchSource.NewRow(); foreach (var item in Field.FieldChilds) { row[item.FieldName.ToLower()] = item.Value; } row["CoreSource"] = 1; DataSearchSource.Rows.Add(row); DataSearchSource.AcceptChanges(); } else { foreach (var item in Field.FieldChilds) { RowEdit[item.FieldName.ToLower()] = item.Value; } RowEdit["CoreSource"] = 2; } Field.Value = GetEditFieldJson(); }