예제 #1
0
        //=========================================================
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (operacao == "novo")
            {
                int periodo = Ferramentas.BuscaCodigoPeriodo(cobPeriodo.Text);

                string data = DateTime.Today.ToString();

                var curso = new Cadastrar(txbDescricao.Text, periodo, data);

                LimpaTela();
                alteraBotoes(1);
            }
            else
            {
                int periodo = Ferramentas.BuscaCodigoPeriodo(cobPeriodo.Text);

                var data = DateTime.Now.ToString();

                var curso = new Atualizar(txbCodCurso.Text, txbDescricao.Text, periodo, data);

                LimpaTela();
                alteraBotoes(1);
            }
        }
예제 #2
0
        //=========================================================
        private void frmCadAtividade_Load(object sender, EventArgs e)
        {
            alteraBotoes(1);

            cobGrupo.DisplayMember = "descricaoGrupo";
            cobGrupo.DataSource    = Ferramentas.PreencheComboBoxGrupo();
        }
예제 #3
0
        //========================================================
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (operacao == "novo")
            {
                int curso = Ferramentas.BuscaCodigoCurso(cobCurso.Text);

                int turma = Ferramentas.BuscaCodigoTurma(cobTurma.Text);

                string data = DateTime.Today.ToString();

                var aluno = new Cadastrar(txbNome.Text, txbMatricula.Text, curso, turma, data);

                LimpaTela();
                alteraBotoes(1);
            }
            else
            {
                int curso = Ferramentas.BuscaCodigoCurso(cobCurso.Text);

                int turma = Ferramentas.BuscaCodigoTurma(cobTurma.Text);

                var data = DateTime.Now.ToString();

                var aluno = new Atualizar(txbCodAluno.Text, txbNome.Text, txbMatricula.Text, curso, turma, data);

                LimpaTela();
                alteraBotoes(1);
            }
        }
예제 #4
0
        //=========================================================
        private void frmCadCurso_Load(object sender, EventArgs e)
        {
            alteraBotoes(1);

            cobPeriodo.DisplayMember = "descricaoPeriodo";
            cobPeriodo.DataSource    = Ferramentas.PreencheComboBoxPeriodo();
        }
예제 #5
0
        //=========================================================
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (operacao == "novo")
            {
                //Busca o método que está dentro da classe 'Ferramentas' e passa o parametro com a combobox.
                int grupo = Ferramentas.BuscaCodigoGrupo(cobGrupo.Text);

                string data = DateTime.Today.ToString();

                var atividade = new Cadastrar(txbDescricao.Text, txbCargaHoraria.Text, grupo, data);

                LimpaTela();
                alteraBotoes(1);
            }
            else
            {
                int grupo = Ferramentas.BuscaCodigoGrupo(cobGrupo.Text);

                var data = DateTime.Now.ToString();

                var aluno = new Atualizar(txbCodAtividade.Text, txbDescricao.Text, txbCargaHoraria.Text, grupo, data);

                LimpaTela();
                alteraBotoes(1);
            }
        }
예제 #6
0
        private void Frm_Login_Load(object sender, EventArgs e)
        {
            /*
             *  Se o arquivo "Logo1.png" existir ele ira apagar o "logo.png" e mudar o nome do logo1 para "Logo.png".
             *
             *  Isso acontecera quando o usuario tenha trocado o logo da empresa e já existir um antigo.
             *  Na hora de salvar se já existir um logo antigo ele ira salvar com o nome de logo1.
             */

            if (File.Exists("Logo1.png"))
            {
                if (File.Exists("Logo.png"))
                {
                    File.Delete("Logo.png");

                    //Problemas em renomear arquivo então faz uma cópia e deleta o antigo.
                    File.Copy("Logo1.png", "Logo.png");
                    File.Delete("Logo1.png");
                }
            }


            //Carregando o logo para empresa
            if (File.Exists("Logo.png"))
            {
                //Carregando o logo da empresa para o PictureBox
                pictureBox1.ImageLocation = "Logo.png";
            }

            Txt_Login.Text = Ferramentas.RecuperarUltimoLogin();
        }
예제 #7
0
        public static bool Autenticar(string email, string senha)
        {
            senha = Ferramentas.Criptografar(senha);
            email = email.ToLower();

            return(UsuarioRepository.Autenticar(email, senha));
        }
