コード例 #1
0
 private void pictureBox14_Click(object sender, EventArgs e)
 {
     Ferramentas.Dedo_Duro();
     if (Global.Margem.ExpirouLicença == "sim")
     {
         Application.Exit();
     }
     if (Global.Margem.ContasReceber == "adm")
     {
         Form contarecebe = new ContasReceber();
         GerenciadorDeFormulario.Abre(contarecebe);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("ContasReceber", "Acessou Cadastro de contas a Receber");
         }
         return;
     }
     if (Global.Margem.ContasReceber == "sim")
     {
         Form contarecebe = new ContasReceber();
         GerenciadorDeFormulario.Abre(contarecebe);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("ContasReceber", "Acessou Cadastro de contas a Receber");
         }
         return;
     }
     if (Global.Margem.ContasReceber == "não")
     {
         MessageBox.Show("Acesso não autorizado");
     }
 }
コード例 #2
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            Form formPrincipal = new TelaPrincipal();

            GerenciadorDeFormulario.Abre(formPrincipal);
            GerenciadorDeFormulario.Fecha(this);
        }
コード例 #3
0
 private void pictureBox10_Click(object sender, EventArgs e)
 {
     if (Global.Margem.Logs == "adm")
     {
         Ferramentas.Dedo_Duro();
         Form log = new LOGs();
         GerenciadorDeFormulario.Abre(log);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("LOG", "Acessou LOGs do Sistema");
         }
         return;
     }
     if (Global.Margem.Logs == "sim")
     {
         Ferramentas.Dedo_Duro();
         Form log = new LOGs();
         GerenciadorDeFormulario.Abre(log);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("LOG", "Acessou LOGs do Sistema");
         }
         return;
     }
     if (Global.Margem.Logs == "não")
     {
         MessageBox.Show("Acesso não autorizado");
     }
 }
コード例 #4
0
 private void pictureBox1_Click_1(object sender, EventArgs e)
 {
     Ferramentas.Dedo_Duro();
     if (Global.Margem.ExpirouLicença == "sim")
     {
         Application.Exit();
     }
     if (Global.Margem.CadastroParticipantes == "adm")
     {
         Form cadPart = new CadastroParticipantes();
         GerenciadorDeFormulario.Abre(cadPart);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("CadParticipantes", "Acessou Cadastro de Participantes do Sistema");
         }
         return;
     }
     if (Global.Margem.CadastroParticipantes == "sim")
     {
         Form cadPart = new CadastroParticipantes();
         GerenciadorDeFormulario.Abre(cadPart);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("CadParticipantes", "Acessou Cadastro de Participantes do Sistema");
         }
         return;
     }
     if (Global.Margem.CadastroParticipantes == "não")
     {
         MessageBox.Show("Acesso não autorizado");
     }
 }
コード例 #5
0
 private void pictureBox15_Click(object sender, EventArgs e)
 {
     Ferramentas.Dedo_Duro();
     if (Global.Margem.ExpirouLicença == "sim")
     {
         Application.Exit();
     }
     if (Global.Margem.FluxoDeCaixa == "adm")
     {
         Form movCaixa = new MovimentoCaixa();
         GerenciadorDeFormulario.Abre(movCaixa);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("FluxoCaixa", "Acessou Fluxo de Caixa");
         }
         return;
     }
     if (Global.Margem.FluxoDeCaixa == "sim")
     {
         Form movCaixa = new MovimentoCaixa();
         GerenciadorDeFormulario.Abre(movCaixa);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("FluxoCaixa", "Acessou Fluxo de Caixa");
         }
         return;
     }
     if (Global.Margem.FluxoDeCaixa == "não")
     {
         MessageBox.Show("Acesso não autorizado");
     }
 }
コード例 #6
0
 private void pictureBox9_Click(object sender, EventArgs e)
 {
     Ferramentas.Dedo_Duro();
     if (Global.Margem.ExpirouLicença == "sim")
     {
         Application.Exit();
     }
     if (Global.Margem.CadastroUsuarios == "adm")
     {
         Form usuarios = new UsuariosSistema();
         GerenciadorDeFormulario.Abre(usuarios);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("CadUsuarios", "Acessou Cadastro de Usuários do Sistema");
         }
         return;
     }
     if (Global.Margem.CadastroUsuarios == "sim")
     {
         Form usuarios = new UsuariosSistema();
         GerenciadorDeFormulario.Abre(usuarios);
         if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
         {
             Ferramentas.CriaLog("CadUsuarios", "Acessou Cadastro de Usuários do Sistema");
         }
         return;
     }
     if (Global.Margem.CadastroUsuarios == "não")
     {
         MessageBox.Show("Acesso não autorizado");
     }
 }
