Esempio n. 1
0
 private void chkTodos_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (chkTodos.Checked)
         {
             for (int i = 0; i < lvArquivos.Items.Count; i++)
             {
                 lvArquivos.Items[i].Checked = true;
             }
         }
         else
         {
             for (int i = 0; i < lvArquivos.Items.Count; i++)
             {
                 lvArquivos.Items[i].Checked = false;
             }
         }
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 2
0
        private void timerBackup_Tick(object sender, EventArgs e)
        {
            if (tspBarraProgresso.Value < 100)
            {
                tspBarraProgresso.Value = tspBarraProgresso.Value + 5;

                if (tspBarraProgresso.Value == 100)
                {
                    MessageBox.Show("Backup realizado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    #region LOG
                    cLog lg = new cLog();
                    lg.log         = string.Concat("Backup realizado em: ", DateTime.Now, Environment.NewLine);
                    lg.form        = this.Text;
                    lg.metodo      = sender.ToString();
                    lg.dt          = DateTime.Now;
                    lg.usersistema = cGlobal.userlogado;
                    lg.userRede    = Environment.UserName;
                    lg.terminal    = Environment.MachineName;
                    lg.tp_flag     = true;
                    lg.grava_log(lg);
                    #endregion
                    grava_log();
                    tspBarraProgresso.Value = 0;
                    this.Cursor             = Cursors.Arrow;
                    timerBackup.Enabled     = false;
                    controle(true);
                    inicio();
                }
            }
            else
            {
                this.Cursor         = Cursors.Arrow;
                timerBackup.Enabled = false;
            }
        }
Esempio n. 3
0
        private void grava_log()
        {
            try
            {
                if (File.Exists(string.Concat(Application.StartupPath, @"\Backup.txt")))
                {
                    File.Delete(string.Concat(Application.StartupPath, @"\Backup.txt"));
                }

                using (StreamWriter sw = new StreamWriter(string.Concat(Application.StartupPath, @"\Backup.txt")))
                {
                    sw.Write(string.Format("{0}-{1}", "1", txtPathBD.Text));
                    sw.Write(Environment.NewLine);
                    sw.Write(string.Format("{0}-{1}", "2", txtDestino.Text));
                    sw.Write(Environment.NewLine);
                    sw.Write(string.Format("{0}-{1} - Usuário: {2}", "3", DateTime.Now, cGlobal.userlogado));
                }
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = "grava_log";
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 4
0
 private void lvRTO_Click(object sender, EventArgs e)
 {
     try
     {
         cGlobal.editando = true;
         txtID.Text       = lvRTO.SelectedItems[0].Text;
         dtComissao.Value = Convert.ToDateTime(lvRTO.SelectedItems[0].SubItems[1].Text);
         dtCorte.Value    = Convert.ToDateTime(lvRTO.SelectedItems[0].SubItems[2].Text);
         txtNumero.Text   = lvRTO.SelectedItems[0].SubItems[3].Text;
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 5
0
 private void tsbtnNovo_Click(object sender, EventArgs e)
 {
     try
     {
         cGlobal.editando    = false;
         txtID.Text          = string.Empty;
         txtRazaoSocial.Text = string.Empty;
         txtSiglaSac.Text    = string.Empty;
         txtSiglaFy.Text     = string.Empty;
         rbCnpj.Checked      = true;
         //mktCnpjCpf.Mask = "00.000.000/0000-00";
         mktCnpjCpf.Text = string.Empty;
         txtRazaoSocial.Focus();
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 6
0
        private void lvTpEventos_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //if (lvTpEventos.SelectedItems.Count == 0)
                //{
                //    tsslblMsg.Text = "Nenhum registro foi selecionado";
                //    return;
                //}

                cGlobal.editando      = true;
                txtID.Text            = lvTpEventos.SelectedItems[0].Text;
                txtEvento.Text        = lvTpEventos.SelectedItems[0].SubItems[1].Text;
                txtMaskara.Text       = lvTpEventos.SelectedItems[0].SubItems[2].Text;
                txtRecomendacoes.Text = lvTpEventos.SelectedItems[0].SubItems[3].Text;
                chkRTO.Checked        = Convert.ToBoolean(lvTpEventos.SelectedItems[0].SubItems[4].Text) == true ? true : false;
                chkExcecao.Checked    = Convert.ToBoolean(lvTpEventos.SelectedItems[0].SubItems[5].Text) == true ? true : false;
                chkHabilitado.Checked = Convert.ToBoolean(lvTpEventos.SelectedItems[0].SubItems[6].Text) == true ? true : false;
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 7
0
 private void btnLocalizar_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(txtLocalizar.Text))
         {
             #region LOG
             cLog lg = new cLog();
             lg.log = string.Concat("Localização de Demanda(Atividade)", Environment.NewLine,
                                    "Evento localizado: ", txtLocalizar.Text
                                    );
             lg.form        = this.Text;
             lg.metodo      = sender.ToString();
             lg.dt          = DateTime.Now;
             lg.usersistema = cGlobal.userlogado;
             lg.userRede    = Environment.UserName;
             lg.terminal    = Environment.MachineName;
             lg.tp_flag     = true;
             lg.grava_log(lg);
             #endregion
             inicio(false);
         }
         else
         {
             inicio(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            try
            {
                //já mostra no campo login o usuário da rede
                txtLogin.Text = Environment.UserName.ToUpper(); //descomentar

                if (!string.IsNullOrEmpty(txtLogin.Text))
                {
                    txtSenha.TabIndex           = 0;
                    btnLogin.TabIndex           = 1;
                    btnCancelar.TabIndex        = 2;
                    lklblCadastraSenha.TabIndex = 3;
                    txtLogin.TabIndex           = 4;
                }

                //txtLogin.Text = "ADMINISTRADOR";
                //txtSenha.Text = "1310"; //"#itau"; //teste
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = "";
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 9
0
        private void btnGerarCapacity_Click(object sender, EventArgs e)
        {
            try
            {
                string param = cGlobal.InputBox("Digite o ano", "Capacity", "");
                if (!string.IsNullOrEmpty(param))
                {
                    cCapacity cc = new cCapacity();
                    cc.ano = param;

                    if (!cc.verifica_capacity_ano(cc))
                    {
                        if (cc.gera_capacity(cc) > 1)
                        {
                            MessageBox.Show("Capacity gerado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Problemas ao gerar Capacity.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        #region LOG
                        cLog lg = new cLog();
                        lg.log         = string.Concat("Geração de Capacity para o ano  ", param, Environment.NewLine);
                        lg.form        = this.Text;
                        lg.metodo      = sender.ToString();
                        lg.dt          = DateTime.Now;
                        lg.usersistema = cGlobal.userlogado;
                        lg.userRede    = Environment.UserName;
                        lg.terminal    = Environment.MachineName;
                        lg.tp_flag     = true;
                        lg.grava_log(lg);
                        #endregion
                    }
                    else
                    {
                        MessageBox.Show(string.Format("Já consta capacity gerado para o ano de {0}.", param), "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 10
0
 private void tsbtnNovo_Click(object sender, EventArgs e)
 {
     try
     {
         cGlobal.editando = false;
         txtID.Text       = string.Empty;
         dtComissao.Value = DateTime.Now;
         dtCorte.Value    = DateTime.Now;
         txtNumero.Text   = string.Empty;
         dtComissao.Focus();
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 11
0
 private void tsbtnCancelar_Click(object sender, EventArgs e)
 {
     try
     {
         Bloqueio(true);
         tsbtnNovo.Enabled     = true;
         tsbtnEditar.Enabled   = false;
         tsbtnCancelar.Enabled = false;
         tsbtnDeletar.Enabled  = false;
         tsbtnSalvar.Enabled   = false;
         txtLocalizar.Enabled  = true;
         btnLocalizar.Enabled  = true;
         inicio(false);
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 12
0
        private void btnIniciarRestore_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtPathBD.Text))
                {
                    MessageBox.Show("Arquivo de backup não informado.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    btnBuscar.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtDestino.Text))
                {
                    MessageBox.Show("Informe o caminho onde será restaurado\no o backup do Banco de Dados.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    btnAbrir.Focus();
                    return;
                }

                DialogResult dlr = (MessageBox.Show("Deseja realmente restaurar este Banco de Dados?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation));
                if (dlr == DialogResult.Yes)
                {
                    this.Cursor = Cursors.AppStarting;
                    controle(false);
                    timerRestore.Enabled  = true;
                    timerRestore.Interval = 100;

                    if (File.Exists(string.Concat(txtDestino.Text, @"\Nav[E]ventos.mdb")))
                    {
                        File.Delete(string.Concat(txtDestino.Text, @"\Nav[E]ventos.mdb"));
                        File.Copy(txtPathBD.Text, txtDestino.Text + @"\Nav[E]ventos.mdb");
                    }
                    else
                    {
                        File.Copy(txtPathBD.Text, txtDestino.Text + @"\Nav[E]ventos.mdb");
                    }
                }
                else
                {
                    controle(true);
                    inicio();
                    return;
                }
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 13
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = (MessageBox.Show("Deseja realmente salvar as alterações?", "Mensagem", MessageBoxButtons.YesNo, MessageBoxIcon.Warning));
                if (dr == DialogResult.Yes)
                {
                    cConfiguracao cf = new cConfiguracao();
                    cf.sac      = string.Format(@"{0}", txtSAC.Text);
                    cf.di8      = string.Format(@"{0}", txtDI8.Text);
                    cf.id_setor = cGlobal.userSetor;
                    cf.update_diretorios(cf);

                    MessageBox.Show("Caminho dos arquivos configurado\r\ncom sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    #region LOG
                    cLog lg = new cLog();
                    lg.log = string.Concat("Configuração de Diretórios",
                                           Environment.NewLine,
                                           "Departamento: ",
                                           cGlobal.userSetor);
                    lg.form        = this.Text;
                    lg.metodo      = sender.ToString();
                    lg.dt          = DateTime.Now;
                    lg.usersistema = cGlobal.userlogado;
                    lg.userRede    = Environment.UserName;
                    lg.terminal    = Environment.MachineName;
                    lg.tp_flag     = true;
                    lg.grava_log(lg);
                    #endregion

                    Dispose();
                    Close();
                }
                else
                {
                    inicio();
                    return;
                }
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 14
0
        private void mnuExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvUsuarios.SelectedItems.Count == 0)
                {
                    return;
                }

                cUsuario user = new cUsuario();
                user.id_usuario = Convert.ToInt32(lvUsuarios.SelectedItems[0].Text);
                user.usuario    = lvUsuarios.SelectedItems[0].SubItems[1].Text.ToUpper();
                DialogResult dlr = (MessageBox.Show(string.Concat("Deseja realmente exclui o usuário:\n", lvUsuarios.SelectedItems[0].SubItems[1].Text, "?"), "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question));
                if (dlr == DialogResult.Yes)
                {
                    user.exclui_usuario(user);
                    MessageBox.Show("Usuário excluído com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    #region LOG
                    cLog lg = new cLog();
                    lg.log = string.Concat("Exclusão de Registro.", Environment.NewLine,
                                           "Usuário: ", user.usuario
                                           );
                    lg.form        = this.Text;
                    lg.metodo      = sender.ToString();
                    lg.dt          = DateTime.Now;
                    lg.usersistema = cGlobal.userlogado;
                    lg.userRede    = Environment.UserName;
                    lg.terminal    = Environment.MachineName;
                    lg.tp_flag     = true;
                    lg.grava_log(lg);
                    #endregion

                    inicio();
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 15
0
        private void inicio(bool flag)
        {
            try
            {
                tspMenuSuperior.Enabled = true;
                cLog cl = new cLog();
                ds = cl.retorna_log(flag);

                if (ds.Tables["Log"].Rows.Count == 0)
                {
                    limpa();
                    return;
                }

                #region DATASET
                txtID.DataBindings.Clear();
                txtForm.DataBindings.Clear();
                txtEvento.DataBindings.Clear();
                txtData.DataBindings.Clear();
                txtUsuarioSistema.DataBindings.Clear();
                txtUsuarioRede.DataBindings.Clear();
                txtTerminal.DataBindings.Clear();
                txtLog.DataBindings.Clear();

                txtID.DataBindings.Add("Text", ds, "Log.ID_LOG");
                txtForm.DataBindings.Add("Text", ds, "Log.FORM");
                txtEvento.DataBindings.Add("Text", ds, "Log.METODO");
                txtData.DataBindings.Add("Text", ds, "Log.DT");
                txtUsuarioSistema.DataBindings.Add("Text", ds, "Log.USER_SISTEMA");
                txtUsuarioRede.DataBindings.Add("Text", ds, "Log.USER_REDE");
                txtTerminal.DataBindings.Add("Text", ds, "Log.TERMINAL");
                txtLog.DataBindings.Add("Text", ds, "Log.LOG");

                //tslblStatus.Text = string.Concat(BindingContext[ds, "Log"].Position + 1, "/", BindingContext[ds, "Log"].Count);
                BindingContext[ds, "Log"].Position = BindingContext[ds, "Log"].Count - 1;
                tslblStatus.Text = string.Concat(BindingContext[ds, "Log"].Count, "/", BindingContext[ds, "Log"].Count);
                #endregion
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = "inicio";
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 16
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                //Jet OLEDB:Database Password = gr@w*16
                monta_caminho = string.Format(@"Provider = Microsoft.Jet.OLEDB.4.0; Data Source ={0}\{1};", txtDiretorio.Text, txtNomeBanco.Text);
                Configuration conf = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
                conf.ConnectionStrings.ConnectionStrings["cnn"].ConnectionString = monta_caminho;
                conf.Save();
                grava_log();
                MessageBox.Show("Configuração alterada com sucesso.\r\nÉ necessário fechar e iniciar novamente o sistema,\r\npara que a alteração tenha efeito.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Dispose();
                Close();

                //Configuration conf = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
                //conf.ConnectionStrings.ConnectionStrings["cnn"].ConnectionString = string.Concat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=", txtDiretorio.Text);
                //conf.Save();

                #region LOG
                cLog lg = new cLog();
                lg.log         = string.Concat("Configuração de Conexão", Environment.NewLine, string.Concat(txtDiretorio.Text, txtNomeBanco.Text));
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = true;
                lg.grava_log(lg);
                #endregion

                Dispose();
                Close();
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 17
0
        private void tsbtnDeletar_Click(object sender, EventArgs e)
        {
            try
            {
                cDemanda cdem = new cDemanda();
                cdem.id_demanda = Convert.ToInt32(txtIdDemanda.Text);

                DialogResult dlr = (MessageBox.Show("Deseja realmente excluir esta Demanda?", "Mensagem", MessageBoxButtons.YesNo, MessageBoxIcon.Question));
                if (dlr == DialogResult.Yes)
                {
                    cdem.deleta_demanda(cdem);
                    MessageBox.Show("Registro excluído com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    #region LOG
                    cLog lg = new cLog();
                    lg.log = string.Concat("Exclusão de Registro.", Environment.NewLine,
                                           "Demanda nº : ", cdem.id_demanda
                                           );
                    lg.form        = this.Text;
                    lg.metodo      = sender.ToString();
                    lg.dt          = DateTime.Now;
                    lg.usersistema = cGlobal.userlogado;
                    lg.userRede    = Environment.UserName;
                    lg.terminal    = Environment.MachineName;
                    lg.tp_flag     = true;
                    lg.grava_log(lg);
                    #endregion

                    inicio(false);
                    txtLocalizar.Text = string.Empty;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 18
0
        private void lvwUsuarios_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text              = lvUsuarios.SelectedItems[0].Text;
                txtNome.Text            = lvUsuarios.SelectedItems[0].SubItems[1].Text;
                txtEmail.Text           = lvUsuarios.SelectedItems[0].SubItems[2].Text;
                txtLogin.Text           = lvUsuarios.SelectedItems[0].SubItems[3].Text;
                chkAprovEventos.Checked = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[5].Text) ? true : false;
                chkGovernanca.Checked   = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[6].Text) ? true : false;
                chkCadCliente.Checked   = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[7].Text) ? true : false;
                chkCronograma.Checked   = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[8].Text) ? true : false;
                chkProduto.Checked      = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[9].Text) ? true : false;
                chkSuporte.Checked      = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[10].Text) ? true : false;
                chkResetaSenha.Checked  = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[11].Text) ? true : false;
                chkAdm.Checked          = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[12].Text) ? true : false;
                chkInativar.Checked     = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[13].Text) ? true : false;

                //MOSTRA SETOR VINCULADO
                cUsuario user = new cUsuario();
                using (DataSet ds = user.retorna_area_usuario(int.Parse(lvUsuarios.SelectedItems[0].Text), Convert.ToInt32(lvUsuarios.SelectedItems[0].SubItems[14].Text)))
                {
                    using (DataTable dt = ds.Tables["Area"])
                    {
                        foreach (DataRow item in dt.Rows)
                        {
                            cboArea.SelectedValue = item["ID_SETOR"].ToString();
                        }
                    }
                }

                status_form(true);
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 19
0
 private void tsbtnSalvar_Click(object sender, EventArgs e)
 {
     try
     {
         cTipoEvento ctp = new cTipoEvento();
         ctp.id_descricao_evento = int.Parse(txtID.Text);
         ctp.maskara             = txtDescricaoEvento.Text;
         ctp.dtdemanda           = dtpDataDemanda.Value;
         ctp.rto    = chkRTO.Checked;
         ctp.dtcota = dtpCota.Value;
         ctp.atualiza_descricao_evento(ctp);
         MessageBox.Show("Registro atualizado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         #region LOG
         cLog lg = new cLog();
         lg.log = string.Concat("Alteração da Registro.", Environment.NewLine,
                                "Evento: ", txtEvento.Text, Environment.NewLine,
                                "Descrição: ", txtDescricaoEvento.Text, Environment.NewLine,
                                "Data da Demanda: ", dtpDataDemanda.Value, Environment.NewLine,
                                "Data da Cota: ", dtpCota.Value
                                );
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = true;
         lg.grava_log(lg);
         #endregion
         Dispose();
         Close();
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 20
0
 private void inicio()
 {
     try
     {
         if (File.Exists(string.Concat(Application.StartupPath, @"\Backup.txt")))
         {
             rdr = new StreamReader(string.Concat(Application.StartupPath, @"\Backup.txt"));
             while ((linha = rdr.ReadLine()) != null)
             {
                 if (linha.Substring(0, 1) == "1")
                 {
                     txtPathBD.Text = linha.ToString().Substring(2, linha.Length - 2);
                 }
                 else if (linha.Substring(0, 1) == "2")
                 {
                     txtDestino.Text = linha.ToString().Substring(2, linha.Length - 2);
                 }
                 else
                 {
                     lblAviso.Text = string.Concat("Último Backup realizado em: ", linha.ToString().Substring(2, linha.Length - 2));
                 }
             }
             rdr.Dispose();
             rdr.Close();
         }
         else
         {
             lblAviso.Text = string.Empty;
         }
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = "inicio";
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 21
0
        private void lvFundo_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string doc;

                cGlobal.editando    = true;
                txtID.Text          = lvFundo.SelectedItems[0].Text;
                txtRazaoSocial.Text = lvFundo.SelectedItems[0].SubItems[1].Text;
                txtSiglaSac.Text    = lvFundo.SelectedItems[0].SubItems[2].Text;
                txtSiglaFy.Text     = lvFundo.SelectedItems[0].SubItems[3].Text;
                doc = lvFundo.SelectedItems[0].SubItems[4].Text.Replace(",", "").Replace(".", "").Replace("/", "").Replace("-", "");

                if (doc.Length == 14)
                {
                    rbCnpj.Checked  = true;
                    mktCnpjCpf.Mask = "00.000.000/0000-00";
                    mktCnpjCpf.Text = string.Concat(doc.Substring(0, 2), doc.Substring(2, 3), doc.Substring(5, 3), doc.Substring(8, 4), doc.Substring(12, 2)).Replace(",", ".");
                }
                else
                {
                    rbCpf.Checked   = true;
                    mktCnpjCpf.Mask = "000.000.000-00";
                    mktCnpjCpf.Text = string.Concat(doc.Substring(0, 3), doc.Substring(3, 3), doc.Substring(6, 3), doc.Substring(9, 2)).Replace(",", ".");
                }
            }
            catch (Exception ex)
            {
                rbCnpj.Checked  = true;
                mktCnpjCpf.Text = "  ,   ,   /    -";
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 22
0
        private void frmConfiguracao_Load(object sender, EventArgs e)
        {
            try
            {
                if (File.Exists(string.Concat(Application.StartupPath, @"\Config.txt")))
                {
                    StreamReader rdr   = null;
                    string       linha = string.Empty;

                    rdr = new StreamReader(string.Concat(Application.StartupPath, @"\Config.txt"));
                    while ((linha = rdr.ReadLine()) != null)
                    {
                        txtDiretorio.Text = linha.ToString();
                    }
                    rdr.Dispose();
                    rdr.Close();
                }

                #region RETORNA O TAMANHO DO ARQUIVO EM DISCO
                FileInfo fi = new FileInfo(string.Concat(Application.StartupPath, @"\Nav[E]ventos.mdb"));
                lbltamanho.Text = string.Concat("Tamanho do Banco de Dados em Disco: ", cGlobal.TamanhoAmigavel(fi.Length));
                #endregion

                //int qtdcaracter = (ConfigurationManager.ConnectionStrings["cnn"].ToString().Length - 45 - txtNomeBanco.Text.Length);
                //txtDiretorio.Text = ConfigurationManager.ConnectionStrings["cnn"].ToString().Substring(45, qtdcaracter);
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 23
0
        private void lvUsuarios_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                txtID.Text             = lvUsuarios.SelectedItems[0].Text;
                txtNome.Text           = lvUsuarios.SelectedItems[0].SubItems[1].Text;
                txtEmail.Text          = lvUsuarios.SelectedItems[0].SubItems[2].Text;
                txtLogin.Text          = lvUsuarios.SelectedItems[0].SubItems[3].Text;
                chkResetaSenha.Checked = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[5].Text) ? true : false;
                chkAdm.Checked         = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[6].Text) ? true : false;
                chkInativar.Checked    = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[7].Text) ? true : false;
                chkExec.Checked        = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[9].Text) ? true : false;
                chkRpt.Checked         = Convert.ToBoolean(lvUsuarios.SelectedItems[0].SubItems[10].Text) ? true : false;

                //MOSTRA SETOR VINCULADO
                cUsuario user = new cUsuario();
                using (DataTable dt = user.retorna_area_usuario(int.Parse(lvUsuarios.SelectedItems[0].Text), Convert.ToInt32(lvUsuarios.SelectedItems[0].SubItems[8].Text)))
                {
                    cboArea.SelectedValue = dt.Rows[0].ItemArray[1].ToString();
                }

                status_form(true);
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = sender.ToString();
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
 private void frmRerportPeriodo_Load(object sender, EventArgs e)
 {
     try
     {
         inicio();
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 25
0
 private void frmAtividade_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         dsdem.Dispose();
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 26
0
        private void inicia_importacao(string caminho_arquivo, string nm_arq)
        {
            try
            {
                //Importação dos registros
                //-----------------------------------------------------------------------------------------------
                List <string> querysImp = new List <string>();

                querysImp = cproc.identifica_arquivo(nm_arq, caminho_arquivo, "insert");

                tsProgresso.Visible = true;
                tsProgresso.Value   = 0;
                tsProgresso.Maximum = querysImp.Count;

                for (int i = 0; i < querysImp.Count; i++)
                {
                    dao.executa_query(querysImp[i].ToString(), "cnn_proc");
                    tsProgresso.Value++;
                }
                //-----------------------------------------------------------------------------------------------
                tsProgresso.Value = 0;
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = "inicia_importacao";
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }
Esempio n. 27
0
 private void mnuLogoff_Click(object sender, EventArgs e)
 {
     try
     {
         #region LOG
         cLog lg = new cLog();
         lg.log         = "Efetuado Logoff no Sistema";
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = true;
         lg.grava_log(lg);
         #endregion
         using (frmLogin frm = new frmLogin())
         {
             this.Hide();
             frm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 28
0
 private void inicio()
 {
     try
     {
         cTipoEvento ctp = new cTipoEvento();
         ctp.id_descricao_evento = cGlobal.id_desc_evento;
         using (DataSet ds = ctp.retorna_descricao_evento(ctp))
         {
             foreach (DataRow drw in ds.Tables["DescEvento"].Rows)
             {
                 txtID.Text              = drw["ID_DESCRICAO_EVENTO"].ToString();
                 txtIDDemanda.Text       = drw["SEQ_EVENTO"].ToString();
                 txtIDTPEvento.Text      = drw["ID_TP_EVENTO"].ToString();
                 txtEvento.Text          = drw["EVENTO"].ToString();
                 txtDescricaoEvento.Text = drw["DESCRICAO"].ToString();
                 chkRTO.Checked          = Convert.ToBoolean(drw["RTO"].ToString());
                 dtpDataDemanda.Value    = Convert.ToDateTime(drw["DTDEMANDA"].ToString());
                 dtpCota.Value           = Convert.ToDateTime(drw["DTCOTA"].ToString());
             }
         }
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = "Inicio";
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 29
0
 private void inicio()
 {
     try
     {
         #region FORMATACAO DA LISTVIEW
         lvArquivos.Clear();
         lvArquivos.View               = View.Details;
         lvArquivos.LabelEdit          = true;
         lvArquivos.AllowColumnReorder = true;
         lvArquivos.CheckBoxes         = true;
         lvArquivos.FullRowSelect      = true;
         lvArquivos.GridLines          = true;
         lvArquivos.Columns.Add("", 50, HorizontalAlignment.Center);
         lvArquivos.Columns.Add("SAC", 160, HorizontalAlignment.Center);
         lvArquivos.Columns.Add("DI8", 160, HorizontalAlignment.Center);
         lvArquivos.Columns.Add("Descrição", 250, HorizontalAlignment.Center);
         lvArquivos.Columns.Add("Status Importação", 180, HorizontalAlignment.Center);
         lvArquivos.Columns.Add("Status Batimento", 180, HorizontalAlignment.Center);
         #endregion
         cproc.preenche_listview(ref lvArquivos);
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = Text;
         lg.metodo      = "inicio";
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }
Esempio n. 30
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     try
     {
         Dispose();
         Close();
         Application.Exit();
     }
     catch (Exception ex)
     {
         #region LOG ERRO
         cLog lg = new cLog();
         lg.log         = ex.Message.Replace("'", "");
         lg.form        = this.Text;
         lg.metodo      = sender.ToString();
         lg.dt          = DateTime.Now;
         lg.usersistema = cGlobal.userlogado;
         lg.userRede    = Environment.UserName;
         lg.terminal    = Environment.MachineName;
         lg.tp_flag     = false;
         lg.grava_log(lg);
         #endregion
     }
 }