示例#1
0
        private void BotaoExcluir(object sender, EventArgs e)
        {
            rolo = new Rolo();
            rolo.excluir(txtCodigo.Text);

            controlePanels("Excluir");
            limpaCampos();
            controle.controlaBotoes(toolPrincipal, "Excluir");
            toolStatus.Text = "...";
            carregaGridPrincipal();
            tabRegistros.SelectedIndex = 0;

            Mensagens.Informacao("Excluído com Sucesso!");
        }
示例#2
0
        private void BotaoSalvar(object sender, EventArgs e)
        {
            #region Validações

            if (txtCodigoMarca.Text.Length == 0)
            {
                Mensagens.Informacao("Preencha o Campo Marca");
                txtCodigoMarca.Focus();
                return;
            }

            if (txtDescricao.Text.Length == 0)
            {
                Mensagens.Informacao("Preencha o Campo Descrição");
                txtDescricao.Focus();
                return;
            }

            #endregion

            modelo = new Modelo(txtCodigo.Text, txtCodigoMarca.Text, txtDescricao.Text);

            if (toolStatus.Text == "Novo")
            {
                modelo.gravar("Novo");
            }
            else if (toolStatus.Text == "Editando")
            {
                modelo.Codigo_modelo = txtCodigo.Text;
                modelo.gravar("Atualizar");
            }

            if (!gravarAno())
            {
                Mensagens.Informacao("Aconteceu algum erro ao Salvar os Anos selecionados.");
                return;
            }

            toolStatus.Text = "...";
            controle.controlaBotoes(toolPrincipal, "Salvar");
            limpaCampos();
            controlePanels("Salvar");

            carregaGridPrincipal();
            tabRegistros.SelectedIndex = 0;

            Mensagens.Informacao("Salvo com Sucesso!");
        }
示例#3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtCodigoAno.Text.Length != 4)
            {
                Mensagens.Informacao("Este não parece um Ano válido. Por favor, verifique!");
                return;
            }

            if (txtCodigoAno.Text.Length > 0)
            {
                cbAnos.Items.Add(txtCodigoAno.Text.Trim());
                txtCodigoAno.Clear();
                txtCodigoAno.Focus();
                cbAnos.Sorted = true;
            }
        }
示例#4
0
        public static DialogResult ShowDialog(Form dialog)
        {
            FormCollection fc = Application.OpenForms;

            foreach (Form f in fc)
            {
                if (f.GetType().Equals(dialog.GetType()))
                {
                    Mensagens.Atencao("Rotina já está aberta!");
                    return(DialogResult.None);
                }
            }

            dialog.ShowInTaskbar = false;
            return(dialog.ShowDialog());
        }
示例#5
0
        private void BotaoExcluir(object sender, EventArgs e)
        {
            if (Mensagens.PeruntaSimNao("Deseja excluir esta Marca?") == DialogResult.No)
            {
                return;
            }

            marca = new Marca();
            marca.excluir(txtCodigo.Text);

            controlePanels("Excluir");
            limpaCampos();
            controle.controlaBotoes(toolPrincipal, "Excluir");
            toolStatus.Text = "...";
            carregaGridPrincipal();
            tabRegistros.SelectedIndex = 0;

            Mensagens.Informacao("Excluído com Sucesso!");
        }
示例#6
0
        private void BotaoSalvar(object sender, EventArgs e)
        {
            #region Validações

            if (txtDescricao.Text.Length == 0)
            {
                Mensagens.Informacao("Preencha o Campo Descrição");
                txtDescricao.Focus();
                return;
            }

            if (txtLargura.Text.Length == 0)
            {
                Mensagens.Informacao("Preencha o Campo Largura");
                txtLargura.Focus();
                return;
            }

            #endregion

            rolo = new Rolo(txtDescricao.Text, txtLargura.Text);

            if (toolStatus.Text == "Novo")
            {
                rolo.gravar("Novo");
            }
            else if (toolStatus.Text == "Editando")
            {
                //LogAlteracao.CriaLog(pnlManutencao, "", "Id", txtCodigo.Text);

                rolo.Id = txtCodigo.Text;
                rolo.gravar("Atualizar");
            }

            toolStatus.Text = "...";
            controle.controlaBotoes(toolPrincipal, "Salvar");
            limpaCampos();
            controlePanels("Salvar");
            carregaGridPrincipal();
            tabRegistros.SelectedIndex = 0;

            Mensagens.Informacao("Salvo com Sucesso!");
        }