コード例 #7
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            Form      formPrincipal = new TelaPrincipal();
            DataTable cor           = DALCadastro.CoresRetorna(Global.Margem.Operador);


            GerenciadorDeFormulario.Abre(formPrincipal);
            GerenciadorDeFormulario.Fecha(this);
        }
コード例 #8
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Ferramentas.Dedo_Duro();
            if (Global.Margem.ExpirouLicença == "sim")
            {
                Application.Exit();
            }
            if (Global.Margem.CadastroProdutos == "sim" || Global.Margem.CadastroProdutos == "adm")
            {
                int x = Screen.PrimaryScreen.Bounds.Width;
                int y = Screen.PrimaryScreen.Bounds.Height;

                if (x < 1024 || y < 768)
                {
                    MessageBox.Show("Resolução Mínima: 1024 x 768 px");
                    return;
                }

                if (x >= 1024 && y >= 768 && x < 1360)
                {
                    Form cadastraprodutos1024x768 = new CadastroProdutos1024x768();
                    GerenciadorDeFormulario.Abre(cadastraprodutos1024x768);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CadProdutos", "Acessou Cadastro de Produtos do Sistema");
                    }
                    return;
                }

                if (x >= 1360 && y >= 768 && x < 1440)
                {
                    Form cadastroprodutos1366x768 = new CadastroProdutos1366x768();
                    GerenciadorDeFormulario.Abre(cadastroprodutos1366x768);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CadProdutos", "Acessou Cadastro de Produtos do Sistema");
                    }
                    return;
                }

                if (x >= 1440 && y >= 768)
                {
                    Form cadastroprodutos = new CadastroProdutos();
                    GerenciadorDeFormulario.Abre(cadastroprodutos);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CadProdutos", "Acessou Cadastro de Produtos do Sistema");
                    }
                    return;
                }
            }
            if (Global.Margem.CadastroProdutos == "não")
            {
                MessageBox.Show("Usuário / Operador não tem permissão para acessar cadastro de produtos");
            }
        }
コード例 #9
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            num         = num - 1;
            label2.Text = Convert.ToString(num);
            if (num == 0)
            {
                timer1.Enabled = false;

                this.Close();

                Form frente = new PDV();
                GerenciadorDeFormulario.Abre(frente);
            }
        }
コード例 #10
0
        private void pictureBox13_Click(object sender, EventArgs e)
        {
            pictureBox17.Visible = true;
            Form login = new Login();

            login.ShowDialog();
            GerenciadorDeFormulario.Fecha(login);
            pictureBox17.Visible = false;
            DataTable cor = DALCadastro.CoresRetorna(Global.Margem.Operador);

            if (cor.Rows.Count > 0)
            {
                panel1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor5"].ToString()));
            }
        }
