Пример #1
0
    private bool PodeLogar()
    {
        if (txtUsuario.Text == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Preencha [Login].", this.Page);
            return(false);
        }
        if (txtSenha.Text == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Preencha [Senha].", this.Page);
            return(false);
        }
        if (txtRamal.Text == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Preencha [Ramal].", this.Page);
            return(false);
        }
        usuarioCTL CUsuario = new usuarioCTL();
        usuario    Usuario  = new usuario();

        Usuario = CUsuario.RetornarUsuario(PontoBr.Utilidades.String.RemoverCaracterInvalido(txtUsuario.Text.Replace(".", "").Replace("-", "")), PontoBr.Utilidades.String.RemoverCaracterInvalido(txtSenha.Text), PontoBr.Utilidades.String.RemoverCaracterInvalido(txtRamal.Text.Replace(".", "").Replace("-", "")));
        if (Usuario.IDUsuario == 0)
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("[Login] e/ou [Senha] incorreto(s).", this.Page);
            return(false);
        }
        else
        {
            HttpContext.Current.Session["Usuario"] = Usuario;
        }

        return(true);
    }
Пример #2
0
        private void ListarUsuarios(int iIDCampanha)
        {
            usuarioCTL CUsuario = new usuarioCTL();

            dgUsuario.DataSource       = CUsuario.RetornarUsuarios(Convert.ToBoolean(chkListarAtivos.Checked));
            dgUsuario.Columns[1].Width = 400;
            dgUsuario.Columns[2].Width = 200;
            dgUsuario.Columns[3].Width = 200;
            dgUsuario.Columns[4].Width = 200;
            dgUsuario.Columns[5].Width = 165;

            int iNumeroOperadoresAtivo = CUsuario.RetornarQuantidadeOperadores();

            lblOperadorAtivo.Text  = "Sua licença é de " + fLogin.iNumeroOperadores.ToString() + " operador(es) ativo(s), ";
            lblOperadorAtivo.Text += "há atualmente " + iNumeroOperadoresAtivo.ToString() + " ativo(s).";

            if (iNumeroOperadoresAtivo > fLogin.iNumeroOperadores)
            {
                lblOperadorAtivo.ForeColor = System.Drawing.Color.Red;
                lblOperadorAtivo.Text     += " Não será possível logar com o Perfil Operador.";
            }
            else
            {
                lblOperadorAtivo.ForeColor = System.Drawing.Color.Black;
            }
        }
        private void CarregarOperadoresAuditoria()
        {
            usuarioCTL CUsuario = new usuarioCTL();

            CUsuario.PreencherComboBox_Operadores(comboOperador, true, false);
            comboOperador.Text          = fLogin.Usuario.Nome;
            comboOperador.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Пример #4
0
    private void CarregarPerfis()
    {
        usuarioCTL CUsuario = new usuarioCTL();

        CUsuario.CarregarRadioButtonListPerfis(radPerfil);

        radPerfil.Items.RemoveAt(0);
    }
Пример #5
0
    protected void cmdSalvar_Click(object sender, EventArgs e)
    {
        try
        {
            string sMensagem = "";
            if (PodeSalvar())
            {
                usuario UsuarioCadastro = (usuario)HttpContext.Current.Session["Usuario"];

                usuario    Usuario  = new usuario();
                usuarioCTL CUsuario = new usuarioCTL();

                Usuario.Nome     = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtNome.Text);
                Usuario.Login    = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtLogin.Text);
                Usuario.Senha    = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtSenha.Text);
                Usuario.Ativo    = Convert.ToInt32(radAtivo.SelectedValue);
                Usuario.IDPerfil = Convert.ToInt32(radPerfil.SelectedValue);

                //Editar
                if (!String.IsNullOrEmpty(hddId.Value))
                {
                    Usuario.IDUsuario = Convert.ToInt32(hddId.Value);

                    //Editar dados da tabela de Usuário
                    CUsuario.EditarUsuario(Usuario);
                    //Exclui todas as campanhas do usuário
                    CUsuario.ExcluirUsuarioCampanhas(Usuario.IDUsuario);
                    foreach (ListItem listItem in chkCampanha.Items)
                    {
                        if (listItem.Selected)
                        {
                            CUsuario.CadastrarUsuarioCampanhas(Usuario.IDUsuario, Convert.ToInt32(listItem.Value));
                        }
                    }

                    sMensagem = "Alterações salvas com sucesso!";
                }
                else //Salvar novo
                {
                    int iIDUsuario = Convert.ToInt32(CUsuario.CadastrarUsuario(Usuario, UsuarioCadastro.IDUsuario));
                    foreach (ListItem listItem in chkCampanha.Items)
                    {
                        if (listItem.Selected)
                        {
                            CUsuario.CadastrarUsuarioCampanhas(iIDUsuario, Convert.ToInt32(listItem.Value));
                        }
                    }
                    sMensagem = "Usuário salvo com sucesso!";
                }
                LimparCampos();
                CarregarUsuarios();
                PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            }
        }
        catch { }
    }
