Example #1
0
        /// <summary>
        /// Passar uma array de string com as colunas que deseja exibir
        /// </summary>
        /// <typeparam name="T">Entidade</typeparam>
        /// <param name="context">Contexto</param>
        /// <param name="columnsView">Array de colunas</param>
        /// <param name="title">Titulo da janela</param>
        /// <returns></returns>
        public static dynamic ShowDiaglogFindEntity <T>(DbContextIts context,
                                                        string[] columnsView, T tipo, Stream layoutStream, string title = "Localizar:", Delegate action = null) where T : class
        {
            XFrmFindEntity xFrmFindEntity = initListaDinamica <T>(context, columnsView, title, tipo);

            if (layoutStream != null)
            {
                xFrmFindEntity.gridViewResults.RestoreLayoutFromStream(layoutStream, OptionsLayoutBase.FullLayout);
            }

            xFrmFindEntity.ShowDialog();

            xFrmFindEntity.setDelegateActionPerfomed(action);

            return(xFrmFindEntity.TEntity);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="lista"></param>A lista a ser exibida no grid
        /// <param name="layoutStream"></param>Layout
        /// <param name="title"></param>Titulo
        /// <param name="action"></param>Ação a ser disparada pelo botão extra
        /// <returns></returns>A entidade selecionada no grid
        public static T ShowDiaglogFindEntityFromList <T>(List <T> lista, Stream layoutStream, string title = "Localizar:",
                                                          Delegate action = null) where T : class
        {
            XFrmFindEntity xFrmFindEntity = new XFrmFindEntity();

            xFrmFindEntity.gridControlResults.DataSource = lista;
            if (layoutStream != null)
            {
                xFrmFindEntity.gridViewResults.RestoreLayoutFromStream(layoutStream, OptionsLayoutBase.FullLayout);
            }

            xFrmFindEntity.ShowDialog();

            xFrmFindEntity.setDelegateActionPerfomed(action);

            if (xFrmFindEntity.IsCancel)
            {
                return(null);
            }

            return(xFrmFindEntity.gridViewResults.GetFocusedRow <T>());
        }