コード例 #11
0
        static void Main()
        {
            //Pega o nome do processo deste programa
            string TelaPrincipal = Process.GetCurrentProcess().ProcessName;

            //Busca os processos com este nome que estão em execução
            Process[] processos = Process.GetProcessesByName(TelaPrincipal);

            //Se já houver um aberto
            if (processos.Length > 1)
            {
                //Mostra mensagem de erro e finaliza
                MessageBox.Show("Não é possível abrir duas instâncias deste programa.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Application.Exit();
            }
            //Caso contrário continue normalmente
            else
            {
                Global.Margem.ConfiguraçãoSistemaBancoDados = "local";
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                DataTable ver = DALCadastro.VersaoCheck();
                if (ver.Rows.Count > 0)
                {
                    if (Convert.ToInt32(ver.Rows[0]["VersaoID"].ToString()) == 1001 && ver.Rows[0]["Cliente"].ToString() == "Mercearia Siqueira")
                    {
                        Form formPrincipal = new TelaPrincipal();
                        //Faz a chamada ao gerenciador de formulário
                        GerenciadorDeFormulario.Abre(formPrincipal);
                        Application.Run(formPrincipal);
                    }
                    if (Convert.ToInt32(ver.Rows[0]["VersaoID"].ToString()) != 1001 || ver.Rows[0]["Cliente"].ToString() != "Mercearia Siqueira")
                    {
                        MessageBox.Show("Informações sobre a versão da licença inválidas.\nFavor entrar em contato com o desenvolvedor do sistema.");
                        Application.Exit();
                        return;
                    }
                }
                if (ver.Rows.Count <= 0)
                {
                    MessageBox.Show("Informações sobre a versão da licença inexistentes .\nFavor entrar em contato com o desenvolvedor do sistema.");
                    Application.Exit();
                    return;
                }
            }
        }
コード例 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox1.Text) == true || String.IsNullOrEmpty(textBox2.Text) == true)
            {
                MessageBox.Show("Campo obrigatório não preenchido!");
                textBox1.Focus();
                return;
            }
            if (textBox1.Text == "ADMIN" && textBox2.Text == "admin")
            {
                string testa1     = Convert.ToString(DALCadastro.testaLicença());
                string testaLogin = Convert.ToString(DALCadastro.TestaLogin());
                if (String.IsNullOrEmpty(testa1) == true)
                {
                    MessageBox.Show("Detectado primeiro uso do sistema! \n\n" + "Será necessário cadastrar um novo usuário e senha de acesso\nno menu Usuários do Sistema" +
                                    "\n\nSerá necessário também fazer o download da ativação\nno menu Renovação da Licença.");
                    DALCadastro.MapearResolução(Convert.ToString(DateTime.Now.Year * 67), Convert.ToString(DateTime.Now.Month * 115), Convert.ToString(DateTime.Now.Day * 57),
                                                Convert.ToString(DateTime.Now.Hour * 33), Convert.ToString(DateTime.Now.Minute * 33), Convert.ToString(DateTime.Now.Second * 33));
                    //DateTime data5 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
                    //Global.Margem.Hora = data5;

                    Global.Margem.Operador              = "admin";
                    Global.Margem.Administrador         = "não";
                    Global.Margem.CadastroUsuarios      = "sim";
                    Global.Margem.CadastroProdutos      = "não";
                    Global.Margem.CadastroParticipantes = "não";
                    Global.Margem.CaixaTerminalVendas   = "não";
                    Global.Margem.Logs                = "não";
                    Global.Margem.FluxoDeCaixa        = "não";
                    Global.Margem.ContasPagar         = "não";
                    Global.Margem.ContasReceber       = "não";
                    Global.Margem.ConfiguraçãoSistema = "sim";
                    Form usuarios = new UsuariosSistema();
                    GerenciadorDeFormulario.Abre(usuarios);

                    this.Close();
                    return;
                }
                if (String.IsNullOrEmpty(testa1) == false)
                {
                    if (String.IsNullOrEmpty(testaLogin) == true)
                    {
                        DateTime data4 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
                        Global.Margem.Hora = data4;
                        MessageBox.Show("Sistema está com a licença instalada.  " +
                                        "\n\nSerá necessário cadastrar um novo usuário e senha de acesso\nno menu Usuários do Sistema");
                        Global.Margem.Operador              = "admin";
                        Global.Margem.Administrador         = "não";
                        Global.Margem.CadastroUsuarios      = "sim";
                        Global.Margem.CadastroProdutos      = "não";
                        Global.Margem.CadastroParticipantes = "não";
                        Global.Margem.CaixaTerminalVendas   = "não";
                        Global.Margem.Logs                = "não";
                        Global.Margem.FluxoDeCaixa        = "não";
                        Global.Margem.ContasPagar         = "não";
                        Global.Margem.ContasReceber       = "não";
                        Global.Margem.ConfiguraçãoSistema = "sim";


                        Form usuarios = new UsuariosSistema();
                        GerenciadorDeFormulario.Abre(usuarios);

                        this.Close();
                        return;
                    }
                    if (String.IsNullOrEmpty(testaLogin) == false)
                    {
                        MessageBox.Show("Usuário admin foi desabilitado, pois existem usuários cadastrados.");
                        //Global.Margem.Operador = "admin";
                        //Form usuarios = new UsuariosSistema();
                        //GerenciadorDeFormulario.Abre(usuarios);
                        textBox1.Text = "";
                        textBox2.Text = "";
                        return;
                    }
                }
            }
            string testa2 = Convert.ToString(DALCadastro.testaLicença());

            if (String.IsNullOrEmpty(testa2) == false)
            {
                string autentica = Convert.ToString(DALCadastro.VerificaLogin(textBox1.Text, textBox2.Text));
                if (String.IsNullOrEmpty(autentica) == false)
                {
                    if (String.IsNullOrEmpty(testa2) == true)
                    {
                        MessageBox.Show("Não foi possível localizar informações sobre a licença do Sistema. \n\nFavor entrar em contato com o desenvolvedor do sistema");
                        Application.Exit();
                        //this.Close();
                        //return;
                    }
                    Ferramentas.Dedo_Duro();
                    if (Global.Margem.ExpirouLicença == "sim")
                    {
                        Application.Exit();
                    }
                    if (autentica == textBox2.Text && Global.Margem.ExpirouLicença != "sim")
                    {
                        string x = Convert.ToString(DALCadastro.ValidaLicença("X"));

                        int resultX = Convert.ToInt32(x) / 77;

                        string y       = Convert.ToString(DALCadastro.ValidaLicença("Y"));
                        int    resultY = Convert.ToInt32(y) / 133;

                        string z       = Convert.ToString(DALCadastro.ValidaLicença("Z"));
                        int    resultZ = Convert.ToInt32(z) / 55;

                        //data aviso
                        string r       = Convert.ToString(DALCadastro.ValidaLicença("R"));
                        int    resultR = Convert.ToInt32(r) / 13;

                        string g       = Convert.ToString(DALCadastro.ValidaLicença("G"));
                        int    resultG = Convert.ToInt32(g) / 7;

                        string b       = Convert.ToString(DALCadastro.ValidaLicença("B"));
                        int    resultB = Convert.ToInt32(b) / 7;

                        //ultimo acesso

                        /*string res1 = Convert.ToString(DALCadastro.ValidaLicença("Res1"));
                         * int resultRes1 = Convert.ToInt32(res1) / 67;
                         *
                         * string res2 = Convert.ToString(DALCadastro.ValidaLicença("Res2"));
                         * int resultRes2 = Convert.ToInt32(res2) / 115;
                         *
                         * string res3 = Convert.ToString(DALCadastro.ValidaLicença("Res3"));
                         * int resultRes3 = Convert.ToInt32(res3) / 57;
                         *
                         * string res4 = Convert.ToString(DALCadastro.ValidaLicença("Res4"));
                         * int resultRes4 = Convert.ToInt32(res4) / 33;
                         *
                         * string res5 = Convert.ToString(DALCadastro.ValidaLicença("Res5"));
                         * int resultRes5 = Convert.ToInt32(res5) / 33;*/

                        DateTime data3 = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
                                                      DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);

                        x       = "20" + Convert.ToString(resultX);
                        resultX = Convert.ToInt32(x);

                        r       = "20" + Convert.ToString(resultR);
                        resultR = Convert.ToInt32(r);

                        //MessageBox.Show(Convert.ToString( resultX) + Convert.ToString( resultR));


                        DateTime data1 = new DateTime(resultX, resultY, resultZ, 20, 00, 00);

                        DateTime data2 = new DateTime(resultR, resultG, resultB, 20, 00, 00);
                        //MessageBox.Show(Convert.ToString(data1) +"  "+ Convert.ToString(data2) +"   "+ Convert.ToString(data3));

                        int result = DateTime.Compare(data1, data3);
                        if (result < 0)
                        {
                            MessageBox.Show("Sistema Expirou. \n\nEntre em contato com o desenvolvedor. O sistema será fechado.");
                            Application.Exit();
                        }
                        else
                        {
                            int resul = DateTime.Compare(data2, data3);
                            if (resul < 0)
                            {
                                string            message = "Licença do sistema expira em: " + Convert.ToString(data1) + ". \nDeseja atualizar agora?";
                                string            caption = "Sistema ==> Licença";
                                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                                DialogResult      resultado;

                                // Displays the MessageBox.

                                resultado = MessageBox.Show(this, message, caption, buttons,
                                                            MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                                if (resultado == DialogResult.Yes)
                                {
                                    string id6 = Convert.ToString(DALCadastro.RetornaPermissão(textBox1.Text, textBox2.Text));
                                    if (String.IsNullOrEmpty(id6) == false)
                                    {
                                        Global.Margem.Operador              = textBox1.Text;
                                        Global.Margem.Administrador         = Convert.ToString(DALCadastro.carregaPermissao("CarregaADM", Convert.ToInt32(id6)));
                                        Global.Margem.CadastroUsuarios      = Convert.ToString(DALCadastro.carregaPermissao("CarregaUm", Convert.ToInt32(id6)));
                                        Global.Margem.CadastroProdutos      = Convert.ToString(DALCadastro.carregaPermissao("CarregaDois", Convert.ToInt32(id6)));
                                        Global.Margem.CadastroParticipantes = Convert.ToString(DALCadastro.carregaPermissao("CarregaTres", Convert.ToInt32(id6)));
                                        Global.Margem.CaixaTerminalVendas   = Convert.ToString(DALCadastro.carregaPermissao("CarregaQuatro", Convert.ToInt32(id6)));
                                        Global.Margem.Logs                = Convert.ToString(DALCadastro.carregaPermissao("CarregaCinco", Convert.ToInt32(id6)));
                                        Global.Margem.FluxoDeCaixa        = Convert.ToString(DALCadastro.carregaPermissao("CarregaSeis", Convert.ToInt32(id6)));
                                        Global.Margem.ContasPagar         = Convert.ToString(DALCadastro.carregaPermissao("CarregaSete", Convert.ToInt32(id6)));
                                        Global.Margem.ContasReceber       = Convert.ToString(DALCadastro.carregaPermissao("CarregaOito", Convert.ToInt32(id6)));
                                        Global.Margem.ConfiguraçãoSistema = Convert.ToString(DALCadastro.carregaPermissao("CarregaNove", Convert.ToInt32(id6)));
                                        Global.Margem.Hora                = data3;
                                        this.Visible = false;
                                        Form lice = new Licenca();

                                        lice.ShowDialog();


                                        lice.Update();
                                        lice.Close();
                                    }
                                }
                                else
                                {
                                    string id5 = Convert.ToString(DALCadastro.RetornaPermissão(textBox1.Text, textBox2.Text));
                                    if (String.IsNullOrEmpty(id5) == false)
                                    {
                                        Global.Margem.Operador              = textBox1.Text;
                                        Global.Margem.Administrador         = Convert.ToString(DALCadastro.carregaPermissao("CarregaADM", Convert.ToInt32(id5)));
                                        Global.Margem.CadastroUsuarios      = Convert.ToString(DALCadastro.carregaPermissao("CarregaUm", Convert.ToInt32(id5)));
                                        Global.Margem.CadastroProdutos      = Convert.ToString(DALCadastro.carregaPermissao("CarregaDois", Convert.ToInt32(id5)));
                                        Global.Margem.CadastroParticipantes = Convert.ToString(DALCadastro.carregaPermissao("CarregaTres", Convert.ToInt32(id5)));
                                        Global.Margem.CaixaTerminalVendas   = Convert.ToString(DALCadastro.carregaPermissao("CarregaQuatro", Convert.ToInt32(id5)));
                                        Global.Margem.Logs                = Convert.ToString(DALCadastro.carregaPermissao("CarregaCinco", Convert.ToInt32(id5)));
                                        Global.Margem.FluxoDeCaixa        = Convert.ToString(DALCadastro.carregaPermissao("CarregaSeis", Convert.ToInt32(id5)));
                                        Global.Margem.ContasPagar         = Convert.ToString(DALCadastro.carregaPermissao("CarregaSete", Convert.ToInt32(id5)));
                                        Global.Margem.ContasReceber       = Convert.ToString(DALCadastro.carregaPermissao("CarregaOito", Convert.ToInt32(id5)));
                                        Global.Margem.ConfiguraçãoSistema = Convert.ToString(DALCadastro.carregaPermissao("CarregaNove", Convert.ToInt32(id5)));
                                        Global.Margem.Hora                = data3;

                                        this.Close();
                                    }
                                }
                            }
                            if (resul > 0)
                            {
                                string id5 = Convert.ToString(DALCadastro.RetornaPermissão(textBox1.Text, textBox2.Text));
                                if (String.IsNullOrEmpty(id5) == false)
                                {
                                    Global.Margem.Operador              = textBox1.Text;
                                    Global.Margem.Administrador         = Convert.ToString(DALCadastro.carregaPermissao("CarregaADM", Convert.ToInt32(id5)));
                                    Global.Margem.CadastroUsuarios      = Convert.ToString(DALCadastro.carregaPermissao("CarregaUm", Convert.ToInt32(id5)));
                                    Global.Margem.CadastroProdutos      = Convert.ToString(DALCadastro.carregaPermissao("CarregaDois", Convert.ToInt32(id5)));
                                    Global.Margem.CadastroParticipantes = Convert.ToString(DALCadastro.carregaPermissao("CarregaTres", Convert.ToInt32(id5)));
                                    Global.Margem.CaixaTerminalVendas   = Convert.ToString(DALCadastro.carregaPermissao("CarregaQuatro", Convert.ToInt32(id5)));
                                    Global.Margem.Logs                = Convert.ToString(DALCadastro.carregaPermissao("CarregaCinco", Convert.ToInt32(id5)));
                                    Global.Margem.FluxoDeCaixa        = Convert.ToString(DALCadastro.carregaPermissao("CarregaSeis", Convert.ToInt32(id5)));
                                    Global.Margem.ContasPagar         = Convert.ToString(DALCadastro.carregaPermissao("CarregaSete", Convert.ToInt32(id5)));
                                    Global.Margem.ContasReceber       = Convert.ToString(DALCadastro.carregaPermissao("CarregaOito", Convert.ToInt32(id5)));
                                    Global.Margem.ConfiguraçãoSistema = Convert.ToString(DALCadastro.carregaPermissao("CarregaNove", Convert.ToInt32(id5)));
                                    Global.Margem.Hora                = data3;

                                    this.Close();
                                }
                            }
                        }
                        //Global.Margem.Hora = data3;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Senha incorreta");
                    }
                }
                else
                {
                    MessageBox.Show("Usuário / Operador não cadastrado, \n e ou problemas na ativação da licença");
                }
            }
        }
