Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TRoamingRecType = (rrtSelected, rrtAll);
- procedure TForm1.MoveSelectedRows(GridSource, GridDestin: TDBGridEh; RoamingRec: TRoamingRecType);
- var
- i, j: Integer;
- begin
- if TDBGridEh(GridSource).DataSource.DataSet.IsEmpty then Exit;
- try
- TDBGridEh(GridSource).DataSource.DataSet.DisableControls;
- TDBGridEh(GridDestin).DataSource.DataSet.DisableControls;
- case RoamingRec of
- rrtSelected:
- begin
- TDBGridEh(GridSource).SaveBookmark;
- for i := 0 to TDBGridEh(GridSource).SelectedRows.Count - 1 do
- begin
- TDBGridEh(GridSource).DataSource.DataSet.Bookmark := TDBGridEh(GridSource).SelectedRows[i];
- TDBGridEh(GridDestin).DataSource.DataSet.Append;
- TDBGridEh(GridDestin).DataSource.DataSet.Edit;
- for j := 0 to Pred(TDBGridEh(GridDestin).DataSource.DataSet.FieldCount) do
- TDBGridEh(GridDestin).DataSource.DataSet.Fields[j].Value := TDBGridEh(GridSource).DataSource.DataSet.Fields[j].Value;
- TDBGridEh(GridDestin).DataSource.DataSet.Post;
- TDBGridEh(GridSource).DataSource.DataSet.Delete;
- end;
- TDBGridEh(GridSource).RestoreBookmark;
- end;
- rrtAll:
- begin
- for i := 0 to Pred(TDBGridEh(GridSource).DataSource.DataSet.RecordCount) do
- begin
- TDBGridEh(GridDestin).DataSource.DataSet.Append;
- TDBGridEh(GridDestin).DataSource.DataSet.Edit;
- for j := 0 to TDBGridEh(GridDestin).DataSource.DataSet.FieldCount - 1 do
- TDBGridEh(GridDestin).DataSource.DataSet.Fields[j].Value := TDBGridEh(GridSource).DataSource.DataSet.Fields[j].Value;
- TDBGridEh(GridDestin).DataSource.DataSet.Post;
- TDBGridEh(GridSource).DataSource.DataSet.Delete;
- end;
- end;
- end;
- finally
- TDBGridEh(GridDestin).DataSource.DataSet.EnableControls;
- TDBGridEh(GridSource).DataSource.DataSet.EnableControls;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement