private void afblGridControl_DragDrop(object sender, DragEventArgs e) { GridControl grid = (GridControl)sender; Point pt = new Point(e.X, e.Y); pt = grid.PointToClient(pt); GridView view = grid.GetViewAt(pt) as GridView; AccountDataSet.AFDLRow srcRow = e.Data.GetData(typeof(AccountDataSet.AFDLRow)) as AccountDataSet.AFDLRow; GridHitInfo trgHitInfo = view.CalcHitInfo(grid.PointToClient(new Point(e.X, e.Y))); int AFBid = (int)view.GetRowCellValue(trgHitInfo.RowHandle, colAFBIDb); object trh, kur; srcRow.AFBID = AFBid; if ((int)AFBid == 0) { srcRow.BKUR = -1; trh = DateTime.Today; } else { AccountDataSet.AFBLRow pRow = srcRow.GetParentRow("AFBL_AFDL") as AccountDataSet.AFBLRow; srcRow.BKUR = pRow.BKUR; //srcRow.GetParentRow("AFBL_AFDL")["KUR"]; trh = pRow.IsFTRTRHNull() ? DateTime.Today : pRow.FTRTRH; } kur = accountQueriesTableAdapter.AFB_KUR(srcRow.DDVZ, (DateTime)trh); view.SetRowCellValue(trgHitInfo.RowHandle, colDKURd, kur); view.RefreshData(); }
void DVTrepositoryItemLookUpEdit_Closed(object sender, DevExpress.XtraEditors.Controls.ClosedEventArgs e) { var a = sender as LookUpEdit; if (a.OldEditValue != a.EditValue) { object trh, kur; if (afdlGridControl.IsFocused) { if ((int)afdlGridView.GetFocusedRowCellValue(colAFBIDd) == 0) { trh = DateTime.Today; } else { AccountDataSet.AFDLRow dRow = afdlGridView.GetDataRow(afdlGridView.FocusedRowHandle) as AccountDataSet.AFDLRow; AccountDataSet.AFBLRow pRow = dRow.GetParentRow("AFBL_AFDL") as AccountDataSet.AFBLRow; //AccountDataSet.AFBLRow pRow = afdlGridView.GetDataRow(afblGridView.FocusedRowHandle).GetParentRow("AFBL_AFDL") as AccountDataSet.AFBLRow; trh = pRow.IsFTRTRHNull() ? DateTime.Today : pRow.FTRTRH; } kur = accountQueriesTableAdapter.AFB_KUR(a.EditValue.ToString(), (DateTime)trh); afdlGridView.SetFocusedRowCellValue(colDKURd, kur); } if (afblGridControl.IsFocused) { if ((int)afblGridView.GetFocusedRowCellValue(colAFBIDd) == 0) { trh = DateTime.Today; } else { trh = afblGridView.GetFocusedRowCellValue(colFTRTRHb) == DBNull.Value ? DateTime.Today : afblGridView.GetFocusedRowCellValue(colFTRTRHb); } kur = accountQueriesTableAdapter.AFB_KUR(a.EditValue.ToString(), (DateTime)trh); afblGridView.SetFocusedRowCellValue(colBKURb, kur); AccountDataSet.AFDLRow[] cRows = afblGridView.GetDataRow(afblGridView.FocusedRowHandle).GetChildRows("AFBL_AFDL") as AccountDataSet.AFDLRow[]; for (int i = 0; i < cRows.Length; i++) { cRows[i].BKUR = (Single)kur; } } } }