public void abrirMensagens(int cod) { DataSet msgDt = Mensagem_DB.SelectAll(cod); int qtd = msgDt.Tables[0].Rows.Count; string usuario = Session["nome"].ToString(); string msgBox = " "; int b = 0; for (int i = 0; i < qtd; i++) { b = i + 1; if (usuario == msgDt.Tables[0].Rows[i][6].ToString()) { msgBox = msgBox + "<div class='allMsg' style='float: right'><div class='txtCard' style='background-color: rgb(220, 248, 198);' onclick='mostraInfo(" + b + ")'>" + msgDt.Tables[0].Rows[i][5].ToString() + "</div><div id='info" + b + "' class='infoMsg'>Enviado por você as " + msgDt.Tables[0].Rows[i][4].ToString() + "</div></div>"; } else { msgBox = msgBox + "<div class='allMsg' style='float: left'> <div class='txtCard' onclick='mostraInfo(" + b + ")'>" + msgDt.Tables[0].Rows[i][5].ToString() + "</div><div id='info" + b + "' class='infoMsg'>Enviado por " + msgDt.Tables[0].Rows[i][6].ToString() + " - " + msgDt.Tables[0].Rows[i][4].ToString() + "</div></div>"; } } msgInsideBox.InnerHtml = msgBox; }
protected void btnNovaMsg_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtResponder.Text)) { string prof = Session["nome"].ToString(); string[] nomeProf = prof.Split(' '); string usuario = nomeProf[0] + " " + nomeProf[nomeProf.Length - 1]; string matricula = Session["matricula"].ToString(); string msg = txtResponder.Text; int cod = Convert.ToInt32(lblMsgId.Text); Mensagem men = new Mensagem(cod, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { Requerimento_DB.UpdateTime(cod); abrirMensagens(cod); } } txtResponder.Text = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); UpdatePanel3.Update(); CarregarGridAtivos(); UpdatePanelAtivados.Update(); }
protected void btnLibera_Click(object sender, EventArgs e) { string[] assuntoGrupo = lblMsgAssunto.Text.Split('-'); //separa a string de assunto automática int codReq = Convert.ToInt32(lblMsgId.Text); Requerimento req = Requerimento_DB.Select(codReq); int codGrupo = req.CodigoGrupo; if (Requerimento_DB.Update(codReq, 2, codGrupo) == 0) { Grupo_DB.Update(codGrupo); Requerimento_DB.UpdateTime(codReq); lblMsgStatus.Text = "Em Andamento"; mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; txtResponder.Text = ""; UpdatePanel3.Update(); string usuario = Session["nome"].ToString(); string matricula = Session["matricula"].ToString(); string msg = "O grupo " + assuntoGrupo[1] + "foi liberado para edição de nota por " + usuario; Mensagem men = new Mensagem(codReq, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { } else { } } else { } abrirMensagens(codReq); CarregarGridAtivos(); UpdatePanel3.Update(); UpdatePanel1.Update(); UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }
protected void btnFinaliza_Click(object sender, EventArgs e) { int cod = Convert.ToInt32(lblMsgId.Text); if (Requerimento_DB.Update(cod, 3) == 0) { Requerimento_DB.UpdateTime(cod); lblMsgStatus.Text = "Finalizado"; mdlHeader.Attributes["style"] = "background-color: #0D9643;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; txtResponder.Attributes["style"] = "background-color: #ccc"; txtResponder.ReadOnly = true; btnNovaMsg.Visible = false; subMenu.Visible = false; btnNovaMsg.Visible = false; btnFinaliza.Visible = false; string usuario = Session["nome"].ToString(); string matricula = Session["matricula"].ToString(); string msg = "Esta solicitação foi finalizada por " + usuario; Mensagem men = new Mensagem(cod, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { } abrirMensagens(cod); txtResponder.Text = ""; } else { } CarregarGridAtivos(); UpdatePanel3.Update(); UpdatePanel1.Update(); UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }
protected void btnNovaMsg_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtResponder.Text)) { string usuario = Session["nome"].ToString(); string matricula = Session["matricula"].ToString(); string msg = txtResponder.Text; int cod = Convert.ToInt32(lblMsgId.Text); Mensagem men = new Mensagem(cod, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { Requerimento_DB.UpdateTime(cod); Requerimento_DB.Update(cod, 2); lblMsgStatus.Text = "Em andamento"; mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; abrirMensagens(cod); CarregarGridAtivos(); } else { } txtResponder.Text = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); UpdatePanelAtivados.Update(); UpdatePanel1.Update(); UpdatePanel3.Update(); UpdatePanelAtivados.Update(); } }
//Método para confirmar a inserção de uma nova Requerimento protected void btnCriarNovoTicket_Click(object sender, EventArgs e) { txtAssunto.Style.Clear(); if (!String.IsNullOrEmpty(txtAssunto.Text) && !String.IsNullOrEmpty(txtCategoria.Text) && !String.IsNullOrEmpty(txtaMsg.Value) && !txtCategoria.SelectedValue.Equals("Selecione")) { string prof = Session["nome"].ToString(); string[] nomeProf = prof.Split(' '); string usuario = nomeProf[0] + " " + nomeProf[nomeProf.Length - 1]; string matricula = Session["matricula"].ToString(); string conteudo = txtaMsg.Value; int grupo = Convert.ToInt32(ddlGrupo.SelectedValue); txtResponder.Text = ""; string assunto = txtAssunto.Text; string categoria = txtCategoria.SelectedItem.Text; Requerimento req = new Requerimento(matricula, assunto, categoria, usuario); if (txtCategoria.SelectedValue.Equals("1")) { // se o requerimento for para alteração de nota, já manda o código do grupo req = new Requerimento(matricula, grupo, assunto, categoria, usuario); } if (Requerimento_DB.Insert(req) == 0) { lblMsg.Text = "<span class='glyphicon glyphicon-ok-circle'></span>   Solicitação enviada com sucesso."; lblMsg.Style.Add("color", "green"); gdvRequerimentoAberto.EditIndex = -1; CarregarGridAtivos(); UpdatePanelAtivados.Update(); req = Requerimento_DB.SelectLast(); int cod = req.CodigoReq; Mensagem men = new Mensagem(cod, matricula, conteudo, usuario); if (Mensagem_DB.Insert(men) == 0) { Requerimento_DB.UpdateTime(cod); abrirMensagens(cod); } else { lblMsg.Text = "Erro ao enviar mensagem"; } txtaMsg.Value = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "FechaModalDepoisdeCriar", "fechaModalClick();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); lblMsgAssunto.Text = req.Assunto; lblMsgProfessor.Text = req.Usuario; //lblMsgCategoria.Text = req.Categoria; lblMsgId.Text = req.CodigoReq.ToString(); abrirMensagens(req.CodigoReq); lblMsgStatus.Text = "Aberto"; mdlHeader.Attributes["style"] = "background-color: #960d10;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; UpdatePanel3.Update(); } else { lblMsg.Text = "Erro ao enviar solicitação!"; } } }