Пример #6
0
    private void CarregarUsuarios()
    {
        usuarioCTL CUsuario = new usuarioCTL();

        CUsuario.CarregarGridviewUsuarios(Convert.ToBoolean(CheckBoxUsuariosAtivos.Checked), gridUsuario);

        int iNumeroOperadoresAtivo = CUsuario.RetornarQuantidadeOperadores();

        lblUsuariosAtivos.Text = "| " + iNumeroOperadoresAtivo.ToString() + " operador(es) ativo(s) |";
    }
Пример #7
0
        private void cmdSalvar_Click(object sender, EventArgs e)
        {
            if (PodeSalvar())
            {
                usuarioCTL CUsuario = new usuarioCTL();
                CUsuario.AlterarSenha(fLogin.Usuario.IDUsuario, txtNovaSenha.Text);

                MessageBox.Show("Senha alterada com sucesso!", "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
    private bool PodeSalvar()
    {
        usuario Usuario = (usuario)HttpContext.Current.Session["Usuario"];

        string sMensagem;

        if (txtSenhaAtual.Text.Trim() == "")
        {
            LimparCampos();
            sMensagem = "Preencha [Senha Atual].";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            return(false);
        }
        if (txtNovaSenha.Text.Trim() == "")
        {
            LimparCampos();
            sMensagem = "Preencha [Nova Senha].";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            return(false);
        }
        if (txtRepetirNovaSenha.Text.Trim() == "")
        {
            LimparCampos();
            sMensagem = "Preencha [Repetir Nova Senha].";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            return(false);
        }
        if (txtNovaSenha.Text.Trim() != txtRepetirNovaSenha.Text.Trim())
        {
            LimparCampos();
            sMensagem = "[Nova Senha] está diferente de [Repetir Nova Senha].";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            return(false);
        }
        usuarioCTL CUsuario = new usuarioCTL();

        if (CUsuario.VerificarSenhaAtual(Usuario.IDUsuario, txtSenhaAtual.Text) == false)
        {
            LimparCampos();
            sMensagem = "[Senha Atual] está incorreta.";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            return(false);
        }
        Usuario = CUsuario.RetornarUsuario(Usuario.IDUsuario);
        if (Usuario.Senha == txtNovaSenha.Text.Trim())
        {
            LimparCampos();
            sMensagem = "A [Nova Senha] não pode ser igual a [Senha Atual].";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
            return(false);
        }
        return(true);
    }
    protected void bntSalvar_Click(object sender, EventArgs e)
    {
        usuario Usuario = (usuario)HttpContext.Current.Session["Usuario"];

        if (PodeSalvar())
        {
            string     sMensagem;
            usuarioCTL CUsuario = new usuarioCTL();
            CUsuario.AlterarSenha(Usuario.IDUsuario, txtNovaSenha.Text);

            sMensagem = "Senha alterada com sucesso!";
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager(sMensagem, this.Page);
        }
    }
Пример #10
0
    private bool PodeSalvar()
    {
        if (txtNome.Text.Trim() == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Preencha [Nome].", this.Page);
            return(false);
        }
        if (txtLogin.Text.Trim() == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Preencha [Login].", this.Page);
            return(false);
        }
        if (txtSenha.Text.Trim() == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Preencha [Senha].", this.Page);
            return(false);
        }
        if (radPerfil.SelectedValue == "")
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Selecione [Perfil].", this.Page);
            return(false);
        }

        bool bCampanhaSelecionada = false;

        foreach (ListItem listItem in chkCampanha.Items)
        {
            if (listItem.Selected)
            {
                bCampanhaSelecionada = true;
            }
        }
        if (bCampanhaSelecionada == false)
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Selecione, pelo menos, uma [Campannha].", this.Page);
            return(false);
        }

        int        iIDUsuario = String.IsNullOrEmpty(hddId.Value) ? -1 : Convert.ToInt32(hddId.Value);
        usuarioCTL CUsuario   = new usuarioCTL();

        if (CUsuario.VerificarExistenciaUsuario(txtLogin.Text.Trim(), iIDUsuario))
        {
            PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("[Login] já cadastrado.", this.Page);
            return(false);
        }
        return(true);
    }
        private void ValidarLicencaNumeroOperadores2()
        {
            usuarioCTL CUsuario = new usuarioCTL();

            Invoke((MethodInvoker) delegate { lblQuantidadeAtual.Text = Convert.ToString(CUsuario.RetornarQuantidadeOperadores()); });
            Invoke((MethodInvoker) delegate { lblOperadorLicenca.Text = Convert.ToString(fLogin.iNumeroOperadores); });
            Invoke((MethodInvoker) delegate { lblVersao.Text = Convert.ToString(fLogin.sVersaoAplicativo); });
            Invoke((MethodInvoker) delegate { lblRelease.Text = Convert.ToString(fLogin.sRelease); });

            if (CUsuario.RetornarQuantidadeOperadores() > fLogin.iNumeroOperadores)
            {
                Invoke((MethodInvoker) delegate { lblAlerta.Text = "[Sua licença execedeu o limite de usuários.]"; });
                lblAlerta.ForeColor          = Color.Red;
                lblQuantidadeAtual.ForeColor = Color.Red;
            }
        }
Пример #12
0
        private void CarregarLayout()
        {
            // this.BackColor = System.Drawing.Color.FromName("Gainsboro");
            this.ControlBox = false;

            string sFormulario = "TABULARE - LOGIN";

            this.Text = sFormulario + " - " + fLogin.sVersaoAplicativo + " (" + fLogin.sRelease + ")";
            login Login = new login();

            usuarioCTL CUsuario = new usuarioCTL();
            int        iAtivos  = CUsuario.RetornarQuantidadeOperadores();

            lblVersaoFramework.Text = "Versão Framework - " + PontoBr.Configuracao.Versao;
            lblLicenca.Text         = "Licenciado para " + fLogin.iNumeroOperadores.ToString() + " operadores - Ativos: " + iAtivos;
        }
Пример #13
0
    private void CarregarOperadores()
    {
        usuario    Usuario  = (usuario)HttpContext.Current.Session["Usuario"];
        usuarioCTL CUsuario = new usuarioCTL();

        CUsuario.PreencherDrop_Operadores(DropOperador, true, false);

        if (Usuario.Perfil == "Operador")
        {
            DropOperador.SelectedValue = Usuario.IDUsuario.ToString();
            dropCampanha.SelectedValue = Usuario.IDCampanha.ToString();
            DropOperador.Enabled       = false;
            dropCampanha.Enabled       = false;

            CarregarDadosVenda();
        }
    }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        txtUsuario.Focus();
        Page.Form.DefaultButton = cmdEntrar.UniqueID;

        if (!IsPostBack)
        {
            //Teste do Chicão para o Robson
            //Variável de sessão para guardar o browser do usuário
            HttpContext.Current.Session["Browser"] = Request.Browser.Browser.ToString();

            //Versão do sistema igual do Windows form
            string sVersaoAplicativo = "v6.0";
            string sRelease          = "r03";

            CarregarConfiguracoes();

            usuarioCTL   CUsuario = new usuarioCTL();
            configuracao Configuracao;
            Configuracao = (configuracao)HttpContext.Current.Session["Configuracao"];

            int    iLicenca    = Configuracao.Licenca;
            int    iAtivos     = CUsuario.RetornarQuantidadeOperadores();
            string nOperadores = "Licenciado para " + iLicenca + " operadores - Ativos: " + iAtivos;

            lblCopyright.Text = "Copyright © " + DateTime.Now.Year + " - PontoBR Sistemas - Versão Framework - " + PontoBr.Configuracao.Versao + " - " + sVersaoAplicativo + " (" + sRelease + ") - " + nOperadores;

            if (ConfigurationManager.AppSettings["TestandoSistema"].ToString() == "Sim")
            {
                txtUsuario.Attributes.Add("value", "s");
                txtSenha.Attributes.Add("value", "s");
                txtRamal.Attributes.Add("value", "12345");
            }


            //CarregarConfiguracoes();

            if (Request.QueryString["e"] != null)
            {
                PontoBr.Utilidades.Diversos.ExibirAlertaScriptManager("Sessão encerrada!\\n\\nCaso queira, faça novo login no sistema.", this.Page);
            }
        }
    }