コード例 #13
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Form cadastroprodutos = new CadastroProdutos();

            GerenciadorDeFormulario.Abre(cadastroprodutos);
        }
コード例 #14
0
        private void TelaPrincipal_Load(object sender, EventArgs e)
        {
            string impressora;

            try
            {
                using (StreamReader reader = new StreamReader("Impressora.txt"))
                {
                    impressora = reader.ReadLine();
                    Global.Margem.Impressora = impressora;
                }
            }
            catch (Exception)
            {
                impressora = "";
            }
            if (String.IsNullOrEmpty(impressora) == true)
            {
                using (StreamWriter writer = new StreamWriter("Impressora.txt"))
                {
                    writer.Write("generic");
                    Global.Margem.Impressora = "generic";
                }
            }
            string impressao;

            try
            {
                using (StreamReader reader = new StreamReader("SI.txt"))
                {
                    impressao = reader.ReadLine();
                    Global.Margem.ServidorImpressao = impressao;
                }
            }
            catch (Exception)
            {
                impressao = "";
            }
            if (String.IsNullOrEmpty(impressao) == true)
            {
                using (StreamWriter writer = new StreamWriter("SI.txt"))
                {
                    writer.Write("não");
                    Global.Margem.ServidorImpressao = "não";
                }
            }
            if (Global.Margem.ServidorImpressao == "sim")
            {
                Form impres = new ServidorImpressao();
                impres.Show();
            }
            string linha;

            try
            {
                using (StreamReader reader = new StreamReader("BD.txt"))
                {
                    linha = reader.ReadLine();
                }
            }
            catch (Exception)
            {
                linha = "local";
            }

            if (linha == "local")
            {
                Global.Margem.ConfiguraçãoSistemaBancoDados = "local";
            }
            if (linha == "rede")
            {
                Global.Margem.ConfiguraçãoSistemaBancoDados = "rede";
                using (StreamReader reader = new StreamReader("BDIp.txt"))
                {
                    Global.Margem.ConfiguraçãoSistemaBancoDadosIp = reader.ReadLine();
                }
                using (StreamReader reader = new StreamReader("BDPorta.txt"))
                {
                    Global.Margem.ConfiguraçãoSistemaBancoDadosPorta = reader.ReadLine();
                }
            }
            string log;

            try
            {
                using (StreamReader reader = new StreamReader("LOG.txt"))
                {
                    log = reader.ReadLine();
                }
            }
            catch (Exception)
            {
                log = "sim";
            }

            if (log == "sim")
            {
                Global.Margem.ConfiguraçãoSistemaLOGs = "sim";
            }
            if (log == "não")
            {
                Global.Margem.ConfiguraçãoSistemaLOGs = "não";
            }


            pictureBox17.Visible = true;
            Form login = new Login();

            login.ShowDialog();

            GerenciadorDeFormulario.Fecha(login);
            pictureBox17.Visible = false;

            DataTable cor = DALCadastro.CoresRetorna(Global.Margem.Operador);

            if (cor.Rows.Count > 0)
            {
                panel1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor5"].ToString()));
            }
            DataTable inicio = DALCadastro.TestaConfiVazia("1");

            if (inicio.Rows.Count > 0)
            {
                Global.Margem.ConfiguraçãoSistemaFinanceiroMargem   = inicio.Rows[0]["Campo1"].ToString();
                Global.Margem.ConfiguraçãoSistemaFinanceiroImpostos = inicio.Rows[0]["Campo2"].ToString();
                Global.Margem.ConfiguraçãoSistemaFinanceiroComissão = inicio.Rows[0]["Campo3"].ToString();
            }
            inicio.Clear();
            inicio = DALCadastro.TestaConfiVazia("2");
            if (inicio.Rows.Count > 0)
            {
                Global.Margem.ConfiguraçãoSistemaEstoque = inicio.Rows[0]["Campo1"].ToString();
            }
            inicio.Clear();
            inicio = DALCadastro.TestaConfiVazia("3");
            if (inicio.Rows.Count > 0)
            {
                Global.Margem.ConfiguraçãoSistemaLOGs = inicio.Rows[0]["Campo1"].ToString();
            }
            inicio.Clear();
            inicio = DALCadastro.TestaConfiVazia("4");
            if (inicio.Rows.Count > 0)
            {
                Global.Margem.ConfiguraçãoSistemaCaixaTerminalVendas = inicio.Rows[0]["Campo1"].ToString();
            }
            Ferramentas.CriaLog("Login", "Fez Login no Sistema");
            //listar avisos
            string dia = DateTime.Now.Day.ToString();

            if (dia.Length == 1)
            {
                dia = "0" + dia;
            }
            string mes = DateTime.Now.Month.ToString();

            if (mes.Length == 1)
            {
                mes = "0" + mes;
            }
            string ano     = DateTime.Now.Year.ToString();
            int    compara = Convert.ToInt32(ano + mes + dia);

            DataTable list = DALCadastro.ListaEventos();

            if (list.Rows.Count > 0)
            {
                for (int i = 0; i < list.Rows.Count; i++)
                {
                    int temp = Convert.ToInt32(list.Rows[i]["DataGatilho"].ToString());
                    if (temp <= compara)
                    {
                        pictureBox17.Visible = true;
                        Form al = new Alert();
                        al.ShowDialog();
                        if (Global.Margem.AbreAviso == "sim")
                        {
                            Form av = new Avisos();
                            av.ShowDialog();
                        }
                        else
                        {
                            pictureBox17.Visible = false;
                        }
                        if (Global.Margem.AbreAviso == "ok")
                        {
                            pictureBox17.Visible = false;
                        }
                        else
                        {
                            pictureBox17.Visible = false;
                        }
                        Global.Margem.AbreAviso = "";
                        return;
                    }
                }
            }
        }