示例#7
0
        private void btnValidarToken_Click(object sender, EventArgs e)
        {
            msgRetorno("Verificando Token, aguarde...");
            pnlToken.Enabled = false;
            RetornoValidacao rv = Token.criaToken(txtToken.Text.Trim());

            if (!rv.pronto)
            {
                Mensagens.Informacao(rv.message);
                pnlToken.Enabled = true;
                lbMensagem.Text  = "";
            }
            else
            {
                addCnpj();
                autorizado = true;
                this.Close();
            }
        }
示例#8
0
        private void toollSincronizacao_Click(object sender, EventArgs e)
        {
            if (!ValidaInternet.existeInternet())
            {
                Mensagens.Atencao("Não existe conexão com a internet");
                return;
            }

            string oldCalculando = lbCalculando.Text;

            lbCalculando.Text     = "CRIPTOGRAFANDO A BASE, ISSO PODE DEMORAR ALGUNS MINUTOS. POR FAVOR AGUARDE...";
            pnlCalculando.Visible = true;
            pbCalc.Visible        = true;
            lbCalculando.Location = new Point(0, 0);
            lbCalculando.Width    = lbCalculando.Parent.Width;

            Color oldColor = pnlCalculando.BackColor;

            pnlCalculando.BackColor = Color.WhiteSmoke;

            lbCalculando.Enabled = true;

            this.Enabled = false;
            SyncFullDatabase.CriptografarBase(pbCalc);

            pnlCalculando.BackColor = oldColor;
            pnlCalculando.Visible   = false;
            pbCalc.Visible          = false;

            this.Enabled = true;

            lbCalculando.Text = oldCalculando;

            DBManager.CloseDatabases();

            if (Mensagens.PeruntaSimNao("Deseja Enviar todas as Alterações para o Servidor?\nTudo enviado será compartilhado com os Clientes.") == DialogResult.Yes)
            {
                FrmSync.ShowSync(true, false, false);
            }

            DBManager.InitDB();
        }
示例#9
0
        private void btnBuscaMarca_Click(object sender, EventArgs e)
        {
            if (Application.OpenForms.OfType <FrmCadMarca>().Count() > 0)
            {
                Mensagens.Atencao("Rotina já esta aberta!");
            }
            else
            {
                FrmCadMarca frm = new FrmCadMarca();
                frm.iRotinaInterna = true;
                frm.ShowDialog();

                if (frm.codigoInterno != null)
                {
                    txtCodigoMarca.Text = frm.codigoInterno;
                    txtCodigoMarca_Leave(txtCodigoMarca.Text, EventArgs.Empty);
                    txtDescricao.Focus();
                }
            }
        }