Пример #15
0
        private bool PodeSalvar()
        {
            string sMensagem;

            if (txtSenhaAtual.Text.Trim() == "")
            {
                LimparCampos();
                sMensagem = "Preencha [Senha Atual].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtNovaSenha.Text.Trim() == "")
            {
                LimparCampos();
                sMensagem = "Preencha [Nova Senha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtRepetirNovaSenha.Text.Trim() == "")
            {
                LimparCampos();
                sMensagem = "Preencha [Repetir Nova Senha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtNovaSenha.Text.Trim() != txtRepetirNovaSenha.Text.Trim())
            {
                LimparCampos();
                sMensagem = "[Nova Senha] está diferente de [Repetir Nova Senha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            usuarioCTL CUsuario = new usuarioCTL();

            if (CUsuario.VerificarSenhaAtual(fLogin.Usuario.IDUsuario, txtSenhaAtual.Text) == false)
            {
                LimparCampos();
                sMensagem = "[Senha Atual] está incorreta.";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }
Пример #16
0
    protected void gridUsuario_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Abrir")
        {
            int iIDUsuario = Convert.ToInt32(gridUsuario.DataKeys[int.Parse((string)e.CommandArgument)]["Cód. Usuário"].ToString());

            usuario    Usuario  = new usuario();
            usuarioCTL CUsuario = new usuarioCTL();

            Usuario = CUsuario.RetornarUsuario(iIDUsuario);

            hddId.Value   = Usuario.IDUsuario.ToString();
            txtNome.Text  = Usuario.Nome;
            txtLogin.Text = Usuario.Login;
            txtSenha.Attributes.Add("value", Usuario.Senha);
            radAtivo.SelectedValue  = Convert.ToInt32(Usuario.Ativo).ToString();
            radPerfil.SelectedValue = Usuario.IDPerfil.ToString();

            //Desmarca todas as campanhas
            foreach (ListItem listItem in chkCampanha.Items)
            {
                listItem.Selected = false;
            }

            //Carregar campanhas do usuários
            DataTable dataTable = CUsuario.RetornarCampanhasUsuario(Usuario.IDUsuario);
            foreach (DataRow dataRow in dataTable.Rows)
            {
                foreach (ListItem listItem in chkCampanha.Items)
                {
                    if (dataRow["IDCampanha"].ToString() == listItem.Value)
                    {
                        listItem.Selected = true;
                    }
                }
            }
            txtNome.Focus();
        }
    }
Пример #17
0
    protected void gridUsuario_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow)
        {
            if (e.Row.RowState == DataControlRowState.Alternate)
            {
                e.Row.Attributes.Add("onmouseover", "this.className='grid_row_selecionado'");
                e.Row.Attributes.Add("onmouseout", "this.className='grid_alternative_row'");
            }
            else
            {
                e.Row.Attributes.Add("onmouseover", "this.className='grid_row_selecionado'");
                e.Row.Attributes.Add("onmouseout", "this.className='grid'");
            }

            //Obs: Não existia a linha: e.Row.Cells[3].Text == "Supervisor" - foi adicionado para listar as campanhas do Supervisor
            if (e.Row.Cells[3].Text == "Operador" || e.Row.Cells[3].Text == "BackOffice" || e.Row.Cells[3].Text == "Supervisor")
            {
                int    iIDUsuario = Convert.ToInt32(gridUsuario.DataKeys[e.Row.RowIndex].Values[0].ToString());
                string sCampanha  = "";

                usuarioCTL CUsuario  = new usuarioCTL();
                DataTable  dataTable = CUsuario.RetornarCampanhasUsuario(iIDUsuario);

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    sCampanha += sCampanha != "" ? "; " + dataRow["Campanha"].ToString() : dataRow["Campanha"].ToString();
                }
                e.Row.Cells[3].Text = sCampanha == "" ? "-" : sCampanha;
            }
            else
            {
                e.Row.Cells[3].Text = "-";
            }
        }
    }
Пример #18
0
        private void fLogin_Load(object sender, EventArgs e)
        {
            usuarioCTL CUsuario = new usuarioCTL();

            //Permite apenas 1 Tabulare aberto por máquina
            Process[] processos      = Process.GetProcesses();
            int       iNumTabuAberto = 0;

            foreach (Process processo in processos)
            {
                if (processo.ProcessName.ToUpper().IndexOf("TABULA") > -1 && processo.MainModule.ModuleName != "v1Tabulare_z13.vshost.exe")
                {
                    iNumTabuAberto++;
                }
            }

            if (iNumTabuAberto > 1)
            {
                cmdEntrar.Visible = false;
                MessageBox.Show("Só é permitida a abertura de uma instância do Tabulare.", "Tabulare Software", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            /*Verifica se o Crystal está instalado na máquina*/
            string sProgramasInstalados = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
            bool   bCrystalInstalado    = false;

            using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(sProgramasInstalados))
            {
                foreach (string sPrograma in registryKey.GetSubKeyNames())
                {
                    using (RegistryKey subRegistryKey = registryKey.OpenSubKey(sPrograma))
                    {
                        try
                        {
                            string x = (subRegistryKey.GetValue("DisplayName") + "  " + subRegistryKey.GetValue("DisplayVersion"));
                            if (x.IndexOf("Crystal Reports") > -1)
                            {
                                bCrystalInstalado = true;
                            }
                        }
                        catch { }
                    }
                }
                if (!bCrystalInstalado)
                {
                    cmdEntrar.Visible = false;
                    MessageBox.Show("Componente Crystal Reports não instalado neste computador.\n\nFavor contactar a TI local.", "Tabulare Software", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            CarregarStringConexao();
            CarregarConfiguracoes();
            CarregarLayout();
            try
            {
                VerificarExistenciaRamal();
            }
            catch (Exception ex)
            {
                PontoBr.Utilidades.Diversos.ExibirAlertaWindowsForm(ex.Message, "Tabulare");
            }

            /*Se tiver testando o sistema*/
            if (usuarioCTL.bTestandoSistema == false)
            {
                txtLogin.Text = "s";
                txtSenha.Text = "s";
                txtRamal.Text = "1712";
                txtAgent.Text = "everkelly.lima";
            }

            //txtLogin.Text = "planetfone.s";
            //txtSenha.Text = "planeta";
            //txtRamal.Text = "9999";
            //txtAgent.Text = "planetfone.s";
        }
Пример #19
0
    private void CarregarOperadores()
    {
        usuarioCTL CUsuario = new usuarioCTL();

        CUsuario.PreencherDrop_Operadores(dropOperador, true, false);
    }
Пример #20
0
        private void dgUsuario_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                txtIDUsuario.Text = dgUsuario.Rows[e.RowIndex].Cells[0].Value.ToString();
                txtNome.Text      = dgUsuario.Rows[e.RowIndex].Cells[1].Value.ToString();
                txtLogin.Text     = dgUsuario.Rows[e.RowIndex].Cells[2].Value.ToString();

                //Robson
                if (dgUsuario.Rows[e.RowIndex].Cells[3].Value.ToString() == "Operador")
                {
                    radOperador.Checked = true;
                }
                else if (dgUsuario.Rows[e.RowIndex].Cells[3].Value.ToString() == "Supervisor")
                {
                    radSupervisor.Checked = true;
                }
                else if (dgUsuario.Rows[e.RowIndex].Cells[3].Value.ToString() == "BackOffice")
                {
                    radBackoffice.Checked = true;
                }

                //Campanha
                usuarioCTL CUsuario = new usuarioCTL();
                if (dgUsuario.Rows[e.RowIndex].Cells[4].Value.ToString() != "")
                {
                    DataTable dataTable = CUsuario.RetornarCampanhasUsuario(Convert.ToInt32(dgUsuario.Rows[e.RowIndex].Cells[0].Value.ToString()));
                    //chlCampanha.DataSource = dataTable;

                    //Desmarca todas as Campanhas
                    for (int i = 0; i < this.chlCampanha.Items.Count; ++i)
                    {
                        this.chlCampanha.SetItemChecked(i, false);
                    }

                    for (int i = 0; i < this.chlCampanha.Items.Count; ++i)
                    {
                        foreach (DataRow dataRow in dataTable.Rows)
                        {
                            if (chlCampanha.Items[i].ToString() == dataRow["Campanha"].ToString())
                            {
                                this.chlCampanha.SetItemChecked(i, true);
                            }
                        }
                    }
                }

                //Ativo
                if (dgUsuario.Rows[e.RowIndex].Cells[5].Value.ToString() == "Sim")
                {
                    radSim.Checked = true;
                    radNao.Checked = false;
                }
                else
                {
                    radSim.Checked = false;
                    radNao.Checked = true;
                }

                txtSenha.Text = CUsuario.RetornarSenha(Convert.ToInt32(dgUsuario.Rows[e.RowIndex].Cells[0].Value.ToString()));
            }
        }
Пример #21
0
        private bool PodeSalvar()
        {
            string sMensagem;

            if (chlCampanha.CheckedItems.Count == 0)
            {
                sMensagem = "Selecione [Campanha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtNome.Text == "")
            {
                sMensagem = "Preencha [Nome].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtNome.Text.IndexOf("'") > -1)
            {
                sMensagem = "Não utilize aspas simples (') no campo [Nome].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtLogin.Text == "")
            {
                sMensagem = "Preencha [Login].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtLogin.Text.IndexOf("'") > -1)
            {
                sMensagem = "Não utilize aspas simples (') no campo [Login].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtSenha.Text == "")
            {
                sMensagem = "Preencha [Senha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (txtSenha.Text.IndexOf("'") > -1)
            {
                sMensagem = "Não utilize aspas simples (') no campo [Senha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (radNao.Checked == false && radSim.Checked == false)
            {
                sMensagem = "Selecione Sim ou Não para Ativo.";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            if (radOperador.Checked == false && radSupervisor.Checked == false && radBackoffice.Checked == false)
            {
                sMensagem = "Selecione [Perfil].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (radOperador.Checked == true && chlCampanha.CheckedItems.Count == 0)
            {
                sMensagem = "Selecione [Campanha].";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            //Verifica se o login já está cadastrado
            int        iIDUsuario = txtIDUsuario.Text == "" ? -1 : Convert.ToInt32(txtIDUsuario.Text);
            usuarioCTL CUsuario   = new usuarioCTL();

            if (CUsuario.VerificarExistenciaUsuario(PontoBr.Utilidades.String.RemoverCaracterInvalido(txtLogin.Text), iIDUsuario))
            {
                sMensagem = "O [Login] já está cadastrado.";
                MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
Пример #22
0
        private void cmdSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                if (PodeSalvar())
                {
                    string     sMensagem = "";
                    usuario    Usuario   = new usuario();
                    usuarioCTL CUsuario  = new usuarioCTL();

                    Usuario.Nome  = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtNome.Text);
                    Usuario.Login = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtLogin.Text);
                    Usuario.Senha = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtSenha.Text);
                    Usuario.Ativo = radSim.Checked == true ? 1 : 0;

                    //Robson
                    if (radSupervisor.Checked == true)
                    {
                        Usuario.IDPerfil = 1;
                    }
                    else if (radOperador.Checked == true)
                    {
                        Usuario.IDPerfil = 2;
                    }
                    else if (radBackoffice.Checked == true)
                    {
                        Usuario.IDPerfil = 4;
                    }

                    if (txtIDUsuario.Text != "")
                    {
                        Usuario.IDUsuario = Convert.ToInt32(txtIDUsuario.Text);

                        //Editar dados da tabela de Usuário
                        CUsuario.EditarUsuario(Usuario);
                        //Exclui todas as campanhas do usuário
                        CUsuario.ExcluirUsuarioCampanhas(Usuario.IDUsuario);
                        foreach (object itemChecked in chlCampanha.CheckedItems)
                        {
                            CUsuario.CadastrarUsuarioCampanhas(Usuario.IDUsuario, itemChecked.ToString());
                        }
                        sMensagem = "Alterações salvas com sucesso!";
                    }
                    else
                    {
                        Usuario.IDUsuario = Convert.ToInt32(CUsuario.CadastrarUsuario(Usuario, fLogin.Usuario.IDUsuario));
                        foreach (object itemChecked in chlCampanha.CheckedItems)
                        {
                            CUsuario.CadastrarUsuarioCampanhas(Usuario.IDUsuario, itemChecked.ToString());
                        }
                        sMensagem = "Usuário cadastrado com sucesso!";
                    }
                    chkListarAtivos.Checked = true;
                    LimparFormulario();
                    ListarUsuarios(-1);
                    MessageBox.Show(sMensagem, "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                PontoBr.Utilidades.Diversos.ExibirAlertaWindowsForm(ex.Message, "Tabulare Software");
            }
        }
Пример #23
0
        private void cmdEntrar_Click(object sender, EventArgs e)
        {
            if (PodeEntrar())
            {
                try
                {
                    usuarioCTL CUsuario = new usuarioCTL();

                    string sLogin = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtLogin.Text);
                    string sSenha = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtSenha.Text);
                    string sRamal = PontoBr.Utilidades.String.RemoverCaracterInvalido(txtRamal.Text);

                    int iIDUsuario = CUsuario.RetornarUsuario(sLogin, sSenha, 1);
                    if (iIDUsuario != 0)
                    {
                        //Cadastra ou atualiza o ramal de acordo com o DNS da máquina
                        CadastrarRamal();

                        Usuario = CUsuario.RetornarUsuario(iIDUsuario);
                        if (Usuario.IDUsuario == 0)
                        {
                            MessageBox.Show("O usuário não está vinculado à nenhuma Campanha.", "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        Usuario        = CUsuario.RetornarUsuario(sLogin, sSenha, sRamal);
                        Usuario.Agente = txtRamal.Text;
                        string sPerfil = Usuario.Perfil;

                        //De acordo com o Usuário do Agent (PlanetFone), retorna o NroAgente
                        if (fLogin.Configuracao.TipoPabx == "PlanetFone")
                        {
                            if (Usuario.Perfil == "Operador")
                            {
                                try
                                {
                                    RetornarNroAgente();

                                    CUsuario.AtualizarNroAgente(Usuario.IDUsuario, operador.fAtendimento.NroAgente);

                                    //Libera a tela do Operador porque o robô envia contato mesmo não logado no Tabulare
                                    if (fLogin.Usuario.TipoDiscador != "Power")
                                    {
                                        //Deixa o IDProspect = NULL - Para liberar a tela do Operador (Preditivo)
                                        CUsuario = new usuarioCTL();
                                        CUsuario.PausaAgente(fLogin.Usuario.IDUsuario, 0);

                                        //1 = Tabulare Logado (Necessário Preditivo) | 0 = Tabulare não Logado
                                        CUsuario.TabulareLogado(fLogin.Usuario.IDUsuario, 1);
                                    }
                                }
                                catch (Exception ex) /*Quando não conseguir integrar */
                                {
                                    PontoBr.Utilidades.Diversos.ExibirAlertaWindowsForm(ex.Message + "\n\nNão foi possível conectar no PlanetFone.\n\nO Tabulare irá funcionar sem a integração com o PABX.", "Tabulare Software");
                                }
                            }
                        }

                        //Licença
                        if (Usuario.Perfil == "Operador")
                        {
                            if (CUsuario.RetornarQuantidadeOperadores() > fLogin.iNumeroOperadores)
                            {
                                string sMensagem = "Sua licença execedeu o limite de usuários (perfil Operador).";
                                sMensagem += " Atualmente seu limite é de " + fLogin.iNumeroOperadores.ToString() + " operadores.";
                                sMensagem += "\n\nPeça o supervisor para acessar o Tabulare e, dentro do Módulo de Usuários, gerenciar a quantidade de operadores.";

                                PontoBr.Utilidades.Diversos.ExibirAlertaWindowsForm(sMensagem, "Tabulare Software");
                                return;
                            }
                        }

                        // int user = Convert.ToInt32(fLogin.iNumeroOperadores.ToString()) - CUsuario.RetornarQuantidadeOperadores();

                        if (VerificarVersaoDiscador() == true)
                        {
                            Logar(Usuario.Perfil);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Login e/ou Senha inválido(s).", "Tabulare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtLogin.Text = "";
                        txtSenha.Text = "";
                        txtLogin.Focus();
                    }
                }
                catch (Exception ex)
                {
                    PontoBr.Utilidades.Diversos.ExibirAlertaWindowsForm(ex.Message, "Tabulare Software");
                }
            }
        }
        private void CarregarOperadores()
        {
            usuarioCTL CUsuario = new usuarioCTL();

            CUsuario.PreencherComboBox_Operadores(comboOperador);
        }