Exemple #1
0
        private void navBarItemSelectMotorista_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            try
            {
                using (var ctx = new SlateContext())
                {
                    ctx.LazyLoading(false);

                    var x = XFrmFindEntity.ShowDialogFindEntity <Motorista>(new ParamsFindEntity()
                    {
                        Context       = ctx,
                        Columns       = new string[] { "IdMotorista", "NomeMotorista" },
                        DynamicObject = _motorista,
                        Title         = "Localizar Motorista"
                    });

                    //var x = XFrmFindEntity.ShowDiaglogFindEntity<Motorista>(ctx,
                    //    new string[] { "IdMotorista", "NomeMotorista" }, _motorista,
                    //    "Selecionar Motorista");

                    if (x != null)
                    {
                        //recupera o cliente
                        this._motorista = ctx.MotoristaDao.Find(x.IdMotorista);

                        this.lblMotorista.Text = this._motorista.NomeMotorista;
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionMessage(ex);
            }
        }
        private async void searchControl1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string pesquisa = "" + searchControl1.EditValue;
                var    ID       = ParseUtil.ToInt(pesquisa);
                if (!string.IsNullOrEmpty(pesquisa))
                {
                    //encapsular isso posteriormente
                    using (var ctx = new SlateContext())
                    {
                        ctx.LazyLoading(false);
                        List <OrdemCarga> lista;
                        if (ID > 0)
                        {
                            //carregando apenas o que for visivel
                            lista = await ctx.OrdensCargas
                                    .Include(v => v.Cliente)
                                    .Include(v => v.Usuario)
                                    .Where(v => v.IdOrdemCarga == ID)
                                    .ToListAsync();
                        }
                        else
                        {
                            lista = await ctx.OrdensCargas
                                    .Include(v => v.Cliente)
                                    .Include(v => v.Usuario)
                                    .Where(l => l.Cliente.RazaoSocial.Contains(pesquisa))
                                    .ToListAsync();
                        }

                        gridControlProposta.DataSource = lista;


                        this.gridViewOrdemCargas.FindFilterText = pesquisa;
                    }
                }
            }
        }
Exemple #3
0
        private void navBarItemSelecionarCliente_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            try
            {
                using (var ctx = new SlateContext())
                {
                    ctx.LazyLoading(false);
                    //carrega o layout dentro do projeto
                    var layoutStream = GridViewUtil.GetLayoutStreamFromResource(Assembly.GetExecutingAssembly(),
                                                                                "ITE.Slate.GridLayout.cliente_basico.xml");

                    var x = XFrmFindEntity.ShowDialogFindEntity <CliFor>(new ParamsFindEntity()
                    {
                        Context       = ctx,
                        Columns       = new string[] { "IdCliFor", "RazaoSocial", "TipoCliente", "CpfCnpj" },
                        DynamicObject = _cliFor,
                        Title         = "Selecionar Comprador",
                        Layout        = layoutStream
                    });

                    //var x = XFrmFindEntity.ShowDiaglogFindEntity<CliFor>(ctx,
                    //         new string[] { "IdCliFor", "RazaoSocial", "TipoCliente", "CpfCnpj" }, _cliFor, layoutStream,
                    //         "Selecionar Comprador");

                    if (x != null)
                    {
                        //recupera o cliente
                        this._cliFor         = ctx.ClienteDao.Find(x.IdCliFor);
                        this.lblCliente.Text = this._cliFor.RazaoSocial;
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionMessage(ex);
            }
        }