コード例 #1
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
     }
 }
コード例 #2
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
     }
 }
コード例 #3
0
        private void mnuExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvTpEventos.SelectedItems.Count == 0)
                {
                    tsslblMsg.Text = "Nenhum registro foi selecionado";
                    return;
                }

                cTipoEvento ctp = new cTipoEvento();
                ctp.id_tpevento = Convert.ToInt32(lvTpEventos.SelectedItems[0].Text);
                ctp.tpevento    = lvTpEventos.SelectedItems[0].SubItems[1].Text;

                DialogResult dlr = (MessageBox.Show(string.Concat("Deseja realmente exclui o tipo de evento:\n", lvTpEventos.SelectedItems[0].SubItems[1].Text, "?"), "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question));
                if (dlr == DialogResult.Yes)
                {
                    if (!ctp.exclui_tpevento(ctp))
                    {
                        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,
                                               "Evento: ", ctp.tpevento.ToUpper()
                                               );
                        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
                    {
                        MessageBox.Show("O registro não pode ser excluído,\npois contém EVENTOS vínculados.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        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
            }
        }
コード例 #4
0
        private void inicio()
        {
            try
            {
                limpa_campos();
                txtEvento.Focus();
                cTipoEvento tpe = new cTipoEvento();
                using (DataSet ds = tpe.preenche_lista_tpeventos())
                {
                    using (DataTable dt = ds.Tables["TpEventos"])
                    {
                        #region listview
                        lvTpEventos.Clear();
                        lvTpEventos.View               = View.Details;
                        lvTpEventos.LabelEdit          = true;
                        lvTpEventos.AllowColumnReorder = true;
                        lvTpEventos.CheckBoxes         = false;
                        lvTpEventos.FullRowSelect      = true;
                        lvTpEventos.GridLines          = true;
                        //lvTpEventos.Sorting = SortOrder.Ascending;

                        lvTpEventos.Columns.Add("ID", 50);
                        lvTpEventos.Columns.Add("Evento", 490, HorizontalAlignment.Left);
                        //lvTpEventos.Columns.Add("Cadastro por", 120, HorizontalAlignment.Left);
                        //lvTpEventos.Columns.Add("Data Cadastro", 120, HorizontalAlignment.Left);
                        lvTpEventos.Columns.Add("", 0);
                        lvTpEventos.Columns.Add("", 0);
                        lvTpEventos.Columns.Add("", 0);
                        lvTpEventos.Columns.Add("", 0);

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            DataRow      drw = dt.Rows[i];
                            ListViewItem lvi = new ListViewItem(drw["ID_TP_EVENTO"].ToString());
                            lvi.SubItems.Add(drw["EVENTO"].ToString());
                            //lvi.SubItems.Add(drw["USERCAD"].ToString());
                            //lvi.SubItems.Add(drw["DTCAD"].ToString());
                            lvi.SubItems.Add(drw["MASCARA"].ToString());
                            lvi.SubItems.Add(drw["RECOMENDACOES"].ToString());
                            lvi.SubItems.Add(drw["RTO"].ToString());
                            lvi.SubItems.Add(drw["FLAG"].ToString());
                            lvi.SubItems.Add(drw["flgHabilitado"].ToString());

                            lvTpEventos.Items.Add(lvi);
                        }
                        lblTotalReg.Text = string.Concat("Total de ", lvTpEventos.Items.Count, " registro(s)");
                        #endregion
                    }
                }

                if (lvTpEventos.Items.Count == 0)
                {
                    mnuOculto.Enabled = false;
                }
                else
                {
                    mnuOculto.Enabled = true;
                }

                if (lvTpEventos.Items.Count > 0)
                {
                    lvTpEventos.Items[0].Selected = true;
                    lvTpEventos_Click(null, null);
                }
            }
            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
            }
        }
コード例 #5
0
        private void tsbtnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                #region VALIDAÇÃO
                if (string.IsNullOrEmpty(txtEvento.Text))
                {
                    tsslblMsg.Text = "Tipo de Evento não informado";
                    txtEvento.Focus();
                    return;
                }
                #endregion

                cTipoEvento ctp = new cTipoEvento();
                if (!cGlobal.editando)
                {
                    ctp.tpevento      = txtEvento.Text.ToUpper();
                    ctp.maskara       = txtMaskara.Text;
                    ctp.recomendacoes = txtRecomendacoes.Text;
                    ctp.rto           = chkRTO.Checked == true ? true : false;
                    ctp.flag_excecao  = chkExcecao.Checked == true ? true : false;
                    ctp.flgHabilitado = chkHabilitado.Checked == true ? true : false;
                    ctp.grava_tipo_evento(ctp);
                    MessageBox.Show("Tipo de Evento cadastrado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    #region LOG
                    cLog lg = new cLog();
                    lg.log = string.Concat("Inclusão de Registro.", Environment.NewLine,
                                           "Evento: ", txtEvento.Text, Environment.NewLine,
                                           "Mascara: ", txtMaskara.Text, Environment.NewLine,
                                           "recomendacoes: ", txtRecomendacoes.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
                }
                else
                {
                    ctp.id_tpevento   = Convert.ToInt32(txtID.Text);
                    ctp.tpevento      = txtEvento.Text.ToUpper();
                    ctp.maskara       = txtMaskara.Text;
                    ctp.recomendacoes = txtRecomendacoes.Text;
                    ctp.rto           = chkRTO.Checked == true ? true : false;
                    ctp.flag_excecao  = chkExcecao.Checked == true ? true : false;
                    ctp.flgHabilitado = chkHabilitado.Checked == true ? true : false;
                    ctp.atualiza_cadastro_tpevento(ctp);
                    MessageBox.Show("O Evento foi alterado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    #region LOG
                    cLog lg = new cLog();
                    lg.log = string.Concat("Alteração de Registro.", Environment.NewLine,
                                           "Evento: ", txtEvento.Text, Environment.NewLine,
                                           "Mascara: ", txtMaskara.Text, Environment.NewLine,
                                           "recomendacoes: ", txtRecomendacoes.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();
            }
            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
            }
        }
コード例 #6
0
        private void inicio(bool pesquisa)
        {
            try
            {
                Bloqueio(true);
                tssMsg.Text = string.Empty;

                #region TIPO EVENTO
                cTipoEvento cte = new cTipoEvento();
                using (DataSet dstpevento = cte.preenche_lista_tpeventos())
                {
                    cboTPEvento.DataSource    = dstpevento.Tables["TpEventos"];
                    cboTPEvento.DisplayMember = "EVENTO";
                    cboTPEvento.ValueMember   = "ID_TP_EVENTO";
                    cboTPEvento.Text          = string.Empty;
                }
                #endregion

                cDemanda cdem = new cDemanda();
                if (!pesquisa)
                {
                    dsdem = cdem.retorna_demanda(null);
                }
                else
                {
                    dsdem = cdem.retorna_demanda(txtLocalizar.Text.ToUpper());
                }

                if (dsdem.Tables["Demanda"].Rows.Count == 0)
                {
                    txtLocalizar.Text = string.Empty;
                    inicio(false);
                }

                #region DATASET
                txtIdDemanda.DataBindings.Clear();
                cboTPEvento.DataBindings.Clear();
                txtAtividade.DataBindings.Clear();
                txtEsforco.DataBindings.Clear();
                cboResponsavel.DataBindings.Clear();
                txtSequencia.DataBindings.Clear();
                txtUsuario.DataBindings.Clear();
                txtDataCad.DataBindings.Clear();

                txtIdDemanda.DataBindings.Add("Text", dsdem, "Demanda.ID_ATIVIDADE");
                txtAtividade.DataBindings.Add("Text", dsdem, "Demanda.ATIVIDADE");
                txtEsforco.DataBindings.Add("Text", dsdem, "Demanda.ESFORCO");
                cboResponsavel.DataBindings.Add("Text", dsdem, "Demanda.RESPONSAVEL");
                txtSequencia.DataBindings.Add("Text", dsdem, "Demanda.SEQUENCIA");
                txtUsuario.DataBindings.Add("Text", dsdem, "Demanda.USERCAD");
                txtDataCad.DataBindings.Add("Text", dsdem, "Demanda.DTCAD");

                cboTPEvento.DataSource    = dsdem.Tables["TpEvento"];
                cboTPEvento.DisplayMember = "EVENTO";
                cboTPEvento.ValueMember   = "ID_TP_EVENTO";
                cboTPEvento.DataBindings.Add("SelectedValue", dsdem, "Demanda.ID_TP_EVENTO");

                tslStatus.Text = string.Concat(BindingContext[dsdem, "Demanda"].Position + 1, "/", BindingContext[dsdem, "Demanda"].Count);

                if (BindingContext[dsdem, "Demanda"].Count > 0)
                {
                    tsbtnNovo.Enabled     = true;
                    tsbtnEditar.Enabled   = true;
                    tsbtnCancelar.Enabled = false;
                    tsbtnDeletar.Enabled  = true;
                    tsbtnSalvar.Enabled   = false;
                }
                else
                {
                    tsbtnNovo.Enabled     = true;
                    tsbtnEditar.Enabled   = false;
                    tsbtnCancelar.Enabled = false;
                    tsbtnDeletar.Enabled  = false;
                    tsbtnSalvar.Enabled   = false;
                    Limpa_campos();
                }
                #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
            }
        }