Beispiel #1
0
        private void CadCli_Click(object sender, EventArgs e)
        {
            if (Application.OpenForms.OfType <frmCadastroCliente>().Count() > 0)
            {
                MessageBox.Show("FORMULÁRIO DE CADASTRO DE CLIENTES JÁ ESTÁ ABERTO");
                return;
            }

            else
            {
                frmCadastroCliente frmCliente = new frmCadastroCliente();
                frmCliente.MdiParent = this;
                frmCliente.Show();
            }
        }
Beispiel #2
0
        private void tsbtnOk_Click(object sender, EventArgs e)
        {
            if (tstxtLogin.Text.Trim() == "")
            {
                MessageBox.Show("Informar o Login");
                return;
            }

            else if (tstxtLogin.Text.IndexOf("@") < 2 || tstxtLogin.Text.IndexOf(".COM") < 0)
            {
                MessageBox.Show("Login Invalido");
                return;
            }
            else if (tstxtSenha.Text.Trim() == "")
            {
                MessageBox.Show("Informar a Senha");
                return;
            }
            else if (tstcmbMod.Text.Trim() == "" || (tstcmbMod.Text.Trim() != "Cliente" && tstcmbMod.Text.Trim() != "Agência"))
            {
                MessageBox.Show("Modo de acesso incorreto, verifique ");

                return;
            }

            if (tstcmbMod.Text == "Cliente")
            {
                if (usuario.logarcli(tstxtLogin.Text, tstxtSenha.Text))
                {
                    frmCadastroCliente   frmcli        = new frmCadastroCliente();
                    ClienteBLL           cliente       = new ClienteBLL();
                    frmPlanoInternacinal internacional = new frmPlanoInternacinal();
                    usuario.inserir_controle_log(tstxtLogin.Text, tstxtSenha.Text);
                    StatusStripIni.Visible   = true;
                    btnLogOff.Enabled        = true;
                    Cadastro.Enabled         = false;
                    expandablePanel2.Visible = false;
                    Variaveis.logado         = "sim";
                    Variaveis.login          = tstxtLogin.Text;
                    Variaveis.senha          = tstxtSenha.Text;
                    Variaveis.modacesso      = tstcmbMod.Text;
                    btnAlterar.Enabled       = true;
                    btnAltCli.Enabled        = true;
                    MessageBox.Show("Logado com Sucesso");
                }
                else
                {
                    MessageBox.Show("Login / Senha Invalidos , ou modo de acesso errado");
                }
            }
            else if (tstcmbMod.Text == "Agência")
            {
                if (usuario.logar_agen(tstxtLogin.Text, tstxtSenha.Text))
                {
                    frmCadastroCliente frmcli = new frmCadastroCliente();
                    usuario.inserir_controle_log(tstxtLogin.Text, tstxtSenha.Text);
                    Variaveis.login          = tstxtLogin.Text;
                    Variaveis.senha          = tstxtSenha.Text;
                    Variaveis.modacesso      = tstcmbMod.Text;
                    Variaveis.logado         = "sim";
                    StatusStripIni.Visible   = true;
                    btnLogOff.Enabled        = true;
                    btnAlterar.Enabled       = true;
                    btnAltAgen.Enabled       = true;
                    Cadastro.Enabled         = false;
                    expandablePanel2.Visible = false;
                    MessageBox.Show("Logado com Sucesso");
                }
                else
                {
                    MessageBox.Show("Login / Senha Invalidos, ou modo de acesso errado");
                }
            }
        }