Beispiel #1
0
        public static bool cadastrar(string tabela, string[] dados)
        {
            bool   estado  = true;
            string s_dados = "";

            s_dados = Apoio.construirDados(dados);
            Conexao con = new Conexao();

            try
            {
                SqlCommand cursor = new SqlCommand("INSERT INTO " + tabela + "(" + infoTabela(tabela)[0] + ") VALUES ( '" + Login.cod_login + "' , " + s_dados + ", 'REGISTRADO')", con.conectar());
                cursor.ExecuteNonQuery();
            }
            catch { estado = false; }

            con.desconectar();
            return(estado);
        }
        private void login(string email, string senha)
        {
            Menu TelaMenu = new Menu();

            if (cod_login != Apoio.validarEmail(email))
            {
                cod_login = Apoio.validarEmail(email);
                if (Apoio.validarSenha(cod_login, senha))
                {
                    TelaMenu.Show();
                    this.Hide();
                }
                else
                {
                    erro_login.Visible = true;
                }
            }
            else
            {
                erro_login.Visible = true;
            }
        }
Beispiel #3
0
        private bool validarCamposClientes()
        {
            bool estado = false;

            if (mtb_nome.Text == "")
            {
                lb_nome_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_nome_err.Text = "*";
            }

            if (mtb_snome.Text == "")
            {
                lb_snome_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_snome_err.Text = "*";
            }

            if (mtb_cpf.Text == "   ,   ,   -")
            {
                lb_cpf_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_cpf_err.Text = "*";
            }

            if (mtb_email.Text == "")
            {
                lb_email_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_email_err.Text = "*";
            }

            if (mtb_celular.Text == "(  )       -")
            {
                lb_celular_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_celular_err.Text = "*";
            }

            if (mtb_cidade.Text == "")
            {
                lb_cidade_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_cidade_err.Text = "*";
            }

            if (mtb_endereco.Text == "")
            {
                lb_endereco_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_endereco_err.Text = "*";
            }

            if (mtb_numero.Text == "")
            {
                lb_numero_err.Text = Apoio.campo_obrigatorio();
            }
            else
            {
                lb_numero_err.Text = "*";
            }

            if (lb_nome_err.Text != Apoio.campo_obrigatorio())
            {
                if (lb_snome_err.Text != Apoio.campo_obrigatorio())
                {
                    if (lb_cpf_err.Text != Apoio.campo_obrigatorio())
                    {
                        if (lb_email_err.Text != Apoio.campo_obrigatorio())
                        {
                            if (lb_celular_err.Text != Apoio.campo_obrigatorio())
                            {
                                if (lb_cidade_err.Text != Apoio.campo_obrigatorio())
                                {
                                    if (lb_endereco_err.Text != Apoio.campo_obrigatorio())
                                    {
                                        if (lb_numero_err.Text != Apoio.campo_obrigatorio())
                                        {
                                            estado = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(estado);
        }