protected void btnEmailAlerta_Click(object sender, EventArgs e) { PriorizaChamadoBLL pcBLL = new PriorizaChamadoBLL(); foreach (VW_PRIORIZACHAMADO pc in pcBLL.GetWhere(txtNumChamado.Text, ddlSiglaArea.SelectedValue, ddlPesqSTATUS.SelectedValue, int.Parse(ddlIdadeStatus.SelectedValue), ddlPesqANALISTAS.SelectedValue).ToList()) { if (pc.STATUS != "CONCLUÍDO") { UsuariosBLL uBLL = new UsuariosBLL(); EnviaEmailDiasStatus(uBLL.Carregar(pc.ID_USUARIO.ToString()), pc.CHAMADO.ToString(), pc.TITULO, pc.STATUS, DateTime.Now.Subtract(((DateTime)pc.DT_INCLUSAO)).Days); } } }
protected void grdPriorizaChamados_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "AddNew") { string CHAMADO = ((TextBox)grdPriorizaChamados.FooterRow.FindControl("txtChamado")).Text; string TITULO = ((TextBox)grdPriorizaChamados.FooterRow.FindControl("txtTITULO")).Text; string AREA = ((DropDownList)grdPriorizaChamados.FooterRow.FindControl("ddlAREA")).SelectedValue; string ID_USUARIO = ((DropDownList)grdPriorizaChamados.FooterRow.FindControl("ddlANALISTA")).SelectedValue; string STATUS = ((DropDownList)grdPriorizaChamados.FooterRow.FindControl("ddlSTATUS")).SelectedValue; string DT_INCLUSAO = ((TextBox)grdPriorizaChamados.FooterRow.FindControl("txtDT_INCLUSAO")).Text; string DT_TERMINO = ((TextBox)grdPriorizaChamados.FooterRow.FindControl("txtDT_TERMINO")).Text; string OBS = ((TextBox)grdPriorizaChamados.FooterRow.FindControl("txtOBS")).Text; if (ValidaCampos(CHAMADO, ID_USUARIO)) { //odsPriorizaChamados.InsertParameters.Add("CHAMADO", CHAMADO); //odsPriorizaChamados.InsertParameters.Add("TITULO", TITULO); //odsPriorizaChamados.InsertParameters.Add("AREA", AREA); //odsPriorizaChamados.InsertParameters.Add("ID_USUARIO", ID_USUARIO); //odsPriorizaChamados.InsertParameters.Add("STATUS", STATUS); //odsPriorizaChamados.InsertParameters.Add("DT_INCLUSAO", DT_INCLUSAO); //odsPriorizaChamados.InsertParameters.Add("DT_TERMINO", DT_TERMINO); //odsPriorizaChamados.InsertParameters.Add("OBS", OBS); //if (odsPriorizaChamados.Insert() > 0) PriorizaChamadoBLL PriorBLL = new PriorizaChamadoBLL(); Resultado res = PriorBLL.InsertData(TITULO, AREA, int.Parse(ID_USUARIO), STATUS, DT_INCLUSAO, DT_TERMINO, OBS, decimal.Parse(CHAMADO)); if (res.Ok) { UsuariosBLL uBLL = new UsuariosBLL(); EnviaEmailPriorizacao(uBLL.Carregar(ID_USUARIO), CHAMADO, TITULO); grdPriorizaChamados.ShowFooter = false; } else { MostraMensagemTelaUpdatePanel(UpdatePanel, "Ocorreu um erro na tentativa de inserir a nova priorização.\\nErro: " + res.Mensagem + "\\n\\n(Contate o Chuck Norris)"); } } } else if (e.CommandName == "Update") { string CHAMADO = ((Label)grdPriorizaChamados.Rows[grdPriorizaChamados.EditIndex].FindControl("lblCHAMADO")).Text; string TITULO = ((TextBox)grdPriorizaChamados.Rows[grdPriorizaChamados.EditIndex].FindControl("txtTITULO")).Text; TextBox DT_TERMINO = (TextBox)grdPriorizaChamados.Rows[grdPriorizaChamados.EditIndex].FindControl("txtDT_TERMINO"); string ID_USUARIO = ((DropDownList)grdPriorizaChamados.Rows[grdPriorizaChamados.EditIndex].FindControl("ddlANALISTA")).SelectedValue; string STATUS_ANTERIOR = ((HiddenField)grdPriorizaChamados.Rows[grdPriorizaChamados.EditIndex].FindControl("hidSTATUS")).Value; DropDownList ddlSTATUS = (DropDownList)grdPriorizaChamados.Rows[grdPriorizaChamados.EditIndex].FindControl("ddlSTATUS"); if (ddlSTATUS.SelectedValue != "CONCLUÍDO" && !String.IsNullOrEmpty(DT_TERMINO.Text)) { ddlSTATUS.SelectedValue = "CONCLUÍDO"; } string STATUS = ddlSTATUS.SelectedValue; if (ValidaCampos(CHAMADO, ID_USUARIO)) { UsuariosBLL uBLL = new UsuariosBLL(); //EnviaEmailPriorizacao(uBLL.Carregar(ID_USUARIO), CHAMADO, TITULO); if (!STATUS.Equals(STATUS_ANTERIOR)) { if (STATUS == "CONCLUÍDO" && String.IsNullOrEmpty(DT_TERMINO.Text)) { DT_TERMINO.Text = DateTime.Now.ToString("dd/MM/yyyy"); } if (STATUS == "PAUSADO") { Session["MostrarObs"] = true; } EnviaEmailConclusaoChamado(uBLL.Carregar(_cod_supervisor), uBLL.Carregar(ID_USUARIO), CHAMADO, TITULO, STATUS, STATUS_ANTERIOR); } } } else if (e.CommandName == "CancelAdd") { grdPriorizaChamados.ShowFooter = false; } }