示例#10
0
        private void FrmPrincipal_Load(object sender, EventArgs e)
        {
            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is MdiClient)
                {
                    ctrl.BackColor = ColorTranslator.FromHtml("#f7f6f6");
                }
            }

            //if (!Debugger.IsAttached)
            //{
            FrmLogin frm = new FrmLogin();

            frm.ShowInTaskbar = false;
            frm.ShowDialog();

            if (frm.autorizado)
            {
                pnlFiltroInfo.Visible = true;
                pnlprincipal.Visible  = true;
                //pnlMapa.Visible = true;
                vvModelo.Visible  = true;
                toolCorte.Visible = true;

                if (Glass.usuario.master != null && Glass.usuario.master != "null" && Glass.usuario.master.Equals("S"))
                {
                    toolArquivo.Visible        = true;
                    toollSincronizacao.Visible = true;
                }

                Glass.usuario.nome = frm.txtNome.Text;

                string mensagemRetorno = ConexaoValidaLogin.mensalidadeAVencer();
                if (mensagemRetorno.Length > 0)
                {
                    Mensagens.Informacao(mensagemRetorno);
                }

                mensagemRetorno = ConexaoValidaLogin.mensalidadeVencida();
                if (mensagemRetorno.Length > 0)
                {
                    Mensagens.Informacao(mensagemRetorno);
                }

                mensagemRetorno = ConexaoValidaLogin.mensalidadeAtrasada();
                if (mensagemRetorno.Length > 0)
                {
                    Mensagens.Atencao(mensagemRetorno);
                    Application.Exit();
                }
            }
            //}
            //else
            //{
            //    pnlFiltroInfo.Visible = true;
            //    pnlprincipal.Visible = true;
            //    //pnlMapa.Visible = true;
            //    vvModelo.Visible = true;
            //    toolCorte.Visible = true;
            //    toolArquivo.Visible = true;
            //    toollSincronizacao.Visible = true;

            //}


            DBManager.VerificaTabelasAuxiliares();

            /*
             * SyncManager.SyncTables.AddRange(new string[] { "ELIMINA_REGISTRO", "MODELO", "MARCA", "MODELO_ANO", "ROLO", "!DESENHOS" });
             * SyncManager.Synckeys.AddRange(new string[] { "ID", "CODIGO_MODELO", "ID", "CODIGO_ANO", "ID", "VEICULO" });
             *
             * SyncManager.SyncStatus = new UpdateSyncStatus(SyncStatusProc);
             * SyncManager.CheckTables();
             *
             * if (Debugger.IsAttached)
             * {
             *  //SyncManager.Syncronize(SyncType.Outgoing);
             * }
             */

            lbQtde.Text = sel.AtualizaMarcas() + " desenhos cadastrados sendo\n" + DBManager.GetNumVeiculoMarca();

            cbMarca.Focus();
            calculapalavra();
        }
示例#11
0
        private void vvModelo_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (filmeAtual == null)
            {
                Mensagens.Atencao("Nenhum filem selecionado!");
                return;
            }

            if (nestManager == null)
            {
                int margin = 0;
                try { margin = 2 * int.Parse(Program.Config["margin"]); } catch { }

                nestManager = new NestManager(filmeAtual.Largura - margin);
            }

            //vvCorte.ImportSelection(vvModelo);

            foreach (VectorPath p in vvModelo.Document.Selection)
            {
                Cursor = Cursors.WaitCursor;
                pnlprincipal.Enabled = false;
                vvCorte.Enabled      = false;
                loadpanel("Adicionando Peça ao Mapa, Aguarde...");

                VectorPath ip = vvCorte.Document.ImportPath(p);
                nestManager.RegisterPath(ip);

                bool forceNest = false;
                try { forceNest = bool.Parse(Program.Config["forceAutoNest"]); } catch { }
                bool forceAngle = false;

                if (forceNest)
                {
                    forceAngle = false; // Isso vai fazer o autonest procurar em todos os ângulos
                }
                else
                {
                    forceAngle = p.ForceAngle; // Respeita o que está defindo no cadastro.
                }

                ip.ForceAngle = forceAngle;

                if (!nestManager.NestPath(ip))
                {
                    vvCorte.Document.Paths.Remove(ip);
                    Mensagens.Atencao("Peça muito grande para ser cortada neste filme!");

                    ip.Source.Imported = false;

                    continue;
                }

                UpdateDocInfo();
                pnlprincipal.Enabled  = true;
                pnlCalculando.Visible = false;
            }

            Cursor               = Cursors.Arrow;
            vvCorte.Enabled      = true;
            pnlprincipal.Enabled = true;

            if (vvCorte.Document.Paths.Count == 1)
            {
                vvCorte.AutoFit();
            }

            vvCorte.Refresh();

            UpdateImportCount();
            UpdateViewCorte();
        }
