private JsonStoreRow _rowAsJSRow(JSChangedRow row) { if (row != null) { var intRowUID = TypeFactory.GetValueOfPropertyOfObject(row.CurRow, CS_INTERNAL_ROWUID_FIELD_NAME) as String; var v_rslt = new JsonStoreRow { InternalROWUID = intRowUID, ChangeType = row.State }; foreach (var fd in this._metadata.Fields) { var v_value = TypeFactory.GetValueOfPropertyOfObject(row.CurRow, fd.Name); v_rslt.Values.Add(v_value); } return v_rslt; } return null; }
private void _regChanges(JSChangedRow chng) { var v_exists = this._dsChanges.FirstOrDefault(c => c.CurRow.Equals(chng.CurRow)); switch (chng.State) { case JsonStoreRowChangeType.Added: if (v_exists == null) this._dsChanges.Add(chng); else { if ((v_exists.State == JsonStoreRowChangeType.Deleted) || (v_exists.State == JsonStoreRowChangeType.Modified)) { this._dsChanges.Remove(v_exists); this._dsChanges.Add(chng); } } break; case JsonStoreRowChangeType.Deleted: if (v_exists == null) this._dsChanges.Add(chng); else { if (v_exists.State == JsonStoreRowChangeType.Added) { this._dsChanges.Remove(v_exists); } if (v_exists.State == JsonStoreRowChangeType.Modified) { this._dsChanges.Remove(v_exists); this._dsChanges.Add(chng); } } break; case JsonStoreRowChangeType.Modified: if (v_exists == null) this._dsChanges.Add(chng); break; } }