예제 #1
0
        private async Task carregarAgenda()
        {
            using (var ctx = new ITSolutionContext())
            {
                //performance em ate 60% mais rapido
                this.contatos = await ctx.Contatos
                                .ToListAsync();

                gridView1.FindFilterText      = "";
                gridControlContato.DataSource = contatos;
            }
        }
예제 #2
0
        private void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.IsSelectOneRowWarning())
            {
                var c = gridView1.GetFocusedRow() as Contato;

                var op = XMessageIts.Confirmacao("Deseja apagar o contato " + c.NomeContato + " da agenda ?");
                if (op == DialogResult.Yes)
                {
                    using (var ctx = new ITSolutionContext())
                    {
                        var contato = ctx.ContatoDao.Find(c.IdContato);
                        ctx.ContatoDao.Delete(contato);
                    }
                }
            }
        }
예제 #3
0
파일: XFrmMenu.cs 프로젝트: gercyc/ITE.ERP
        private void loadLembretes()
        {
            this.gridControl1.BeginInvoke(new Action(async() =>
            {
                using (var ctx = new ITSolutionContext())
                {
                    var lista = await ctx.LembreteDao.FindAllAsync();

                    gridControl1.DataSource = lista;
                    tileView1.RefreshData();
                    if (tileView1.DataRowCount > 0)
                    {
                        dockPanelRight.Visibility = DockVisibility.Visible;
                    }
                }
            }));
        }
예제 #4
0
        private async void searchControl1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string pesquisa = "" + searchControl1.EditValue;
                if (!string.IsNullOrEmpty(pesquisa))
                {
                    using (var ctx = new ITSolutionContext())
                    {
                        //carregando apenas os clientes
                        var lista = await ctx.Contatos.ToListAsync();

                        gridControlContato.DataSource = lista;
                        this.gridView1.FindFilterText = pesquisa;
                    }
                }
            }
        }
예제 #5
0
파일: MenuUtil.cs 프로젝트: gercyc/ITE.ERP
        /// <summary>
        /// Cria um contexto
        /// </summary>
        /// <returns></returns>O Contexto
        private BalcaoContext createCtx()
        {
            try
            {
                //retorna o pai
                this._ctx = new BalcaoContext();

                using (var ctxIts = new ITSolutionContext())
                {
                    ctxIts.LazyLoading(false);
                    ctxIts.LembreteDao.Find(1);
                }


                //apenas invoca o mesmo para criação das tabelas
                using (var ctxRpt = new ReportContext())
                {
                    ctxRpt.LazyLoading(false);
                    ctxRpt.ReportGroupDao.Find(1);
                }

                using (var ctxCambio = new CambioContext())
                {
                    ctxCambio.LazyLoading(false);
                    ctxCambio.MoedaDao.Find(1);
                }
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionJustMessage(ex, "Falha na inicialização do controlador do contexto!", "Falha no Sistema");
                Application.Exit();
                Environment.Exit(0);
            }

            return(_ctx);
        }