Пример #1
0
        internal static void AddDateItemToUnBoundGrid(this IBoundGrid grid, object dataItem)
        {
            GridInfo gridInfo = ADInfoBll.Instance.GetGridInfo(grid.GridName);

            if (!Authority.AuthorizeByRule(gridInfo.Visible))
            {
                return;
            }

            GridRowInfo gridRowInfo = ADInfoBll.Instance.GetGridRowInfo(grid.GridName);

            if (!Permission.AuthorizeByRule(gridRowInfo.Visible, dataItem))
            {
                return;
            }
            Xceed.Grid.DataRow row = grid.DataRows.AddNew();
            grid.SetDataRowsIListData(dataItem, row);
            row.EndEdit();
        }
Пример #2
0
        internal static void SetUnBoundGridDataBinding(this IBoundGrid grid)
        {
            try
            {
                grid.BeginInit();

                grid.DataRows.Clear();

                GridInfo gridInfo = ADInfoBll.Instance.GetGridInfo(grid.GridName);
                if (!Authority.AuthorizeByRule(gridInfo.Visible))
                {
                    return;
                }
                if (!string.IsNullOrEmpty(gridInfo.ReadOnly))
                {
                    grid.ReadOnly = Authority.AuthorizeByRule(gridInfo.ReadOnly);
                }

                GridRowInfo gridRowInfo = ADInfoBll.Instance.GetGridRowInfo(grid.GridName);

                foreach (object entity in grid.DisplayManager.Items)
                {
                    if (!Permission.AuthorizeByRule(gridRowInfo.Visible, entity))
                    {
                        continue;
                    }
                    Xceed.Grid.DataRow row = grid.DataRows.AddNew();
                    grid.SetDataRowsIListData(entity, row);
                    row.EndEdit();
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
            finally
            {
                grid.EndInit();
            }

            grid.AfterLoadData();
        }