예제 #8
0
        public static void Cadastrar(Usuario usuario)
        {
            usuario.Senha = Ferramentas.Criptografar(usuario.Senha);
            usuario.Email = usuario.Email.ToLower();

            UsuarioRepository.Adicionar(usuario);
        }
예제 #9
0
        public static void AtualizarCadastro(Usuario usuario)
        {
            usuario.Senha = Ferramentas.Criptografar(usuario.Senha);
            usuario.Email = usuario.Email.ToLower();

            UsuarioRepository.Atualizar(usuario);
        }
예제 #10
0
        //=========================================================
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (operacao == "novo")
            {
                int classificacao = Ferramentas.BuscaCodigoAtividade(cobClassificacao.Text);

                string data = DateTime.Today.ToString();

                var certificado = new Cadastrar(txbMatricula.Text, txbCodAluno.Text, txbData.Text, txbDescricao.Text, classificacao, txbCargaHoraria.Text, data);

                LimpaTela();
                alteraBotoes(1);
            }
            else
            {
                int classificacao = Ferramentas.BuscaCodigoAtividade(cobClassificacao.Text);

                var data = DateTime.Now.ToString();

                var certificado = new Atualizar(txbCodCertificado.Text, txbMatricula.Text, txbCodAluno.Text, txbDescricao.Text, txbCargaHoraria.Text, txbData.Text, classificacao, data);

                LimpaTela();
                alteraBotoes(1);
            }
        }
        /// <summary>
        /// Btm Salvar
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (ControllerPessoa.VerificarExistencia(Txt_Clientes.Text))
            {
                string Retorno = ControllerOrdemServico.Criar(PreencherOS());

                MessageBox.Show(String.Format("{0}", Retorno), "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (MessageBox.Show("Deseja imprimir  a ordem de serviço?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //TODO: Função para gerar uma ordem de serviço em PDF Aqui.
                }

                if (Ferramentas.VerificarEmailValido(ControllerPessoa.ObterEmail(Txt_Clientes.Text)))
                {
                    if (MessageBox.Show("Deseja enviar a ordem de serviço para o cliente?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        //TODO:Arrumar o código após a criação do sistema de e-mail
                        // string ResultadoEnvio = ControllerEmail.EnviarOrdemDeServiço(OSBase,EmpresaBase,PessoaBase);
                        // MessageBox.Show(ResultadoEnvio, "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                LimparCampos();
            }
            else
            {
                MessageBox.Show("Selecione um cliente!", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #12
0
        //========================================================
        private void btnLocalizar_Click(object sender, EventArgs e)
        {
            var form = new frmConsultaAluno();

            form.ShowDialog();

            if (form.codigo != "")
            {
                string curso = Ferramentas.ConverteCurso(form.curso);

                string turma = Ferramentas.ConverteTurma(form.turma);

                txbMatricula.Text = form.matricula.ToString();
                txbNome.Text      = form.nome;
                cobCurso.Text     = curso;
                cobTurma.Text     = turma;
                txbCodAluno.Text  = form.codigo;

                alteraBotoes(3);
            }
            else
            {
                LimpaTela();
                alteraBotoes(1);
            }
            form.Dispose();
        }
예제 #13
0
        //=========================================================
        private void btnLocalizar_Click(object sender, EventArgs e)
        {
            var form = new frmConsultaCertificado();

            form.ShowDialog();

            if (form.codigo != "")
            {
                string atividade = Ferramentas.ConverteAtividade(form.atividade);

                string aluno = Ferramentas.ConverteAluno(Convert.ToInt32(form.codAluno));

                txbCodCertificado.Text = form.codigo;
                txbMatricula.Text      = form.matricula;
                txbNome.Text           = aluno;
                txbDescricao.Text      = form.descricao;
                txbCargaHoraria.Text   = form.carga;
                txbData.Text           = form.data;
                cobClassificacao.Text  = atividade;
                txbCodAluno.Text       = form.codAluno.ToString();

                alteraBotoes(3);
            }
            else
            {
                LimpaTela();
                alteraBotoes(1);
                return;
            }
            form.Dispose();
        }
예제 #14
0
        public ActionResult Busca(string busca)
        {
            busca = Ferramentas.SubstituiAcentos(busca);
            var repositorio   = new Repositorio.Repositorio();
            var subCategorias = repositorio.ListarSubCategorias().Where(x => x.DescricaoSemAcentos.ToLower().Contains(busca.ToLower())).ToList();

            ViewBag.busca = busca;
            return(View(subCategorias));
        }
예제 #15
0
    protected void btnExcluir_Click(object sender, ImageClickEventArgs e)
    {
        int         Codigo = int.Parse(((ImageButton)sender).CommandArgument);
        Ferramentas fr     = new Ferramentas();

        fr.Codigo = Codigo;
        fr.Excluir();
        gridFerramenta.DataSource = Ferramentas.Listar();
        gridFerramenta.DataBind();
    }
예제 #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["LOGADO"] == null)
     {
         Response.Redirect("Default.aspx");
     }
     ;
     gridFerramenta.DataSource = Ferramentas.Listar();
     gridFerramenta.DataBind();
 }
예제 #17
0
        public void FormatarNumero()
        {
            //Arranje
            string numero = "745123";
            //Act
            var result = Ferramentas.FomataNumero(numero);

            //Assert
            result.Equals("745.123");
        }
예제 #18
0
        static void Main(string[] args)
        {
            /*
             * Console.WriteLine("~~~~~~~~~~~ Cadastro de cliente ~~~~~~~~~~~");
             * Cliente c = new Cliente();
             * c.Nome = "gravando cliente";
             * c.Telefone = "54";
             * c.CPF = "43";
             * c.Gravar();
             *
             *
             *
             * foreach (Cliente cl in Usuario.LerClientes())
             * {
             *     Console.WriteLine(cl.Nome);
             *     Console.WriteLine(cl.Telefone);
             *     Console.WriteLine(cl.CPF);
             *     Console.WriteLine("===========================");
             * }
             *
             */


            Ferramentas f = new Ferramentas();

            f.MetodoParaTodosQueUtilizarOAssembly();
            bool x = f.ValidarCPF("3232");



            Console.WriteLine("~~~~~~~~~~~ Cadastro de usuario ~~~~~~~~~~~");

            Usuario u = new Usuario();

            u.Nome     = "gravando usuario";
            u.Telefone = "54";
            u.CPF      = "43";
            u.Gravar();
            u.Olhar();

            /*
             *
             * foreach (Usuario us in Usuario.LerUsuarios())
             * {
             *  Console.WriteLine(us.Nome);
             *  Console.WriteLine(us.Telefone);
             *  Console.WriteLine(us.CPF);
             *  Console.WriteLine("===========================");
             *
             *
             * }*/

            Console.Read();
        }
예제 #19
0
        /// <summary>
        /// Validação server
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public override bool IsValid(object value)
        {
            if (value == null || string.IsNullOrEmpty(value.ToString()))
            {
                return(true);
            }

            bool valido = Ferramentas.ValidaCPF(value.ToString());

            return(valido);
        }
        public bool Insert(Ferramentas ferramenta)
        {
            bool   status = false;
            string sql    = string.Format(Ferramentas.INSERT, ferramenta.Descricao, ferramenta.Tipo, ferramenta.Marca, ferramenta.Preco);

            using (var connection = new DB())
            {
                status = connection.ExecQuery(sql);
            }
            return(status);
        }
예제 #21
0
 // Start is called before the first frame update
 void Start()
 {
     fer = ferramentaGameObject.GetComponent <Ferramentas>();
     fer.StartQuantPrices();
     telaTextsTrabalhadores = transform.GetChild(0).transform.GetChild(8).transform.GetChild(0).gameObject;
     homensNoWork           = 100;
     textHNW.text           = homensNoWork.ToString();
     for (int i = 0; i < 14; i++)
     {
         telaTextsTrabalhadores.transform.GetChild(i).transform.GetChild(5).GetComponent <Text>().text = prices[i].ToString();
     }
 }
예제 #22
0
        //========================================================
        private void frmCadAluno_Load(object sender, EventArgs e)
        {
            alteraBotoes(1);

            //Parâmetro necessário para exibir os valores recuperados no controle combobox.
            cobCurso.DisplayMember = "descricaoCurso";
            //Busca o método que está dentro da classe 'Ferramentas' e retorna o valor para o DataSource do controle combobox.
            cobCurso.DataSource = Ferramentas.PreencheComboBoxCurso();

            cobTurma.DisplayMember = "anoTurma";
            cobTurma.DataSource    = Ferramentas.PreencheComboBoxTurma();
        }
예제 #23
0
        static void Main(string[] args)
        {
            //Menu.Criar();

            /*
             * Console.WriteLine("================= Cadastro de Cliente ==================");
             * Cliente c = new Cliente();
             * c.Nome = "Cliente";
             * c.Telefone = "926600040";
             * c.CC = "236936529";
             * c.Gravar();
             *
             * foreach (Cliente cl in Cliente.LerClientes())
             * {
             *      Console.WriteLine(cl.Nome);
             *      Console.WriteLine(cl.Telefone);
             *      Console.WriteLine(cl.CC);
             *      Console.WriteLine("========================================================");
             * }
             */

            Ferramentas f = new Ferramentas();              // 2. criado nova instancia Ferramentas();

            f.MetodoParaTodosQueUtilizarOAssembly();        // 3. é possivel acessar o metodo publico mas não o internal criado anteriormente.
            bool d = f.ValidarCC("123456789");              // 4. é possivel acessar o metodo bool mas não o internal criado anteriormente.

            // 5. Nota de que agora Se forem ao diretorio Componentes, dentro de bin/Debug ja encontram uma dll que podem enviar a outros para partilhar
            // por E-mail por exemplo. o ficheiro Componentes.dll -->  C:\Users\josec\Source\Repos\Csharp-Open\16-POO-Protegidos_Internos\Componentes\bin\Debug

            Cliente c = new Cliente();

            // c.CalcularUmMaisDois3();
            c.CalcularUmMaisDois4();

            Console.WriteLine("================ Cadastro de Usuario ===================");
            Usuario u = new Usuario();

            u.Nome     = "Usuario";
            u.Telefone = "929955440";
            u.CC       = "188736529";
            //u.Gravar();
            u.Olhar();              // Testar o Usuario

            /*
             * foreach (Usuario us in Usuario.LerUsuarios())
             * {
             *      Console.WriteLine(us.Nome);
             *      Console.WriteLine(us.Telefone);
             *      Console.WriteLine(us.CC);
             *      Console.WriteLine("========================================================");
             * } */
        }
        private void Frm_OpicoesInicial_Load(object sender, EventArgs e)
        {
            String CaminhoLogo = String.Format("{0}/Logo.png", Ferramentas.ObterCaminhoDoExecutavel());

            pictureBox1.ImageLocation = CaminhoLogo;

            Model.Empresa EmpresaBase = new Model.Empresa();

            EmpresaBase = ControllerEmpresa.Load();

            Txt_Nome.Text     = EmpresaBase.Nome;
            Txt_Contato.Text  = EmpresaBase.Contato;
            Txt_Endereco.Text = EmpresaBase.Endereco;
        }
예제 #25
0
        protected void BtnSalvar_Click(object sender, EventArgs e)
        {
            Ferramentas ferramenta = getData();
            var         db         = new FerramentaDB();

            if (db.Insert(ferramenta))
            {
                LblMsg.Text = "Registro inserido!";
                LoadGrid();
            }
            else
            {
                LblMsg.Text = "Erro ao inserir registro";
            }
        }
예제 #26
0
        public static List <Cliente> BuscarClientes()
        {
            List <Cliente> clienteLista = null;

            try
            {
                var package =
                    new ExcelPackage(new FileInfo(Settings.Default.CaminhoUsuarios +
                                                  "Usuarios.xlsx"));
                var workBook = package.Workbook;
                clienteLista = new List <Cliente>();

                if (workBook != null)
                {
                    var worksheet = package.Workbook.Worksheets["Planilha1"];
                    var rowCount  = worksheet.Dimension.End.Row;

                    // Começa depois do cabeçalho
                    for (var row = 2; row <= rowCount; row++)
                    {
                        if (!string.IsNullOrEmpty(worksheet.Cells[row, 4].Value.ToString()))
                        {
                            clienteLista.Add(new Cliente(
                                                 worksheet.Cells[row, 1].Value?.ToString().Trim(),
                                                 worksheet.Cells[row, 5].Value?.ToString().Trim().ToUpper() == "SIM",
                                                 worksheet.Cells[row, 6].Value?.ToString().Trim(),
                                                 worksheet.Cells[row, 7].Value?.ToString().Trim(),
                                                 worksheet.Cells[row, 8].Value?.ToString().Trim(),
                                                 worksheet.Cells[row, 9].Value?.ToString().Trim(),
                                                 worksheet.Cells[row, 10].Value?.ToString(),
                                                 worksheet.Cells[row, 12].Value?.ToString(),
                                                 worksheet.Cells[row, 13].Value?.ToString().Trim().ToUpper() == "SIM",
                                                 worksheet.Cells[row, 14].Value?.ToString(),
                                                 worksheet.Cells[row, 15].Value?.ToString()
                                                 ));
                        }
                    }
                }

                package.Dispose();
            }
            catch (Exception ex)
            {
                Ferramentas.GravarLog("BuscarClientes", ex);
            }
            return(new List <Cliente>(clienteLista ?? throw new InvalidOperationException("Rotina BuscarClientes, retornou null!")));
        }
        private void Btm_Salvar_Click(object sender, EventArgs e)
        {
            try
            {
                Model.Empresa EmpresaBase = new Model.Empresa();

                EmpresaBase.Nome     = Txt_Nome.Text;
                EmpresaBase.Contato  = Txt_Contato.Text;
                EmpresaBase.Endereco = Txt_Endereco.Text;

                string Resultado = ControllerEmpresa.Save(EmpresaBase.Nome, EmpresaBase.Contato, EmpresaBase.Endereco);

                MessageBox.Show(Resultado, "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);

                String CaminhoLogo1 = String.Format("{0}/Logo1.png", Ferramentas.ObterCaminhoDoExecutavel());
                String CaminhoLogo  = String.Format("{0}/Logo.png", Ferramentas.ObterCaminhoDoExecutavel());

                if (TemFoto)
                {
                    /*
                     *  Se o arquivo do logo já existe ele cria um novo com o 1 no final para não dar erro(Arquivo já esta sendo usado), com esse
                     * erro não  posso excluir nem subistituir o arquivo por isso do numero 1 no final, e toda vez que o FRM_Login for chamado
                     * ele ira verificar se existe um arquivo "Logo1.png" e ira renomear para "Logo.png". (Na tela de login a imagen ainda não
                     * esta sendo usada, por isso dara para renomer/ excluir).
                     *
                     */
                    if (File.Exists(CaminhoLogo))
                    {
                        File.Copy(openFileDialog1.FileName, CaminhoLogo1);
                    }
                    else
                    {
                        File.Copy(openFileDialog1.FileName, CaminhoLogo);
                    }

                    pictureBox1.ImageLocation = CaminhoLogo1;

                    MessageBox.Show("Logo modificado com sucesso! Reinicie seu software para que as modificações sejam feitas.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception Exc)
            {
                ControllerArquivoLog.GeraraLog(Exc);

                MessageBox.Show("Ocorreu um erro inesperado, um arquivo de LOG foi criado no diretorio do seu software!");
            }
        }
예제 #28
0
    public static void ShowFerramenta(string t)
    {
        string strCss   = "";
        int    Contador = 0;

        DataTable dt = Ferramentas.ListarTipo(t);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Contador++;
            strCss = strCss + "<a href='" + dt.Rows[i]["url"].ToString() + "' ";
            strCss = strCss + "class='enlaceherr' target='_blank'>";
            strCss = strCss + Contador.ToString() + ") " + dt.Rows[i]["descricao"].ToString() + "</a> <br />";
        }

        HttpContext.Current.Response.Write(strCss);
    }
예제 #29
0
    protected void btnAlterar_Click(object sender, ImageClickEventArgs e)
    {
        int         codigo = int.Parse(((ImageButton)sender).CommandArgument.ToString());
        Ferramentas pc     = new Ferramentas();

        if (pc.Carregar(codigo))
        {
            lblCodigo.Text    = codigo.ToString();
            txtDescricao.Text = pc.Descricao.ToString();
            txtUrl.Text       = pc.Url.ToString();
            txtTipo.Text      = pc.Tipo.ToString();
        }
        else
        {
            btnNovo_Click(sender, e);
        }
    }
        private List <Ferramentas> TransformSQLReaderToList(SqlDataReader returnData)
        {
            var lst = new List <Ferramentas>();

            while (returnData.Read())
            {
                var item = new Ferramentas()
                {
                    Id        = int.Parse(returnData["id"].ToString()),
                    Descricao = returnData["descricao"].ToString(),
                    Marca     = returnData["Marca"].ToString(),
                    Tipo      = returnData["Tipo"].ToString(),
                    Preco     = returnData["Preco"].ToString(),
                };
                lst.Add(item);
            }
            return(lst);
        }