protected void Page_Load(object sender, EventArgs e)
        {
            String Form_user = "******";

            // *** Inicio da rotina de verificação
            String nome_3 = strNomeUser();

            if (nome_3 == null)
            {
                nome_3 = "";
                Response.Redirect("WebLogar1.aspx");
                Response.End();
            }
            else
            {
                // Verifica se Usuario tem permissao para uso

                // *****************************************************************************************
                string nodo_Form = Form_user;   // <<< **** Não esquecer de colocar o nome do Form **** >>>
                // *****************************************************************************************

                Funcoes1 busca_pro  = new Funcoes1();
                string   busca_pro1 = busca_pro.progr_user(nodo_Form, nome_3, strConx());

                if (busca_pro1 == "NAO_FAZ")
                {
                    Response.Redirect("Acessedenied.aspx");
                    Response.End();
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // *** Inicio da rotina de verificação

            String strSessao3 = (string)Session["usuarSessa"];
            String strSenha3  = (string)Session["senhrSessa"];
            String nome_3     = strSessao3;

            if (nome_3 == null)
            {
                nome_3 = "";
                Response.Redirect("WebLogar1.aspx");
                Response.End();
            }
            else
            {
                // Verifica se Usuario tem permissao para uso

                // *****************************************************************************************
                string nodo_Form = "CapturaUser";   // <<< **** Não esquecer de colocar o nome do Form **** >>>
                // *****************************************************************************************

                Funcoes1 busca_pro  = new Funcoes1();
                string   busca_pro1 = busca_pro.progr_user(nodo_Form, nome_3, strConx());

                if (busca_pro1 == "NAO_FAZ")
                {
                    Response.Redirect("Acessedenied.aspx");
                    Response.End();
                }
            }
            // *** fim da rotina de verificação


            if (Request.QueryString["produto"] != "")
            {
                this.lblLabel1.Text  = Request.QueryString["produto"];
                this.lblmsgerro.Text = "";
                string cod_prod = "";
                int    cod_info = 0;
                cod_prod = Request.QueryString["codigo"];
                cod_info = Convert.ToInt32(Request.QueryString["inf"]);
            }
            else
            {
                Button2.Enabled = false;

                this.lblmsgerro.Text = "Menhum Usuario Encontrado !!!";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string tabelaper = "tt_ser_01";
            String Form_user = "******";

            // *** Inicio da rotina de verificação
            String nome_3 = strNomeUser();

            if (nome_3 == null)
            {
                nome_3 = "";
                Response.Redirect("WebLogar1.aspx");
                Response.End();
            }
            else
            {
                // Verifica se Usuario tem permissao para uso

                // *****************************************************************************************
                string nodo_Form = Form_user;   // <<< **** Não esquecer de colocar o nome do Form **** >>>
                // *****************************************************************************************

                Funcoes1 busca_pro  = new Funcoes1();
                string   busca_pro1 = busca_pro.progr_user(nodo_Form, nome_3, strConx());

                if (busca_pro1 == "NAO_FAZ")
                {
                    Response.Redirect("Acessedenied.aspx");
                    Response.End();
                }

                // Verificar quais botoes pode ser usado

                string per_1 = "";
                string per_2 = "";
                string per_3 = "";
                string per_4 = "";

                // ******  Inicio da Busca do Programa
                using (MySqlConnection connection6 = new MySqlConnection(strConx()))
                {
                    MySqlCommand    cmd6;
                    MySqlDataReader dr6;
                    connection6.Open();
                    try
                    {
                        cmd6             = connection6.CreateCommand();
                        cmd6.CommandText = "SELECT * FROM permissoes WHERE login = '******' AND tabela = '" + tabelaper.ToUpper() + "'";
                        dr6 = cmd6.ExecuteReader();

                        if (dr6.Read())
                        {
                            per_1 = dr6["incluir"].ToString();
                            per_2 = dr6["alterar"].ToString();
                            per_3 = dr6["excluir"].ToString();
                            per_4 = dr6["imprimir"].ToString();
                        }

                        if (per_1 == "SIM")
                        {
                            this.Incluir.Enabled = true;
                        }
                        if (per_2 == "SIM")
                        {
                            this.Alterar.Enabled = true;
                        }
                        if (per_3 == "SIM")
                        {
                            this.Excluir.Enabled = true;
                        }
                        if (per_4 == "SIM")
                        {
                            this.Imprimir1.Enabled = true;
                        }
                    }
                    catch { }
                }
                // Fim da Verificacao dos botoes
            }

            if (!Page.IsPostBack)
            {
                // Consulta para voltar a mesma tela

                if (Request.QueryString["codigo"] != null)
                {
                    this.Fotoprod1.Enabled = true;

                    string cod_ret = "";
                    cod_ret = Request.QueryString["codigo"];

                    String query = "";
                    query = "SELECT * FROM tt_ser_01 WHERE login = '******'";


                    using (MySqlConnection con = new MySqlConnection(strConx()))
                    {
                        MySqlDataReader dr;
                        MySqlCommand    command = con.CreateCommand();
                        command.CommandText = query;

                        try
                        { con.Open(); }
                        catch { }

                        try
                        {
                            dr = command.ExecuteReader();
                            // Mostra registros na tela
                            if (dr.Read())
                            {
                                this.txtid.Value      = dr["id"].ToString();
                                this.txtlogin.Text    = dr["login"].ToString();
                                this.txtsenha.Text    = dr["senha2"].ToString();
                                this.txtData.Text     = dr["data"].ToString();
                                this.txtNome.Value    = dr["nome_l"].ToString();
                                this.txtMaquina.Value = dr["maquina"].ToString();
                                this.txtConta.ClearSelection();
                                this.txtConta.Items.Insert(0, dr["conta"].ToString());
                                this.txtPrograma.Value = dr["programas"].ToString();
                                this.txtHora1.Value    = dr["hora1"].ToString();
                                this.txtHora2.Value    = dr["hora2"].ToString();
                                this.txtTipo.ClearSelection();
                                this.txtTipo.Items.Insert(0, dr["tipo"].ToString());
                                this.txtSemana.Value   = dr["semana"].ToString();
                                this.txtEmail.Value    = dr["e_mail"].ToString();
                                this.txtfoto1.ImageUrl = dr["foto"].ToString();
                            }
                        }
                        catch { }
                    }
                }
                else
                {
                    this.Fotoprod1.Enabled = false;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                if (this.txtidforne.Value == "")
                {

                    CarregaCombo();

                }


            }
            string tabelaper = "Estoque";
            String Form_user = "******";

            // *** Inicio da rotina de verificação
            String nome_3 = strNomeUser();
            if (nome_3 == null)
            {

                nome_3 = "";
                Response.Redirect("WebLogar1.aspx");
                Response.End();

            }
            else
            {


                // *****************************************************************************************
                string nodo_Form = Form_user;   // <<< **** Não esquecer de colocar o nome do Form **** >>>
                // *****************************************************************************************

                Funcoes1 busca_pro = new Funcoes1();
                string busca_pro1 = busca_pro.progr_user(nodo_Form, nome_3, strConx());

                if (busca_pro1 == "NAO_FAZ")
                {
                    Response.Redirect("Acessedenied.aspx");
                    Response.End();
                }

                // Verificar quais botoes pode ser usado

                string per_1 = "";
                string per_2 = "";
                string per_3 = "";
                string per_4 = "";

                // ******  Inicio da Busca do Programa
                using (MySqlConnection connection6 = new MySqlConnection(strConx()))
                {
                    MySqlCommand cmd6;
                    MySqlDataReader dr6;
                    connection6.Open();
                    try
                    {
                        cmd6 = connection6.CreateCommand();
                        cmd6.CommandText = "SELECT * FROM permissoes WHERE login = '******' AND tabela = '" + tabelaper.ToUpper() + "'";
                        dr6 = cmd6.ExecuteReader();

                        if (dr6.Read())
                        {
                            per_1 = dr6["incluir"].ToString();
                            per_2 = dr6["alterar"].ToString();
                            per_3 = dr6["excluir"].ToString();
                            per_4 = dr6["imprimir"].ToString();
                        }

                        if (per_1 == "SIM") { this.Incluir.Enabled = true; }
                        if (per_2 == "SIM") { this.Alterar.Enabled = true; }
                        if (per_3 == "SIM") { this.Excluir.Enabled = true; }
                        if (per_4 == "SIM") { this.Imprimir1.Enabled = true; }
                    }
                    catch { }
                }
                // Fim da Verificacao dos botoes

            }


            if (!Page.IsPostBack)
            {

                // Consulta para voltar a mesma tela

                if (Request.QueryString["codigo"] != "")
                {
                    this.Fotoprod1.Enabled = true;

                    int cod_ret = 0;
                    cod_ret = Convert.ToInt32(Request.QueryString["codigo"]);

                    String query = "";
                    query = "SELECT * FROM estoque WHERE codigo = '" + cod_ret + "'";


                    //Request.QueryString["codigo"] = "";

                    using (MySqlConnection con = new MySqlConnection(strConx()))
                    {
                        MySqlDataReader dr;
                        MySqlCommand command = con.CreateCommand();
                        command.CommandText = query;

                        try
                        {
                            con.Open();

                        }
                        catch { }

                        try
                        {

                            dr = command.ExecuteReader();
                            // Mostra registros na tela
                            if (dr.Read())
                            {

                                this.txtid.Value = dr["id"].ToString();
                                this.txtCodigo.Value = dr["codigo"].ToString();
                                this.txtData.Text = dr["data"].ToString();
                                this.txtDescricao.Value = dr["descricao"].ToString();
                                this.txtUnidade.Value = dr["unidade"].ToString();
                                this.txtQtd.Value = dr["qtd_estq"].ToString();
                                this.txtMini.Value = dr["qtd_mini"].ToString();
                                this.txtClasse.Text = dr["classe"].ToString();
                                this.txtVencto.Text = dr["vencimento"].ToString();
                                this.txtFornecedor.ClearSelection();
                                this.txtFornecedor.Items.Insert(0, dr["fornecedor"].ToString());
                                this.txtidforne.Value = dr["fornecedor"].ToString();
                                this.txtRefere.Value = dr["referencia"].ToString();
                                this.txtSaldo.Value = dr["saldo"].ToString();
                                this.txtValor.Value = dr["valor"].ToString();
                                this.txtObs.Value = dr["obs"].ToString();
                                this.foto1.ImageUrl = dr["foto"].ToString();
                                this.lblBarra1.Text = "!0000000000" + this.txtCodigo.Value + "!";

                            }
                        }
                        catch { }
                    }
                }
                else
                {
                    this.Fotoprod1.Enabled = false;
                }
            }
            if (this.txtCodigo.Value != "" || this.txtCodigo.Value != null)
            {
                this.Fotoprod1.Enabled = true;
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string tabelaper = "fornecedor";
            String Form_user = "******";

            // *** Inicio da rotina de verificação
            String nome_3 = strNomeUser();

            if (nome_3 == null)
            {
                nome_3 = "";
                Response.Redirect("WebLogar1.aspx");
                Response.End();
            }
            else
            {
                // Verifica se Usuario tem permissao para uso

                // *****************************************************************************************
                string nodo_Form = Form_user;   // <<< **** Não esquecer de colocar o nome do Form **** >>>
                // *****************************************************************************************

                Funcoes1 busca_pro  = new Funcoes1();
                string   busca_pro1 = busca_pro.progr_user(nodo_Form, nome_3, strConx());

                if (busca_pro1 == "NAO_FAZ")
                {
                    Response.Redirect("Acessedenied.aspx");
                    Response.End();
                }

                // Verificar quais botoes pode ser usado
                string per_1 = "";
                string per_2 = "";
                string per_3 = "";
                string per_4 = "";

                // ******  Inicio da Busca do Programa
                using (MySqlConnection connection = new MySqlConnection(strConx()))
                {
                    MySqlCommand    cmd;
                    MySqlDataReader dr;
                    connection.Open();
                    try
                    {
                        cmd             = connection.CreateCommand();
                        cmd.CommandText = "SELECT * FROM permissoes WHERE login = '******' AND tabela = '" + tabelaper.ToUpper() + "'";
                        dr = cmd.ExecuteReader();

                        if (dr.Read())
                        {
                            per_1 = dr["incluir"].ToString();
                            per_2 = dr["alterar"].ToString();
                            per_3 = dr["excluir"].ToString();
                            per_4 = dr["imprimir"].ToString();
                        }

                        if (this.lblmodulo1.Text != "Inclusão")
                        {
                            // Abilita para uso os Bottoes
                            if (per_1 == "SIM")
                            {
                                this.Incluir.Enabled = true;
                            }
                            if (per_2 == "SIM")
                            {
                                this.Alterar.Enabled = true;
                            }
                            if (per_3 == "SIM")
                            {
                                this.Excluir.Enabled = true;
                            }
                            if (per_4 == "SIM")
                            {
                                this.Imprimir1.Enabled = true;
                            }
                        }
                    }
                    catch { }
                }
                // Fim da Verificacao dos botoes
            }

            if (!Page.IsPostBack)
            {
                // Consulta para voltar a mesma tela vindo de outra Pagina
                if (Request.QueryString["codigo"] != null)
                {
                    int cod_ret = 0;
                    cod_ret = Convert.ToInt32(Request.QueryString["codigo"]);

                    String query = "";
                    query = "SELECT * FROM fornecedor WHERE codigo = " + cod_ret + "";

                    using (MySqlConnection con = new MySqlConnection(strConx()))
                    {
                        MySqlDataReader dr;
                        MySqlCommand    command = con.CreateCommand();
                        command.CommandText = query;

                        try
                        { con.Open(); }
                        catch { }

                        try
                        {
                            dr = command.ExecuteReader();
                            // Mostra registros na tela
                            if (dr.Read())
                            {
                                this.txtid.Value     = dr["id"].ToString();
                                this.TxtCodigo.Text  = dr["codigo"].ToString();
                                this.txtData.Text    = dr["data"].ToString();
                                this.txtNome.Value   = dr["fornecedor"].ToString();
                                this.txtTel.Text     = dr["fone"].ToString();
                                this.txtCel.Text     = dr["celular"].ToString();
                                this.txtEmail.Text   = dr["e_mail"].ToString();
                                this.txtEnd.Value    = dr["endereco"].ToString();
                                this.txtNumero.Value = dr["numero"].ToString();
                                this.txtCep.Value    = dr["cep"].ToString();
                                this.txtBairro.Text  = dr["bairro"].ToString();
                                this.txtCidade.Value = dr["cidade"].ToString();
                                this.txtUf.Text      = dr["estado"].ToString();
                                this.txtObs.Value    = dr["obs"].ToString();
                            }
                        }
                        catch { }
                    }
                }
                else
                {
                }
            }
        }