コード例 #15
0
        private void pictureBox16_Click(object sender, EventArgs e)
        {
            Ferramentas.Dedo_Duro();
            if (Global.Margem.ExpirouLicença == "sim")
            {
                Application.Exit();
            }
            if (Global.Margem.CaixaTerminalVendas == "adm")
            {
                string linha;
                try
                {
                    using (StreamReader reader = new StreamReader("CaixaAberto.txt"))
                    {
                        linha = reader.ReadLine();
                    }
                }
                catch (Exception)
                {
                    linha = "não";
                }

                if (linha == "não")
                {
                    pictureBox17.Visible = true;
                    Form abre = new AbrirCaixa();
                    abre.ShowDialog();
                    pictureBox17.Visible = false;;
                    if (Global.Margem.SemContaCadastrada == "sim")
                    {
                        Global.Margem.SemContaCadastrada = "";
                        return;
                    }
                    Form frente = new PDV();
                    GerenciadorDeFormulario.Abre(frente);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CaixaTerminalVendas", "Acessou Caixa / Terminal de Vendas");
                    }
                }
                if (linha == "sim")
                {
                    string conta;
                    try
                    {
                        using (StreamReader reader = new StreamReader("Conta.txt"))
                        {
                            conta = reader.ReadLine();
                            Global.Margem.ContaAberta = conta;
                        }
                    }
                    catch (Exception)
                    {
                        conta = "";
                    }
                    string valor;
                    try
                    {
                        using (StreamReader reader = new StreamReader("Valor.txt"))
                        {
                            valor = reader.ReadLine();
                            Global.Margem.ValorAberto = valor;
                        }
                    }
                    catch (Exception)
                    {
                        valor = "";
                    }
                    if (String.IsNullOrEmpty(valor) == true || String.IsNullOrEmpty(conta) == true)
                    {
                        using (StreamWriter writer = new StreamWriter("CaixaAberto.txt"))
                        {
                            writer.Write("não");
                            return;
                        }
                    }
                    string empresa;
                    try
                    {
                        using (StreamReader reader = new StreamReader("Empresa.txt"))
                        {
                            empresa = reader.ReadLine();
                            Global.Margem.EmpresaCaixa = empresa;
                        }
                    }
                    catch (Exception)
                    {
                        conta = "";
                    }


                    pictureBox17.Visible = true;
                    Form al = new Alert2();
                    al.ShowDialog();

                    Form frente = new PDV();
                    GerenciadorDeFormulario.Abre(frente);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CaixaTerminalVendas", "Acessou Caixa / Terminal de Vendas");
                    }
                    pictureBox17.Visible = false;
                    //carrega conf de caixa aberto
                }

                return;
            }
            if (Global.Margem.CaixaTerminalVendas == "sim")
            {
                string linha;
                try
                {
                    using (StreamReader reader = new StreamReader("CaixaAberto.txt"))
                    {
                        linha = reader.ReadLine();
                    }
                }
                catch (Exception)
                {
                    linha = "não";
                }

                if (linha == "não")
                {
                    pictureBox17.Visible = true;
                    Form abre = new AbrirCaixa();
                    abre.ShowDialog();
                    pictureBox17.Visible = false;
                    if (Global.Margem.SemContaCadastrada == "sim")
                    {
                        Global.Margem.SemContaCadastrada = "";
                        return;
                    }
                    Form frente = new PDV();
                    GerenciadorDeFormulario.Abre(frente);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CaixaTerminalVendas", "Acessou Caixa / Terminal de Vendas");
                    }
                }
                if (linha == "sim")
                {
                    string conta;
                    try
                    {
                        using (StreamReader reader = new StreamReader("Conta.txt"))
                        {
                            conta = reader.ReadLine();
                            Global.Margem.ContaAberta = conta;
                        }
                    }
                    catch (Exception)
                    {
                        conta = "";
                    }
                    string valor;
                    try
                    {
                        using (StreamReader reader = new StreamReader("Valor.txt"))
                        {
                            valor = reader.ReadLine();
                            Global.Margem.ValorAberto = valor;
                        }
                    }
                    catch (Exception)
                    {
                        valor = "";
                    }
                    if (String.IsNullOrEmpty(valor) == true || String.IsNullOrEmpty(conta) == true)
                    {
                        using (StreamWriter writer = new StreamWriter("CaixaAberto.txt"))
                        {
                            writer.Write("não");
                            return;
                        }
                    }
                    MessageBox.Show("[ Este Caixa não foi Finalizado / Fechado e será reaberto. ]");
                    Form frente = new PDV();
                    GerenciadorDeFormulario.Abre(frente);
                    if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim")
                    {
                        Ferramentas.CriaLog("CaixaTerminalVendas", "Acessou Caixa / Terminal de Vendas");
                    }
                    //carrega conf de caixa aberto
                }

                return;
            }
            if (Global.Margem.CaixaTerminalVendas == "não")
            {
                MessageBox.Show("Acesso não autorizado");
            }
        }