コード例 #1
0
 void tsmSelectAll_Click(object sender, System.EventArgs e)
 {
     Xceed.Grid.Row contextRow = m_grid.GridHelper.ContextRow;
     if (contextRow != null)
     {
         contextRow.GridControl.SelectedRows.Clear();
         foreach (Xceed.Grid.DataRow row in contextRow.ParentGroup.GetSortedDataRows(false))
         {
             if (row.Visible)
             {
                 m_grid.GridControl.SelectedRows.Add(row);
             }
         }
     }
 }
コード例 #2
0
        ///// <summary>
        ///// ErrorIcon(all set icon in validationProvider)
        ///// </summary>
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        //public System.Drawing.Icon ErrorIcon
        //{
        //    get { return m_grid.ErrorIcon; }
        //    set
        //    {
        //        m_grid.ErrorIcon = value;
        //        this.validationProvider1.Icon = value;
        //    }
        //}

        #endregion

        #region "ContextMenu"

        private void tsmDeleteBatch_Click(object sender, EventArgs e)
        {
            Xceed.Grid.Row contextRow = m_grid.GridHelper.ContextRow;
            if (contextRow == null)
            {
                return;
            }

            Xceed.Grid.DetailGrid parentGrid = contextRow.ParentGrid;
            //int originalCnt = parentGrid.DataRows.Count;

            List <DataRow> list = new List <DataRow>();

            if (m_grid.GridControl.SelectedRows.Contains(contextRow))
            {
                if (!MessageForm.ShowYesNo("选定记录将要被删除,是否继续?", "确定", true))
                {
                    return;
                }
                foreach (Xceed.Grid.Row row in m_grid.GridControl.SelectedRows)
                {
                    Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                    if (dataRow != null && dataRow.ParentGrid == parentGrid)
                    {
                        list.Add(dataRow);
                    }
                }
            }
            else
            {
                if (!MessageForm.ShowYesNo("当前记录将要被删除,是否继续?", "确认", true))
                {
                    return;
                }
                Xceed.Grid.DataRow dataRow = contextRow as Xceed.Grid.DataRow;
                if (dataRow != null)
                {
                    list.Add(dataRow);
                }
            }

            try
            {
                int unDeleteCnt = 0;
                foreach (Xceed.Grid.DataRow dataRow in list)
                {
                    bool ret = DeleteByRow(dataRow);
                    if (!ret)
                    {
                        unDeleteCnt++;
                    }
                }

                //int nowCnt = parentGrid.DataRows.Count;
                if (unDeleteCnt > 0)
                {
                    MessageForm.ShowInfo(string.Format("因权限原因,有{0}条记录未删除!", unDeleteCnt));
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
        }