示例#12
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            if (salvando)
            {
                return;
            }

            salvando = true;

            try
            {
                if (lbAnos.CheckedItems.Count <= 0)
                {
                    MessageBox.Show("Nenhum ano selecionado", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                VectorDocument doc = vectorView.Document;

                pbDesenho.Value   = 0;
                pbDesenho.Maximum = lbAnos.CheckedItems.Count;
                pbDesenho.Visible = true;

                Application.DoEvents();

                if (doc != null)
                {
                    string svg = null;

                    if (doc != null && doc.Paths.Count > 0)
                    {
                        svg = doc.ToSVG();
                    }

                    foreach (object i in lbAnos.CheckedItems)
                    {
                        ModeloAno v = (ModeloAno)i;

                        DBManager.SalvarDesenho(Convert.ToInt32(v.Codigo_ano), svg, txtObs.Text, sel.TipoDesenho, imageData);

                        pbDesenho.Value++;
                        Application.DoEvents();
                    }

                    Mensagens.Informacao("Desenho Salvo com Sucesso!");
                    pbDesenho.Visible = false;

                    toolStripButton1_Click(sender, e);
                    cbMarca.Focus();
                }
                else
                {
                    MessageBox.Show("Nenhum desenho carregado!", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }

                pbDesenho.Visible = false;
                lbAnos.Items.Clear();

                rbEsquerda.Checked = false;
                rbDireita.Checked  = false;
                tbEtiqueta.Text    = "";
                tbNomePeca.Text    = "";
            }
            catch
            {
            }
            finally
            {
                salvando = false;
            }
        }
示例#13
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (salvando)
            {
                return;
            }

            salvando = true;

            try
            {
                if (lbAnos.CheckedItems.Count <= 0)
                {
                    MessageBox.Show("Nenhum ano selecionado", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                if (MessageBox.Show("Deseja realmente remover o desenho dos anos selecionados?", "ATENÇÃO", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                pbDesenho.Value   = 0;
                pbDesenho.Maximum = lbAnos.CheckedItems.Count;
                pbDesenho.Visible = true;

                Application.DoEvents();

                try
                {
                    foreach (object i in lbAnos.CheckedItems)
                    {
                        ModeloAno v = (ModeloAno)i;
                        DBManager.RemoverDesenho(Convert.ToInt32(v.Codigo_ano));

                        pbDesenho.Value++;
                        Application.DoEvents();
                    }

                    Mensagens.Informacao("Desenho Removido com Sucesso!");
                    pbDesenho.Visible = false;

                    toolStripButton1_Click(sender, e);
                    cbMarca.Focus();
                }
                catch
                {
                }
                pbDesenho.Visible = false;
                lbAnos.Items.Clear();

                rbEsquerda.Checked = false;
                rbDireita.Checked  = false;
                tbEtiqueta.Text    = "";
                tbNomePeca.Text    = "";
            }
            catch
            {
            }
            finally
            {
                salvando = false;
            }
        }
示例#14
0
        private void btnExportar_Click(object sender, EventArgs e)
        {
            if (salvando)
            {
                return;
            }

            salvando = true;

            try
            {
                if (lbAnos.CheckedItems.Count <= 0)
                {
                    MessageBox.Show("Nenhum ano selecionado. Selecione um ou mais anos para exportação", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                VectorDocument doc = vectorView.Document;

                FolderBrowserDialog fbd = new FolderBrowserDialog();

                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    pbDesenho.Value   = 0;
                    pbDesenho.Maximum = lbAnos.CheckedItems.Count;
                    pbDesenho.Visible = true;

                    Application.DoEvents();

                    string baseName = fbd.SelectedPath + "\\" + string.Format("{0}-{1}", cbMarca.Text, cbModelo.Text).Replace('\\', '_');

                    foreach (object i in lbAnos.CheckedItems)
                    {
                        ModeloAno v = (ModeloAno)i;

                        int codDesenho = 0;

                        string ppv = null;
                        string svg = DBManager.CarregarDesenho(Convert.ToInt32(v.Codigo_ano), out codDesenho, sel.TipoDesenho);

                        string fname = string.Format("{0} {1}.svg", baseName, v.Ano);

                        if (File.Exists(fname))
                        {
                            File.Delete(fname);
                        }

                        File.WriteAllText(fname, svg, Encoding.UTF8);

                        if (ppv != null)
                        {
                            fname = string.Format("{0} {1}-ppv.svg", baseName, v.Ano);

                            if (File.Exists(fname))
                            {
                                File.Delete(fname);
                            }

                            File.WriteAllText(fname, ppv, Encoding.UTF8);
                        }

                        pbDesenho.Value++;
                        Application.DoEvents();
                    }

                    Mensagens.Informacao("Desenho Exportado com Sucesso!");
                    pbDesenho.Visible = false;

                    toolStripButton1_Click(sender, e);
                    cbMarca.Focus();

                    pbDesenho.Visible = false;
                    lbAnos.Items.Clear();

                    rbEsquerda.Checked = false;
                    rbDireita.Checked  = false;
                    tbEtiqueta.Text    = "";
                    tbNomePeca.Text    = "";
                }
            }
            catch
            {
            }
            finally
            {
                salvando = false;
            }
        }
示例#15
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            //if (Debugger.IsAttached)
            //{
            //    autorizado = true;
            //    Close();
            //    return;
            //}

            if (txtNome.Text.Trim().Length == 0 || txtSenha.Text.Trim().Length == 0)
            {
                Mensagens.Informacao("Preencha o Login e Senha corretamente para Continuar");
                return;
            }

            if (txtCnpj.Text.Length == 0 && txtCnpj.Visible)
            {
                Mensagens.Informacao("Preencha o Cnpj ou Cpf para Continuar");
                return;
            }

            pnlLogin.Enabled = false;
            msgRetorno("Entrando, aguarde...");

            if (ValidaInternet.existeInternet())
            {
                ValidaLogin      vi = new ValidaLogin(txtNome.Text.Trim(), txtSenha.Text.Trim(), txtCnpj.Text.Trim());
                RetornoValidacao rv = new RetornoValidacao();

                if (txtCnpj.Text.Trim().Length > 0)
                {
                    rv = vi.verificaLicenca();
                }

                if (rv.pronto || txtCnpj.Text.Trim().Length == 0)
                {
                    if (txtCnpj.Text.Trim().Length == 0)
                    {
                        ValidaLogin.cnpj = buscaCnpj();
                    }

                    rv = vi.inicia();

                    if (rv.pronto)
                    {
                        if (vi.valida())
                        {
                            addCnpj();
                            ConexaoValidaLogin.atualizaAcesso();
                            autorizado = true;
                            this.Close();
                        }
                        else
                        {
                            if (Glass.usuario.licenca.Length > 0)
                            {
                                Mensagens.Informacao("Este Computador não possui uma Licença Ativa.");
                                pnlToken.Visible = false;
                                pnlToken.Enabled = true;
                                pnlLogin.Enabled = true;
                                lbMensagem.Text  = "";
                            }
                            else if (!Glass.usuario.status.Equals("A"))
                            {
                                Mensagens.Informacao("Cliente Bloqueado, por favor, entre em Contato.");
                                pnlToken.Visible = false;
                                pnlToken.Enabled = true;
                                pnlLogin.Enabled = true;
                                lbMensagem.Text  = "";
                            }
                            else
                            {
                                pnlToken.Visible = true;
                                pnlToken.Enabled = true;
                                pnlLogin.Enabled = true;
                                lbMensagem.Text  = "";

                                pnlLogin.Size = new Size(352, 99);
                                this.Size     = new Size(358, 317);
                            }
                        }
                    }
                    else
                    {
                        Mensagens.Informacao(rv.message);
                        pnlToken.Visible = false;
                        pnlToken.Enabled = true;
                        pnlLogin.Enabled = true;
                        lbMensagem.Text  = "";
                    }
                }
                else
                {
                    Mensagens.Informacao(rv.message);
                    pnlToken.Visible = false;
                    pnlToken.Enabled = true;
                    pnlLogin.Enabled = true;
                    lbMensagem.Text  = "";
                }
            }
            else
            {
                MessageBox.Show("Sem Internet");
                pnlLogin.Enabled = true;
                lbMensagem.Text  = "";
            }
        }