コード例 #1
2
ファイル: ws.cs プロジェクト: tofupl/Csharp
        public void DeleteSelectedRows(DevExpress.XtraGrid.Views.Grid.GridView view)
        {
            if (view == null || view.SelectedRowsCount == 0) return;

            DataRow[] rows = new DataRow[view.SelectedRowsCount];

            for (int i = 0; i < view.SelectedRowsCount; i++)
                rows[i] = view.GetDataRow(view.GetSelectedRows()[i]);

            view.BeginSort();

            try
            {
                foreach (DataRow row in rows)
                    row.Delete();
            }
            finally
            {
                view.EndSort();
            }
        }
コード例 #2
1
        private void RemoverRenglonDelGrid(DevExpress.XtraGrid.GridControl Grid, DevExpress.XtraGrid.Views.Grid.GridView GV)
        {
            var lstDoctosPV = (List<DoctosPV>)(Grid.DataSource);

            if (lstDoctosPV.Count > 0)
            {
                int i = GV.GetSelectedRows()[0];
                DoctosPV retiro = (DoctosPV)GV.GetRow(i);

                lstDoctosPV.Remove(retiro);

                Grid.DataSource = lstDoctosPV;
                GV.RefreshData();
            }
        }
コード例 #3
0
        private void RemoverRenglonDelGrid(DevExpress.XtraGrid.GridControl Grid, DevExpress.XtraGrid.Views.Grid.GridView GV)
        {
            var lstRegistros = (List<ChequeTransferencia>)(Grid.DataSource);

            if (lstRegistros.Count > 0)
            {
                int i = GV.GetSelectedRows()[0];
                ChequeTransferencia registro = (ChequeTransferencia)GV.GetRow(i);

                lstRegistros.Remove(registro);

                Grid.DataSource = lstRegistros;
                GV.RefreshData();
            }
        }
コード例 #4
0
 public static bool deleteSelectedRows(DevExpress.XtraGrid.Views.Grid.GridView xgv)
 {
     if (xgv == null)
         return false;
     int[] nSelectedRows = xgv.GetSelectedRows();
     if (nSelectedRows.Length == 0)
         return false;
     try
     {
         DataRow drRow = null;
         foreach(int nRowHandle in nSelectedRows)
         {
             drRow = xgv.GetDataRow(nRowHandle);
             if (drRow != null)
                 drRow.Delete();
         }
     }
     catch(Exception ex)
     {
         throw(ex);
     }
     return true;
 }
コード例 #5
0
 IList GetSelectedObjects(DevExpress.XtraGrid.Views.Base.ColumnView focusedView) {
     int[] selectedRows = focusedView.GetSelectedRows();
     if ((selectedRows != null) && (selectedRows.Length > 0)) {
         IEnumerable<object> objects = selectedRows.Where(rowHandle => rowHandle > -1).Select(focusedView.GetRow).Where(obj => obj != null);
         return objects.ToList();
     }
     return new List<object>();
 }
コード例 #6
0
ファイル: ws.cs プロジェクト: tofupl/Csharp
 public object[] GetSelectedValues(DevExpress.XtraGrid.Views.Grid.GridView view, string fieldName)
 {
     int[] selectedRows = view.GetSelectedRows();
     object[] result = new object[selectedRows.Length];
     for (int i = 0; i < selectedRows.Length; i++)
     {
         int rowHandle = selectedRows[i];
         if (!gvMain.IsGroupRow(rowHandle))
         {
             result[i] = view.GetRowCellValue(rowHandle, fieldName);
         }
         else
             result[i] = -1;
     }
     return result;
 }