private void mostra_registros() { try { //retorna dados do evento cMaskara cm = new cMaskara(); int retidevento = cm.retorna_id_tipo_evento(tvwDemanda.SelectedNode.Text); if (retidevento > 0) { cEvento ce = new cEvento(); using (DataSet ds = ce.retorna_descricao_evento(NDemanda, int.Parse(retidevento.ToString()))) { foreach (DataRow item in ds.Tables["RetDescEvento"].Rows) { txtinfProduto.Text = item["PRODUTO"].ToString(); txtinfCliente.Text = item["CLIENTE"].ToString(); txtinfFundo.Text = item["RAZAO_SOCIAL"].ToString(); txtinfSiglaSAC.Text = item["SIGLA_SAC"].ToString(); txtinfSiglaFY.Text = item["SIGLA_FY"].ToString(); if (item["CNPJ_CPF"].ToString().Length == 14) { txtinfCNPJCPF.Text = string.Concat(item["CNPJ_CPF"].ToString().Substring(0, 2), ".", item["CNPJ_CPF"].ToString().Substring(2, 3), ".", item["CNPJ_CPF"].ToString().Substring(5, 3), "/", item["CNPJ_CPF"].ToString().Substring(8, 4), "-", item["CNPJ_CPF"].ToString().Substring(12, 2)).Replace(",", "."); } else { txtinfCNPJCPF.Text = string.Concat(item["CNPJ_CPF"].ToString().Substring(0, 3), ".", item["CNPJ_CPF"].ToString().Substring(3, 3), ".", item["CNPJ_CPF"].ToString().Substring(6, 3), "-", item["CNPJ_CPF"].ToString().Substring(9, 2)).Replace(",", "."); } txtDtDemanda.Text = item["DTDEMANDA"].ToString().Substring(0, 10); txtDtCota.Text = item["DTCOTA"].ToString().Substring(0, 10); txtStatus.Text = item["STATUS"].ToString(); //txtApCad.Text = item["USER_CAD"].ToString(); //txtApCadData.Text = item["DT_USER_CAD"].ToString(); //txtApGov.Text = item["GOV_CAD"].ToString(); //txtApGovData.Text = item["DT_GOV_CAD"].ToString(); //txtApCap.Text = item["CAPACITY_CAD"].ToString(); //txtApCapData.Text = item["DT_CAPACITY_CAD"].ToString(); //txtApRTO.Text = item["RTO_CAD"].ToString(); //txtApRTOData.Text = item["DT_RTO_CAD"].ToString(); } if (ds.Tables["RetDescEvento"].Rows.Count > 0) { previa_Cronograma pc = new previa_Cronograma(); using (DataTable dt = pc.retorna_cronograma(NDemanda, int.Parse(retidevento.ToString()))) { #region CAMPOS DataGridViewTextBoxColumn campo0 = new DataGridViewTextBoxColumn(); campo0.Name = "Atividade"; campo0.HeaderText = "Atividade"; campo0.DataPropertyName = "ATIVIDADE"; campo0.Width = 200; DataGridViewTextBoxColumn campo1 = new DataGridViewTextBoxColumn(); campo1.Name = "Esforço"; campo1.HeaderText = "Esforço"; campo1.DataPropertyName = "ESFORCO_PLAN"; campo1.Width = 100; DataGridViewTextBoxColumn campo2 = new DataGridViewTextBoxColumn(); campo2.Name = "Data Execução"; campo2.HeaderText = "Data Execução"; campo2.DataPropertyName = "DT_EXEC_PLAN"; campo2.Width = 100; DataGridViewTextBoxColumn campo3 = new DataGridViewTextBoxColumn(); campo3.Name = "Responsavel"; campo3.HeaderText = "Responsável"; campo3.DataPropertyName = "RESPONSAVEL"; campo3.Width = 100; dgvCronograma.Columns.Clear(); dgvCronograma.AutoGenerateColumns = false; dgvCronograma.Columns.AddRange(new DataGridViewColumn[] { campo0, campo1, campo2, campo3 }); dgvCronograma.DataSource = dt; dt.Dispose(); cDGV modelo = new cDGV(); dgvCronograma = modelo.Grade(dgvCronograma); #region RETORNA TOTAL DE MINUTOS CONFORME O RESPONSAVEL decimal min_passivo = 0; decimal min_processamento = 0; decimal min_suporte = 0; foreach (DataGridViewRow item in dgvCronograma.Rows) { if ((string)item.Cells[3].Value == "Passivo") { min_passivo = min_passivo + Convert.ToDecimal(item.Cells[1].Value); } if ((string)item.Cells[3].Value == "Processamento") { min_processamento = min_processamento + Convert.ToDecimal(item.Cells[1].Value); } if ((string)item.Cells[3].Value == "Suporte") { min_suporte = min_suporte + Convert.ToDecimal(item.Cells[1].Value); } } txtPassivo.Text = Convert.ToString(min_passivo); txtProcessamento.Text = Convert.ToString(min_processamento); txtSuporte.Text = Convert.ToString(min_suporte); #endregion #endregion } } } } } catch (Exception ex) { throw ex; } }
private void tsbtnCancelarEvento_Click(object sender, EventArgs e) { try { DialogResult dlr = (MessageBox.Show("Deseja realmente cancelar este Evento?", "Mensagem", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); if (dlr == DialogResult.Yes) { if (cboStatus.Text == "Cancelado") { MessageBox.Show("Este evento já está cancelado.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //RETORNA O STATUS DO EVENTO cEvento ce = new cEvento(); b_reserva = ce.retorna_status_capacity_do_evento(NDemanda); previa_Cronograma pc = new previa_Cronograma(); using (DataTable dt = pc.retorna_cronograma(NDemanda, cGlobal.id_tp_evento)) { foreach (DataRow item in dt.Rows) { //int disponivel = int.Parse(item["DISPONIVEL"].ToString()); //int comprometido = int.Parse(item["COMPROMETIDO"].ToString()); //int reservado = int.Parse(item["RESERVA"].ToString()); int esforco = int.Parse(item["ESFORCO_PLAN"].ToString()); DateTime dt_esforco = Convert.ToDateTime(item["DT_EXEC_PLAN"].ToString()); string resp = item["RESPONSAVEL"].ToString(); pc.cancela_minutos_reservados(esforco, dt_esforco, resp, b_reserva); } } //remove cronograma //pc.remove_cronograma(NDemanda); //atualiza status do cronograma para Cancelado pc.atualiza_status_cronograma(NDemanda, cGlobal.id_tp_evento); MessageBox.Show("O evento foi cancelado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); #region LOG cLog lg = new cLog(); lg.log = string.Concat("Cancelamento de Evento(s)", Environment.NewLine, "Demanda nº ", NDemanda); 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 mostra_registros(); } } 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 } }