コード例 #1
0
        private void FPreco_Lancamento_Shown(object sender, EventArgs e)
        {
            try
            {
                Padroes();

                if (Modo == Modo.Cadastrar)
                {
                    preco = new TB_EST_PRECO();
                }
                else if (Modo == Modo.Alterar)
                {
                    if (preco == null)
                    {
                        Excessoes.Alterar();
                    }

                    // Colocado a vericação para que quando não tiver preço no produto lançado no PDV, caia como alteração com os valores pré cadastrados.
                    if (preco.ID_PRECO.TemValor())
                    {
                        teID_PRECO.Text = preco.ID_PRECO.ToString();
                    }

                    beID_PRODUTO.Text = preco.ID_PRODUTO.ToString();
                    beID_PRODUTO_Leave(null, null);
                    rgTP_PRECO.SelectedIndex = preco.TP_PRECO.Validar() == "V" ? 0 : 1;
                    seVL_PRECO.Value         = preco.VL_PRECO.Padrao();
                }
            }
            catch (Exception excessao)
            {
                excessao.Validar();
            }
        }
コード例 #2
0
        public FAmbiente_Cadastro()
        {
            InitializeComponent();

            this.Shown += delegate
            {
                try
                {
                    if (Modo == Modo.Cadastrar)
                    {
                        Ambiente = new TB_GOU_AMBIENTE();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (Ambiente == null)
                        {
                            Excessoes.Alterar();
                        }

                        teIdentificador.Text = Ambiente.ID_AMBIENTE.ToString();
                        teNMAmbiente.Text    = Ambiente.NM.Validar();
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #3
0
        public FImpressora_Cadastro()
        {
            InitializeComponent();

            this.Shown += delegate
            {
                try
                {
                    if (Modo == Modo.Cadastrar)
                    {
                        impressora = new TB_GOU_IMPRESSORA();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (impressora == null)
                        {
                            Excessoes.Alterar();
                        }

                        teIdentificador.Text = impressora.ID_IMPRESSORA.ToString();
                        teNM.Text            = impressora.NM.Validar();
                        teCaminho.Text       = impressora.NM_CAMINHO.Validar();
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #4
0
        public FDepartamento_Cadastro()
        {
            InitializeComponent();
            this.Shown += delegate
            {
                try
                {
                    if (Modo == Modo.Cadastrar)
                    {
                        Departamento = new TB_EST_DEPARTAMENTO();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (Departamento == null)
                        {
                            Excessoes.Alterar();
                        }

                        teIdentificador.Text = Departamento.ID_DEPARTAMENTO.ToString();
                        teDescricao.Text     = Departamento.NM.Validar();
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #5
0
        public FCCusto_Cadastro()
        {
            InitializeComponent();

            this.Shown += delegate
            {
                try
                {
                    if (Modo == Modo.Cadastrar)
                    {
                        CCusto = new TB_FIN_CENTROCUSTO();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (CCusto == null)
                        {
                            Excessoes.Alterar();
                        }

                        teIdentificador.Text = CCusto.ID_CENTROCUSTO.ToString();
                        teDescricao.Text     = CCusto.NM.Validar();
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #6
0
        private void FMarca_Cadastro_Shown(object sender, EventArgs e)
        {
            try
            {
                if (Modo == Modo.Cadastrar)
                {
                    marca = new TB_EST_MARCA();
                }
                else if (Modo == Modo.Alterar)
                {
                    if (marca == null)
                    {
                        Excessoes.Alterar();
                    }

                    teID_MARCA.Text = marca.ID_MARCA.ToString();
                    teNM_MARCA.Text = marca.NM.Validar();
                }

                teNM_MARCA.Focus();
            }
            catch (Exception excessao)
            {
                excessao.Validar();
            }
        }
コード例 #7
0
        private void FGrupo_Cadastro_Shown(object sender, EventArgs e)
        {
            try
            {
                //tcgAdicionais.Visibility = Parametros.ST_Gourmet ? LayoutVisibility.Always : LayoutVisibility.Never;

                if (Modo == Modo.Cadastrar)
                {
                    Grupo = new TB_EST_GRUPO();
                }
                else if (Modo == Modo.Alterar)
                {
                    if (Grupo == null)
                    {
                        Excessoes.Alterar();
                    }

                    teID_GRUPO.Text           = Grupo.ID_GRUPO.ToString();
                    ceST_COMPLEMENTO.Checked  = Grupo.ST_COMPLEMENTO.Padrao();
                    ceST_ALMOXARIFADO.Checked = Grupo.ST_ALMOXARIFADO.Padrao();
                    ceST_FRACAO.Checked       = Grupo.ST_FRACAO.Padrao();
                    ceST_SERVICO.Checked      = Grupo.ST_SERVICO.Padrao();
                    teNM_GRUPO.Text           = Grupo.NM.Validar();

                    // Aba gourmet
                    if (tcgAdicionais.Visibility == LayoutVisibility.Always)
                    {
                        // Aba COM
                        if (Grupo.TB_EST_GRUPO_ADICIONAIs != null)
                        {
                            gcCOM.DataSource = (from a in Grupo.TB_EST_GRUPO_ADICIONAIs
                                                where a.TP == "C"
                                                select a).ToList();
                        }

                        // Aba SEM
                        if (Grupo.TB_EST_GRUPO_ADICIONAIs != null)
                        {
                            gcSEM.DataSource = (from a in Grupo.TB_EST_GRUPO_ADICIONAIs
                                                where a.TP == "S"
                                                select a).ToList();
                        }
                    }
                }
            }
            catch (Exception excessao)
            {
                excessao.Validar();
            }
        }
コード例 #8
0
        public FContas_Cadastro()
        {
            InitializeComponent();
            this.Shown += delegate
            {
                try
                {
                    if (Modo == Modo.Cadastrar)
                    {
                        duplicata = new TB_FIN_DUPLICATA();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (duplicata == null)
                        {
                            Excessoes.Alterar();
                        }

                        if (new QLiquidacao().Buscar(0, duplicata.ID_DUPLICATA).Count() > 0)
                        {
                            lcGeral.Enabled = false;
                        }

                        teIdentificador.Text = duplicata.ID_DUPLICATA.ToString();
                        teNrDocumento.Text   = duplicata.ID_DOCUMENTO;
                        deEmissao.Text       = duplicata.DT_EMISSAO.ToString();
                        rbPagar.Checked      = duplicata.TP == "P";
                        rbReceber.Checked    = duplicata.TP == "R";
                        beEmpresa.Text       = duplicata.ID_EMPRESA.ToString();
                        beEmpresa_Leave(null, null);
                        beClifor.Text = duplicata.ID_CLIFOR.ToString();
                        beClifor_Leave(null, null);
                        beCCusto.Text = duplicata.ID_CENTROCUSTO.ToString();
                        beCCusto_Leave(null, null);
                        beCondicao.Text = duplicata.ID_CONDICAOPAGAMENTO.ToString();
                        beCondicao_Leave(null, null);
                        seQtdParcelas.Value = duplicata.QT_PARCELAS ?? 0m;
                        seValor.Value       = duplicata.VL ?? 0m;
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #9
0
        private void FProduto_Cadastro_Shown(object sender, EventArgs e)
        {
            try
            {
                // Seta os padrões para os componentes
                Padroes();

                if (Modo == Modo.Cadastrar)
                {
                    Produto = new TB_EST_PRODUTO();
                }
                else if (Modo == Modo.Alterar)
                {
                    if (Produto == null)
                    {
                        Excessoes.Alterar();
                    }

                    #region Aba "Detalhes"

                    teID_PRODUTO.Text = Produto.ID_PRODUTO.ToString();
                    teNM_PRODUTO.Text = Produto.NM.Validar();

                    beID_UNIDADE.Text = Produto.ID_UNIDADE.ToString();
                    beID_UNIDADE_Leave(null, null);

                    beID_GRUPO.Text = Produto.ID_GRUPO.ToString();
                    beID_GRUPO_Leave(null, null);

                    beID_MARCA.Text = Produto.ID_MARCA != null?Produto.ID_MARCA.ToString() : beID_MARCA.Text;

                    beID_MARCA_Leave(null, null);

                    beID_DEPARTAMENTO.Text = Produto.ID_DEPARTAMENTO != null?Produto.ID_DEPARTAMENTO.ToString() : beID_DEPARTAMENTO.Text;

                    beID_DEPARTAMENTO_Leave(null, null);

                    ceST_ALMOXARIFADO.Checked = Produto.ST_ALMOXARIFADO.Padrao();
                    ceST_FRACAO.Checked       = Produto.ST_FRACAO.Padrao();
                    ceST_COMPLEMENTO.Checked  = Produto.ST_COMPLEMENTO.Padrao();
                    ceST_SERVICO.Checked      = Produto.ST_SERVICO.Padrao();

                    #endregion

                    #region Aba "Fiscal"

                    #region Aba "Detalhes"

                    teFCI.Text      = Produto.ID_FCI.Padrao();
                    beID_NCM.Text   = Produto.ID_NCM.Padrao().ToString();
                    beID_CFOP.Text  = Produto.ID_CFOP.Padrao().ToString();
                    beID_CST.Text   = Produto.ID_CST.Padrao().ToString();
                    beID_CSOSN.Text = Produto.ID_CSOSN.Padrao().ToString();
                    beID_CE.Text    = Produto.ID_CLASSEENQUADRAMENTO.Padrao().ToString();
                    beID_E.Text     = Produto.ID_ENQUADRAMENTO.Padrao().ToString();

                    #endregion

                    #endregion

                    #region CODBARRA

                    teCodBarra.Text = Produto.TB_EST_PRODUTO_BARRAs.FirstOrDefault().ID_BARRA_REFERENCIA ?? "";

                    #endregion

                    // Aba gourmet
                    if (lcgGourmet.Visibility == LayoutVisibility.Always)
                    {
                        ceST_BALANCA.Checked = Produto.TB_GOU_PRODUTO != null ? (Produto.TB_GOU_PRODUTO.ST_BALANCA != null ? Produto.TB_GOU_PRODUTO.ST_BALANCA.Padrao() : false) : false;

                        beID_IMPRESSORA.Text = Produto.TB_GOU_PRODUTO != null ? (Produto.TB_GOU_PRODUTO.ID_IMPRESSORA != null ? Produto.TB_GOU_PRODUTO.TB_GOU_IMPRESSORA.ID_IMPRESSORA.ToString() : beID_IMPRESSORA.Text) : beID_IMPRESSORA.Text;
                        beID_IMPRESSORA_Leave(null, null);

                        //// Aba composição
                        //if (Produto.TB_GOU_PRODUTO != null && Produto.TB_GOU_PRODUTO.TB_GOU_COMPOSICAOs != null)
                        //    composicao = (from a in QQuery.BancoDados.TB_GOU_COMPOSICAOs
                        //                               join b in QQuery.BancoDados.TB_EST_PRODUTOs on a.ID_PRODUTO_COMPOSTO equals b.ID_PRODUTO
                        //                               where a.ID_PRODUTO == Produto.ID_PRODUTO
                        //                               select new QComposicao.MComposicao
                        //                               {
                        //                                   ID_PRODUTO = a.ID_PRODUTO_COMPOSTO,
                        //                                   NM = b.NM,
                        //                                   QT = a.QT ?? 0m
                        //                               }).ToList();


                        //// Aba complemento
                        //if (Produto.TB_GOU_PRODUTO != null && Produto.TB_GOU_PRODUTO.TB_GOU_PRODUTO_X_GRUPOs != null)
                        //    bsComplemento.DataSource = (from a in QQuery.BancoDados.TB_GOU_PRODUTO_X_GRUPOs
                        //                                where a.ID_PRODUTO == Produto.ID_PRODUTO
                        //                                select new SYS.QUERYS.Cadastros.Estoque.QGrupo.MGrupo
                        //                                {
                        //                                    ID_GRUPO = a.ID_GRUPO,
                        //                                    NM = a.TB_EST_GRUPO.NM
                        //                                }).ToList();
                    }
                }

                teNM_PRODUTO.Focus();
            }
            catch (Exception excessao)
            {
                excessao.Validar();
            }
        }
コード例 #10
0
        public FEmpresa_Cadastro()
        {
            InitializeComponent();

            this.Shown += delegate
            {
                try
                {
                    beClifor.ButtonClick += delegate
                    {
                        try
                        {
                            using (var filtro = new SYS.FORMS.FFiltro()
                            {
                                Consulta = Clifor(false),
                                Colunas = new List <SYS.FORMS.Coluna>()
                                {
                                    new SYS.FORMS.Coluna {
                                        Nome = "ID", Descricao = "Identificador do clifor", Tamanho = 100
                                    },
                                    new SYS.FORMS.Coluna {
                                        Nome = "NM", Descricao = "Nome do clifor", Tamanho = 350
                                    }
                                }
                            })
                            {
                                if (filtro.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    beClifor.Text = (filtro.Selecionados.FirstOrDefault().ID as int?).Padrao().ToString();
                                    teRazao.Text  = (filtro.Selecionados.FirstOrDefault().NM as string).Validar();
                                }
                            }
                        }
                        catch (Exception excessao)
                        {
                            excessao.Validar();
                        }
                    };
                    Action CliforLeave = delegate
                    {
                        try
                        {
                            var grupo = Clifor(true).FirstOrDefaultDynamic();

                            beClifor.Text = grupo != null ? (grupo.ID as int?).Padrao().ToString() : "";
                            teRazao.Text  = grupo != null ? (grupo.NM as string).Validar() : "";
                        }
                        catch (Exception excessao)
                        {
                            excessao.Validar();
                        }
                    };
                    beClifor.Leave += delegate { CliforLeave(); };

                    if (Modo == Modo.Cadastrar)
                    {
                        empresa = new TB_CON_EMPRESA();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (empresa == null)
                        {
                            Excessoes.Alterar();
                        }

                        teIdentificador.Text = empresa.ID_EMPRESA.ToString();
                        beClifor.Text        = empresa.ID_CLIFOR.ToString().Validar();
                        CliforLeave();
                        ceGourmet.Checked = empresa.ST_GOURMET.Padrao();// ?? false;
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #11
0
        public FMesa_Cadastro()
        {
            InitializeComponent();

            this.Shown += delegate
            {
                try
                {
                    beAmbiente.ButtonClick += (s, e) =>
                    {
                        if (e.Button.Tag.ToString() == "adicionar")
                        {
                            try
                            {
                                using (var filtro = new SYS.FORMS.FFiltro()
                                {
                                    Consulta = Ambientes(false),
                                    Colunas = new List <SYS.FORMS.Coluna>()
                                    {
                                        new SYS.FORMS.Coluna {
                                            Nome = "ID", Descricao = "Identificador do ambiente", Tamanho = 100
                                        },
                                        new SYS.FORMS.Coluna {
                                            Nome = "NM", Descricao = "Nome do ambiente", Tamanho = 350
                                        }
                                    }
                                })
                                {
                                    if (filtro.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                    {
                                        beAmbiente.Text   = (filtro.Selecionados.FirstOrDefault().ID as int?).Padrao().ToString();
                                        teNMambiente.Text = (filtro.Selecionados.FirstOrDefault().NM as string).Validar();
                                    }
                                }
                            }
                            catch (Exception excessao)
                            {
                                excessao.Validar();
                            }
                        }
                    };

                    Action AmbienteLeave = delegate
                    {
                        try
                        {
                            var complemento = Ambientes(true).FirstOrDefaultDynamic();

                            beAmbiente.Text   = complemento != null ? (complemento.ID as int?).Padrao().ToString() : "";
                            teNMambiente.Text = complemento != null ? (complemento.NM as string).Validar() : "";
                        }
                        catch (Exception excessao)
                        {
                            excessao.Validar();
                        }
                    };

                    beAmbiente.Leave += delegate { AmbienteLeave(); };

                    if (Modo == Modo.Cadastrar)
                    {
                        Mesa = new TB_GOU_MESA();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (Mesa == null)
                        {
                            Excessoes.Alterar();
                        }

                        teInicial.ReadOnly = true;
                        teFinal.ReadOnly   = true;

                        teIdentificador.Text = Mesa.ID_MESA.ToString();
                        beAmbiente.Text      = Mesa.ID_AMBIENTE.ToString();
                        AmbienteLeave();
                        ceAtivo.Checked = Mesa.ST_ATIVO ?? false;
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }
コード例 #12
0
        public FUsuario_Cadastro()
        {
            InitializeComponent();

            this.Shown += delegate
            {
                try
                {
                    beClifor.ButtonClick += delegate
                    {
                        try
                        {
                            using (var filtro = new SYS.FORMS.FFiltro
                            {
                                Consulta = Clifor(false),
                                Colunas = new List <SYS.FORMS.Coluna>()
                                {
                                    new SYS.FORMS.Coluna {
                                        Nome = "ID", Descricao = "Identificador do clifor", Tamanho = 100
                                    },
                                    new SYS.FORMS.Coluna {
                                        Nome = "NM", Descricao = "Nome do clifor", Tamanho = 350
                                    }
                                }
                            })
                            {
                                if (filtro.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    beClifor.Text   = (filtro.Selecionados.FirstOrDefault().ID as int?).Padrao().ToString();
                                    teNMClifor.Text = (filtro.Selecionados.FirstOrDefault().NM as string).Validar();
                                }
                            }
                        }
                        catch (Exception excessao)
                        {
                            excessao.Validar();
                        }
                    };
                    Action CliforLeave = delegate
                    {
                        try
                        {
                            var unidade = Clifor(true).FirstOrDefaultDynamic();

                            beClifor.Text   = unidade != null ? (unidade.ID as int?).Padrao().ToString() : "";
                            teNMClifor.Text = unidade != null ? (unidade.NM as string).Validar() : "";
                        }
                        catch (Exception excessao)
                        {
                            excessao.Validar();
                        }
                    };
                    beClifor.Leave += delegate { CliforLeave(); };


                    if (Modo == Modo.Cadastrar)
                    {
                        usuario = new TB_CON_USUARIO();
                    }
                    else if (Modo == Modo.Alterar)
                    {
                        if (usuario == null)
                        {
                            Excessoes.Alterar();
                        }

                        teIdentificador.Text = usuario.ID_USUARIO.ToString();
                        teSenha.Text         = usuario.SENHA.Validar();
                        rgTP.SelectedIndex   = usuario.TP == "N" ? 0 : 1;
                        ceAtivo.Checked      = usuario.ST_ATIVO ?? false;
                        beClifor.Text        = usuario.ID_CLIFOR.ToString();
                        CliforLeave();

                        teIdentificador.ReadOnly = true;
                    }
                }
                catch (Exception excessao)
                {
                    excessao.Validar();
                }
            };
        }